DataDirector API
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ChunkProducer Class Reference

#include <ChunkProducer.h>

Inheritance diagram for ChunkProducer:
DDD_AttributeContainer DDD_Base DDD_AttributeObserver DDD_LogFacade DIS_Producer RawProducer XplaneProducer

Public Member Functions

 ChunkProducer ()
 
 ~ChunkProducer ()
 
virtual void ProcessMessage (unsigned char *msgBuf, unsigned int receivedLength)
 
virtual int BuildMessage (unsigned char *msgBuf, unsigned int maxMessageLength, unsigned int chunkNumber)
 
ChunkAttributeFindAttributeByName (std::string &name)
 
ChunkDescriptionFindChunkDescriptionByName (std::string &name)
 
void SetDebugMode (unsigned int debugMode)
 
void SetCheckForChangeBeforeUpdate (const bool value)
 
virtual void Start ()
 
- Public Member Functions inherited from DDD_Base
 DDD_Base ()
 
virtual ~DDD_Base ()
 
const char * GetInstanceName () const
 
virtual void SetInstanceName (const char *name)
 
virtual void SetParams (const DDD_AttributeList &params)
 
virtual DDD_AttributeListGetParams ()
 

Static Public Member Functions

static void Swap2 (unsigned char *val)
 
static void Swap4 (unsigned char *val)
 
static void Swap8 (unsigned char *val)
 
- Static Public Member Functions inherited from DDD_LogFacade
static void LogDebug (const char *format,...)
 
static void LogInfo (const char *format,...)
 
static void LogWarning (const char *format,...)
 
static void LogError (const char *format,...)
 

Protected Member Functions

void ReadBitfield (ChunkAttribute *attr, unsigned char *msgBuf)
 
void ReadInt (ChunkAttribute *attr, unsigned char *msgBuf)
 
void ReadUInt (ChunkAttribute *attr, unsigned char *msgBuf)
 
void ReadDouble (ChunkAttribute *attr, unsigned char *msgBuf)
 
void ReadBoolean (ChunkAttribute *attr, unsigned char *msgBuf)
 
void ReadString (ChunkAttribute *attr, unsigned char *msgBuf)
 
void ReadChunk (ChunkDescription *chunk, unsigned char *msgBuf, unsigned int receivedLen)
 
int WriteBitfield (ChunkAttribute *attr, unsigned char *msgBuf)
 
int WriteInt (ChunkAttribute *attr, unsigned char *msgBuf)
 
int WriteUInt (ChunkAttribute *attr, unsigned char *msgBuf)
 
int WriteDouble (ChunkAttribute *attr, unsigned char *msgBuf)
 
int WriteBoolean (ChunkAttribute *attr, unsigned char *msgBuf)
 
int WriteString (ChunkAttribute *attr, unsigned char *msgBuf)
 
int WriteChunk (ChunkDescription *chunk, unsigned char *msgBuf, unsigned int maxLen)
 
void PrintDebugInfo (unsigned char *msgBuf, unsigned int receivedLength)
 
virtual void OnAttributeChanged (DDD_AttributeBase *attribute)
 

Protected Attributes

unsigned int _packetCount
 
unsigned int _debugMode
 
bool _checkForChangeBeforeUpdate
 
- Protected Attributes inherited from DDD_Base
std::string _instanceName
 
DDD_AttributeList _params
 

Detailed Description

The Chunk Producer class. Abstract base class for other "Producers" that will produce attributes for use by the UDP_Asset

Constructor & Destructor Documentation

A list of chunk descriptions Constructor

Destructor

Member Function Documentation

virtual int BuildMessage ( unsigned char *  msgBuf,
unsigned int  maxMessageLength,
unsigned int  chunkNumber 
)
inlinevirtual

Builds an outbound message buffer. Only implemented by ChunkProducers that send data.

Parameters
msgBufA buffer to contain the message
maxMessageLengthThe max length of the message to build
Returns
The length of the message built or -1 if no message built

Reimplemented in DIS_Producer, and RawProducer.

ChunkAttribute* FindAttributeByName ( std::string &  name)

Find the chunk attribute by fully qualified name, e.g. chunkDesc.attributeName

Parameters
attributeNameThe fully qualified attribute name to find
Returns
A pointer to the attribute if found, NULL otherwise
ChunkDescription* FindChunkDescriptionByName ( std::string &  name)

Find the specified chunk description by name

Parameters
chunkNameThe name of the chunk to find
Returns
A pointer to the chunk if found, NULL otherwise
virtual void OnAttributeChanged ( DDD_AttributeBase attribute)
inlineprotectedvirtual

