33 waiting(0), n(0), maxn(height)
35 Dprintf((
"Barrier::Barrier()"));
45 Dprintf((
"Barrier::Barrier(\"%s\")", name));
55 Dprintf((
"Barrier::~Barrier() // \"%s\" ",
Name().c_str()));
64 Dprintf((
"Barrier\"%s\".Enter(%s)",
Name().c_str(), e->
Name().c_str()));
101 for (
unsigned i = 0; i <
n; i++)
116 Error(
"Barrier size less than 1");
126 Dprintf((
"%s.ChangeHeight(%u)",
Name().c_str(), new_height));
127 if (new_height <
n || new_height < 1)
128 Error(
"Barrier height can not be changed");
131 for (
unsigned i = 0; i <
n; i++)
136 for (
unsigned i = n; i <
maxn; i++)
146 for (
unsigned i = 0; i <
maxn; i++)
156 for (
unsigned i = 0; i <
maxn; i++)
160 Print(
"%3d: empty\n", i);
void ChangeHeight(unsigned new_maxn)
change size
unsigned n
current number of waiting entities
void SetName(const std::string &name)
assign the name
virtual void Enter(Entity *e)
wait for barrier break TODO: remove/rename
virtual void Passivate()
deactivation
int Print(const char *fmt,...)
for Output methods, can be redirected
Barrier(unsigned N)
constructor
Implementation of class CalendarList interface is static - using global functions in SQS namespace...
virtual void Output() const override
print status
abstract base class for active entities (Process, Event) instances of derived classes provide Behavio...
Entity *const & Current
pointer to active (now running) entity
virtual int Break()
activate all waiting entities
const double & Time
model time (is NOT the block)
void Error(const char *fmt,...)
print message and terminate program
void Clear()
initialization
virtual bool Wait()
wait for barrier break (Current)
Internal header file for SIMLIB/C++.
unsigned maxn
barrier height/size
Main SIMLIB/C++ interface.
virtual std::string Name() const
get object name
Entity ** waiting
array of waiting entities (fixed size)
void Activate()
activate now
void Init()
initialization
virtual ~Barrier()
destructor