SADB-Client  0.99
Situational Awareness Database
 All Classes Functions Variables
Public Member Functions | Public Attributes | List of all members
SADB::Blackboard Class Reference

Public Member Functions

 Blackboard (void)
 
 ~Blackboard (void)
 
void Initialize (void)
 Initializes object.
 
void Free (void)
 Frees allocated memory.
 
int ConnectToServer (void)
 Connect to the SADB Server.
 
int ConnectToServer (const char *address, int port=SADBPort)
 
void ConnectToServerWithRetry (void)
 Connect to the SADB Server and retry to connect until the connection is established.
 
void ConnectToServerWithRetry (const char *address, int port=SADBPort)
 
void GenerateHeader (SADBu8 *Header, SADBu8 CMD, SADBu64 OUID1, SADBu64 OUID2, SADBu64 Second, SADBu16 Millisecond, SADBu32 DataLength)
 
void Disconnect (void)
 Disconnect from the SADB Server.
 
SADBs64 Ping (void)
 
SADBu64 CreateObject (void)
 
void DeleteObject (SADBu64 OUID)
 
int IsValidObject (SADBu64 OUID)
 
void SetObjectName (SADBu64 OUID, const char *Name)
 
void GetObjectName (SADBu64 OUID, SADBu8 **Name)
 
void SetObjectDescription (SADBu64 OUID, const char *Description)
 
void GetObjectDescription (SADBu64 OUID, SADBu8 **Description)
 
SADBu64 GetObjectByName (const char *Name)
 
int SendObjectValue (SADBu64 OUID, BlackboardObject *Object)
 
int GetLatestObjectValue (SADBu64 OUID, BlackboardObject *Object)
 
int GetLatestObjectTimestamp (SADBu64 OUID, Timestamp *time)
 
int GetNextObjectTimestamp (SADBu64 OUID, Timestamp *Current, Timestamp *Next)
 
int GetPreviousObjectTimestamp (SADBu64 OUID, Timestamp *Current, Timestamp *Previous)
 
int GetNearestObjectTimestamp (SADBu64 OUID, Timestamp *Target, Timestamp *Result)
 
int GetObjectValueAtTimestamp (SADBu64 OUID, BlackboardObject *Object, Timestamp *Time, int Interpolation, int nPoints)
 
int GetObjectValueAtNearestTimestamp (SADBu64 OUID, Timestamp *Time, BlackboardObject *Object)
 
int RemoveOldestValue (SADBu64 OUID)
 
int KeepOnlyLatestValues (SADBu64 OUID, int nValues)
 
int GetObjectValueAtNextTimestamp (SADBu64 OUID, Timestamp *Time, BlackboardObject *Object)
 
int GetObjectValueAtPreviousTimestamp (SADBu64 OUID, Timestamp *Time, BlackboardObject *Object)
 
SADBu64 CreateCategory (void)
 
SADBu64 CreateCategoryIfNonExistant (const char *Name)
 
void DeleteCategory (SADBu64 CUID)
 
int IsValidCategory (SADBu64 CUID)
 
void SetCategoryName (SADBu64 CUID, const char *Name)
 
void GetCategoryName (SADBu64 CUID, SADBu8 **Name)
 
void SetCategoryDescription (SADBu64 CUID, const char *Description)
 
void GetCategoryDescription (SADBu64 CUID, SADBu8 **Description)
 
SADBu64 GetCategoryByName (const char *Name)
 
void AddObjectToCategory (SADBu64 CUID, SADBu64 OUID)
 
void RemoveObjectFromCategory (SADBu64 CUID, SADBu64 OUID)
 
int FindObjects (const char *Request, SADBu64 **Objects)
 
SADBu64 GetNextObjectID (void)
 
SADBu64 GetNextCategoryID (void)
 
void Reset (void)
 

Public Attributes

char * Address
 
int Port
 

Constructor & Destructor Documentation

Blackboard::Blackboard ( void  )

Constructor, initializes object

See also
Blackboard::Initialize
Blackboard::~Blackboard ( void  )

Destructor, deinitializes object

See also
Blackboard::Free

Member Function Documentation

void Blackboard::AddObjectToCategory ( SADBu64  CUID,
SADBu64  OUID 
)

Add an object to a category

Parameters
CUIDID of the category
OUIDID of the object
int Blackboard::ConnectToServer ( const char *  address,
int  port = SADBPort 
)

