40 #include "FONcArray.h"
42 #include "FONcUtils.h"
58 : _arr( a ), _ingrid( ingrid ), _defined( false ), _ref( 1 )
89 if( !_ref )
delete this ;
108 Array *map = _arr->array();
110 BESDEBUG(
"fonc",
"FONcMap::compare - comparing " << tomap->name()
111 <<
" to " << map->name() << endl );
114 if (isequal && tomap->name() != map->name()) {
119 if (isequal && tomap->var()->type() != map->var()->type()) {
124 if (isequal && tomap->length() != map->length()) {
129 if (isequal && tomap->dimensions() != map->dimensions()) {
134 if (isequal && map->dimension_name(map->dim_begin()) != map->name()) {
139 if (isequal && tomap->dimension_name(tomap->dim_begin()) != map->dimension_name(map->dim_begin())) {
144 if (isequal && tomap->dimension_size(tomap->dim_begin(),
true) != map->dimension_size(map->dim_begin(),
true)) {
150 char *map_buf = map->get_buf();
151 char *tomap_buf = tomap->get_buf();
152 int cmpres = memcmp(map_buf, tomap_buf, map->width());
158 switch (tomap->var()->type()) {
160 dods_byte my_values[map->length()];
161 map->value(my_values);
162 dods_byte to_values[map->length()];
163 tomap->value(to_values);
164 for (
int i = 0; i < map->length(); i++) {
165 if (my_values[i] != to_values[i]) {
173 dods_int16 my_values[map->length()];
174 map->value(my_values);
175 dods_int16 to_values[map->length()];
176 tomap->value(to_values);
177 for (
int i = 0; i < map->length(); i++) {
178 if (my_values[i] != to_values[i]) {
185 case dods_uint16_c: {
186 dods_uint16 my_values[map->length()];
187 map->value(my_values);
188 dods_uint16 to_values[map->length()];
189 tomap->value(to_values);
190 for (
int i = 0; i < map->length(); i++) {
191 if (my_values[i] != to_values[i]) {
199 dods_int32 my_values[map->length()];
200 map->value(my_values);
201 dods_int32 to_values[map->length()];
202 tomap->value(to_values);
203 for (
int i = 0; i < map->length(); i++) {
204 if (my_values[i] != to_values[i]) {
211 case dods_uint32_c: {
212 dods_uint32 my_values[map->length()];
213 map->value(my_values);
214 dods_uint32 to_values[map->length()];
215 tomap->value(to_values);
216 for (
int i = 0; i < map->length(); i++) {
217 if (my_values[i] != to_values[i]) {
224 case dods_float32_c: {
225 dods_float32 my_values[map->length()];
226 map->value(my_values);
227 dods_float32 to_values[map->length()];
228 tomap->value(to_values);
229 for (
int i = 0; i < map->length(); i++) {
230 if (my_values[i] != to_values[i]) {
237 case dods_float64_c: {
238 dods_float64 my_values[map->length()];
239 map->value(my_values);
240 dods_float64 to_values[map->length()];
241 tomap->value(to_values);
242 for (
int i = 0; i < map->length(); i++) {
243 if (my_values[i] != to_values[i]) {
252 vector<string> my_values;
253 map->value(my_values);
254 vector<string> to_values;
255 tomap->value(to_values);
256 vector<string>::const_iterator mi = my_values.begin();
257 vector<string>::const_iterator me = my_values.end();
258 vector<string>::const_iterator ti = to_values.begin();
259 for (; mi != me; mi++, ti++) {
260 if ((*mi) != (*ti)) {
273 "FONcMap::compare - done comparing " << tomap->name() <<
" to " << map->name() <<
": " << isequal << endl);
282 _shared_by.push_back( name );
317 _arr->
write( ncid ) ;
330 strm << BESIndent::LMarg <<
"FONcMap::dump - ("
331 << (
void *)
this <<
")" << endl ;
332 BESIndent::Indent() ;
333 strm << BESIndent::LMarg <<
"array:" ;
337 BESIndent::Indent() ;
339 BESIndent::UnIndent() ;
343 strm <<
" not set" << endl ;
345 strm << BESIndent::LMarg <<
"shared by: " ;
346 vector<string>::const_iterator i = _shared_by.begin() ;
347 vector<string>::const_iterator e = _shared_by.end() ;
351 if( !first ) strm <<
", " ;
356 BESIndent::UnIndent() ;