AGXDynamics  2.31.1.0
agxNet::StructuredMessage Struct Reference

#include <FramePacket.h>

+ Inheritance diagram for agxNet::StructuredMessage:

Public Member Functions

 StructuredMessage ()
 
 StructuredMessage (const agx::String &uri)
 
 StructuredMessage (const agx::String &uri, const agxJson::Value &header, agxData::BinaryData *binarySegment=nullptr)
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
StructuredMessage * createResponse () const
 
agxData::BinaryData * getBinarySegment ()
 
const agxData::BinaryData * getBinarySegment () const
 
agxJson::Value & getHeader ()
 
const agxJson::Value & getHeader () const
 
agx::UInt32 getMessageId () const
 
int getReferenceCount () const
 
agx::UInt32 getResponseId () const
 
const agx::String & getUri () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
 PreHeader ()
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void setBinarySegment (agxData::BinaryData *binarySegment)
 
void setHeader (const agxJson::Value &header)
 
void setResponseId (agx::UInt32 id)
 
void setUri (const agx::String &uri)
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 

Static Public Member Functions

static StructuredMessage * parse (const agx::UInt8 *data, size_t numBytes, bool copyBinaryData=false)
 
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Public Attributes

agx::UInt32 binarySegmentOffset
 
agx::UInt32 binarySegmentSize
 
agx::UInt32 headerSize
 
agx::UInt32 id
 
agx::UInt32 responseId
 
agx::UInt32 uriSize
 

Static Public Attributes

static const agx::UInt32 BINARY_SEGMENT_ALIGNMENT = 32
 
static const agx::UInt32 STREAM_END_OF_FILE = 0
 

Protected Member Functions

virtual ~StructuredMessage ()
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
void setMessageId (agx::UInt32 id) const
 

Static Protected Member Functions

static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

Protected Attributes

Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Definition at line 56 of file FramePacket.h.

Constructor & Destructor Documentation

◆ StructuredMessage() [1/3]

agxNet::StructuredMessage::StructuredMessage ( )

◆ StructuredMessage() [2/3]

agxNet::StructuredMessage::StructuredMessage ( const agx::String &  uri)

◆ StructuredMessage() [3/3]

agxNet::StructuredMessage::StructuredMessage ( const agx::String &  uri,
const agxJson::Value &  header,
agxData::BinaryData *  binarySegment = nullptr 
)

◆ ~StructuredMessage()

virtual agxNet::StructuredMessage::~StructuredMessage ( )
protectedvirtual

Member Function Documentation

◆ allocateObserverVector()

void agx::Referenced::allocateObserverVector ( ) const
protectedinherited

◆ as() [1/2]

template<typename T >
T* agx::Referenced::as ( )
inherited

Subclass casting.

Template type must match actual type, dynamic_cast assertion will fail otherwise.

Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), agx::InternalData::getOrCreate(), and agx::InternalData::hasData().

◆ as() [2/2]

template<typename T >
const T* agx::Referenced::as ( ) const
inherited

◆ asSafe() [1/2]

template<typename T >
T* agx::Referenced::asSafe ( )
inherited

Safe subclass casting, return nullptr if template type does not match.

Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().

◆ asSafe() [2/2]

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited

◆ createResponse()

StructuredMessage* agxNet::StructuredMessage::createResponse ( ) const

◆ deleteUsingDeleteHandler()

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited

◆ getBinarySegment() [1/2]

agxData::BinaryData * agxNet::StructuredMessage::getBinarySegment ( )

Definition at line 192 of file FramePacket.h.

◆ getBinarySegment() [2/2]

const agxData::BinaryData * agxNet::StructuredMessage::getBinarySegment ( ) const

Definition at line 193 of file FramePacket.h.

◆ getDeleteHandler()

static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.

◆ getHeader() [1/2]

agxJson::Value & agxNet::StructuredMessage::getHeader ( )

Definition at line 189 of file FramePacket.h.

◆ getHeader() [2/2]

const agxJson::Value & agxNet::StructuredMessage::getHeader ( ) const

Definition at line 190 of file FramePacket.h.

◆ getMessageId()

agx::UInt32 agxNet::StructuredMessage::getMessageId ( ) const
Returns
The ID of this message. Set by the WebSocket that sent the message.

◆ getReferenceCount()

int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.

◆ getResponseId()

agx::UInt32 agxNet::StructuredMessage::getResponseId ( ) const
Returns
The ID of the message that this message is a response to.

◆ getUri()

const agx::String & agxNet::StructuredMessage::getUri ( ) const

Definition at line 188 of file FramePacket.h.

◆ is()

template<typename T >
bool agx::Referenced::is ( ) const
inherited

◆ parse()

static StructuredMessage* agxNet::StructuredMessage::parse ( const agx::UInt8 *  data,
size_t  numBytes,
bool  copyBinaryData = false 
)
static

◆ PreHeader()

agxNet::StructuredMessage::PreHeader ( )

◆ reference()

void agx::Referenced::reference ( void *  ptr = nullptr) const
inherited

Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.

This method should be used with care, always balanced with the same number of calls to unreference.

◆ setBinarySegment()

void agxNet::StructuredMessage::setBinarySegment ( agxData::BinaryData *  binarySegment)

◆ setDeleteHandler()

static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.

◆ setHeader()

void agxNet::StructuredMessage::setHeader ( const agxJson::Value &  header)

◆ setMessageId()

void agxNet::StructuredMessage::setMessageId ( agx::UInt32  id) const
protected

◆ setResponseId()

void agxNet::StructuredMessage::setResponseId ( agx::UInt32  id)

◆ setUri()

void agxNet::StructuredMessage::setUri ( const agx::String &  uri)

◆ unreference()

void agx::Referenced::unreference ( void *  ptr = nullptr) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.

This method should be used with care, always balanced with the same number of calls to reference.

Referenced by agxData::EntityRef< ContactMaterialPtr >::~EntityRef().

◆ unreference_nodelete()

void agx::Referenced::unreference_nodelete ( ) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.

◆ ValidateCast()

template<typename T >
static bool agx::Referenced::ValidateCast ( const Referenced *  object)
staticinherited

Member Data Documentation

◆ BINARY_SEGMENT_ALIGNMENT

const agx::UInt32 agxNet::StructuredMessage::BINARY_SEGMENT_ALIGNMENT = 32
static

Definition at line 60 of file FramePacket.h.

◆ binarySegmentOffset

agx::UInt32 agxNet::StructuredMessage::binarySegmentOffset

Definition at line 114 of file FramePacket.h.

◆ binarySegmentSize

agx::UInt32 agxNet::StructuredMessage::binarySegmentSize

Definition at line 115 of file FramePacket.h.

◆ headerSize

agx::UInt32 agxNet::StructuredMessage::headerSize

Definition at line 113 of file FramePacket.h.

◆ id

agx::UInt32 agxNet::StructuredMessage::id

Definition at line 110 of file FramePacket.h.

◆ m_mutex

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

◆ m_observers

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

◆ m_refCount

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.

◆ responseId

agx::UInt32 agxNet::StructuredMessage::responseId

Definition at line 111 of file FramePacket.h.

◆ STREAM_END_OF_FILE

const agx::UInt32 agxNet::StructuredMessage::STREAM_END_OF_FILE = 0
static

Definition at line 117 of file FramePacket.h.

◆ uriSize

agx::UInt32 agxNet::StructuredMessage::uriSize

Definition at line 112 of file FramePacket.h.


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