Connect to the SADB Server

Parameters
AddressAddress of the server
PortPort of the server
void Blackboard::ConnectToServerWithRetry ( const char *  address,
int  port = SADBPort 
)

Connect to the SADB Server and retry to connect until the connection is established

Parameters
AddressAddress of the server
PortPort of the server
SADBu64 Blackboard::CreateCategory ( void  )

Create a new category on the blackboard

Returns
CUID of the new category
SADBu64 Blackboard::CreateCategoryIfNonExistant ( const char *  Name)

Get the ID of a category given its name. If the category does not exist, create a new one and return its ID.

Parameters
NameName of the category
Returns
CUID of the (possibly new) category
SADBu64 Blackboard::CreateObject ( void  )

Create a new object on the blackboard

Returns
OUID of the new object
void Blackboard::DeleteCategory ( SADBu64  CUID)

Delete an existing category from the blackboard

Parameters
CUIDID of the category to remove
void Blackboard::DeleteObject ( SADBu64  OUID)

delete an existing object from the blackboard

Parameters
OUIDID of the object to remove
int Blackboard::FindObjects ( const char *  Request,
SADBu64 **  Objects 
)

Find IDs of objects matching a query

Note
Make sure the pointer to the list is initialized to NULL
Parameters
RequestString representation of the request
ObjectsPointer to a list of objet IDs
Returns
Number of Objects matching the query
SADBu64 Blackboard::GetCategoryByName ( const char *  Name)

Get the CUID of a category given its name

Parameters
NameName of the category CUID of the object, or 0 if not found
void Blackboard::GetCategoryDescription ( SADBu64  CUID,
SADBu8 **  Description 
)

Get the Description of a category on the blackboard

Parameters
CUIDID of the target category
NameReturn address
void Blackboard::GetCategoryName ( SADBu64  CUID,
SADBu8 **  Name 
)

Get the name of a category on the blackboard

Parameters
CUIDID of the target category
NameReturn address
int Blackboard::GetLatestObjectTimestamp ( SADBu64  OUID,
Timestamp time 
)

Get the latest timestamp of an object

Note
This method does not get the value of the object, only the timestamp
Parameters
OUIDID of the object in SADB
timePointer to a Timestamp object
Returns
0 on success, 1 otherwise
int Blackboard::GetLatestObjectValue ( SADBu64  OUID,
BlackboardObject Object 
)

Get the latest value of an object

Parameters
OUIDID of the object in SADB
ObjectPointer to an object that will contain the latest value
Returns
0 on success, 1 otherwise
int Blackboard::GetNearestObjectTimestamp ( SADBu64  OUID,
Timestamp Target,
Timestamp Result 
)

Get the nearest timestamp of an object to the target

Note
This method does not get the value of the object, only the timestamp
Parameters
OUIDID of the object in SADB
TargetPointer to a Timestamp object
[out]ResultPointer to a Timestamp object to store result
Returns
0 on success, 1 otherwise
SADBu64 Blackboard::GetNextCategoryID ( void  )

Get the next Category ID.

Returns
Next available Category ID, or 0 on error (0 is the ID number reserved for no category)
SADBu64 Blackboard::GetNextObjectID ( void  )

Get the next Object ID.

Returns
Next available Object ID, or 0 on error (0 is the ID number reserved for no object)
int Blackboard::GetNextObjectTimestamp ( SADBu64  OUID,
Timestamp Current,
Timestamp Next 
)

Get the next timestamp of an object

Note
This method does not get the value of the object, only the timestamp
Parameters
OUIDID of the object in SADB
CurrentPointer to a Timestamp object
[out]NextPointer to a Timestamp object to store result
Returns
0 on success, 1 otherwise
SADBu64 Blackboard::GetObjectByName ( const char *  Name)

Get the OUID of an object given its name

Parameters
NameName of the object OUID of the object, or 0 if not found
void Blackboard::GetObjectDescription ( SADBu64  OUID,
SADBu8 **  Description 
)

Get the Description of an object on the blackboard

Parameters
OUIDID of the target object
NameReturn address
void Blackboard::GetObjectName ( SADBu64  OUID,
SADBu8 **  Name 
)

Get the name of an object on the blackboard

Parameters
OUIDID of the target object
NameReturn address
int Blackboard::GetObjectValueAtNearestTimestamp ( SADBu64  OUID,
Timestamp Time,
BlackboardObject Object 
)

