cgma
|
#include <CAUniqueId.hpp>
Public Member Functions | |
virtual | ~CAUniqueId () |
CAUniqueId (RefEntity *, const CubitSimpleAttrib &) | |
CubitStatus | actuate () |
CubitStatus | update () |
CubitStatus | reset () |
CubitSimpleAttrib | cubit_simple_attrib () |
int | unique_id () |
void | unique_id (int id) |
int | int_attrib_type () |
virtual void | print () |
Static Public Member Functions | |
static CubitStatus | actuate_all () |
static bool | auto_unique_id () |
static void | auto_unique_id (const bool flag) |
static UIDMap | get_old_to_new_uid_map () |
static void | clear_out_old_to_new_map () |
Private Attributes | |
int | uniqueId |
Static Private Attributes | |
static DLIList< CAUniqueId * > | allCAUniqueIds |
static bool | autoUniqueId = false |
static UIDMap | oldUIDToNewUID |
Definition at line 16 of file CAUniqueId.hpp.
CAUniqueId::~CAUniqueId | ( | ) | [virtual] |
Definition at line 23 of file CAUniqueId.cpp.
{ if (allCAUniqueIds.move_to(this)) allCAUniqueIds.extract(); }
CAUniqueId::CAUniqueId | ( | RefEntity * | new_attrib_owner, |
const CubitSimpleAttrib & | csa_ptr | ||
) |
Definition at line 29 of file CAUniqueId.cpp.
: CubitAttrib(new_attrib_owner) { uniqueId = -1; if(!csa_ptr.isEmpty()) { uniqueId = csa_ptr.int_data_list()[0]; } allCAUniqueIds.append(this); }
CubitStatus CAUniqueId::actuate | ( | ) | [virtual] |
Implements CubitAttrib.
Definition at line 42 of file CAUniqueId.cpp.
{ if (hasActuated == CUBIT_TRUE) return CUBIT_SUCCESS; // create a TDUniqueId for the entity, if it doesn't already // exist TDUniqueId *uid = (TDUniqueId *) attrib_owner()->get_TD(&TDUniqueId::is_unique_id); if (uid != NULL) { // check to make sure it's the same unique id if (uid->unique_id() != uniqueId) { PRINT_ERROR("Different unique id found for %s %d.\n", attrib_owner()->class_name(), attrib_owner()->id()); return CUBIT_FAILURE; } } else { if( !GSaveOpen::performingUndo && GeometryQueryTool::importingSolidModel && !GeometryQueryTool::mergeGloballyOnImport) { //Is there an entity that already has this id? ToolDataUser *tdu = TDUniqueId::find_td_unique_id(uniqueId); if( tdu ) { //is it already in the map UIDMap::iterator iter; iter = oldUIDToNewUID.find( uniqueId ); if( iter != oldUIDToNewUID.end() ) uniqueId = (*iter).second; else { int new_unique_id = TDUniqueId::generate_unique_id(); UIDMap::value_type this_pair(uniqueId, new_unique_id); oldUIDToNewUID.insert(this_pair); uniqueId = new_unique_id; } } } // else make a new one uid = new TDUniqueId(attrib_owner(), uniqueId); } delete_attrib(CUBIT_TRUE); hasActuated = CUBIT_TRUE; return CUBIT_SUCCESS; }
CubitStatus CAUniqueId::actuate_all | ( | ) | [static] |
Definition at line 126 of file CAUniqueId.cpp.
{ //- actuate all the CAUI's on the list, then empty the list for (int i = allCAUniqueIds.size(); i > 0; i--) { CAUniqueId *cauid = allCAUniqueIds.get(); if (cauid->actuate() == CUBIT_SUCCESS) allCAUniqueIds.extract(); else allCAUniqueIds.step(); } return CUBIT_SUCCESS; }
bool CAUniqueId::auto_unique_id | ( | ) | [inline, static] |
Definition at line 70 of file CAUniqueId.hpp.
{ return autoUniqueId; }
void CAUniqueId::auto_unique_id | ( | const bool | flag | ) | [inline, static] |
Definition at line 75 of file CAUniqueId.hpp.
{ autoUniqueId = flag; }
void CAUniqueId::clear_out_old_to_new_map | ( | ) | [static] |
Definition at line 147 of file CAUniqueId.cpp.
{ oldUIDToNewUID.clear(); }
CubitSimpleAttrib CAUniqueId::cubit_simple_attrib | ( | ) | [virtual] |
Implements CubitAttrib.
Definition at line 120 of file CAUniqueId.cpp.
{ return CubitSimpleAttrib(att_internal_name(), "", "", &uniqueId); }
static UIDMap CAUniqueId::get_old_to_new_uid_map | ( | ) | [inline, static] |
Definition at line 65 of file CAUniqueId.hpp.
{ return oldUIDToNewUID; }
int CAUniqueId::int_attrib_type | ( | ) | [inline, virtual] |
void CAUniqueId::print | ( | ) | [virtual] |
Reimplemented from CubitAttrib.
Definition at line 138 of file CAUniqueId.cpp.
{ // print info on this attribute PRINT_INFO("CAUniqueId: owner = %s %d: uid=%d\n", attribOwnerEntity->class_name(), attribOwnerEntity->id(), uniqueId); }
CubitStatus CAUniqueId::reset | ( | ) | [inline, virtual] |
int CAUniqueId::unique_id | ( | ) | [inline] |
Definition at line 49 of file CAUniqueId.hpp.
{ return uniqueId;}
void CAUniqueId::unique_id | ( | int | id | ) | [inline] |
Definition at line 51 of file CAUniqueId.hpp.
CubitStatus CAUniqueId::update | ( | ) | [virtual] |
Implements CubitAttrib.
Definition at line 95 of file CAUniqueId.cpp.
{ if (hasUpdated) return CUBIT_SUCCESS; // set the updated flag hasUpdated = CUBIT_TRUE; // if the owner has a unique id, save it, otherwise delete this one TDUniqueId *td_uid = (TDUniqueId *) attrib_owner()->get_TD(&TDUniqueId::is_unique_id); if (NULL == td_uid && autoUniqueId) td_uid = new TDUniqueId(attrib_owner()); if (td_uid == NULL) { delete_attrib(CUBIT_TRUE); } else { uniqueId = td_uid->unique_id(); if (delete_attrib() == CUBIT_TRUE) delete_attrib(CUBIT_FALSE); } return CUBIT_SUCCESS; }
DLIList< CAUniqueId * > CAUniqueId::allCAUniqueIds [static, private] |
Definition at line 23 of file CAUniqueId.hpp.
bool CAUniqueId::autoUniqueId = false [static, private] |
Definition at line 26 of file CAUniqueId.hpp.
UIDMap CAUniqueId::oldUIDToNewUID [static, private] |
Definition at line 30 of file CAUniqueId.hpp.
int CAUniqueId::uniqueId [private] |
Definition at line 20 of file CAUniqueId.hpp.