cgma
|
00001 //- Class: CAUniqueId 00002 //- Owner: Greg Nielson 00003 //- Description: Cubit attribute for mesh interval. 00004 //- Checked by: 00005 //- Version: 00006 00007 #ifndef CA_UNIQUE_ID_HPP 00008 #define CA_UNIQUE_ID_HPP 00009 00010 #include "CubitAttrib.hpp" 00011 #include "DLIList.hpp" 00012 #include "CADefines.hpp" 00013 00014 typedef std::map<long, long> UIDMap; 00015 00016 class CUBIT_GEOM_EXPORT CAUniqueId: public CubitAttrib 00017 { 00018 private: 00019 00020 int uniqueId; 00021 //- the unique id tag for an entity 00022 00023 static DLIList<CAUniqueId *> allCAUniqueIds; 00024 //- list of all CAUI's; used in actuate_all function 00025 00026 static bool autoUniqueId; 00027 //- flag controlling whether uids are automatically created (even when no other 00028 //- CA's request them) 00029 00030 static UIDMap oldUIDToNewUID; 00031 00032 public: 00033 00034 virtual ~CAUniqueId(); 00035 00036 CAUniqueId(RefEntity*, const CubitSimpleAttrib&); 00037 //- make a CAMI from a simple attribute 00038 00039 CubitStatus actuate(); 00040 00041 CubitStatus update(); 00042 00043 CubitStatus reset() {return CUBIT_SUCCESS;}; 00044 //- don't need to do anything, as all the data gets assigned 00045 //- and not appended 00046 00047 CubitSimpleAttrib cubit_simple_attrib(); 00048 00049 int unique_id() { return uniqueId;} 00050 00051 void unique_id (int id) {uniqueId = id;}; 00052 00053 int int_attrib_type() {return CA_UNIQUE_ID;}; 00054 00055 static CubitStatus actuate_all(); 00056 //- actuate all the CAUI's on the list, then empty the list 00057 00058 static bool auto_unique_id(); 00059 static void auto_unique_id(const bool flag); 00060 //- get/set autoUniqueId 00061 00062 virtual void print(); 00063 //- print the value of this attribute 00064 00065 static UIDMap get_old_to_new_uid_map() { return oldUIDToNewUID; } 00066 static void clear_out_old_to_new_map(); 00067 00068 }; 00069 00070 inline bool CAUniqueId::auto_unique_id() 00071 { 00072 return autoUniqueId; 00073 } 00074 00075 inline void CAUniqueId::auto_unique_id(const bool flag) 00076 { 00077 autoUniqueId = flag; 00078 } 00079 00080 CubitAttrib* CAUniqueId_creator(RefEntity* entity, const CubitSimpleAttrib &p_csa); 00081 00082 #endif 00083