#include <ExManagerId.h>
Public Methods | |
ExManagerId () | |
~ExManagerId () | |
void | Reset (void) |
IdName | GetNewIdName (char *Name) |
ExId | GetObjectIdByName (char *Name) |
char * | GetObjectNameById (ExId Id) |
bool | RemoveIdName (char *Name) |
bool | RemoveIdName (ExId Id) |
bool | isNameAviable (char *Name) |
bool | RecordIdName (ExId Id, char *Name) |
bool | RecordIdName (IdName idname) |
Data Fields | |
std::ostrstream * | Consol |
void(* | WriteToConsol )(const char *Label) |
Private Methods | |
char * | GetAviableName (const char *Name, int occu) |
Private Attributes | |
int | m_ExIdCounter |
std::vector< IdName > | m_VecObject |
std::vector< IdName >::iterator | m_ItVecObject |
|
Definition at line 26 of file ExManagerId.cpp. References ExManagerId(), Guard, m_ExIdCounter, and UnGuard. Referenced by ExManagerId(), and ~ExManagerId().
00027 { 00028 Guard(ExManagerId::ExManagerId()) 00029 m_ExIdCounter=0; 00030 UnGuard 00031 } |
|
Definition at line 33 of file ExManagerId.cpp. References ExManagerId(), Guard, and UnGuard.
00034 { 00035 Guard(ExManagerId::~ExManagerId()) 00036 UnGuard 00037 } |
|
Definition at line 48 of file ExManagerId.cpp. References GetAviableName(), GetObjectIdByName(), Guard, and UnGuard. Referenced by GetAviableName(), GetNewIdName(), and RecordIdName().
00049 { 00050 Guard(char * ExManagerId::GetAviableName(const char *Name,int occu)) 00051 char *NameB; 00052 NameB=new char[strlen(Name)]; 00053 sprintf(NameB,"%s",Name); 00054 00055 if(GetObjectIdByName(NameB)==-1)//new name 00056 { 00057 return NameB; 00058 }else 00059 { 00060 //here code to change name 00061 std::string newname(NameB); 00062 if(occu>0) 00063 { 00064 newname.erase(newname.end()-1,newname.end()); 00065 } 00066 if(occu>10) 00067 { 00068 newname.erase(newname.end()-1,newname.end()); 00069 } 00070 if(occu>100) 00071 { 00072 newname.erase(newname.end()-1,newname.end()); 00073 } 00074 if(occu>1000) 00075 { 00076 newname.erase(newname.end()-1,newname.end()); 00077 } 00078 if(occu>10000) 00079 { 00080 newname.erase(newname.end()-1,newname.end()); 00081 } 00082 char buffer[255]; 00083 memset(buffer,0,255); 00084 sprintf(buffer,"%s%d",newname.data(),occu); 00085 00086 return GetAviableName(buffer,occu+1); 00087 } 00088 UnGuard 00089 } |
|
Definition at line 91 of file ExManagerId.cpp. References GetAviableName(), GetNewIdName(), Guard, IdName, m_ExIdCounter, m_VecObject, and UnGuard. Referenced by ExManagerEntite::Add(), GetNewIdName(), ExManagerEntite::NewObject(), and ExManagerCam::NewObject().
00092 { 00093 Guard(IdName ExManagerId::GetNewIdName(char * Name)); 00094 IdName idname; 00095 idname.first=m_ExIdCounter; 00096 idname.second=GetAviableName(Name,0); 00097 m_ExIdCounter++; 00098 //char buffer[255]; 00099 //sprintf(buffer,"New Id :%ld For:%s",idname.first,idname.second); 00100 //WriteToConsol(buffer); 00101 m_VecObject.push_back(idname); 00102 return idname; 00103 UnGuard 00104 } |
|
Definition at line 106 of file ExManagerId.cpp. References ExId, GetObjectIdByName(), Guard, m_ItVecObject, m_VecObject, and UnGuard. Referenced by GetAviableName(), GetObjectIdByName(), ExManagerCommand::ProcessAction(), and ExManagerEntite::SetCurrentEntiteName().
00107 { 00108 Guard(ExId ExManagerId::GetObjectIdByName(char * Name)) 00109 for(m_ItVecObject=m_VecObject.begin();m_ItVecObject!=m_VecObject.end();m_ItVecObject++) 00110 { 00111 if(strcmp(m_ItVecObject->second,Name)==0) 00112 { 00113 return m_ItVecObject->first; 00114 } 00115 } 00116 return -1; 00117 UnGuard 00118 } |
|
Definition at line 120 of file ExManagerId.cpp. References ExId, GetObjectNameById(), Guard, m_ItVecObject, m_VecObject, and UnGuard. Referenced by GetObjectNameById().
00121 { 00122 Guard(char * ExManagerId::GetObjectNameById(ExId Id)) 00123 for(m_ItVecObject=m_VecObject.begin();m_ItVecObject!=m_VecObject.end();m_ItVecObject++) 00124 { 00125 if(m_ItVecObject->first==Id) 00126 { 00127 return m_ItVecObject->second; 00128 } 00129 } 00130 return "NOTHING"; 00131 UnGuard 00132 } |
|
Definition at line 134 of file ExManagerId.cpp. References Guard, isNameAviable(), m_ItVecObject, m_VecObject, and UnGuard. Referenced by isNameAviable(), and ExManagerEntite::SetCurrentEntiteName().
00135 { 00136 Guard(bool ExManagerId::isNameAviable(char * Name)) 00137 for(m_ItVecObject=m_VecObject.begin();m_ItVecObject!=m_VecObject.end();m_ItVecObject++) 00138 { 00139 if(strcmp(m_ItVecObject->second,Name)==0) 00140 { 00141 return false; 00142 } 00143 } 00144 return true; 00145 UnGuard 00146 } |
|
|
|
Definition at line 178 of file ExManagerId.cpp. References Consol, ExId, GetAviableName(), Guard, IdName, m_ExIdCounter, m_VecObject, RecordIdName(), and UnGuard. Referenced by RecordIdName(), and ExManagerEntite::SetCurrentEntiteName().
00179 { 00180 Guard(bool ExManagerId::RecordIdName(ExId Id,char * Name)); 00181 IdName idname; 00182 idname.first=Id; 00183 idname.second=GetAviableName(Name,0); 00184 m_ExIdCounter++; 00185 *Consol<<"New Id :"<<idname.first<<" For:"<<idname.second<<std::endl; 00186 m_VecObject.push_back(idname); 00187 return true; 00188 UnGuard 00189 } |
|
Definition at line 163 of file ExManagerId.cpp. References ExId, Guard, m_ItVecObject, m_VecObject, RemoveIdName(), and UnGuard.
00164 { 00165 Guard(bool ExManagerId::RemoveIdName(ExId Id)) 00166 for(m_ItVecObject=m_VecObject.begin();m_ItVecObject!=m_VecObject.end();m_ItVecObject++) 00167 { 00168 if(m_ItVecObject->first==Id) 00169 { 00170 m_VecObject.erase(m_ItVecObject); 00171 return true; 00172 } 00173 } 00174 return false; 00175 UnGuard 00176 } |
|
Definition at line 148 of file ExManagerId.cpp. References Guard, m_ItVecObject, m_VecObject, RemoveIdName(), and UnGuard. Referenced by RemoveIdName(), and ExManagerEntite::SetCurrentEntiteName().
00149 { 00150 Guard(bool ExManagerId::RemoveIdName(char * Name)) 00151 for(m_ItVecObject=m_VecObject.begin();m_ItVecObject!=m_VecObject.end();m_ItVecObject++) 00152 { 00153 if(strcmp(m_ItVecObject->second,Name)==0) 00154 { 00155 m_VecObject.erase(m_ItVecObject); 00156 return true; 00157 } 00158 } 00159 return false; 00160 UnGuard 00161 } |
|
Definition at line 41 of file ExManagerId.cpp. References Guard, m_VecObject, Reset(), and UnGuard. Referenced by ExManagerCommand::ProcessAction(), and Reset().
00042 { 00043 Guard(ExManagerId::Reset(void)) 00044 m_VecObject.clear(); 00045 UnGuard 00046 } |
|
Definition at line 54 of file ExManagerId.h. Referenced by RecordIdName(), and SetManagerLink(). |
|
Definition at line 38 of file ExManagerId.h. Referenced by ExManagerId(), GetNewIdName(), and RecordIdName(). |
|
Definition at line 41 of file ExManagerId.h. Referenced by GetObjectIdByName(), GetObjectNameById(), isNameAviable(), and RemoveIdName(). |
|
Definition at line 40 of file ExManagerId.h. Referenced by GetNewIdName(), GetObjectIdByName(), GetObjectNameById(), isNameAviable(), RecordIdName(), RemoveIdName(), and Reset(). |
|
Referenced by SetManagerLink(). |