Classes | Public Member Functions | Friends

CdcEnginesSet Class Reference

This class works very similar to AdaptersSet, just a little simpler. More...

#include <DcEnginesSet.h>

List of all members.

Classes

class  CdcEngineNode
 Class of one node in the engines list.

Public Member Functions

 CdcEnginesSet ()
 Constructor - Does nothing.
virtual ~CdcEnginesSet ()
 The Destructor - Does nothing.
void Login ()
 start the release thread.
void Logout ()
 close all engines, and close the release thread.
IdcEngineGetEngine (const CdcString &name)
 If this object has an engine of the name 'name' it returns it and removes it from its map.
bool PutEngine (const CdcString &name, IdcEngine *peng)
 This function adds an engine to the set.

Friends

int DcReleaseEngine (void *pParam)
 This is a global friend function.

Detailed Description

This class works very similar to AdaptersSet, just a little simpler.

In this case the EnginesBank is the client and this class is the server. EnginesBank can put an engine here for storage, and can take an engine out. When the EnginesBank takes an engine out, the class delete the place for this engine, but the engine of course is still alive. When EnginesBank puts an engine in, the class allocates a space for it, and set the idle Start Time to Now. The only cases when this class delete an engine itself, is if it was stored over the time limit, or if it was stored when the user logged out (in the Destructor). Otherwise the Engines Bank is the one that deletes the engines. It simply take them out and doesn't put them back in.

This class is thread safe, as user can have more then one thread going in the same time. An engine however, can be in use of just one thread at a time.

Author:
Erez Bibi
Version:
1.0

Definition at line 55 of file DcEnginesSet.h.


Constructor & Destructor Documentation

CdcEnginesSet::CdcEnginesSet (  ) [inline]

Constructor - Does nothing.

Definition at line 105 of file DcEnginesSet.h.

virtual CdcEnginesSet::~CdcEnginesSet (  ) [inline, virtual]

The Destructor - Does nothing.

Definition at line 113 of file DcEnginesSet.h.


Member Function Documentation

IdcEngine * CdcEnginesSet::GetEngine ( const CdcString name )

If this object has an engine of the name 'name' it returns it and removes it from its map.

Parameters:
nameThe desired engine name.
Returns:
(IdcEngine*) The engine pointer or NULL.

Definition at line 58 of file DcEnginesSet.cpp.

void CdcEnginesSet::Login (  )

start the release thread.

DcEnginesSet.cpp: implementation of the CdcEnginesSet class.

for documentation see the header file.

Definition at line 26 of file DcEnginesSet.cpp.

void CdcEnginesSet::Logout (  )

close all engines, and close the release thread.

Definition at line 40 of file DcEnginesSet.cpp.

bool CdcEnginesSet::PutEngine ( const CdcString name,
IdcEngine peng 
)

This function adds an engine to the set.

If an engine with this name is already in the set, it will not replace it and return false.

Parameters:
nameThe engine name.
pengA pointer to this engine.
Returns:
(bool) True on success, or False if an engine with this name is already in the set.

Definition at line 75 of file DcEnginesSet.cpp.


Friends And Related Function Documentation

int DcReleaseEngine ( void *  pParam ) [friend]

This is a global friend function.

This function runs in a separate thread, has access to all private members of the class and in charge of releasing engines that have not been used for sometime. The time is defined in the parameters file for all the engines. This time limit can be zero (so engines will not be released). The release thread get created just if the time limit for the engines exists and its more then 0.

Definition at line 92 of file DcEnginesSet.cpp.


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