SIMLIB/C++ 3.09
Loading...
Searching...
No Matches
simlib3::Entity Class Referenceabstract

abstract base class for active entities (Process, Event) instances of derived classes provide Behavior() method implementation, execution can be scheduled in calendar More...

#include <simlib.h>

Inheritance diagram for simlib3::Entity:
Collaboration diagram for simlib3::Entity:

Public Types

typedef EntityPriority_t Priority_t
Public Types inherited from simlib3::SimObject
enum  _Flags { _CLEAR_ALL_FLAGS = 0 , _ALLOCATED_FLAG = 1<<0 , _EVAL_FLAG = 1<<1 , _HAS_NAME_FLAG = 1<<2 }

Public Member Functions

unsigned long id () const
 Entity (Priority_t p=DEFAULT_PRIORITY)
 constructor
virtual ~Entity ()
 destructor
 operator Entity * ()
double ActivationTime ()
 get activation time of entity - iff scheduled
it is here, because Entity has no knowledge of calendar activation record structure
void Activate ()
 activate now
virtual void Activate (double t)
 activate at time t (schedule)
virtual void Passivate ()
 deactivation
virtual void Terminate ()=0
 end Behavior() and remove entity
bool Idle ()
 entity activation is not scheduled in calendar
void Cancel ()
 end Behavior() and remove entity
virtual void Out () override
 remove entity from queue
EventNotice * GetEventNotice ()
Public Member Functions inherited from simlib3::SimObject
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

Public Attributes

Priority_t Priority
 priority of the entity (scheduling,queues)

Protected Attributes

unsigned long _Ident
 unique identification number of entity
double _MarkTime
union simlib3::Entity:: { ... }  
ServicePriority_t _SPrio
 priority of service in Facility
Protected Attributes inherited from simlib3::SimObject
unsigned _flags
 bool flags for internal use (TODO bitfield?)

Static Protected Attributes

static unsigned long _Number = 0L
 current number of entities

Private Member Functions

virtual void _Run () noexcept=0
 run the Behavior() function

Private Attributes

EventNotice * _evn
 points to calendar item, iff scheduled

Friends

class Queue
class Facility
class Store
struct EventNotice
void SIMLIB_DoActions ()

Additional Inherited Members

Detailed Description

abstract base class for active entities (Process, Event) instances of derived classes provide Behavior() method implementation, execution can be scheduled in calendar

Definition at line 380 of file simlib.h.

Member Typedef Documentation

◆ Priority_t

Definition at line 402 of file simlib.h.

Constructor & Destructor Documentation

◆ Entity()

simlib3::Entity::Entity ( Priority_t p = DEFAULT_PRIORITY)

◆ ~Entity()

simlib3::Entity::~Entity ( )
virtual

destructor

Definition at line 46 of file entity.cc.

References _Ident, _Number, Dprintf, simlib3::SQS::Get(), and Idle().

Member Function Documentation

◆ _Run()

virtual void simlib3::Entity::_Run ( )
privatepure virtualnoexcept

run the Behavior() function

Implemented in simlib3::Event, and simlib3::Process.

References SIMLIB_DoActions.

Referenced by SIMLIB_DoActions.

◆ Activate() [1/2]

◆ Activate() [2/2]

void simlib3::Entity::Activate ( double t)
virtual

activate at time t (schedule)

entity activation at given time

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

Definition at line 56 of file entity.cc.

References simlib3::SQS::Get(), Idle(), simlib3::SQS::ScheduleAt(), and t.

◆ ActivationTime()

double simlib3::Entity::ActivationTime ( )

get activation time of entity - iff scheduled
it is here, because Entity has no knowledge of calendar activation record structure

Definition at line 1358 of file calendar.cc.

References GetEventNotice(), Idle(), simlib3::SIMLIB_MAXTIME, and simlib3::EventNotice::time.

Referenced by simlib3::CalendarQueue::Get(), and simlib3::Facility::Seize().

◆ Cancel()

void simlib3::Entity::Cancel ( )
inline

end Behavior() and remove entity

Definition at line 418 of file simlib.h.

References Terminate().

◆ GetEventNotice()

EventNotice * simlib3::Entity::GetEventNotice ( )
inline

◆ id()

unsigned long simlib3::Entity::id ( ) const
inline

◆ Idle()

◆ operator Entity *()

simlib3::Entity::operator Entity * ( )
inline

Definition at line 409 of file simlib.h.

References Entity().

◆ Out()

void simlib3::Entity::Out ( )
overridevirtual

◆ Passivate()

◆ Terminate()

void simlib3::Entity::Terminate ( )
pure virtual

end Behavior() and remove entity

passivate and destroy entity

Implemented in simlib3::Event, and simlib3::Process.

Definition at line 97 of file entity.cc.

References Dprintf, simlib3::SQS::Get(), Idle(), simlib3::SimObject::isAllocated(), simlib3::SimObject::Name(), and simlib3::SIMLIB_Current.

Referenced by Cancel().

◆ EventNotice

friend struct EventNotice
friend

Definition at line 429 of file simlib.h.

References EventNotice.

Referenced by EventNotice, and GetEventNotice().

◆ Facility

friend class Facility
friend

◆ Queue

friend class Queue
friend

Definition at line 388 of file simlib.h.

References Queue.

Referenced by simlib3::Process::Behavior(), simlib3::Process::Into(), and Queue.

◆ SIMLIB_DoActions

void SIMLIB_DoActions ( )
friend

Definition at line 135 of file run.cc.

References _Run(), CALL_HOOK, simlib3::SIMLIB_Current, and SIMLIB_DoActions.

Referenced by _Run(), and SIMLIB_DoActions.

◆ Store

friend class Store
friend

Definition at line 392 of file simlib.h.

References Store.

Referenced by simlib3::Process::Behavior(), simlib3::Process::Enter(), simlib3::Process::Leave(), and Store.

Member Data Documentation

◆ @112372207000137034317156326271043057372074041324

union { ... } simlib3::Entity

◆ _evn

EventNotice* simlib3::Entity::_evn
private

points to calendar item, iff scheduled

Definition at line 430 of file simlib.h.

Referenced by simlib3::EventNotice::create_reverse_link(), simlib3::EventNotice::delete_reverse_link(), Entity(), GetEventNotice(), and Idle().

◆ _Ident

◆ _MarkTime

double simlib3::Entity::_MarkTime
protected

Definition at line 389 of file simlib.h.

Referenced by Entity(), simlib3::Queue::Get(), and simlib3::Queue::PredIns().

◆ _Number

unsigned long simlib3::Entity::_Number = 0L
staticprotected

current number of entities

serial number of created entity

Definition at line 382 of file simlib.h.

Referenced by Entity(), and ~Entity().

◆ _SPrio

ServicePriority_t simlib3::Entity::_SPrio
protected

◆ Priority

Priority_t simlib3::Entity::Priority

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