Get the value of an object at the nearest Timestamp

Parameters
OUIDID of the object in SADB
TimeRequested Timestamp
ObjectPointer to an object that will contain the latest value
Returns
0 on success, 1 otherwise
int Blackboard::GetObjectValueAtNextTimestamp ( SADBu64  OUID,
Timestamp Time,
BlackboardObject Object 
)

Get the value of an object at the next Timestamp after the target time

Note
if there is no timestamp after the target time, the last value (latest) is returned
Parameters
OUIDID of the object in SADB
TimeTarget Timestamp
ObjectPointer to an object that will contain the value
Returns
0 on success, 1 otherwise
int Blackboard::GetObjectValueAtPreviousTimestamp ( SADBu64  OUID,
Timestamp Time,
BlackboardObject Object 
)

Get the value of an object at the next Timestamp after the target time

Note
if there is no timestamp before the target time, the first value (earliest) is returned
Parameters
OUIDID of the object in SADB
TimeTarget Timestamp
ObjectPointer to an object that will contain the value
Returns
0 on success, 1 otherwise
int Blackboard::GetObjectValueAtTimestamp ( SADBu64  OUID,
BlackboardObject Object,
Timestamp Time,
int  Interpolation,
int  nPoints 
)

Get the latest value of an object at a given timestamp

Parameters
OUIDID of the object in SADB
ObjectPointer to an object that will contain the value
TimeRequested timestamp
InterpolationRequested interpolation method
nPointsNumber of points to use for interpolation
Returns
0 on success, 1 otherwise
int Blackboard::GetPreviousObjectTimestamp ( SADBu64  OUID,
Timestamp Current,
Timestamp Previous 
)

Get the previous timestamp of an object

Note
This method does not get the value of the object, only the timestamp
Parameters
OUIDID of the object in SADB
CurrentPointer to a Timestamp object
[out]PreviousPointer to a Timestamp object to store result
Returns
0 on success, 1 otherwise
int Blackboard::IsValidCategory ( SADBu64  CUID)

Check if a Category exists (has been created and not deleted)

Parameters
CUIDID of the category
Returns
1 if CUID is valid, 0 otherwise
int Blackboard::IsValidObject ( SADBu64  OUID)

Check if an Object exists (has been created and not deleted)

Parameters
OUIDID of the Object
Returns
1 if CUID is valid, 0 otherwise
int Blackboard::KeepOnlyLatestValues ( SADBu64  OUID,
int  nValues 
)

Tell the SADB server to discard older values of an object and to keep only the nValues latest values.

Parameters
OUIDID of the target object
nValuesnumber of values to keep
Returns
0 on success, 1 otherwise
SADBs64 Blackboard::Ping ( void  )

Ping the SADB Server for testing purposes and to determine latency

Returns
number of milliseconds between the ping and the pong
void Blackboard::RemoveObjectFromCategory ( SADBu64  CUID,
SADBu64  OUID 
)

Remove an object from a category

Parameters
CUIDID of the category
OUIDID of the object
int Blackboard::RemoveOldestValue ( SADBu64  OUID)

Tell the SADB server to discard the oldest value of an object.

Parameters
OUIDID of the target object
Returns
0 on success, 1 otherwise
void Blackboard::Reset ( void  )

Reset the SADB Server

Note
Should probably never be used
int Blackboard::SendObjectValue ( SADBu64  OUID,
BlackboardObject Object 
)

Send the value of an object

Parameters
OUIDID of the object in SADB
ObjectPointer to an object
Returns
Returns 0 on success
void Blackboard::SetCategoryDescription ( SADBu64  CUID,
const char *  Description 
)

Set the description of a category on the blackboard

Parameters
CUIDID of the category to edit
DescriptionNull-terminated string to set
void Blackboard::SetCategoryName ( SADBu64  CUID,
const char *  Name 
)

Set the name of a category on the blackboard

Parameters
CUIDID of the category to edit
NameNull-terminated string to set
void Blackboard::SetObjectDescription ( SADBu64  OUID,
const char *  Description 
)

Set the description of an object on the blackboard

Parameters
OUIDID of the object to edit
DescriptionNull-terminated string to set
void Blackboard::SetObjectName ( SADBu64  OUID,
const char *  Name 
)

Set the name of an object on the blackboard

Parameters
OUIDID of the object to edit
NameNull-terminated string to set

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