Public Member Functions

IdcAdaptersSet Class Reference

This interface is implemented by Beesnest!
More...

#include <DcAdaptersSet.h>

Inheritance diagram for IdcAdaptersSet:
CdcAdaptersSet

List of all members.

Public Member Functions

virtual ~IdcAdaptersSet ()
 Empty virtual Destructor.
virtual unsigned int GetAdapter (BufferHolder name)=0
 Returns an ID of an adapter from the type 'name', or 0 if the user cannot get this adapter at the moment.
virtual void ReleaseAdapter (unsigned int AID, bool cf=false)=0
 This function releases an adapter.
virtual void AdapterDone (unsigned int AID)=0
 When an engine exits (done with a script) it must call this function on every adapter ID it has (got with GetAdapter and didn't release).
virtual BufferHolder Read (unsigned int AID, BufferHolder address)=0 throw (BufferHolder)
 This is the function that calls the adapter Read function.
virtual bool Write (unsigned int AID, BufferHolder address, BufferHolder value)=0 throw (BufferHolder)
 This is the function that calls the adapter Write function.

Detailed Description

This interface is implemented by Beesnest!

This abstract class is the interface for CdcAdaptersSet. IdcEngine can use this interface to create, use and release adapters. An adapter can be either already created and saved in this set for the user, or it can be newly created from the Adapters Bank. IdcEngine will get just the adapter ID, and will use it when Reading, Writing or Releasing the adapter. When the engine exits (when it is done with a script) it must call AdapterDone on all the adapters IDs it used and didn't release.

The Read and Write functions might throw a BufferHolder exception. It is not defined what the script engine should do with these exceptions. If the script language support exceptions, the best thing will be to catch them and throw a proper exception in the script itself (so the script writer can handle it). If the script language does not support exceptions, the engine should probably catch the exception print it on the page, and return (from Process) with value of False. If the engine will ignore these exceptions, the thread will abort, and the user will not get any response, that also might results in the script interpreter doesn't close cleanly. So DO NOT ignore these exceptions! You should copy the string this BufferHolder points to immediately (the string should be valid until the next call to this adapter), remember that this string does not have to end with NULL.

All interfaces uses BufferHolder to pass strings or buffers.

Definition at line 40 of file DcAdaptersSet.h.


Constructor & Destructor Documentation

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

Empty virtual Destructor.

Definition at line 47 of file DcAdaptersSet.h.


Member Function Documentation

virtual void IdcAdaptersSet::AdapterDone ( unsigned int  AID ) [pure virtual]

When an engine exits (done with a script) it must call this function on every adapter ID it has (got with GetAdapter and didn't release).

If the adapter is not "Storable", the class will release (delete) it. If the adapter is "Storable", the class will mark it as free, set the Start Idle time (for the release idles thread), but keep the adapter in its memory.

Parameters:
AIDThe ID of the adapter an engine is done with.
virtual unsigned int IdcAdaptersSet::GetAdapter ( BufferHolder  name ) [pure virtual]

Returns an ID of an adapter from the type 'name', or 0 if the user cannot get this adapter at the moment.

Parameters:
nameThe desired adapter name.
Returns:
(uint) The adapter ID or 0 if the user cannot get this adapter.

Implemented in CdcAdaptersSet.

virtual BufferHolder IdcAdaptersSet::Read ( unsigned int  AID,
BufferHolder  address 
) throw (BufferHolder) [pure virtual]

This is the function that calls the adapter Read function.

Parameters:
AIDThe adapter ID.
addressThe address (or name) to read from.
Returns:
(BufferHolder) Holds the result string or an empty string.
Exceptions:
(BufferHolder)Just pass an exception from the adapter.

Implemented in CdcAdaptersSet.

virtual void IdcAdaptersSet::ReleaseAdapter ( unsigned int  AID,
bool  cf = false 
) [pure virtual]

This function releases an adapter.

If the adapter is "Storable", it will not be saved for the user any more.

Parameters:
AIDThe adapter ID.
cfThe engine does not use this parameter.
virtual bool IdcAdaptersSet::Write ( unsigned int  AID,
BufferHolder  address,
BufferHolder  value 
) throw (BufferHolder) [pure virtual]

This is the function that calls the adapter Write function.

When using this function, you should make value optional in the script, and pass this function an empty BufferHolder if it is missing (initialize a BufferHolder with NULL will create it empty).

Parameters:
AIDThe adapter ID.
addressThe address (or name) to write to.
valueThe string to write to this address (Optional).
Returns:
(bool) True on success.
Exceptions:
(BufferHolder)Just pass an exception from the adapter.

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