A callback method that will be called when the attribute being observed changes if this observer has registered to be notified on attribute change

Parameters
attributeA pointer to the attribute that changed

Implements DDD_AttributeObserver.

Reimplemented in DIS_Producer, and RawProducer.

void PrintDebugInfo ( unsigned char *  msgBuf,
unsigned int  receivedLength 
)
protected

Processes an inbound message, only for printing debug information to the console.

Parameters
msgBufA buffer containing a message
receivedLengthThe length of the received message
virtual void ProcessMessage ( unsigned char *  msgBuf,
unsigned int  receivedLength 
)
inlinevirtual

Processes an inbound message, classifying it into chunks and then updating their associated attributes. Required for producers which receive messages. Only implemented by ChunkProducers that receive data.

Parameters
msgBufA buffer containing a message
receivedLengthThe length of the received message

Reimplemented in DIS_Producer, XplaneProducer, and RawProducer.

void ReadBitfield ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an inbound bitfield attribute update. Performs the actual decoding, byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the bitfield attribute
msgBufA buffer containing a chunk of data
void ReadBoolean ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an inbound boolean attribute update. Performs the actual decoding, byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the boolean
msgBufA buffer containing a chunk of data
void ReadChunk ( ChunkDescription chunk,
unsigned char *  msgBuf,
unsigned int  receivedLen 
)
protected

Processes an inbound chunk and updates any connected attributes

Parameters
chunkThe chunk specification
msgBufThe UDP message buffer
receivedLenThe length of the UDP message
void ReadDouble ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an inbound double/float attribute update. Performs the actual decoding, byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the double
msgBufA buffer containing a chunk of data
void ReadInt ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an inbound integer attribute update. Performs the actual decoding, byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the integer
msgBufA buffer containing a chunk of data
void ReadString ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an inbound string attribute update. Strings are not byte swapped byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the string
msgBufA buffer containing a chunk of data
void ReadUInt ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an inbound unsigned integer attribute update. Performs the actual decoding, byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the unsigned integer
msgBufA buffer containing a chunk of data
void SetCheckForChangeBeforeUpdate ( const bool  value)
inline

Setter for the flag specifying whether to check for value change before updating over connections

Parameters
valuetrue = check for change before updating over connections, false = do not
void SetDebugMode ( unsigned int  debugMode)
inline

Sets the debug mode for the chunk producer

Parameters
debugModeNew debug Mode: 0=None, 1=Light, 2=Verbose
virtual void Start ( )
inlinevirtual

Perform any producer specific initialization

Reimplemented in DIS_Producer.

static void Swap2 ( unsigned char *  val)
static

Swaps a 2 byte quanity into the native byte order of this machine

Parameters
valPointer to the value to swap
static void Swap4 ( unsigned char *  val)
static

Swaps a 4 byte quanity into the native byte order of this machine

Parameters
valPointer to the value to swap
static void Swap8 ( unsigned char *  val)
static

Swaps an 8 byte quanity into the native byte order of this machine

Parameters
valPointer to the value to swap
int WriteBitfield ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an outbound bitfield attribute update. Performs the actual encoding, byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the bitfield attribute
msgBufA buffer containing a chunk of data
int WriteBoolean ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an outbound boolean attribute update. Performs the actual encoding, byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the boolean
msgBufA buffer containing a chunk of data
int WriteChunk ( ChunkDescription chunk,
unsigned char *  msgBuf,
unsigned int  maxLen 
)
protected

Processes an outbound chunk

Parameters
chunkThe chunk specification
msgBufThe UDP message buffer
receivedLenThe length of the UDP message
int WriteDouble ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an outbound double/float attribute update. Performs the actual encoding, byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the double
msgBufA buffer containing a chunk of data
int WriteInt ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an outbound integer attribute update. Performs the actual encoding, byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the integer
msgBufA buffer containing a chunk of data
int WriteString ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an outbound string attribute update. Strings are not byte swapped byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the string
msgBufA buffer containing a chunk of data
int WriteUInt ( ChunkAttribute attr,
unsigned char *  msgBuf 
)
protected

Processes an outbound unsigned integer attribute update. Performs the actual encoding, byte swapping, etc of the attribute

Parameters
attrThe chunk attribute describing the unsigned integer
msgBufA buffer containing a chunk of data

Member Data Documentation

bool _checkForChangeBeforeUpdate
protected

Whether or not to check the values for change before updating the connection value

unsigned int _debugMode
protected

0=None, 1=Light, 2=Verbose

unsigned int _packetCount
protected

For debugging only


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