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

Public Member Functions

 BlackboardObject (void)
 
 ~BlackboardObject (void)
 
void Initialize (void)
 Initializes object.
 
void Free (void)
 Frees allocated memory.
 
void Create (Blackboard *board, const char *name)
 
void Create (Blackboard *board, const char *name, const char *description)
 
void Create (Blackboard *board, const char *name, const char *description, enum BODataType type)
 
void Create (Blackboard *board, const char *name, enum BODataType)
 
void SetBlackboard (Blackboard *board)
 
void AddToBlackboard (void)
 
int Send (void)
 
void AddToCategory (SADBu64 CUID)
 
void AddToCategory (const char *Cat)
 
void RemoveFromCategory (SADBu64 CUID)
 
void RemoveFromCategory (const char *Cat)
 
void CreateIfNonExistant (const char *name)
 
void GetByName (const char *name)
 
int GetLatestValue (void)
 
int GetValueAtNearestTimestamp (Timestamp *Time)
 
int GetValueAtTimestampNoInterpolation (Timestamp *Time)
 
int GetValueAtTimestamp (Timestamp *Time)
 
int GetValueAtTimestamp (Timestamp *Time, int Interpolation)
 
int GetValueAtTimestamp (Timestamp *Time, int Interpolation, int nPoints)
 
int GetValueAtNextTimestamp (Timestamp *Time)
 
int GetValueAtPreviousTimestamp (Timestamp *Time)
 
int GetLatestTimestamp (Timestamp *Time)
 
int GetPreviousTimestamp (Timestamp *Current, Timestamp *Previous)
 
int GetNextTimestamp (Timestamp *Current, Timestamp *Next)
 
int GetNearestTimestamp (Timestamp *Target, Timestamp *Result)
 
void SetDataType (enum BODataType)
 
int SetDimensionsf (SADBu32 D,...)
 
int OnlySetDimensionsf (SADBu32 D,...)
 
int SetDimensions (SADBu32 D, SADBu32 *Ds)
 
SADBu32 GetDimension (SADBu32 D)
 
int SetName (const char *name)
 
void GetName (void)
 Get Human Readable name of the object from the blackboard.
 
int SetDescription (const char *desc)
 
void GetDescription (void)
 Get Human Readable description of the object from the blackboard.
 
void CreateWithInitialValueFromCSV (Timestamp *Time, const char *Filename, enum BODataType DataType, char Delimiter)
 
void CreateWithInitialValueFromCSV (const char *Filename, enum BODataType DataType)
 
void CreateWithInitialValueFromCSV (const char *Filename, enum BODataType DataType, char Delimiter)
 
void CreateWithValuesFromCSV (const char *Filename, enum BODataType DataType)
 
void CreateWithValuesFromCSV (const char *Filename, enum BODataType DataType, char Delimiter)
 
void ExportAllValuesToCSV (const char *Filename)
 
void ExportRaw (const char *Filename)
 
void ImportRaw (const char *Filename)
 
void ImportRaw (const char *Filename, float A, float B)
 
void SetByte (SADBu8 Value,...)
 
void SetInteger (SADBu32 Value,...)
 
void SetFloat (SADBfl Value,...)
 
void SetDouble (SADBdfl Value,...)
 
void SetString (const char *str)
 
void SetStringElement (const char *str,...)
 
void SetBoolean (bool Value,...)
 
SADBu8 GetByte (int X,...)
 
SADBu32 GetInteger (int X,...)
 
SADBfl GetFloat (int X,...)
 
SADBdfl GetDouble (int X,...)
 
const char * GetString (void)
 
char * GetNewString (void)
 
bool GetBoolean (int X,...)
 
char * GetStringElement (int X,...)
 
void RemoveOldestValue (void)
 Remove oldest value from the blackboard.
 
void KeepOnlyLatestValues (int nValues)
 
int CheckForNewValue (void)
 
void Information (void)
 Print Human Readable information about the object.
 
void SetTimestamp (Timestamp *time)
 
void SetTimestampNow (void)
 Set the timestamp to the current time.
 

Public Attributes

BlackboardBoard
 Blackboard where the object resides.
 
SADBu8 * Name
 Human Readable Object Name.
 
SADBu8 * Description
 Human Readable Object Description.
 
void * Data
 Pointer to Memory Location of the data.
 
SADBu32 Dimensionality
 Dimensionality of the data (number of dimensiosns)
 
SADBu32 * Dimensions
 Dimensions of the data.
 
int TotalNumberOfElements
 Total number of elements (Product of all dimensions)
 
enum BODataType DataType
 Data Type.
 
int ElementSize
 Element Size (in bytes)
 
SADBu64 ID
 Object ID on the blackboard.
 
Timestamp Time
 Timestamp of the data.
 

