SIMLIB/C++  3.07
Public Member Functions | Public Attributes | Protected Attributes | List of all members
simlib3::Semaphore Class Reference

basic synchronization tool for processes simplified implementation More...

#include <simlib.h>

Inheritance diagram for simlib3::Semaphore:
Inheritance graph
[legend]
Collaboration diagram for simlib3::Semaphore:
Collaboration graph
[legend]

Public Member Functions

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

Public Attributes

Queue Q
 internal quqeue More...
 

Protected Attributes

int n
 
- Protected Attributes inherited from simlib3::SimObject
unsigned _flags
 bool flags for internal use (TODO bitfield?) 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

basic synchronization tool for processes simplified implementation

Definition at line 1757 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 1759 of file simlib.h.

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

◆ Q

Queue simlib3::Semaphore::Q

internal quqeue

Definition at line 1761 of file simlib.h.

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


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