SIMLIB/C++  3.07
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 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...
 
- 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...
 

Protected Attributes

unsigned long capacity
 Capacity of store. More...
 
unsigned long used
 Currently used capacity. More...
 
QueueQ
 input queue More...
 
TStat tstat
 usage statistics More...
 
- Protected Attributes inherited from simlib3::SimObject
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

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

◆ Clear()

void simlib3::Store::Clear ( )
virtual

initialize

Clear.

  • store (re-)initialization, including internal queue

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().

◆ Empty()

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

store is empty

Definition at line 807 of file simlib.h.

◆ Enter()

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

◆ Free()

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

free capacity

Definition at line 803 of file simlib.h.

Referenced by Enter(), and Leave().

◆ Full()

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

store is full

Definition at line 806 of file simlib.h.

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(), 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 simlib3::SQS::Clear(), 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(), simlib3::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 _OWNQ, _Qflag, CHECKQUEUE, OwnQueue(), Q, QueueLen(), simlib3::SetQueueError, and simlib3::SIMLIB_warning().

◆ Used()

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

used capacity

Definition at line 804 of file simlib.h.

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 Enter(), and SetCapacity().

◆ Q

Queue* simlib3::Store::Q
protected

input queue

Definition at line 790 of file simlib.h.

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

◆ tstat

TStat simlib3::Store::tstat
protected

usage statistics

Definition at line 791 of file simlib.h.

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

◆ used

unsigned long simlib3::Store::used
protected

Currently used capacity.

Definition at line 789 of file simlib.h.

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


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