Constructor & Destructor Documentation

BlackboardObject::BlackboardObject ( void  )

Constructor, initializes object

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

Destructor, deinitializes object

See also
BlackboardObject::Free

Member Function Documentation

void BlackboardObject::AddToBlackboard ( void  )

Add the object to a blackboard

Note
an object may only be associated with a single blackboard
Parameters
boardPointer to the target blackboard object
void BlackboardObject::AddToCategory ( SADBu64  CUID)

Add the object to a category

Parameters
CUIDID of the category
void BlackboardObject::AddToCategory ( const char *  Cat)

Add the object to a category

Parameters
CatName of the category
int BlackboardObject::CheckForNewValue ( void  )

Check to see if there is a new value on the SADB server, without retrieving it

Returns
1 if a new value is present, 0 if no new value is available, and 2 on error
void BlackboardObject::Create ( Blackboard board,
const char *  name 
)

Create an object (convenience function)

Parameters
boardPointer to the target blackboard object
nameName of the object
void BlackboardObject::Create ( Blackboard board,
const char *  name,
const char *  description 
)

Create an object (convenience function)

Parameters
boardPointer to the target blackboard object
nameName of the object
descriptionDescription of the object
void BlackboardObject::Create ( Blackboard board,
const char *  name,
const char *  description,
enum BODataType  type 
)

Create an object (convenience function)

Parameters
boardPointer to the target blackboard object
nameName of the object
descriptionDescription of the object
typeDatatype of the object
void BlackboardObject::Create ( Blackboard board,
const char *  name,
enum BODataType  type 
)

Create an object (convenience function)

Parameters
boardPointer to the target blackboard object
nameName of the object
typeDatatype of the object
void BlackboardObject::CreateIfNonExistant ( const char *  name)

Get an object from the blackboard or create it if it doesn't already exist

Parameters
nameName of the object
void BlackboardObject::CreateWithInitialValueFromCSV ( Timestamp time,
const char *  Filename,
enum BODataType  DataType,
char  Delimiter 
)

Initialize the object with data from a comma separated values (CSV) file

Note
The entire CSV file gets loaded as the value of the object for a given timestamp
Parameters
TimePointer to a timestamp object
FilenamePath to the CSV file
DataTypeType of the data in the CSV File
DelimiterDelimiter (normally ',')
void BlackboardObject::CreateWithInitialValueFromCSV ( const char *  Filename,
enum BODataType  DataType 
)

Initialize the object with data from a comma separated values (CSV) file

Note
The entire CSV file gets loaded as the value of the object for a given timestamp
Uses the current time as the timestamp
Parameters
FilenamePath to the CSV file
DataTypeType of the data in the CSV File
void BlackboardObject::CreateWithInitialValueFromCSV ( const char *  Filename,
enum BODataType  DataType,
char  Delimiter 
)

Initialize the object with data from a comma separated values (CSV) file

Note
The entire CSV file gets loaded as the value of the object for a given timestamp
Uses the current time as the timestamp
Parameters
FilenamePath to the CSV file
DataTypeType of the data in the CSV File
DelimiterDelimiter (normally ',')
void BlackboardObject::CreateWithValuesFromCSV ( const char *  Filename,
enum BODataType  DataType 
)

Initialize the object with data from a comma separated values (CSV) file

Note
the first column of each row should contain a timestamp encoded as a double, each row of data will be loaded on the blackboard as a different value at a distinct timestamp
Parameters
FilenamePath to the CSV file
DataTypeType of the data in the CSV File (other than the first column, which MUST be a double/float)
void BlackboardObject::CreateWithValuesFromCSV ( const char *  Filename,
enum BODataType  DataType,
char  Delimiter 
)

Initialize the object with data from a comma separated values (CSV) file

Note
the first column of each row should contain a timestamp encoded as a double, each row of data will be loaded on the blackboard as a different value at a distinct timestamp
Parameters
FilenamePath to the CSV file
DataTypeType of the data in the CSV File (other than the first column, which MUST be a double/float)
DelimiterDelimiter (normally ',')
void BlackboardObject::ExportAllValuesToCSV ( const char *  Filename)

Write the values of the object to a CSV file. The first element of each line is the timestamp and the remaining cells of the line contain the value.

Note
For the time being, each value is vectorized to fit on a line, dimensions information is discarded. This may cause problems with objects of higher dimensions.
If the dimensions of the object changes over time, the lines of the CSV file will have different lengths in order to export the entire data.
Parameters
FilenamePath to the CSV file
void BlackboardObject::ExportRaw ( const char *  Filename)

Write the values of the object to a raw file. Similar to the exportCSV function, but this one also stores information about the dimensions of objects. The first element of each line is the timestamp, the second element is the data type, the third column is the number of dimensions, the next few columns are the dimensions, and the remaining cells contain the value.

