DUNE: Uniform Navigational Environment  2016.05.0
DUNE::IMC::Collision Class Reference

Detailed Description

Public Types

enum  TypeBits { CD_X, CD_Y, CD_Z, CD_IMPACT }
 

Public Member Functions

 Collision (void)
 
Messageclone (void) const
 
void clear (void)
 
bool fieldsEqual (const Message &msg__) const
 
int validate (void) const
 
uint8_t * serializeFields (uint8_t *bfr__) const
 
uint16_t deserializeFields (const uint8_t *bfr__, uint16_t size__)
 
uint16_t reverseDeserializeFields (const uint8_t *bfr__, uint16_t size__)
 
uint16_t getId (void) const
 
const char * getName (void) const
 
unsigned getFixedSerializationSize (void) const
 
fp64_t getValueFP (void) const
 
void setValueFP (fp64_t val)
 
void fieldsToJSON (std::ostream &os__, unsigned nindent__) const
 
- Public Member Functions inherited from DUNE::IMC::Message
 Message (void)
 
virtual ~Message (void)
 
double setTimeStamp (double ts)
 
double setTimeStamp (void)
 
double getTimeStamp (void) const
 
uint16_t getSource (void) const
 
void setSource (uint16_t src)
 
uint8_t getSourceEntity (void) const
 
void setSourceEntity (uint8_t src_ent)
 
uint16_t getDestination (void) const
 
void setDestination (uint16_t dst)
 
uint8_t getDestinationEntity (void) const
 
void setDestinationEntity (uint8_t dst_ent)
 
virtual uint16_t getSubId (void) const
 
virtual void setSubId (uint16_t subid)
 
unsigned getSerializationSize (void) const
 
unsigned getPayloadSerializationSize (void) const
 
virtual unsigned getVariableSerializationSize (void) const
 
void toJSON (std::ostream &os) const
 
void toText (std::ostream &os) const
 
bool operator== (const Message &other) const
 
bool operator!= (const Message &other) const
 

Static Public Member Functions

static uint16_t getIdStatic (void)
 

Public Attributes

fp32_t value
 
uint8_t type
 

Additional Inherited Members

- Protected Member Functions inherited from DUNE::IMC::Message
virtual void setTimeStampNested (double value)
 
virtual void setSourceNested (uint16_t value)
 
virtual void setSourceEntityNested (uint8_t value)
 
virtual void setDestinationNested (uint16_t value)
 
virtual void setDestinationEntityNested (uint8_t value)
 
- Protected Attributes inherited from DUNE::IMC::Message
Header m_header
 

Member Enumeration Documentation

Type.

Enumerator
CD_X 

X-axis.

CD_Y 

Y-axis.

CD_Z 

Z-axis.

CD_IMPACT 

Impact.

Constructor & Destructor Documentation

DUNE::IMC::Collision::Collision ( void  )

Member Function Documentation

void DUNE::IMC::Collision::clear ( void  )
virtual

Reset message's fields.

Implements DUNE::IMC::Message.

References type, and value.

Referenced by Collision().

Message* DUNE::IMC::Collision::clone ( void  ) const
inlinevirtual

Retrieve a copy of the message.

Returns
message copy.

Implements DUNE::IMC::Message.

References Collision().

uint16_t DUNE::IMC::Collision::deserializeFields ( const uint8_t *  bfr,
uint16_t  len 
)
virtual

Deserialize message fields from a packet.

Parameters
bfrstream of bytes (packet)
lenlength of the byte stream.
Returns
number of bytes processed.

Implements DUNE::IMC::Message.

References DUNE::IMC::deserialize(), type, and value.

bool DUNE::IMC::Collision::fieldsEqual ( const Message other) const
virtual

Compare fields for equality.

Parameters
[in]othermessage to compare.
Returns
true if fields are equal, false otherwise.

Reimplemented from DUNE::IMC::Message.

References type, and value.

void DUNE::IMC::Collision::fieldsToJSON ( std::ostream &  os,
unsigned  indent_level 
) const
virtual

Output the message fields (excluding header) in JSON format.

Parameters
osoutput stream.
indent_levelnumber of indentation spaces.

Reimplemented from DUNE::IMC::Message.

References DUNE::IMC::toJSON(), type, and value.

unsigned DUNE::IMC::Collision::getFixedSerializationSize ( void  ) const
inlinevirtual

Get the fixed amount of bytes required to properly serialize this message (variable length fields are not included).

Returns
amount of variable bytes required to serialize the message.

Reimplemented from DUNE::IMC::Message.

uint16_t DUNE::IMC::Collision::getId ( void  ) const
inlinevirtual

Retrieve message's identification number.

Returns
message's identification number.

Implements DUNE::IMC::Message.

References getIdStatic().

static uint16_t DUNE::IMC::Collision::getIdStatic ( void  )
inlinestatic

Referenced by getId().

const char* DUNE::IMC::Collision::getName ( void  ) const
inlinevirtual

Retrieve message's name.

Returns
message's name.

Implements DUNE::IMC::Message.

fp64_t DUNE::IMC::Collision::getValueFP ( void  ) const
virtual

Get the field 'value' on messages containing a field with such an abbreviation with floating point type.

Returns
value of field 'value', 0.0 otherwise.

Reimplemented from DUNE::IMC::Message.

References value.

uint16_t DUNE::IMC::Collision::reverseDeserializeFields ( const uint8_t *  bfr,
uint16_t  len 
)
virtual

Deserialize message fields from a packet, swapping the byte order.

Parameters
bfrstream of bytes (packet)
lenlength of the byte stream.
Returns
number of bytes processed.

Implements DUNE::IMC::Message.

References DUNE::IMC::deserialize(), DUNE::IMC::reverseDeserialize(), type, and value.

uint8_t * DUNE::IMC::Collision::serializeFields ( uint8_t *  bfr__) const
virtual

Implements DUNE::IMC::Message.

References DUNE::IMC::serialize(), type, and value.

void DUNE::IMC::Collision::setValueFP ( fp64_t  val)
virtual

Set the field 'value' on messages containing a field with such an abbreviation with floating point type.

Parameters
valdesired value.

Reimplemented from DUNE::IMC::Message.

References value.

int DUNE::IMC::Collision::validate ( void  ) const
virtual

Validate the message's contents.

Returns
negative value in case of a valid message or a positive value indicating the position of the invalid message field.

Implements DUNE::IMC::Message.

Member Data Documentation

uint8_t DUNE::IMC::Collision::type
Collaboration diagram for DUNE::IMC::Collision:
Collaboration graph