- Timestamp:
- 11/03/09 13:51:30 (3 weeks ago)
- Location:
- cgm/trunk/itaps
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
cgm/trunk/itaps/CATag.cpp
r3166 r3275 258 258 { 259 259 std::string tmp_name(tag_name); 260 TagInfo tmp_info = {tag_length, tmp_name, tag_type, NULL, true}; 261 260 262 std::map<std::string,long>::iterator mit = tagNameMap.find(tmp_name); 261 263 if (mit != tagNameMap.end()) { 264 // we found a tag with this name; is it still active? 265 bool active = (mit->second > 0 ? tagInfo[mit->second] : 266 presetTagInfo[-mit->second]).isActive; 262 267 *tag_handle = mit->second; 263 iGeom_setLastError( iBase_TAG_ALREADY_EXISTS ); 264 return iBase_TAG_ALREADY_EXISTS; 265 } 266 267 TagInfo tmp_info = {tag_length, std::string(tag_name), tag_type, NULL, true}; 268 tagInfo.push_back(tmp_info); 269 *tag_handle = tagInfo.size() - 1; 268 if (active) { 269 iGeom_setLastError( iBase_TAG_ALREADY_EXISTS ); 270 return iBase_TAG_ALREADY_EXISTS; 271 } 272 273 tagInfo[*tag_handle] = tmp_info; 274 } 275 else { 276 // create a new tag entirely 277 tagInfo.push_back(tmp_info); 278 *tag_handle = tagInfo.size() - 1; 279 280 // put the name and handle into the map too 281 tagNameMap[std::string(tag_name)] = *tag_handle; 282 } 283 270 284 if (default_value != NULL) { 271 285 tagInfo[*tag_handle].defaultValue = (char *) malloc(tag_length); 272 286 memcpy(tagInfo[*tag_handle].defaultValue, default_value, tag_length); 273 287 } 274 275 // put the name and handle into the map too276 tagNameMap[std::string(tag_name)] = *tag_handle;277 288 278 289 RETURN(iBase_SUCCESS); … … 316 327 tagNameMap.find(std::string(tag_name)); 317 328 if (it != tagNameMap.end()) { 329 bool active = (it->second > 0 ? tagInfo[it->second] : 330 presetTagInfo[-it->second]).isActive; 331 if (active) { 318 332 iGeom_clearLastError(); 319 return (*it).second; 320 } 321 322 else { 323 iGeom_setLastError( iBase_TAG_NOT_FOUND ); 324 return 0; 325 } 333 return it->second; 334 } 335 } 336 337 iGeom_setLastError( iBase_TAG_NOT_FOUND ); 338 return 0; 326 339 } 327 340 -
cgm/trunk/itaps/iGeom.h
r3163 r3275 1966 1966 * \param entity_handle Pointer to an entity handle corresponding to the 1967 1967 * current value of iterator 1968 * \param has_data Pointer to flag; if returned non-zero, next iterator 1969 * has an entity 1968 * \param has_data Pointer to a flag indicating if the value returned 1969 * in entity_handle is valid. A non-zero value indicates the value 1970 * is valid. A zero value indicates the value is NOT valid. 1970 1971 * \param *err Pointer to error type returned from function 1971 1972 */ … … 1990 1991 * \param *entity_handles_size Pointer to occupied size of entity_handles 1991 1992 * array 1992 * \param has_data Pointer to flag; if returned non-zero, next iterator 1993 * has a non-zero number of entities 1993 * \param has_data Pointer to a flag indicating if the value(s) returned 1994 * in entity_handles are valid. A non-zero value indicates the 1995 * value(s) are valid. A zero value indicates the value(s) are NOT 1996 * valid. 1994 1997 * \param *err Pointer to error type returned from function 1995 1998 */ -
cgm/trunk/itaps/iGeom_CGMA.cc
r3270 r3275 525 525 * @param gentity_iterator Iterator being iterated over 526 526 * @param gentity_handle Next gentity 527 * @return If true, there are more gentities, if false, this is the last one 527 * @return If true, there were more gentities, if false, the iterator was 528 * already at the end. 528 529 */ 529 530 void … … 537 538 CGMAIterator* iterator = reinterpret_cast<CGMAIterator*>(gentity_iterator); 538 539 RefEntity** out_handle = reinterpret_cast<RefEntity**>(gentity_handle); 539 *has_data = 1; 540 iterator->next( out_handle, *has_data ); 540 *has_data = !iterator->at_end(); 541 if (*has_data) { 542 int count = 1; 543 iterator->next( out_handle, count ); 544 } 545 RETURN(iBase_SUCCESS); 541 546 } 542 547 … … 554 559 CGMAIterator* iterator = reinterpret_cast<CGMAIterator*>(entArr_iterator); 555 560 CHECK_SIZE(*entity_handles, iBase_EntityHandle, iterator->size()); 556 iterator->next( (RefEntity**)*entity_handles, *entity_handles_size ); 557 *has_data = iterator->at_end(); 561 *has_data = !iterator->at_end(); 562 if (has_data) 563 iterator->next( (RefEntity**)*entity_handles, *entity_handles_size ); 564 RETURN(iBase_SUCCESS); 558 565 } 559 566 … … 1301 1308 tag_name = tag_name_buf.c_str(); 1302 1309 *tag_handle = reinterpret_cast<iBase_TagHandle>(static_cast<size_t>(TM->getTagHandle( tag_name ))); 1303 RETURN(iBase_SUCCESS); 1310 1311 *err = iGeom_getLastErrorType(); 1304 1312 } 1305 1313
![(please configure the [header_logo] section in trac.ini)](/projects/ITAPS/chrome/common/trac_banner.png)