helics
3.5.2
|
#include <ActionMessage.hpp>
Public Member Functions | |
ActionMessage () noexcept | |
ActionMessage (action_message_def::action_t startingAction) | |
ActionMessage (action_message_def::action_t startingAction, GlobalFederateId sourceId, GlobalFederateId destId) | |
ActionMessage (ActionMessage &&act) noexcept | |
ActionMessage (std::unique_ptr< Message > message) | |
ActionMessage (const std::string &bytes) | |
ActionMessage (const std::vector< char > &bytes) | |
ActionMessage (const void *data, size_t size) | |
~ActionMessage () | |
ActionMessage (const ActionMessage &act) | |
ActionMessage & | operator= (const ActionMessage &act) |
ActionMessage & | operator= (ActionMessage &&act) noexcept |
ActionMessage & | operator= (std::unique_ptr< Message > message) noexcept |
action_message_def::action_t | action () const noexcept |
void | setAction (action_message_def::action_t newAction) |
void | setSource (GlobalHandle hand) |
void | setDestination (GlobalHandle hand) |
const std::vector< std::string > & | getStringData () const |
void | name (std::string_view name) |
std::string_view | name () const |
void | clearStringData () |
void | setStringData (std::string_view string1) |
void | setStringData (std::string_view string1, std::string_view string2) |
void | setStringData (std::string_view string1, std::string_view string2, std::string_view string3) |
void | setStringData (std::string_view string1, std::string_view string2, std::string_view string3, std::string_view string4) |
const std::string & | getString (int index) const |
void | setString (int index, std::string_view str) |
GlobalHandle | getSource () const |
GlobalHandle | getDest () const |
void | swapSourceDest () noexcept |
void | setExtraData (int32_t data) |
int32_t | getExtraData () const |
void | setExtraDestData (int32_t data) |
int32_t | getExtraDestData () const |
int | serializedByteCount () const |
int | toByteArray (std::byte *data, std::size_t buffer_size) const |
void | to_string (std::string &data) const |
std::string | to_string () const |
std::string | to_json_string () const |
std::string | packetize () const |
void | packetize (std::string &data) const |
std::string | packetize_json () const |
void | to_vector (std::vector< char > &data) const |
std::vector< char > | to_vector () const |
std::size_t | fromByteArray (const std::byte *data, std::size_t buffer_size) |
std::size_t | depacketize (const void *data, std::size_t buffer_size) |
std::size_t | from_string (std::string_view data) |
bool | from_json_string (std::string_view data) |
std::size_t | from_vector (const std::vector< char > &data) |
Public Attributes | |
int32_t | messageID {0} |
8 – multiMessage ID for a variety of purposes | |
GlobalFederateId | source_id {parent_broker_id} |
12 – for federate_id or route_id | |
InterfaceHandle | source_handle {} |
16 – for local handle or local code | |
GlobalFederateId | dest_id {parent_broker_id} |
20 fed_id for a targeted multiMessage | |
InterfaceHandle | dest_handle {} |
24 local handle for a targeted multiMessage | |
uint16_t | counter {0} |
26 counter for filter tracking or multiMessage counter | |
uint16_t | flags {0} |
28 set of messageFlags | |
uint32_t | sequenceID {0} |
32 a sequence number for ordering | |
Time | actionTime {timeZero} |
40 the time an action took place or will take place //32 | |
Time | Te {timeZero} |
48 event time | |
Time | Tdemin {timeZero} |
56 min dependent event time | |
Time | Tso {timeZero} |
64 the second order dependent time | |
SmallBuffer | payload |
buffer to contain the data payload | |
Friends | |
std::unique_ptr< Message > | createMessageFromCommand (const ActionMessage &cmd) |
std::unique_ptr< Message > | createMessageFromCommand (ActionMessage &&cmd) |
class defining the primary multiMessage object used in HELICS
|
inlinenoexcept |
default constructor
helics::ActionMessage::ActionMessage | ( | action_message_def::action_t | startingAction | ) |
construct from an action type
this is intended to be an implicit constructor
startingAction | from an action message definition |
helics::ActionMessage::ActionMessage | ( | action_message_def::action_t | startingAction, |
GlobalFederateId | sourceId, | ||
GlobalFederateId | destId | ||
) |
construct from action, source and destination id's
|
noexcept |
move constructor
|
explicit |
build an action message from a message
|
explicit |
construct from a string
References from_string().
|
explicit |
construct from a data vector
References from_vector().
helics::ActionMessage::ActionMessage | ( | const void * | data, |
size_t | size | ||
) |
construct from a data pointer and size
References from_string().
|
default |
destructor
helics::ActionMessage::ActionMessage | ( | const ActionMessage & | act | ) |
copy constructor
|
inlinenoexcept |
get the action of the multiMessage
Referenced by helics::FederateState::addAction(), helics::appendMessage(), helics::apps::TypedBrokerServer::generateMessageResponse(), helics::prettyPrintString(), helics::TimeCoordinator::processConfigUpdateMessage(), helics::BaseTimeCoordinator::processDependencyUpdateMessage(), helics::FilterFederate::processDestFilterReturn(), helics::FilterFederate::processFilterReturn(), helics::FilterFederate::processMessageFilter(), helics::FederateState::processPostTerminationAction(), helics::BaseTimeCoordinator::processTimeMessage(), helics::TimeCoordinator::processTimeMessage(), helics::FederateState::routeMessage(), helics::FederateState::sendCommand(), helics::FederateState::setInterfaceProperty(), and helics::FederateState::setProperties().
std::size_t helics::ActionMessage::depacketize | ( | const void * | data, |
std::size_t | buffer_size | ||
) |
load a command from a packetized stream /ref packetize
References from_json_string(), and fromByteArray().
Referenced by fromByteArray().
bool helics::ActionMessage::from_json_string | ( | std::string_view | data | ) |
read a command from a json string
References actionTime, counter, dest_handle, dest_id, flags, messageID, payload, sequenceID, source_handle, source_id, Tdemin, Te, and Tso.
Referenced by depacketize(), from_string(), and from_vector().
std::size_t helics::ActionMessage::from_string | ( | std::string_view | data | ) |
read a command from a string
References from_json_string(), and fromByteArray().
Referenced by ActionMessage().
std::size_t helics::ActionMessage::from_vector | ( | const std::vector< char > & | data | ) |
read a command from a char vector
References from_json_string(), and fromByteArray().
Referenced by ActionMessage().
std::size_t helics::ActionMessage::fromByteArray | ( | const std::byte * | data, |
std::size_t | buffer_size | ||
) |
generate a command from a raw data stream
References actionTime, helics::SmallBuffer::assign(), counter, depacketize(), dest_handle, dest_id, flags, helics::GlobalFederateId::getBaseTypePointer(), helics::InterfaceHandle::getBaseTypePointer(), messageID, payload, sequenceID, source_handle, source_id, Tdemin, Te, helics::timeZero, and Tso.
Referenced by depacketize(), from_string(), and from_vector().
|
inline |
get the global destination handle
References dest_handle, and dest_id.
Referenced by helics::FilterFederate::processMessageFilter().
|
inline |
get the extra piece of integer data
References helics::InterfaceHandle::baseValue(), and dest_handle.
Referenced by helics::FederateState::setProperties().
|
inline |
get the extra piece of integer data used in the destination
References helics::InterfaceHandle::baseValue(), and source_handle.
Referenced by helics::FederateState::setInterfaceProperty().
|
inline |
get the source GlobalHandle
References source_handle, and source_id.
Referenced by helics::FilterFederate::processMessageFilter().
|
inline |
get the reference to the string data vector
|
inline |
get the string name associated with an action Message
References payload, and helics::SmallBuffer::to_string().
|
inline |
set the string name associated with a actionMessage
References name(), and payload.
Referenced by helics::CoreBroker::addAlias(), helics::CommonCore::addDependency(), helics::CommonCore::addDestinationFilterToEndpoint(), helics::CoreBroker::addDestinationFilterToEndpoint(), helics::CommonCore::addSourceFilterToEndpoint(), helics::CoreBroker::addSourceFilterToEndpoint(), helics::CommonCore::connect(), helics::CoreBroker::dataLink(), helics::CommonCore::dataLink(), helics::NetworkCommsInterface::generateReplyToIncomingMessage(), helics::CommonCore::linkEndpoints(), helics::CoreBroker::linkEndpoints(), name(), helics::prettyPrintString(), helics::CommonCore::registerCloningFilter(), helics::CommonCore::registerDataSink(), helics::CommonCore::registerEndpoint(), helics::CommonCore::registerFederate(), helics::CommonCore::registerFilter(), helics::CommonCore::registerPublication(), helics::CommonCore::registerTargetedEndpoint(), helics::CommonCore::registerTranslator(), and helics::CommonCore::removeTarget().
|
noexcept |
move assignment
ActionMessage & helics::ActionMessage::operator= | ( | const ActionMessage & | act | ) |
copy operator
References actionTime, counter, dest_handle, dest_id, flags, messageID, payload, sequenceID, source_handle, source_id, Tdemin, Te, and Tso.
|
noexcept |
move assignment from message data into the actionMessage
take ownership of the message and move the contents out then destroy the message shell
message | the message to move. |
std::string helics::ActionMessage::packetize | ( | ) | const |
packetize the multiMessage with a simple header and tail sequence
std::string helics::ActionMessage::packetize_json | ( | ) | const |
packetize the multiMessage with a simple header and tail sequence using json serialization
References to_json_string().
int helics::ActionMessage::serializedByteCount | ( | ) | const |
generate a size of the multiMessage in bytes if it were to be serialized
References payload, and helics::SmallBuffer::size().
Referenced by to_string(), and to_vector().
void helics::ActionMessage::setAction | ( | action_message_def::action_t | newAction | ) |
set the action
Referenced by helics::CommonCore::addDestinationTarget(), helics::CommonCore::addSourceTarget(), helics::FilterFederate::destinationProcessMessage(), helics::BaseTimeCoordinator::generateTimeRequest(), helics::FilterFederate::processDestFilterReturn(), helics::FilterFederate::processFilterReturn(), helics::FilterFederate::processMessageFilter(), and helics::CommonCore::removeTarget().
|
inline |
set the destination from a global handle
References dest_handle, dest_id, helics::GlobalHandle::fed_id, and helics::GlobalHandle::handle.
Referenced by helics::FederateState::closeInterface(), helics::FilterFederate::processMessageFilter(), helics::CommonCore::setInterfaceTag(), and helics::CommonCore::setValue().
|
inline |
set some extra piece of data if the full destination is not used
References dest_handle.
Referenced by helics::CommsInterface::addRoute(), helics::TimeCoordinator::enteringExecMode(), helics::FederateState::finalize(), helics::NetworkCommsInterface::generateReplyToIncomingMessage(), helics::BaseTimeCoordinator::generateTimeRequest(), helics::CommsInterface::removeRoute(), helics::BaseTimeCoordinator::sendTimingInfo(), helics::TimeCoordinator::sendUpdatedExecRequest(), and helics::CommonCore::setIntegerProperty().
|
inline |
set some extra piece of data if the full source is not used
References source_handle.
Referenced by helics::BaseTimeCoordinator::generateTimeRequest(), helics::TimeCoordinator::sendUpdatedExecRequest(), helics::CommonCore::setHandleOption(), and helics::GlobalTimeCoordinator::updateTimeFactors().
|
inline |
set the source from a global handle
References helics::GlobalHandle::fed_id, helics::GlobalHandle::handle, source_handle, and source_id.
Referenced by helics::CommonCore::addDestinationTarget(), helics::CommonCore::addSourceTarget(), helics::CommonCore::closeHandle(), helics::FederateState::closeInterface(), helics::FilterFederate::processFilterReturn(), helics::FilterFederate::processMessageFilter(), helics::CommonCore::removeTarget(), and helics::CommonCore::setInterfaceTag().
|
inlinenoexcept |
swap the source and destination
References dest_handle, dest_id, source_handle, and source_id.
std::string helics::ActionMessage::to_json_string | ( | ) | const |
convert to a json string
References actionTime, helics::GlobalFederateId::baseValue(), helics::InterfaceHandle::baseValue(), counter, dest_handle, dest_id, flags, messageID, payload, sequenceID, source_handle, source_id, Tdemin, Te, helics::SmallBuffer::to_string(), and Tso.
Referenced by packetize_json(), and to_string().
std::string helics::ActionMessage::to_string | ( | ) | const |
convert to a byte string
References helics::checkActionFlag(), serializedByteCount(), to_json_string(), toByteArray(), and helics::use_json_serialization_flag.
void helics::ActionMessage::to_string | ( | std::string & | data | ) | const |
convert to a string using a reference
References serializedByteCount(), and toByteArray().
Referenced by helics::appendMessage(), and helics::zeromq::ZmqRequestSets::transmit().
std::vector< char > helics::ActionMessage::to_vector | ( | ) | const |
convert a command to a byte vector
References serializedByteCount(), and toByteArray().
void helics::ActionMessage::to_vector | ( | std::vector< char > & | data | ) | const |
convert to a byte vector using a reference
References serializedByteCount(), and toByteArray().
int helics::ActionMessage::toByteArray | ( | std::byte * | data, |
std::size_t | buffer_size | ||
) | const |
convert a command to a raw data bytes
[out] | data | pointer to memory to store the command |
buffer_size | the size of the buffer |
References actionTime, helics::GlobalFederateId::baseValue(), helics::InterfaceHandle::baseValue(), counter, helics::SmallBuffer::data(), dest_handle, dest_id, flags, messageID, payload, sequenceID, helics::SmallBuffer::size(), source_handle, source_id, Tdemin, Te, and Tso.
Referenced by to_string(), and to_vector().
|
friend |
create a new multiMessage object that moves all the information from the ActionMessage into newly allocated memory for the multiMessage
|
friend |
create a new multiMessage object that copies all the information from the ActionMessage into newly allocated memory for the multiMessage