33 waiting(0), n(0), maxn(height)
35 Dprintf((
"Barrier::Barrier()"));
43 waiting(0), n(0), maxn(height)
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);
virtual bool Wait()
wait for barrier break (Current)
unsigned n
current number of waiting entities
void Init()
initialization
void ChangeHeight(unsigned new_maxn)
change size
virtual void Enter(Entity *e)
wait for barrier break TODO: remove/rename
Entity ** waiting
array of waiting entities (fixed size)
virtual int Break()
activate all waiting entities
virtual void Output() const override
print status
virtual ~Barrier()
destructor
Barrier(unsigned N)
constructor
void Clear()
initialization
unsigned maxn
barrier height/size
abstract base class for active entities (Process, Event) instances of derived classes provide Behavio...
void Activate()
activate now
virtual void Passivate()
deactivation
void SetName(const std::string &name)
assign the name
virtual std::string Name() const
get object name
Internal header file for SIMLIB/C++.
Implementation of class CalendarList interface is static - using global functions in SQS namespace.
const double & Time
model time (is NOT the block)
void Error(const char *fmt,...)
print message and terminate program
int Print(const char *fmt,...)
for Output methods, can be redirected
Entity *const & Current
pointer to active (now running) entity
Main SIMLIB/C++ interface.