Parameters
FilenamePath to the output file
bool BlackboardObject::GetBoolean ( int  X,
  ... 
)

Get the value of a boolean in the object at a given location

Note
Booleans are stored as bytes (false is stored as 0, true as 1)
Parameters
XPosition in the first dimension (required as a first argument to va_start)
...Position of the element in the other dimensions
void BlackboardObject::GetByName ( const char *  name)

Get the object Id from the associated blackboard from the name

Parameters
nameName of the object on the blackboard
SADBu8 BlackboardObject::GetByte ( int  X,
  ... 
)

Get the value of a byte in the object at a given location

Parameters
XPosition in the first dimension (required as a first argument to va_start)
...Position of the element in the other dimensions
SADBu32 BlackboardObject::GetDimension ( SADBu32  D)

The the size in the nth dimension

Parameters
DIndex of the desired dimension (starts at 0)
Returns
The size, or 0 if dimension doesn't exist
SADBdfl BlackboardObject::GetDouble ( int  X,
  ... 
)

Get the value of a double precision float in the object at a given location

Parameters
XPosition in the first dimension (required as a first argument to va_start)
...Position of the element in the other dimensions
SADBfl BlackboardObject::GetFloat ( int  X,
  ... 
)

Get the value of a float in the object at a given location

Parameters
XPosition in the first dimension (required as a first argument to va_start)
...Position of the element in the other dimensions
SADBu32 BlackboardObject::GetInteger ( int  X,
  ... 
)

Get the value of an integer in the object at a given location

Parameters
XPosition in the first dimension (required as a first argument to va_start)
...Position of the element in the other dimensions
int BlackboardObject::GetLatestTimestamp ( Timestamp Time)

Get the latest timestamp on the server

Note
This function only gets the timestamp, not the acutal data
Parameters
[out]TimePointer to a Timestamp object to store result
Returns
0 on success, 1 otherwise
int BlackboardObject::GetLatestValue ( void  )

Get the latest value form the SADB server

Returns
0 on success, 1 otherwise
int BlackboardObject::GetNearestTimestamp ( Timestamp Target,
Timestamp Result 
)

Get the timestamp on server closest to the rquested one

Note
This function only gets the timestamp, not the acutal data
Parameters
TargetPointer to a Timestamp object
[out]ResultPointer to a Timestamp object to store result
Returns
0 on success, 1 otherwise
char * BlackboardObject::GetNewString ( void  )

Get the content of the object as a string

Note
this function assumes that the object contains a single string, for string tables, look a the SADBStringTable class
This functions allocates memory, you mustt free the returned pointer yourself
Returns
Pointer to the start of the string
int BlackboardObject::GetNextTimestamp ( Timestamp Current,
Timestamp Next 
)

Get the next timestamp on the server

Note
This function only gets the timestamp, not the acutal data
Parameters
CurrentPointer to a Timestamp object
[out]NextPointer to a Timestamp object to store result
Returns
0 on success, 1 otherwise
int BlackboardObject::GetPreviousTimestamp ( Timestamp Current,
Timestamp Previous 
)

Get the previous timestamp on the server

Note
This function only gets the timestamp, not the acutal data
Parameters
CurrentPointer to a Timestamp object
[out]PreviousPointer to a Timestamp object to store result
Returns
0 on success, 1 otherwise
const char * BlackboardObject::GetString ( void  )

Get the content of the object as a string

Note
this function assumes that the object contains a single string, for string tables, look a the SADBStringTable class
Returns
Pointer to the start of the string
char * BlackboardObject::GetStringElement ( int  X,
  ... 
)

Get the value of a float in the object at a given location

Parameters
XPosition in the first dimension (required as a first argument to va_start)
...Position of the element in the other dimensions
int BlackboardObject::GetValueAtNearestTimestamp ( Timestamp Time)

Get the value at the nearest timestamp

Parameters
TimeRequested Timestamp
Returns
0 on success, 1 otherwise
int BlackboardObject::GetValueAtNextTimestamp ( Timestamp Time)

Get the value at the next timestamp

Parameters
TimeTarget Timestamp
Returns
0 on success, 1 otherwise
int BlackboardObject::GetValueAtPreviousTimestamp ( Timestamp Time)

Get the value at the previous timestamp

Parameters
TimeTarget Timestamp
Returns
0 on success, 1 otherwise
int BlackboardObject::GetValueAtTimestamp ( Timestamp Time)

Get the value at the exact timestamp with default interpolation method (linear)

Parameters
TimeRequested Timestamp
Returns
0 on success, 1 otherwise
int BlackboardObject::GetValueAtTimestamp ( Timestamp Time,
int  Interpolation 
)

