SIMLIB/C++
3.07
|
(SOL-like) store store capacity can be changed dynamically More...
#include <simlib.h>
Public Member Functions | |
Store () | |
Store (unsigned long _capacity) | |
Store (const char *_name, unsigned long _capacity) | |
Store (unsigned long _capacity, Queue *queue) | |
Store (const char *_name, unsigned long _capacity, Queue *queue) | |
virtual | ~Store () |
virtual void | Output () const override |
print statistics More... | |
operator Store * () | |
void | SetCapacity (unsigned long _capacity) |
change the capacity More... | |
void | SetQueue (Queue *queue) |
change input queue More... | |
unsigned long | Free () const |
free capacity More... | |
unsigned long | Used () const |
used capacity More... | |
unsigned long | Capacity () const |
max capacity More... | |
bool | Full () const |
store is full More... | |
bool | Empty () const |
store is empty More... | |
bool | OwnQueue () const |
OwnQueue. More... | |
unsigned | QueueLen () const |
virtual void | Enter (Entity *e, unsigned long rcap) |
allocate capacity More... | |
virtual void | Leave (unsigned long rcap) |
deallocate capacity More... | |
virtual void | QueueIn (Entity *e, unsigned long c) |
insert entity into queue More... | |
virtual void | Clear () |
initialize 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... | |
Protected Attributes | |
unsigned long | capacity |
Capacity of store. More... | |
unsigned long | used |
Currently used capacity. More... | |
Queue * | Q |
input queue More... | |
TStat | tstat |
usage statistics More... | |
![]() | |
unsigned | _flags |
bool flags for internal use (TODO bitfield?) More... | |
Private Attributes | |
unsigned char | _Qflag |
true if store is owner of input queue More... | |
Additional Inherited Members | |
![]() | |
enum | _Flags { _CLEAR_ALL_FLAGS = 0, _ALLOCATED_FLAG = 1<<0, _EVAL_FLAG = 1<<1, _HAS_NAME_FLAG = 1<<2 } |
|
explicit |
simlib3::Store::Store | ( | const char * | _name, |
unsigned long | _capacity | ||
) |
Definition at line 56 of file store.cc.
References Dprintf, and simlib3::SimObject::SetName().
simlib3::Store::Store | ( | unsigned long | _capacity, |
Queue * | queue | ||
) |
Definition at line 66 of file store.cc.
References CHECKQUEUE, Dprintf, and simlib3::SimObject::Name().
simlib3::Store::Store | ( | const char * | _name, |
unsigned long | _capacity, | ||
Queue * | queue | ||
) |
Definition at line 76 of file store.cc.
References CHECKQUEUE, Dprintf, simlib3::SimObject::Name(), and simlib3::SimObject::SetName().
|
virtual |
Definition at line 92 of file store.cc.
References Clear(), Dprintf, simlib3::SimObject::Name(), OwnQueue(), and Q.
|
inline |
|
virtual |
initialize
Clear.
Definition at line 191 of file store.cc.
References simlib3::TStat::Clear(), simlib3::Queue::Clear(), Dprintf, simlib3::SimObject::Name(), OwnQueue(), Q, tstat, and used.
Referenced by ~Store().
|
virtual |
allocate capacity
Enter.
Definition at line 128 of file store.cc.
References capacity, simlib3::Current, Dprintf, simlib3::EnterCapError, simlib3::EntityRefError, Free(), simlib3::SimObject::Name(), simlib3::Entity::Passivate(), QueueIn(), simlib3::SIMLIB_error(), tstat, and used.
Referenced by simlib3::Process::Enter().
|
inline |
|
inline |
|
virtual |
deallocate capacity
Leave.
Definition at line 152 of file store.cc.
References simlib3::Entity::_RequiredCapacity, simlib3::Entity::Activate(), simlib3::Queue::begin(), Dprintf, simlib3::List::empty(), simlib3::Queue::end(), Free(), Full(), simlib3::LeaveManyError, simlib3::TStat::n, simlib3::SimObject::Name(), simlib3::Entity::Out(), Q, simlib3::SIMLIB_error(), tstat, and used.
Referenced by simlib3::Process::Leave().
|
overridevirtual |
print statistics
Reimplemented from simlib3::SimObject.
Definition at line 187 of file output2.cc.
References simlib3::TStat::Max(), simlib3::TStat::MeanValue(), simlib3::TStat::Min(), simlib3::TStat::n, simlib3::SimObject::Name(), simlib3::TStat::Number(), simlib3::Facility::OwnQueue(), simlib3::Print(), simlib3::TStat::StartTime(), simlib3::Time, and simlib3::Facility::tstat.
bool simlib3::Store::OwnQueue | ( | ) | const |
|
virtual |
insert entity into queue
QueueIn.
Definition at line 181 of file store.cc.
References simlib3::Entity::_RequiredCapacity, Dprintf, simlib3::Queue::Insert(), simlib3::SimObject::Name(), and Q.
Referenced by Enter().
|
inline |
Definition at line 809 of file simlib.h.
References simlib3::SQS::Clear(), and simlib3::List::size().
Referenced by SetCapacity(), and SetQueue().
void simlib3::Store::SetCapacity | ( | unsigned long | newcapacity | ) |
change the capacity
SetCapacity.
Definition at line 102 of file store.cc.
References capacity, QueueLen(), simlib3::SetCapacityError, simlib3::SIMLIB_error(), and used.
void simlib3::Store::SetQueue | ( | Queue * | queue | ) |
change input queue
SetQueue.
Definition at line 113 of file store.cc.
References _OWNQ, _Qflag, CHECKQUEUE, OwnQueue(), Q, QueueLen(), simlib3::SetQueueError, and simlib3::SIMLIB_warning().
|
inline |
|
private |
true if store is owner of input queue
Definition at line 786 of file simlib.h.
Referenced by OwnQueue(), and SetQueue().
|
protected |
Capacity of store.
Definition at line 788 of file simlib.h.
Referenced by Enter(), and SetCapacity().
|
protected |
|
protected |
|
protected |