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 subscribeToAddr(uint64_t sourceAddr)
Subscribe to the message located at the sourceAddr in memory.
-
inline void subscribeToCAddr(uint64_t sourceAddr)
Subscribe to the C message located at the sourceAddr in memory.
-
inline void subscribeTo(Message<messageType> *source)
Subscribe to a C++ message.
-
inline void unsubscribe()
Unsubscribe to the connected message, noop if no message was connected.
-
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 uint8_t isSubscribedToAddr(uint64_t sourceAddr)
Check if self has been subscribed to the message at sourceAddr.
-
inline uint8_t isSubscribedToCAddr(uint64_t sourceAddr)
Check if self has been subscribed to the message at sourceAddr.
-
inline Recorder<messageType> recorder(uint64_t timeDiff = 0)
Recorder method description.
-
inline uintptr_t getPayloadPtrAddress() const
Return the address of the internal payloadPointer member.
-
inline uintptr_t getLinkedAddress() const
Return the address of the internal initialized flag.
Public Members
-
BSKLogger bskLogger
< — BSK Logging
— bsk logging instance
-
messageType zeroMsgPayload = {}
— zero’d copy of the message payload type
Private Members
-
messageType *payloadPointer
— pointer to the incoming msg data
-
bool initialized
— flag indicating if the input message is connect to another message
-
inline ReadFunctor()
-
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
-
inline WriteFunctor()
-
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()
— request read rights. returns reference to class
readvariable
-
WriteFunctor<messageType> addAuthor()
— 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.
-
inline uintptr_t getPayloadAddress()
Return the raw address of the message payload struct.
-
inline uintptr_t getHeaderAddress()
Return the raw address of the message header struct.
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
-
ReadFunctor<messageType> read = ReadFunctor<messageType>(&payload, &header)
read functor instance
-
ReadFunctor<messageType> addSubscriber()
-
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)
— Use this to record cpp messages
-
inline Recorder(void *message, uint64_t timeDiff = 0)
— Use this to record C messages
-
inline Recorder(ReadFunctor<messageType> *messageReader, uint64_t timeDiff = 0)
— Use this to keep track of what someone is reading
-
inline Recorder(const Recorder &obj)
— Copy recorder state while keeping a unique SysModel module ID
-
inline Recorder &operator=(const Recorder &obj)
— Copy recorder state while preserving this recorder’s module ID
-
inline ~Recorder()
-
inline void SelfInit()
— self initialization
-
inline void IntegratedInit()
— cross initialization
-
inline void UpdateState(uint64_t CurrentSimNanos)
— Read and record the message
-
inline void Reset(uint64_t CurrentSimNanos)
Reset method.
-
inline std::vector<unsigned long long> times()
recorded times, copied out as a std::vector so the Python interface is unchanged. The element type is “unsigned long long” (not uint64_t) to match the SWIG TimeVector template exactly; on LP64 platforms uint64_t is “unsigned long”, a distinct type that would fail to copy-construct.
-
inline std::vector<unsigned long long> timesWritten()
message-written times, copied out as a std::vector (see times() for the element-type rationale)
-
inline std::deque<messageType> &record()
internal accessor: the recorded-payload deque by reference, used by the SWIG recorder typemaps
-
inline std::vector<messageType> recordList()
recorded payloads copied out as a std::vector, exposed to Python so the result is randomly indexable
-
inline size_t size()
size of the record so far
-
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
-
inline void recordOnChange(bool enabled = true)
method to record messages only when the payload content changes
Public Members
-
BSKLogger bskLogger
— BSK Logging
Private Functions
-
inline void logInvalidMessageWarning()
log warning if message is invalid but don’t change behavior
-
inline void recordMessage(uint64_t CurrentSimNanos, const messageType &messageData)
record the supplied message payload
-
inline void scheduleNextUpdate(uint64_t CurrentSimNanos)
schedule the next eligible recorder update
-
inline bool messagePayloadChanged(const messageType &messageData)
check if the payload differs from the last recorded payload
Private Members
-
std::deque<messageType> msgRecord
deque of recorded messages (deque avoids the geometric reallocation spikes a vector incurs as the history grows; see issue #788)
-
std::deque<uint64_t> msgRecordTimes
deque of times at which messages are recorded
-
std::deque<uint64_t> msgWrittenTimes
deque of times at which messages are written
-
uint64_t nextUpdateTime = 0
[ns] earliest time at which the msg is recorded again
-
uint64_t timeInterval = 0
[ns] recording time interval
-
uint64_t lastUpdateTime = 0
[ns] last time the msg was checked for recording
-
bool hasLastUpdateTime = false
flag indicating whether the msg was checked
-
bool recordOnlyOnChange = false
flag to record only changed message payloads
-
ReadFunctor<messageType> readMessage
method description
-
inline Recorder()