SIMLIB/C++ 3.09
Loading...
Searching...
No Matches
simlib3::Store Class Reference

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

#include <simlib.h>

Inheritance diagram for simlib3::Store:
Collaboration diagram for simlib3::Store:

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

Protected Attributes

unsigned long capacity
 Capacity of store.
unsigned long used
 Currently used capacity.
Queue * Q
 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 790 of file simlib.h.

Constructor & Destructor Documentation

◆ Store() [1/5]

simlib3::Store::Store ( )

Definition at line 38 of file store.cc.

References _OWNQ, _Qflag, capacity, Dprintf, Q, and used.

Referenced by operator Store *().

◆ Store() [2/5]

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

Definition at line 47 of file store.cc.

References _OWNQ, _Qflag, capacity, Dprintf, Q, and used.

◆ Store() [3/5]

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

Definition at line 56 of file store.cc.

References _OWNQ, _Qflag, capacity, Dprintf, Q, simlib3::SimObject::SetName(), and used.

◆ Store() [4/5]

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

Definition at line 66 of file store.cc.

References _Qflag, capacity, CHECKQUEUE, Dprintf, simlib3::SimObject::Name(), Q, and used.

◆ 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 810 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 812 of file simlib.h.

References Used().

◆ Enter()

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

◆ Free()

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

free capacity

Definition at line 808 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 811 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 805 of file simlib.h.

References Store().

◆ Output()

◆ 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 Dprintf, simlib3::Queue::Insert(), simlib3::SimObject::Name(), and Q.

Referenced by Enter().

◆ QueueLen()

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

Definition at line 814 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(), 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 809 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 791 of file simlib.h.

Referenced by OwnQueue(), SetQueue(), Store(), Store(), Store(), Store(), and Store().

◆ capacity

unsigned long simlib3::Store::capacity
protected

Capacity of store.

Definition at line 793 of file simlib.h.

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

◆ Q

Queue* simlib3::Store::Q
protected

input queue

Definition at line 795 of file simlib.h.

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

◆ tstat

TStat simlib3::Store::tstat
protected

usage statistics

Definition at line 796 of file simlib.h.

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

◆ used

unsigned long simlib3::Store::used
protected

Currently used capacity.

Definition at line 794 of file simlib.h.

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


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