SIMLIB/C++  3.07
Public Member Functions | Private Member Functions | List of all members
simlib3::Event Class Referenceabstract

abstract base class for events Event behavior is simple function (can not be interrupted) More...

#include <simlib.h>

Inheritance diagram for simlib3::Event:
Inheritance graph
[legend]
Collaboration diagram for simlib3::Event:
Collaboration graph
[legend]

Public Member Functions

 Event (Priority_t p=DEFAULT_PRIORITY)
 constructor, default priority if not specified More...
 
virtual ~Event ()
 destructor More...
 
virtual void Behavior ()=0
 behavior description More...
 
virtual void Output () const override
 print object to default output More...
 
virtual std::string Name () const override
 name of object More...
 
virtual void Activate (double t) override
 activate at time t (schedule) More...
 
- Public Member Functions inherited from simlib3::Entity
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 Passivate ()
 deactivation 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
 
bool HasName () const
 
void SetName (const std::string &name)
 assign the name More...
 

Private Member Functions

virtual void _Run () noexcept override
 activation method, called from simulation control algorithm More...
 
virtual void Terminate () override
 passivate event, it will be destroyed if not activated later in Behavior()
Should not be used. More...
 

Additional Inherited Members

- Public Types inherited from simlib3::Entity
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 Attributes inherited from simlib3::Entity
Priority_t Priority
 priority of the entity (scheduling,queues) More...
 
- Protected Attributes inherited from simlib3::Entity
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 inherited from simlib3::Entity
static unsigned long _Number = 0L
 current number of entities More...
 

Detailed Description

abstract base class for events Event behavior is simple function (can not be interrupted)

Definition at line 488 of file simlib.h.

Constructor & Destructor Documentation

◆ Event()

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

constructor, default priority if not specified

Definition at line 28 of file event.cc.

References Dprintf.

◆ ~Event()

simlib3::Event::~Event ( )
virtual

destructor

Definition at line 35 of file event.cc.

References Dprintf.

Member Function Documentation

◆ _Run()

void simlib3::Event::_Run ( )
overrideprivatevirtualnoexcept

activation method, called from simulation control algorithm

Implements simlib3::Entity.

Definition at line 42 of file event.cc.

References Behavior(), simlib3::Entity::Idle(), and Terminate().

◆ Activate()

void simlib3::Event::Activate ( double  t)
overridevirtual

activate at time t (schedule)

Reimplemented from simlib3::Entity.

Definition at line 62 of file event.cc.

References simlib3::Entity::_Ident, simlib3::Entity::Activate(), and Dprintf.

◆ Behavior()

virtual void simlib3::Event::Behavior ( )
pure virtual

behavior description

Implemented in simlib3::Sampler, and simlib3::ZDelayTimer.

Referenced by _Run().

◆ Name()

std::string simlib3::Event::Name ( ) const
overridevirtual

name of object

get name of event. It is generic "Event#" if not explicitly named

Reimplemented from simlib3::SimObject.

Definition at line 71 of file event.cc.

References simlib3::Entity::_Ident, simlib3::SimObject::Name(), and simlib3::SIMLIB_create_tmp_name().

Referenced by Output(), simlib3::List::Output(), and Terminate().

◆ Output()

void simlib3::Event::Output ( ) const
overridevirtual

print object to default output

Reimplemented from simlib3::SimObject.

Reimplemented in simlib3::Sampler.

Definition at line 35 of file output1.cc.

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

◆ Terminate()

void simlib3::Event::Terminate ( )
overrideprivatevirtual

passivate event, it will be destroyed if not activated later in Behavior()
Should not be used.

It is there only for backwards compatibility.

Implements simlib3::Entity.

Definition at line 52 of file event.cc.

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

Referenced by _Run().


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