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

basic synchronization tool for processes simplified implementation More...

#include <simlib.h>

Inheritance diagram for simlib3::Semaphore:
Collaboration diagram for simlib3::Semaphore:

Public Member Functions

 Semaphore ()
 Semaphore (const char *_name)
virtual ~Semaphore ()
void Clear ()
 initialization
virtual void Output () const override
 print object to default output
virtual void P ()
 P operation.
virtual void V ()
 V operation.
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

Public Attributes

Queue Q
 internal quqeue

Protected Attributes

int n
Protected Attributes inherited from simlib3::SimObject
unsigned _flags
 bool flags for internal use (TODO bitfield?)

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

basic synchronization tool for processes simplified implementation

Definition at line 1762 of file simlib.h.

Constructor & Destructor Documentation

◆ Semaphore() [1/2]

simlib3::Semaphore::Semaphore ( )

Definition at line 33 of file semaphor.cc.

References Dprintf, and n.

◆ Semaphore() [2/2]

simlib3::Semaphore::Semaphore ( const char * _name)
explicit

Definition at line 39 of file semaphor.cc.

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

◆ ~Semaphore()

simlib3::Semaphore::~Semaphore ( )
virtual

Definition at line 50 of file semaphor.cc.

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

Member Function Documentation

◆ Clear()

void simlib3::Semaphore::Clear ( )

initialization

Definition at line 59 of file semaphor.cc.

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

◆ Output()

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

print object to default output

print object's info TODO: use operator <<

Reimplemented from simlib3::SimObject.

Definition at line 69 of file semaphor.cc.

References n, simlib3::SimObject::Name(), and simlib3::Print().

◆ P()

void simlib3::Semaphore::P ( )
virtual

◆ V()

void simlib3::Semaphore::V ( )
virtual

Member Data Documentation

◆ n

int simlib3::Semaphore::n
protected

Definition at line 1764 of file simlib.h.

Referenced by Clear(), Output(), P(), Semaphore(), Semaphore(), V(), and ~Semaphore().

◆ Q

Queue simlib3::Semaphore::Q

internal quqeue

Definition at line 1766 of file simlib.h.

Referenced by Clear(), P(), and V().


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