SIMLIB/C++ 3.09
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Attributes | List of all members
simlib3::Store Class Reference

(SOL-like) store store capacity can be changed dynamically More...

#include <simlib.h>

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

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
 
 operator Store * ()
 
void SetCapacity (unsigned long _capacity)
 change the capacity
 
void SetQueue (Queue *queue)
 change input queue
 
unsigned long Free () const
 free capacity
 
unsigned long Used () const
 used capacity
 
unsigned long Capacity () const
 max capacity
 
bool Full () const
 store is full
 
bool Empty () const
 store is empty
 
bool OwnQueue () const
 OwnQueue.
 
unsigned QueueLen () const
 
virtual void Enter (Entity *e, unsigned long rcap)
 allocate capacity
 
virtual void Leave (unsigned long rcap)
 deallocate capacity
 
virtual void QueueIn (Entity *e, unsigned long c)
 insert entity into queue
 
virtual void Clear ()
 initialize
 
- 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
 

Protected Attributes

unsigned long capacity
 Capacity of store.
 
unsigned long used
 Currently used capacity.
 
QueueQ
 input queue
 
TStat tstat
 usage statistics
 
- Protected Attributes inherited from simlib3::SimObject
unsigned _flags
 bool flags for internal use (TODO bitfield?)
 

Private Attributes

unsigned char _Qflag
 true if store is owner of input queue
 

Additional Inherited Members

- 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 }
 

Detailed Description

(SOL-like) store store capacity can be changed dynamically

Definition at line 785 of file simlib.h.

Constructor & Destructor Documentation

◆ Store() [1/5]

simlib3::Store::Store ( )

Definition at line 38 of file store.cc.

References Dprintf.

◆ Store() [2/5]

simlib3::Store::Store ( unsigned long  _capacity)
explicit

Definition at line 47 of file store.cc.

References Dprintf.

◆ Store() [3/5]

simlib3::Store::Store ( const char *  _name,
unsigned long  _capacity 
)

Definition at line 56 of file store.cc.

References Dprintf, and simlib3::SimObject::SetName().

◆ Store() [4/5]

simlib3::Store::Store ( unsigned long  _capacity,
Queue queue 
)

Definition at line 66 of file store.cc.

References CHECKQUEUE, Dprintf, and simlib3::SimObject::Name().

◆ Store() [5/5]

simlib3::Store::Store ( const char *  _name,
unsigned long  _capacity,
Queue queue 
)

◆ ~Store()

simlib3::Store::~Store ( )
virtual

Definition at line 92 of file store.cc.

References Clear(), Dprintf, simlib3::SimObject::Name(), OwnQueue(), and Q.

Member Function Documentation

◆ Capacity()

unsigned long simlib3::Store::Capacity ( ) const
inline

max capacity

Definition at line 805 of file simlib.h.

References capacity.

Referenced by Output().

◆ Clear()

void simlib3::Store::Clear ( )
virtual

initialize

Clear.

  • store (re-)initialization, including internal queue

Definition at line 191 of file store.cc.

References simlib3::Queue::Clear(), simlib3::TStat::Clear(), Dprintf, simlib3::SimObject::Name(), OwnQueue(), Q, tstat, and used.

Referenced by ~Store().

◆ Empty()

bool simlib3::Store::Empty ( ) const
inline

store is empty

Definition at line 807 of file simlib.h.

References Used().

◆ Enter()

void simlib3::Store::Enter ( Entity e,
unsigned long  rcap 
)
virtual

allocate capacity

Enter.

  • allocate requested capacity

Definition at line 128 of file store.cc.

References capacity, simlib3::Current, Dprintf, EnterCapError, EntityRefError, Free(), simlib3::SimObject::Name(), simlib3::Entity::Passivate(), QueueIn(), simlib3::SIMLIB_error(), tstat, and used.

Referenced by simlib3::Process::Enter().

◆ Free()

unsigned long simlib3::Store::Free ( ) const
inline

free capacity

Definition at line 803 of file simlib.h.

References capacity, and used.

Referenced by Enter(), Full(), Leave(), and Output().

◆ Full()

bool simlib3::Store::Full ( ) const
inline

store is full

Definition at line 806 of file simlib.h.

References Free().

Referenced by Leave().

◆ Leave()

void simlib3::Store::Leave ( unsigned long  rcap)
virtual

◆ operator Store *()

simlib3::Store::operator Store * ( )
inline

Definition at line 800 of file simlib.h.

◆ Output()

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

◆ OwnQueue()

bool simlib3::Store::OwnQueue ( ) const

OwnQueue.

  • check if store owns internal queue

Definition at line 203 of file store.cc.

References _OWNQ, and _Qflag.

Referenced by Clear(), Output(), SetQueue(), and ~Store().

◆ QueueIn()

void simlib3::Store::QueueIn ( Entity e,
unsigned long  c 
)
virtual

insert entity into queue

QueueIn.

  • insert entity into priority queue

Definition at line 181 of file store.cc.

References simlib3::Entity::_RequiredCapacity, Dprintf, simlib3::Queue::Insert(), simlib3::SimObject::Name(), and Q.

Referenced by Enter().

◆ QueueLen()

unsigned simlib3::Store::QueueLen ( ) const
inline

Definition at line 809 of file simlib.h.

References Q, and simlib3::List::size().

Referenced by SetCapacity(), and SetQueue().

◆ SetCapacity()

void simlib3::Store::SetCapacity ( unsigned long  newcapacity)

change the capacity

SetCapacity.

  • change capacity of store

Definition at line 102 of file store.cc.

References capacity, QueueLen(), SetCapacityError, simlib3::SIMLIB_error(), and used.

◆ SetQueue()

void simlib3::Store::SetQueue ( Queue queue)

change input queue

SetQueue.

  • use another queue

Definition at line 113 of file store.cc.

References _Qflag, CHECKQUEUE, OwnQueue(), Q, QueueLen(), SetQueueError, and simlib3::SIMLIB_warning().

◆ Used()

unsigned long simlib3::Store::Used ( ) const
inline

used capacity

Definition at line 804 of file simlib.h.

References used.

Referenced by Empty().

Member Data Documentation

◆ _Qflag

unsigned char simlib3::Store::_Qflag
private

true if store is owner of input queue

Definition at line 786 of file simlib.h.

Referenced by OwnQueue(), and SetQueue().

◆ capacity

unsigned long simlib3::Store::capacity
protected

Capacity of store.

Definition at line 788 of file simlib.h.

Referenced by Capacity(), Enter(), Free(), and SetCapacity().

◆ Q

Queue* simlib3::Store::Q
protected

input queue

Definition at line 790 of file simlib.h.

Referenced by Clear(), Leave(), Output(), QueueIn(), QueueLen(), SetQueue(), and ~Store().

◆ tstat

TStat simlib3::Store::tstat
protected

usage statistics

Definition at line 791 of file simlib.h.

Referenced by Clear(), Enter(), Leave(), and Output().

◆ used

unsigned long simlib3::Store::used
protected

Currently used capacity.

Definition at line 789 of file simlib.h.

Referenced by Clear(), Enter(), Free(), Leave(), Output(), SetCapacity(), and Used().


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