SIMLIB/C++ 3.09
Loading...
Searching...
No Matches
simlib3::SimObject Class Reference

Base class for almost all SIMLIB classes. More...

#include <simlib.h>

Inheritance diagram for simlib3::SimObject:

Public Types

enum  _Flags { _CLEAR_ALL_FLAGS = 0 , _ALLOCATED_FLAG = 1<<0 , _EVAL_FLAG = 1<<1 , _HAS_NAME_FLAG = 1<<2 }

Public Member Functions

bool TestAndSetFlag (bool new_value, unsigned n)
 internal method for flag manipulation is used for algebraic loop checking in continuous blocks
 SimObject ()
 constructor
virtual ~SimObject ()
 virtual destructor
void * operator new (size_t size)
 allocate object, set _flags
void operator delete (void *ptr)
 deallocate object
void * operator new[] (size_t size)=delete
void operator delete[] (void *ptr)=delete
bool isAllocated () const
virtual std::string Name () const
 get object name
bool HasName () const
void SetName (const std::string &name)
 assign the name
virtual void Output () const
 print object to default output

Protected Attributes

unsigned _flags
 bool flags for internal use (TODO bitfield?)

Private Member Functions

 SimObject (const SimObject &)=delete
 disable copy operation
SimObject & operator= (const SimObject &)=delete
 disable assign operation

Detailed Description

Base class for almost all SIMLIB classes.

  • objects can have name
  • objects know if they are created dynamically (using new)

Definition at line 304 of file simlib.h.

Member Enumeration Documentation

◆ _Flags

Enumerator
_CLEAR_ALL_FLAGS 

internal flags (bitmasks: 1bit set)

_ALLOCATED_FLAG 
_EVAL_FLAG 
_HAS_NAME_FLAG 

Definition at line 306 of file simlib.h.

Constructor & Destructor Documentation

◆ SimObject() [1/2]

simlib3::SimObject::SimObject ( )

constructor

Definition at line 100 of file object.cc.

References _ALLOCATED_FLAG, _flags, and simlib3::SimObject_allocated.

Referenced by operator delete(), operator=(), and SimObject().

◆ ~SimObject()

simlib3::SimObject::~SimObject ( )
virtual

virtual destructor

Definition at line 114 of file object.cc.

References simlib3::NameDict::Erase(), HasName(), and simlib3::name_dict.

◆ SimObject() [2/2]

simlib3::SimObject::SimObject ( const SimObject & )
privatedelete

disable copy operation

References SimObject().

Member Function Documentation

◆ HasName()

bool simlib3::SimObject::HasName ( ) const
inline

Definition at line 326 of file simlib.h.

References _flags, and _HAS_NAME_FLAG.

Referenced by ~SimObject().

◆ isAllocated()

◆ Name()

std::string simlib3::SimObject::Name ( ) const
virtual

get object name

get the name of object

Reimplemented in simlib3::_Time, simlib3::Event, and simlib3::Process.

Definition at line 134 of file object.cc.

References simlib3::NameDict::Get(), and simlib3::name_dict.

Referenced by simlib3::Barrier::ChangeHeight(), simlib3::Barrier::Clear(), simlib3::Facility::Clear(), simlib3::Semaphore::Clear(), simlib3::Store::Clear(), simlib3::TStat::Clear(), simlib3::Queue::clear(), simlib3::Barrier::Enter(), simlib3::Store::Enter(), simlib3::Facility::Facility(), simlib3::Facility::Facility(), simlib3::Queue::Get(), simlib3::Queue::GetFirst(), simlib3::Queue::GetLast(), simlib3::GetName(), simlib3::GetName(), simlib3::Barrier::Init(), simlib3::Queue::Insert(), simlib3::Queue::InsFirst(), simlib3::Queue::InsLast(), simlib3::Store::Leave(), simlib3::Event::Name(), simlib3::Process::Name(), simlib3::Barrier::Output(), simlib3::Facility::Output(), simlib3::Histogram::Output(), simlib3::List::Output(), simlib3::Queue::Output(), simlib3::Semaphore::Output(), Output(), simlib3::Stat::Output(), simlib3::Store::Output(), simlib3::TStat::Output(), simlib3::Semaphore::P(), simlib3::Queue::PostIns(), simlib3::Queue::PredIns(), simlib3::Facility::QueueIn(), simlib3::Store::QueueIn(), simlib3::Facility::QueueIn2(), simlib3::Facility::Release(), simlib3::CalendarQueue::ScheduleAt(), simlib3::Facility::Seize(), simlib3::Store::Store(), simlib3::Store::Store(), simlib3::Entity::Terminate(), simlib3::Semaphore::V(), simlib3::Barrier::Wait(), simlib3::Barrier::~Barrier(), simlib3::Facility::~Facility(), simlib3::Histogram::~Histogram(), simlib3::List::~List(), simlib3::Queue::~Queue(), simlib3::Semaphore::~Semaphore(), simlib3::Stat::~Stat(), simlib3::Store::~Store(), and simlib3::TStat::~TStat().

◆ operator delete()

void simlib3::SimObject::operator delete ( void * ptr)

deallocate object

free memory

Definition at line 87 of file object.cc.

References _flags, isAllocated(), and SimObject().

◆ operator delete[]()

void simlib3::SimObject::operator delete[] ( void * ptr)
delete

◆ operator new()

void * simlib3::SimObject::operator new ( size_t size)

allocate object, set _flags

allocate memory for object

Definition at line 71 of file object.cc.

References simlib3::SimObject_allocated.

◆ operator new[]()

void * simlib3::SimObject::operator new[] ( size_t size)
delete

◆ operator=()

SimObject & simlib3::SimObject::operator= ( const SimObject & )
privatedelete

disable assign operation

References SimObject().

◆ Output()

void simlib3::SimObject::Output ( ) const
virtual

print object to default output

print object's info TODO: use operator <<

Reimplemented in simlib3::Barrier, simlib3::Event, simlib3::Facility, simlib3::Histogram, simlib3::List, simlib3::Process, simlib3::Queue, simlib3::Sampler, simlib3::Semaphore, simlib3::Stat, simlib3::Store, and simlib3::TStat.

Definition at line 144 of file object.cc.

References Name(), and simlib3::Print().

◆ SetName()

◆ TestAndSetFlag()

bool simlib3::SimObject::TestAndSetFlag ( bool new_value,
unsigned n )
inline

internal method for flag manipulation is used for algebraic loop checking in continuous blocks

Definition at line 293 of file internal.h.

References _flags.

Referenced by simlib3::AlgLoopDetector::lock(), and simlib3::AlgLoopDetector::unlock().

Member Data Documentation

◆ _flags

unsigned simlib3::SimObject::_flags
protected

bool flags for internal use (TODO bitfield?)

Definition at line 313 of file simlib.h.

Referenced by HasName(), isAllocated(), operator delete(), SetName(), SimObject(), and TestAndSetFlag().


The documentation for this class was generated from the following files: