com::pcbsys::nirvana::client::nRegisteredEvent Class Reference

This class enables a client to maintain a copy of an event, make changes to the properties and then when commit is called only the changes are published to the server. More...

#include <nRegisteredEvent.h>

Inherits Mutex.

Public Member Functions

void commitChanges (bool bReplace=false)
 Writes all changes to the server and resets any internal counts, timers and copies. More...
 
int getChangeSize ()
 Returns the number of changes made since the last commitChanges was called. More...
 
unsigned char * getData (int &dataLength)
 Returns the byte array data payload of the event. More...
 
const std::string & getPrimaryKeyName ()
 Retrieves the name of the primary key name used for this event. More...
 
Object * getPrimaryKeyValue ()
 Retrieves the unique value for the primary key used for this event. More...
 
nEventPropertiesgetProperties ()
 Retrieves the properties for the event. More...
 
const std::string & getTag ()
 Returns the string tag of the event. More...
 
void setData (unsigned char *pData, int dataLength)
 Sets the byte array data payload for the event. More...
 
void setTag (const std::string &tag)
 Sets the tag for the event. More...
 
longlong timeSinceLastChange ()
 Returns the time in milliseconds since the last change was made to the event. More...
 

Protected Member Functions

nConsumeEventgetChangedEvent (bool bReplace)
 Writes all changes to the server and resets any internal counts, timers and copies. More...
 

Detailed Description

This class enables a client to maintain a copy of an event, make changes to the properties and then when commit is called only the changes are published to the server.

This enables a mechanism whereby only changes are published and not full events

Member Function Documentation

void com::pcbsys::nirvana::client::nRegisteredEvent::commitChanges ( bool  bReplace = false)

Writes all changes to the server and resets any internal counts, timers and copies.

Parameters
bReplace,iftrue the server will replace the referenced event with a complete copy of this event and will not merge any data from previous events.
Exceptions
nSecurityExceptionUser is not authorised for the function
nSessionPausedExceptionThe session is currently paused, please resume
nIllegalArgumentExceptionIllegal parameter, check the message for more information
nSessionNotConnectedExceptionCurrent session is not connected
nTransactionExceptionthrown if any transactional errors occur
nRequestTimedOutExceptionThe server has not responded to the request in the timeout period
nChannelNotFoundExceptionThe channel specified could not be found
nUnexpectedResponseExceptionInternal Error has occured, since we received a response from the server out of sequence
nConsumeEvent* com::pcbsys::nirvana::client::nRegisteredEvent::getChangedEvent ( bool  bReplace)
protected

Writes all changes to the server and resets any internal counts, timers and copies.

Parameters
bReplace,iftrue the server will replace the referenced event with a complete copy of this event and will not merge any data from previous events.
Exceptions
nSecurityExceptionUser is not authorised for the function
nSessionPausedExceptionThe session is currently paused, please resume
nIllegalArgumentExceptionIllegal parameter, check the message for more information
nSessionNotConnectedExceptionCurrent session is not connected
nRequestTimedOutExceptionThe server has not responded to the request in the timeout period
nUnexpectedResponseExceptionInternal Error has occured, since we received a response from the server out of sequence
int com::pcbsys::nirvana::client::nRegisteredEvent::getChangeSize ( )

Returns the number of changes made since the last commitChanges was called.

Returns
int number of changes since the last commitChanges
unsigned char* com::pcbsys::nirvana::client::nRegisteredEvent::getData ( int &  dataLength)

Returns the byte array data payload of the event.

Parameters
dataLengththe length of the returned byte array
Returns
unsigned char* of user data
const std::string& com::pcbsys::nirvana::client::nRegisteredEvent::getPrimaryKeyName ( )

Retrieves the name of the primary key name used for this event.

This key name is setup during channel construction using the publish key API

Returns
String name of the key
Object* com::pcbsys::nirvana::client::nRegisteredEvent::getPrimaryKeyValue ( )

Retrieves the unique value for the primary key used for this event.

Returns
Object value of the key
nEventProperties* com::pcbsys::nirvana::client::nRegisteredEvent::getProperties ( )

Retrieves the properties for the event.

The client can then change the key/value pairs in the properties. When the commitChanges() is called all changes will be sent to the server

Returns
The events nEventProperties
const std::string& com::pcbsys::nirvana::client::nRegisteredEvent::getTag ( )

Returns the string tag of the event.

Returns
String tag for the event
void com::pcbsys::nirvana::client::nRegisteredEvent::setData ( unsigned char *  pData,
int  dataLength 
)

Sets the byte array data payload for the event.

Parameters
*pDataa byte array to be sent
dataLengththe length of pData
void com::pcbsys::nirvana::client::nRegisteredEvent::setTag ( const std::string &  tag)

Sets the tag for the event.

Parameters
tagString representation of the tag to use
longlong com::pcbsys::nirvana::client::nRegisteredEvent::timeSinceLastChange ( )

Returns the time in milliseconds since the last change was made to the event.

If no change then the function will return 0

Returns
time in milliseconds since the last change