23 (CompressionNone)(CompressionLz4)(CompressionZstd)(CompressionSnappy))
69 (CREATEMODULECOMPOUND)
99 static bool isHub(
int id);
100 static bool isModule(
int id);
101 static std::string toString(Reserved
id);
102 static std::string toString(
int id);
108 static void init(
int id,
int rank);
126 void setRank(
int rank);
128 template<
class M,
class... P>
131 M m(std::forward<P>(p)...);
138 int m_id = Id::Invalid;
161 static const size_t MESSAGE_SIZE = 1024;
163 Message(
const Type type,
const unsigned int size);
167 unsigned long typeFlags()
const;
170 void setUuid(
const uuid_t &uuid);
172 const uuid_t &uuid()
const;
174 void setReferrer(
const uuid_t &ref);
176 const uuid_t &referrer()
const;
180 int senderId()
const;
182 void setSenderId(
int id);
186 void setRank(
int rank);
192 bool isForBroadcast()
const;
194 void setForBroadcast(
bool enable =
true);
196 bool wasBroadcast()
const;
198 void setWasBroadcast(
bool enable =
true);
200 bool isNotification()
const;
202 void setNotify(
bool enable);
207 void setDestId(
int id);
210 int destRank()
const;
212 void setDestRank(
int r);
214 int destUiId()
const;
216 void setDestUiId(
int id);
218 size_t payloadSize()
const;
220 void setPayloadSize(
size_t size);
222 std::string payloadName()
const;
226 CompressionMode payloadCompression()
const;
228 void setPayloadCompression(CompressionMode mode);
230 size_t payloadRawSize()
const;
232 void setPayloadRawSize(
size_t size);
234 template<
class SomeMessage>
237 SomeMessage *m =
static_cast<SomeMessage *
>(
this);
238 assert(m->type() == SomeMessage::s_type);
241 template<
class SomeMessage>
242 SomeMessage
const &
as()
const
244 const SomeMessage *m =
static_cast<const SomeMessage *
>(
this);
245 assert(m->type() == SomeMessage::s_type);
284static_assert(
sizeof(Message) %
sizeof(
double) == 0,
"not padded to ensure double alignment");
291 memset(payload.data(), 0, payload.size());
292 memcpy(payload.data(), (
char *)&message +
sizeof(
Message), message.
size() -
sizeof(
Message));
296 *
static_cast<Message *
>(
this) = rhs;
297 memcpy(payload.data(), rhs.payload.data(), payload.size());
301 template<
class SomeMessage>
304 SomeMessage *m =
static_cast<SomeMessage *
>(
static_cast<Message *
>(
this));
305 assert(m->type() == SomeMessage::s_type);
308 template<
class SomeMessage>
309 SomeMessage
const &
as()
const
311 const SomeMessage *m =
static_cast<const SomeMessage *
>(
static_cast<const Message *
>(
this));
312 assert(m->type() == SomeMessage::s_type);
318 char *
data() {
return static_cast<char *
>(
static_cast<void *
>(
this)); }
319 const char *
data()
const {
return static_cast<const char *
>(
static_cast<const void *
>(
this)); }
326template<
class MessageClass, Type MessageType>
353 codec_error(
const std::string &what =
"unsupported codec");
Definition: exception.h:13
Definition: message.h:286
size_t size() const
Definition: message.h:317
char * data()
Definition: message.h:318
const Buffer & operator=(const Buffer &rhs)
Definition: message.h:294
Buffer(const Message &message)
Definition: message.h:289
Buffer()
Definition: message.h:288
SomeMessage & as()
Definition: message.h:302
SomeMessage const & as() const
Definition: message.h:309
const char * data() const
Definition: message.h:319
size_t bufferSize() const
Definition: message.h:316
Definition: message.h:105
Definition: message.h:327
MessageBase()
Definition: message.h:332
static const Type s_type
Definition: message.h:329
Definition: message.h:119
M message(P &&...p) const
Definition: message.h:129
Definition: message.h:157
static const size_t MESSAGE_SIZE
Definition: message.h:161
uint64_t m_payloadRawSize
raw (uncompressed) payload size
Definition: message.h:271
bool m_forBroadcast
broadcast to all ranks?
Definition: message.h:277
uint64_t m_payloadSize
payload size
Definition: message.h:269
int m_payloadCompression
payload compression method
Definition: message.h:273
SomeMessage & as()
Definition: message.h:235
shm_name_t m_payloadName
name of payload in shared memory
Definition: message.h:275
bool m_notification
message is not a request for action
Definition: message.h:279
SomeMessage const & as() const
Definition: message.h:242
size_t size() const
message size
Definition: message.cpp:251
Definition: message.h:351
#define V_COREEXPORT
Definition: export.h:9
#define V_ENUM_OUTPUT_OP(name, scope)
Definition: enum.h:72
Definition: message.cpp:29
std::array< char, 350 > description_t
Definition: message.h:150
std::array< char, 500 > path_t
Definition: message.h:152
const int ModuleNameLength
Definition: message.h:142
INVALID(ANY)(IDENTIFY)(CLOSECONNECTION)(ADDHUB)(REMOVEHUB)(SETID)(TRACE)(SPAWN)(SPAWNPREPARED)(KILL)(DEBUG)(QUIT)(STARTED)(MODULEEXIT)(BUSY)(IDLE)(EXECUTIONPROGRESS)(EXECUTE)(CANCELEXECUTE)(ADDOBJECT)(ADDOBJECTCOMPLETED)(DATATRANSFERSTATE)(ADDPORT)(REMOVEPORT)(CONNECT)(DISCONNECT)(ADDPARAMETER)(REMOVEPARAMETER)(SETPARAMETER)(SETPARAMETERCHOICES)(PING)(PONG)(BARRIER)(BARRIERREACHED)(SENDTEXT)(UPDATESTATUS)(OBJECTRECEIVEPOLICY)(SCHEDULINGPOLICY)(REDUCEPOLICY)(MODULEAVAILABLE)(CREATEMODULECOMPOUND)(LOCKUI)(REPLAYFINISHED)(REQUESTTUNNEL)(REQUESTOBJECT)(SENDOBJECT)(REMOTERENDERING)(FILEQUERY)(FILEQUERYRESULT)(COVER)(INSITU)(NumMessageTypes)) struct V_COREEXPORT Id
Definition: message.h:29
std::array< char, 200 > address_t
Definition: message.h:151
@ Broadcast
Definition: messagerouter.h:36
V_COREEXPORT std::ostream & operator<<(std::ostream &s, const Message &msg)
Definition: messages.cpp:1718
buffer compressPayload(CompressionMode &mode, const buffer &raw, int speed)
Definition: message.cpp:326
boost::uuids::uuid uuid_t
Definition: message.h:154
std::array< char, 32 > param_name_t
Definition: message.h:146
std::array< char, 256 > param_value_t
Definition: message.h:147
std::array< char, ModuleNameLength > module_name_t
Definition: message.h:144
std::array< char, 300 > shmsegname_t
Definition: message.h:149
std::array< char, 32 > port_name_t
Definition: message.h:145
DEFINE_ENUM_WITH_STRING_CONVERSIONS(CompressionMode,(CompressionNone)(CompressionLz4)(CompressionZstd)(CompressionSnappy)) DEFINE_ENUM_WITH_STRING_CONVERSIONS(Type
std::array< char, 50 > param_choice_t
Definition: message.h:148
buffer decompressPayload(CompressionMode mode, size_t size, size_t rawsize, buffer &compressed)
Definition: message.cpp:409
Definition: allobjects.cpp:30
std::vector< char, allocator< char > > buffer
Definition: buffer.h:9