iox::runtime::IpcMessage🔗
#include <ipc_message.hpp>
Public Functions🔗
Name | |
---|---|
IpcMessage() =default Creates an empty and valid IPC channel message. |
|
IpcMessage(const std::initializer_list< std::string > & msg) Creates a separator separated string. If one element contains a separator symbol the IpcMessage becomes invalid and returns false on isValid(). |
|
IpcMessage(const std::string & msg) Takes a separator separated string and interprets it as a IpcMessage. In this case the IpcMessage can only become invalid if it is not empty and does not end with the separator. |
|
template \<typename T > IpcMessage & |
operator<<(const T & entry) Adds a new entry to the IpcMessage, if the entry is invalid no entry is added and the IpcMessage becomes invalid. |
uint32_t | getNumberOfElements() const Returns the number of entries stored in IpcMessage. If the message is invalid the return value is undefined. |
std::string | getElementAtIndex(const uint32_t index) const Returns the entry at position f_index. If f_index is larger then the sum of the entries stored in IpcMessage it returns std::string() |
bool | isValidEntry(const std::string & entry) const returns if an entry is valid. Non valid entries are containing at least one separator |
bool | isValid() const check if the message is valid |
std::string | getMessage() const The message is casted to the actual separator separated string If the message is invalid the return value is undefined. |
void | setMessage(const std::string & msg) Takes a separator separated string and interprets it as a IpcMessage. In this case the IpcMessage can only become invalid if it is not empty and does not end with the separator. All the entries that were stored previously in the IpcMessage will be cleared after a call to setMessage. |
void | clearMessage() Clears the message. After a call to clearMessage() the. |
template \<typename T > void |
addEntry(const T & entry) Adds a new entry to the IpcMessage, if the entry is invalid no entry is added and the IpcMessage becomes invalid. |
bool | operator==(const IpcMessage & rhs) const Compares two IpcMessages to be equal. |
Detailed Description🔗
class iox::runtime::IpcMessage;
The symbol , is per default the separator.
A valid entry is an arbitrary string which does not contain the separator symbol, otherwise, if it contains the separator symbol it is defined as a invalid entry. A valid entry can contain none or more characters.
A message is a concatination of valid entries separated by the separator. A message is defined as valid if all entries contained in that message are valid and it ends with the separator or it is empty, otherwise it is defined as invalid.
Public Functions Documentation🔗
function IpcMessage🔗
IpcMessage() =default
Creates an empty and valid IPC channel message.
function IpcMessage🔗
IpcMessage(
const std::initializer_list< std::string > & msg
)
Creates a separator separated string. If one element contains a separator symbol the IpcMessage becomes invalid and returns false on isValid().
Parameters:
- msg array of strings to combine in a message
function IpcMessage🔗
IpcMessage(
const std::string & msg
)
Takes a separator separated string and interprets it as a IpcMessage. In this case the IpcMessage can only become invalid if it is not empty and does not end with the separator.
Parameters:
- separator separated string for a message
function operator<<🔗
template <typename T >
IpcMessage & operator<<(
const T & entry
)
Adds a new entry to the IpcMessage, if the entry is invalid no entry is added and the IpcMessage becomes invalid.
Parameters:
- entry Datatype which is convertable to string via std::to_string
function getNumberOfElements🔗
uint32_t getNumberOfElements() const
Returns the number of entries stored in IpcMessage. If the message is invalid the return value is undefined.
Return: number of entries in messaage
function getElementAtIndex🔗
std::string getElementAtIndex(
const uint32_t index
) const
Returns the entry at position f_index. If f_index is larger then the sum of the entries stored in IpcMessage it returns std::string()
Parameters:
- index desired entry position
Return: If the element exists it returns the element at f_index otherwise an empty string
function isValidEntry🔗
bool isValidEntry(
const std::string & entry
) const
returns if an entry is valid. Non valid entries are containing at least one separator
Parameters:
- entry sstring to check
Return: true = if it is a valid entry otherwise false
function isValid🔗
bool isValid() const
check if the message is valid
Return: If one element in the CTor initializer_list was invalid it returns false, otherwise true.
function getMessage🔗
std::string getMessage() const
The message is casted to the actual separator separated string If the message is invalid the return value is undefined.
Return: the current message as separator separated string
function setMessage🔗
void setMessage(
const std::string & msg
)
Takes a separator separated string and interprets it as a IpcMessage. In this case the IpcMessage can only become invalid if it is not empty and does not end with the separator. All the entries that were stored previously in the IpcMessage will be cleared after a call to setMessage.
Parameters:
- separator separated string for the message
function clearMessage🔗
void clearMessage()
Clears the message. After a call to clearMessage() the.
function addEntry🔗
template <typename T >
void addEntry(
const T & entry
)
Adds a new entry to the IpcMessage, if the entry is invalid no entry is added and the IpcMessage becomes invalid.
Parameters:
- entry to add to the message
Template Parameters:
- Datatype which is convertable to string via std::stringstream
function operator==🔗
bool operator==(
const IpcMessage & rhs
) const
Compares two IpcMessages to be equal.
Parameters:
- rhs IpcMessage to compare with
Updated on 31 May 2022 at 15:29:16 CEST