SIMLIB/C++  3.07
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for simlib3::Entity:
Collaboration graph
[legend]

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 More...
 
virtual ~Entity ()
 destructor More...
 
 operator Entity * ()
 
double ActivationTime ()
 get activation time of entity - iff scheduled
it is here, because Entity has no knowledge of calendar activation record structure More...
 
void Activate ()
 activate now More...
 
virtual void Activate (double t)
 activate at time t (schedule) More...
 
virtual void Passivate ()
 deactivation More...
 
virtual void Terminate ()=0
 end Behavior() and remove entity More...
 
bool Idle ()
 entity activation is not scheduled in calendar More...
 
void Cancel ()
 end Behavior() and remove entity More...
 
virtual void Out () override
 remove entity from queue More...
 
EventNoticeGetEventNotice ()
 
- 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 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...
 

Public Attributes

Priority_t Priority
 priority of the entity (scheduling,queues) More...
 

Protected Attributes

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

Static Protected Attributes

static unsigned long _Number = 0L
 current number of entities More...
 

Private Member Functions

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

Private Attributes

EventNotice_evn
 points to calendar item, iff scheduled More...
 

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

Member Typedef Documentation

◆ Priority_t

Definition at line 397 of file simlib.h.

Constructor & Destructor Documentation

◆ Entity()

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

constructor

Definition at line 33 of file entity.cc.

References _Ident, _Number, and Dprintf.

◆ ~Entity()

simlib3::Entity::~Entity ( )
virtual

destructor

Definition at line 46 of file entity.cc.

References _Ident, 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.

Referenced by simlib3::SIMLIB_DoActions().

◆ Activate() [1/2]

void simlib3::Entity::Activate ( )
inline

◆ 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(), and simlib3::SQS::ScheduleAt().

◆ 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 simlib3::SIMLIB_MAXTIME.

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

◆ Cancel()

void simlib3::Entity::Cancel ( )
inline

end Behavior() and remove entity

Definition at line 413 of file simlib.h.

References simlib3::SIMLIB_DoActions().

◆ GetEventNotice()

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

Definition at line 427 of file simlib.h.

Referenced by simlib3::EventNotice::Create().

◆ id()

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

◆ Idle()

bool simlib3::Entity::Idle ( )
inline

◆ operator Entity *()

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

Definition at line 404 of file simlib.h.

◆ Out()

void simlib3::Entity::Out ( )
overridevirtual

◆ Passivate()

void simlib3::Entity::Passivate ( )
virtual

◆ 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 _Ident, Dprintf, simlib3::SQS::Get(), Idle(), simlib3::SimObject::isAllocated(), simlib3::SimObject::Name(), simlib3::SIMLIB_create_tmp_name(), and simlib3::SIMLIB_Current.

Friends And Related Function Documentation

◆ EventNotice

friend struct EventNotice
friend

Definition at line 424 of file simlib.h.

◆ Facility

friend class Facility
friend

Definition at line 386 of file simlib.h.

◆ Queue

friend class Queue
friend

Definition at line 383 of file simlib.h.

◆ SIMLIB_DoActions

void SIMLIB_DoActions ( )
friend

Definition at line 135 of file run.cc.

◆ Store

friend class Store
friend

Definition at line 387 of file simlib.h.

Member Data Documentation

◆ @2

union { ... }

◆ _evn

EventNotice* simlib3::Entity::_evn
private

points to calendar item, iff scheduled

Definition at line 425 of file simlib.h.

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

◆ _Ident

unsigned long simlib3::Entity::_Ident
protected

◆ _MarkTime

double simlib3::Entity::_MarkTime
protected

Definition at line 384 of file simlib.h.

Referenced by 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 377 of file simlib.h.

Referenced by Entity().

◆ _RemainingTime

double simlib3::Entity::_RemainingTime

Definition at line 390 of file simlib.h.

Referenced by simlib3::Facility::Release(), and simlib3::Facility::Seize().

◆ _RequiredCapacity

unsigned long simlib3::Entity::_RequiredCapacity

Definition at line 391 of file simlib.h.

Referenced by simlib3::Store::Leave(), and simlib3::Store::QueueIn().

◆ _SPrio

ServicePriority_t simlib3::Entity::_SPrio
protected

◆ Priority

Priority_t simlib3::Entity::Priority

priority of the entity (scheduling,queues)

priority of the entity

Definition at line 399 of file simlib.h.

Referenced by simlib3::EventNotice::Create(), simlib3::Queue::Insert(), simlib3::WaitUntilList::InsertCurrent(), simlib3::Facility::QueueIn(), simlib3::Facility::QueueIn2(), and simlib3::EventNotice::Set().


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