15 #include <unordered_map> 30 using TNameDict = std::unordered_map<SimObject*,std::string>;
50 TNameDict::iterator it = dict->find(const_cast<SimObject*>(o));
71 void *SimObject::operator
new(
size_t size) {
74 ptr = ::new
char[size];
78 SimObject_allocated =
true;
87 void SimObject::operator
delete(
void *ptr) {
92 ::operator
delete[](ptr);
105 if(SimObject_allocated) {
106 SimObject_allocated =
false;
118 name_dict.
Erase(
this);
127 name_dict.
Set(
this,name);
137 return name_dict.
Get(
this);
146 Print(
"SimObject: this=%p, name=%s\n",
this,
Name().c_str());
std::unordered_map< SimObject *, std::string > TNameDict
void SetName(const std::string &name)
assign the name
unsigned _flags
bool flags for internal use (TODO bitfield?)
std::string Get(const SimObject *o) const
int Print(const char *fmt,...)
for Output methods, can be redirected
Implementation of class CalendarList interface is static - using global functions in SQS namespace...
virtual void Output() const
print object to default output
Base class for almost all SIMLIB classes.
virtual ~SimObject()
virtual destructor
static NameDict name_dict
Internal header file for SIMLIB/C++.
Main SIMLIB/C++ interface.
virtual std::string Name() const
get object name
void Set(SimObject *o, const std::string &name)
static bool SimObject_allocated