VDSF
Menu

vdsSession Class Reference

List of all members.

Public Member Functions

 vdsSession ()
virtual ~vdsSession ()
 Terminate the current session and destroy this object.
void Commit ()
 Commit all insertions and deletions (of the current session) executed since the previous call to Commit or Rollback.
void CreateObject (const std::string &objectName, vdsObjectType objectType)
 Create a new object in shared memory.
void CreateObject (const char *objectName, size_t nameLengthInBytes, vdsObjectType objectType)
 Create a new object in shared memory.
void DestroyObject (const std::string &objectName)
 Destroy an existing object in shared memory.
void DestroyObject (const char *objectName, size_t nameLengthInBytes)
 Destroy an existing object in shared memory.
void ErrorMsg (char *message, size_t msgLengthInBytes)
 Return the error message associated with the last error(s).
std::string & ErrorMsg (std::string &message)
 Return the error message associated with the last error(s).
void GetInfo (vdsInfo *pInfo)
 Return information on the current status of the VDS (Virtual Data Space).
void GetStatus (const std::string &objectName, vdsObjStatus *pStatus)
 Return the status of the named object.
void GetStatus (const char *objectName, size_t nameLengthInBytes, vdsObjStatus *pStatus)
 Return the status of the named object.
void Init ()
 This function initializes a session.
int LastError ()
 Return the last error seen in previous calls (of the current session).
void Rollback ()
 Rollback all insertions and deletions (of the current session) executed since the previous call to Commit or Rollback.

Private Attributes

VDS_HANDLE m_sessionHandle
 Pointer to the vdsaSession struct.

Friends

class vdsFolder
class vdsHashMap
class vdsQueue

Constructor & Destructor Documentation

vdsSession::vdsSession (  ) 

virtual vdsSession::~vdsSession (  )  [virtual]

Terminate the current session and destroy this object.

An implicit call to Rollback is executed by this destructor.


Member Function Documentation

void vdsSession::Commit (  ) 

Commit all insertions and deletions (of the current session) executed since the previous call to Commit or Rollback.

Insertions and deletions subjected to this call include both data items inserted and deleted from data containers (maps, etc.) and objects themselves created with CreateObject and/or destroyed with DestroyObject.

Note: the internal calls executed by the engine to satisfy this request cannot fail. As such, you cannot find yourself with an ugly situation where some operations were committed and others not. If this function thows an exception, nothing was committed.

Exceptions:
vdsException An abnormal error occured.

void vdsSession::CreateObject ( const char *  objectName,
size_t  nameLengthInBytes,
vdsObjectType  objectType 
)

Create a new object in shared memory.

The creation of the object only becomes permanent after a call to Commit.

Parameters:
[in] objectName The fully qualified name of the object.
[in] nameLengthInBytes The length of objectName (in bytes) not counting the null terminator.
[in] objectType The type of object to create (folder, queue, etc.).
Exceptions:
vdsException An abnormal error occured.

void vdsSession::CreateObject ( const std::string &  objectName,
vdsObjectType  objectType 
)

Create a new object in shared memory.

The creation of the object only becomes permanent after a call to Commit.

Parameters:
[in] objectName The fully qualified name of the object.
[in] objectType The type of object to create (folder, queue, etc.).
Exceptions:
vdsException An abnormal error occured.

void vdsSession::DestroyObject ( const char *  objectName,
size_t  nameLengthInBytes 
)

Destroy an existing object in shared memory.

The destruction of the object only becomes permanent after a call to Commit.

Parameters:
[in] objectName The fully qualified name of the object.
[in] nameLengthInBytes The length of objectName (in bytes) not counting the null terminator.
Exceptions:
vdsException An abnormal error occured.

void vdsSession::DestroyObject ( const std::string &  objectName  ) 

Destroy an existing object in shared memory.

The destruction of the object only becomes permanent after a call to Commit.

Parameters:
[in] objectName The fully qualified name of the object.
Exceptions:
vdsException An abnormal error occured.

std::string& vdsSession::ErrorMsg ( std::string &  message  ) 

Return the error message associated with the last error(s).

Caveat, some basic errors cannot be captured, if the provided handles (session handles or object handles) are incorrect (NULL, for example). Without a proper handle, the code cannot know where to store the error...

Parameters:
[out] message Buffer for the error message. Memory allocation for this buffer is the responsability of the caller.
Exceptions:
vdsException An abnormal error occured.

void vdsSession::ErrorMsg ( char *  message,
size_t  msgLengthInBytes 
)

Return the error message associated with the last error(s).

If the length of the error message is greater than the length of the provided buffer, the error message will be truncated to fit in the provided buffer.

Caveat, some basic errors cannot be captured, if the provided handles (session handles or object handles) are incorrect (NULL, for example). Without a proper handle, the code cannot know where to store the error...

Parameters:
[out] message Buffer for the error message. Memory allocation for this buffer is the responsability of the caller.
[in] msgLengthInBytes The length of message (in bytes). Must be at least 32 bytes.
Exceptions:
vdsException An abnormal error occured.

void vdsSession::GetInfo ( vdsInfo *  pInfo  ) 

Return information on the current status of the VDS (Virtual Data Space).

The fetched information is mainly about the current status of the memory allocator.

Parameters:
[out] pInfo A pointer to the vdsInfo structure.
Exceptions:
vdsException An abnormal error occured.

void vdsSession::GetStatus ( const char *  objectName,
size_t  nameLengthInBytes,
vdsObjStatus *  pStatus 
)

Return the status of the named object.

Parameters:
[in] objectName The fully qualified name of the object.
[in] nameLengthInBytes The length of objectName (in bytes) not counting the null terminator.
[out] pStatus A pointer to the vdsObjStatus structure.
Exceptions:
vdsException An abnormal error occured.

void vdsSession::GetStatus ( const std::string &  objectName,
vdsObjStatus *  pStatus 
)

Return the status of the named object.

Parameters:
[in] objectName The fully qualified name of the object.
[out] pStatus A pointer to the vdsObjStatus structure.
Exceptions:
vdsException An abnormal error occured.

void vdsSession::Init (  ) 

This function initializes a session.

This function will also initiate a new transaction.

Upon normal termination, the current transaction is rolled back. You MUST explicitly call Commit to save your changes.

Exceptions:
vdsException An abnormal error occured.

int vdsSession::LastError (  ) 

Return the last error seen in previous calls (of the current session).

Exceptions:
vdsException An abnormal error occured.

void vdsSession::Rollback (  ) 

Rollback all insertions and deletions (of the current session) executed since the previous call to Commit or Rollback.

Insertions and deletions subjected to this call include both data items inserted and deleted from data containers (maps, etc.) and objects themselves created with CreateObject and/or destroyed with DestroyObject.

Note: the internal calls executed by the engine to satisfy this request cannot fail. As such, you cannot find yourself with an ugly situation where some operations were rollbacked and others not. If this function thows an exception, nothing was rollbacked.

Exceptions:
vdsException An abnormal error occured.


Friends And Related Function Documentation

friend class vdsFolder [friend]

friend class vdsHashMap [friend]

friend class vdsQueue [friend]


Member Data Documentation

VDS_HANDLE vdsSession::m_sessionHandle [private]

Pointer to the vdsaSession struct.


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

Last updated on March 23, 2008.