messaging

template<typename messageType>
class ReadFunctor
#include <messaging.h>

Read functors have read-only access to messages

Public Functions

inline ReadFunctor()

constructor

inline ReadFunctor(messageType *payloadPtr, MsgHeader *headerPtr)

constructor

inline const messageType &operator()()

constructor

inline bool isLinked()

check if this msg has been connected to

inline bool isWritten()

check if the message has been ever written to

inline uint64_t timeWritten()

return the time at which the message was written

inline int64_t moduleID()

return the moduleID of who wrote wrote the message

inline void subscribeToC(void *source)

subscribe to a C message

inline void subscribeTo(Message<messageType> *source)

Subscribe to a C++ message.

inline uint8_t isSubscribedToC(void *source)

Check if self has been subscribed to a C message.

inline uint8_t isSubscribedTo(Message<messageType> *source)

Check if self has been subscribed to a Cpp message.

inline Recorder<messageType> recorder(uint64_t timeDiff = 0)

Recorder method description.

Public Members

BSKLogger bskLogger

< &#8212; BSK Logging

&#8212; bsk logging instance

messageType zeroMsgPayload = {}

&#8212; zero’d copy of the message payload type

Private Members

messageType *payloadPointer

&#8212; pointer to the incoming msg data

MsgHeader *headerPointer

&#8212; pointer to the incoming msg header

bool initialized

&#8212; flag indicating if the input message is connect to another message

template<typename messageType>
class WriteFunctor
#include <messaging.h>

Write Functor

Public Functions

inline WriteFunctor()

write functor constructor

inline WriteFunctor(messageType *payloadPointer, MsgHeader *headerPointer)

write functor constructor

inline void operator()(messageType *payload, int64_t moduleID, uint64_t callTime)

write functor constructor

Private Members

messageType *payloadPointer

pointer to the message payload

MsgHeader *headerPointer

pointer to the message header

template<typename messageType>
class Message
#include <messaging.h>

forward-declare sim message for use by read functor

base class template for bsk messages

Public Functions

ReadFunctor<messageType> addSubscriber()

&#8212; request read rights. returns reference to class read variable

WriteFunctor<messageType> addAuthor()

&#8212; request write rights.

messageType *subscribeRaw(MsgHeader **msgPtr)

for plain ole c modules

messageType *getMsgPointers(MsgHeader **msgPtr)

for plain ole c modules

inline Recorder<messageType> recorder(uint64_t timeDiff = 0)

Recorder object.

inline bool isLinked()

check if this msg has been connected to

inline uint64_t getPayloadSize()

Return the memory size of the payload, be careful about dynamically sized things.

Public Members

WriteFunctor<messageType> write = WriteFunctor<messageType>(&payload, &header)

write functor to this message

messageType zeroMsgPayload = {}

zero’d copy of the message payload structure

Private Members

messageType payload = {}

struct defining message payload, zero’d on creation

MsgHeader header = {}

struct defining the message header, zero’d on creation

ReadFunctor<messageType> read = ReadFunctor<messageType>(&payload, &header)

read functor instance

template<typename messageType>
class Recorder : public SysModel
#include <messaging.h>

Keep a time history of messages accessible to users from python

Public Functions

inline Recorder()
inline Recorder(Message<messageType> *message, uint64_t timeDiff = 0)

&#8212; Use this to record cpp messages

inline Recorder(void *message, uint64_t timeDiff = 0)

&#8212; Use this to record C messages

inline Recorder(ReadFunctor<messageType> *messageReader, uint64_t timeDiff = 0)

&#8212; Use this to keep track of what someone is reading

inline ~Recorder()
inline void SelfInit()

&#8212; self initialization

inline void IntegratedInit()

&#8212; cross initialization

inline void UpdateState(uint64_t CurrentSimNanos)

&#8212; Read and record the message

inline void Reset(uint64_t CurrentSimNanos)

Reset method.

inline std::vector<uint64_t> &times()

time recorded method

inline std::vector<uint64_t> &timesWritten()

time written method

inline std::vector<messageType> &record()

record method

inline std::string findMsgName(std::string msgName)

determine message name

inline void clear()

clear the recorded messages, i.e. purge the history

inline void updateTimeInterval(uint64_t timeDiff)

method to update the minimum time interval before recording the next message

Public Members

BSKLogger bskLogger

&#8212; BSK Logging

Private Members

std::vector<messageType> msgRecord

vector of recorded messages

std::vector<uint64_t> msgRecordTimes

vector of times at which messages are recorded

std::vector<uint64_t> msgWrittenTimes

vector of times at which messages are written

uint64_t nextUpdateTime = 0

[ns] earliest time at which the msg is recorded again

uint64_t timeInterval

[ns] recording time intervale

ReadFunctor<messageType> readMessage

method description