SIMLIB/C++
3.07
|
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>
Public Types | |
typedef EntityPriority_t | Priority_t |
![]() | |
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... | |
EventNotice * | GetEventNotice () |
![]() | |
Link () | |
virtual | ~Link () |
virtual void | Into (List *l) |
insert last More... | |
List * | Where () |
where is linked More... | |
virtual bool | isInQueue () |
present in queue More... | |
![]() | |
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... | |
![]() | |
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 | |
![]() | |
Link (Link *p, Link *s, List *h) | |
abstract base class for active entities (Process, Event) instances of derived classes provide Behavior() method implementation, execution can be scheduled in calendar
simlib3::Entity::Entity | ( | Priority_t | p = DEFAULT_PRIORITY | ) |
|
virtual |
|
privatepure virtualnoexcept |
run the Behavior() function
Implemented in simlib3::Event, and simlib3::Process.
Referenced by simlib3::SIMLIB_DoActions().
|
inline |
activate now
Definition at line 408 of file simlib.h.
References Activate(), simlib3::Activate(), simlib3::Passivate(), and t.
Referenced by Activate(), simlib3::Activate(), simlib3::Process::Activate(), simlib3::Event::Activate(), simlib3::ZDelayTimer::Behavior(), simlib3::Sampler::Behavior(), simlib3::Barrier::Break(), simlib3::Barrier::Enter(), simlib3::Process::Interrupt(), simlib3::Store::Leave(), simlib3::Facility::Release(), simlib3::ZDelayTimer::Start(), simlib3::Sampler::Start(), simlib3::Sampler::Stop(), simlib3::Semaphore::V(), simlib3::Process::Wait(), and simlib3::Barrier::Wait().
|
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().
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().
|
inline |
end Behavior() and remove entity
Definition at line 413 of file simlib.h.
References simlib3::SIMLIB_DoActions().
|
inline |
Definition at line 427 of file simlib.h.
Referenced by simlib3::EventNotice::Create().
|
inline |
Definition at line 396 of file simlib.h.
Referenced by simlib3::WaitUntilList::GetCurrent(), simlib3::WaitUntilList::InsertCurrent(), and simlib3::WaitUntilList::Remove().
|
inline |
entity activation is not scheduled in calendar
Definition at line 412 of file simlib.h.
Referenced by simlib3::Process::_Run(), simlib3::Event::_Run(), Activate(), simlib3::CalendarList::Get(), simlib3::CalendarQueue::Get(), Passivate(), simlib3::SQS::ScheduleAt(), simlib3::Facility::Seize(), Terminate(), simlib3::Process::Terminate(), simlib3::Event::Terminate(), ~Entity(), and simlib3::Process::~Process().
|
overridevirtual |
remove entity from queue
Reimplemented from simlib3::Link.
Definition at line 90 of file entity.cc.
References simlib3::Link::Out().
Referenced by simlib3::Process::_Run(), simlib3::Process::Into(), simlib3::Store::Leave(), Passivate(), simlib3::Facility::Release(), simlib3::Process::Terminate(), and simlib3::Process::~Process().
|
virtual |
deactivation
Reimplemented in simlib3::Process.
Definition at line 68 of file entity.cc.
References simlib3::SQS::Get(), Idle(), simlib3::Queue::Insert(), simlib3::Link::Into(), Out(), simlib3::QueueRefError, and simlib3::SIMLIB_error().
Referenced by simlib3::Sampler::Behavior(), simlib3::Store::Enter(), simlib3::Barrier::Enter(), simlib3::Passivate(), simlib3::Process::Passivate(), simlib3::Facility::Seize(), simlib3::ZDelayTimer::Stop(), simlib3::Sampler::Stop(), and simlib3::Barrier::Wait().
|
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.
|
friend |
union { ... } |
|
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().
|
protected |
unique identification number of entity
Definition at line 378 of file simlib.h.
Referenced by simlib3::Process::_Run(), simlib3::Process::Activate(), simlib3::Event::Activate(), Entity(), simlib3::Process::Interrupt(), simlib3::Process::Name(), simlib3::Event::Name(), Terminate(), simlib3::Process::Terminate(), simlib3::Process::Wait(), and ~Entity().
|
protected |
Definition at line 384 of file simlib.h.
Referenced by simlib3::Queue::Get(), and simlib3::Queue::PredIns().
|
staticprotected |
double simlib3::Entity::_RemainingTime |
Definition at line 390 of file simlib.h.
Referenced by simlib3::Facility::Release(), and simlib3::Facility::Seize().
unsigned long simlib3::Entity::_RequiredCapacity |
Definition at line 391 of file simlib.h.
Referenced by simlib3::Store::Leave(), and simlib3::Store::QueueIn().
|
protected |
priority of service in Facility
Definition at line 393 of file simlib.h.
Referenced by simlib3::Facility::QueueIn(), simlib3::Facility::QueueIn2(), simlib3::Facility::Release(), and simlib3::Facility::Seize().
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().