Get the value at the nearest timestamp

Parameters
TimeRequested Timestamp
InterpolationRequested Interpolation method
Returns
0 on success, 1 otherwise
int BlackboardObject::GetValueAtTimestamp ( Timestamp Time,
int  Interpolation,
int  nPoints 
)

Get the value at the nearest timestamp

Parameters
TimeRequested Timestamp
InterpolationRequested Interpolation method
nPointsNumber of points to use for interpolation
Returns
0 on success, 1 otherwise
int BlackboardObject::GetValueAtTimestampNoInterpolation ( Timestamp Time)

Get the value at a given timestamp, if such a value exists

Parameters
TimeRequested Timestamp
Returns
0 on success, 1 otherwise
void BlackboardObject::ImportRaw ( const char *  Filename)

Initialize the object with data from a raw data file (exported with exportraw)

Parameters
FilenamePath to the raw file
void BlackboardObject::ImportRaw ( const char *  Filename,
float  A,
float  B 
)

Initialize the object with data from a raw data file (exported with exportraw)

Parameters
FilenamePath to the raw file
ABeginning Percentage
AEnd Percentage
void BlackboardObject::KeepOnlyLatestValues ( int  nValues)

Discard earliest values and keep only the n most recent

Parameters
nValuesNumber of Values to be kept
int BlackboardObject::OnlySetDimensionsf ( SADBu32  D,
  ... 
)

Sets the size of the object by defining its dimensionality and its dimensions, without allocating memory

Parameters
DNumber of Dimensions
...Dimensions (Height, Width, etc)
Returns
0 on success
void BlackboardObject::RemoveFromCategory ( SADBu64  CUID)

Add the object to a category

Parameters
CUIDID of the category
void BlackboardObject::RemoveFromCategory ( const char *  Cat)

Add the object to a category

Parameters
CatName of the category
int BlackboardObject::Send ( void  )

Send the object data to the blackboard

Returns
Returns 0 on success, will return 1 if either the board is not defined or the transfer fails
void BlackboardObject::SetBlackboard ( Blackboard board)

Associate the object to a blackboard

Note
an object may only be associated with a single blackboard
Parameters
boardPointer to the target blackboard object
void BlackboardObject::SetBoolean ( bool  Value,
  ... 
)

Sets the value of an element in the object

Note
Booleans are stored as bytes (false is stored as 0, true as 1)
Parameters
ValueValue to set
...Position of the element to receive the value (X,Y,Z,...)
void BlackboardObject::SetByte ( SADBu8  Value,
  ... 
)

Sets the value of an element in the object

Parameters
ValueValue to set
...Position of the element to receive the value (X,Y,Z,...)
void BlackboardObject::SetDataType ( enum BODataType  Type)

Sets the type of data that the object will contain

Parameters
TypeData Type
int BlackboardObject::SetDescription ( const char *  desc)

Set Human Readable description of the object

Parameters
descDescription
Returns
0 on success
int BlackboardObject::SetDimensions ( SADBu32  D,
SADBu32 *  Ds 
)

Sets the size of the object by defining its dimensionality and its dimensions

Parameters
DNumber of Dimensions
Dslist of Dimensions (Height, Width, etc)
Returns
0 on success
int BlackboardObject::SetDimensionsf ( SADBu32  D,
  ... 
)

Sets the size of the object by defining its dimensionality and its dimensions

Parameters
DNumber of Dimensions
...Dimensions (Height, Width, etc)
Returns
0 on success
void BlackboardObject::SetDouble ( SADBdfl  Value,
  ... 
)

Sets the value of an element in the object

Parameters
ValueValue to set
...Position of the element to receive the value (X,Y,Z,...)
void BlackboardObject::SetFloat ( SADBfl  Value,
  ... 
)

Sets the value of an element in the object

Parameters
ValueValue to set
...Position of the element to receive the value (X,Y,Z,...)
void BlackboardObject::SetInteger ( SADBu32  Value,
  ... 
)

Sets the value of an element in the object

Parameters
ValueValue to set
...Position of the element to receive the value (X,Y,Z,...)
int BlackboardObject::SetName ( const char *  name)

Set Human Readable name of the object

Parameters
nameName
Returns
0 on success
void BlackboardObject::SetString ( const char *  str)

Set a string as the content of the object.

Note
this function assumes that the object contains a single string, for string tables, look a the SADBStringTable class
Allocates the required memory
Parameters
strDesired string
void BlackboardObject::SetStringElement ( const char *  str,
  ... 
)

Sets a string in an object

Parameters
strString
...Position of the element to receive the value (X,Y,Z,...), the last dimension stores the string
void BlackboardObject::SetTimestamp ( Timestamp time)

Set the timestamp

Parameters
timeDesired timestamp

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