SIMLIB/C++  3.07
Public Types | Public Member Functions | Protected Attributes | Private Member Functions | List of all members
simlib3::SimObject Class Reference

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

#include <simlib.h>

Inheritance diagram for simlib3::SimObject:
Inheritance graph
[legend]

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 More...
 
 SimObject ()
 constructor More...
 
virtual ~SimObject ()
 virtual destructor More...
 
void * operator new (size_t size)
 allocate object, set _flags More...
 
void operator delete (void *ptr)
 deallocate object More...
 
void * operator new[] (size_t size)=delete
 
void operator delete[] (void *ptr)=delete
 
bool isAllocated () const
 
virtual std::string Name () const
 get object name More...
 
bool HasName () const
 
void SetName (const std::string &name)
 assign the name More...
 
virtual void Output () const
 print object to default output More...
 

Protected Attributes

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

Private Member Functions

 SimObject (const SimObject &)=delete
 disable copy operation More...
 
SimObjectoperator= (const SimObject &)=delete
 disable assign operation More...
 

Detailed Description

Base class for almost all SIMLIB classes.

Definition at line 299 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 301 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, and _flags.

Referenced by HasName().

◆ ~SimObject()

simlib3::SimObject::~SimObject ( )
virtual

virtual destructor

Definition at line 114 of file object.cc.

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

◆ SimObject() [2/2]

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

disable copy operation

Member Function Documentation

◆ HasName()

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

◆ isAllocated()

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

◆ Name()

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

get object name

get the name of object

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

Definition at line 134 of file object.cc.

References simlib3::NameDict::Get().

Referenced by simlib3::Barrier::ChangeHeight(), simlib3::TStat::Clear(), simlib3::Queue::clear(), simlib3::Facility::Clear(), simlib3::Store::Clear(), simlib3::Semaphore::Clear(), simlib3::Barrier::Clear(), simlib3::Store::Enter(), simlib3::Barrier::Enter(), simlib3::Hyst::Eval(), simlib3::Blash::Eval(), simlib3::Relay::Eval(), simlib3::Facility::Facility(), simlib3::Queue::Get(), simlib3::Queue::GetFirst(), simlib3::Queue::GetLast(), simlib3::GetName(), simlib3::Barrier::Init(), simlib3::Queue::Insert(), simlib3::Queue::InsFirst(), simlib3::Queue::InsLast(), isAllocated(), simlib3::Store::Leave(), simlib3::Process::Name(), simlib3::Event::Name(), Output(), simlib3::Process::Output(), simlib3::Stat::Output(), simlib3::TStat::Output(), simlib3::Queue::Output(), simlib3::Histogram::Output(), simlib3::Facility::Output(), simlib3::Store::Output(), simlib3::Semaphore::Output(), simlib3::Barrier::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::AlgLoop::Set(), simlib3::SIMLIB_DoConditions(), simlib3::Store::Store(), simlib3::Entity::Terminate(), simlib3::Semaphore::V(), simlib3::_Add::Value(), simlib3::_Sub::Value(), simlib3::_Mul::Value(), simlib3::_Div::Value(), simlib3::_UMinus::Value(), simlib3::Integrator::Value(), simlib3::Status::Value(), simlib3::Function1::Value(), simlib3::Function2::Value(), simlib3::Lim::Value(), simlib3::Insv::Value(), simlib3::Qntzr::Value(), simlib3::Frict::Value(), simlib3::Rline::Value(), 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, and isAllocated().

◆ 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.

◆ operator new[]()

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

◆ operator=()

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

disable assign operation

Referenced by HasName().

◆ Output()

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

print object to default output

print object's info TODO: use operator <<

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

Definition at line 144 of file object.cc.

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

Referenced by simlib3::Sampler::GetStep(), HasName(), and simlib3::Barrier::Height().

◆ SetName()

void simlib3::SimObject::SetName ( const std::string &  name)

◆ 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.

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 308 of file simlib.h.

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


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