Fawkes API
Fawkes Development Version
|
24 #ifndef _INTERFACE_MESSAGE_H_
25 #define _INTERFACE_MESSAGE_H_
27 #include <core/exceptions/software.h>
28 #include <core/utils/refcount.h>
29 #include <interface/field_iterator.h>
30 #include <interface/types.h>
32 #define INTERFACE_MESSAGE_TYPE_SIZE_ 64
38 class InterfaceFieldIterator;
53 unsigned int id()
const;
54 void set_id(
unsigned int message_id);
62 const char *
type()
const;
72 unsigned int hops()
const;
84 template <
class MessageType>
92 template <
class MessageType>
96 unsigned int message_id_;
99 Time * time_enqueued_;
101 unsigned int recipient_interface_mem_serial;
102 unsigned int sender_interface_instance_serial;
105 char * _sender_thread_name;
106 unsigned int _sender_id;
112 unsigned int num_fields_;
122 const char * enumtype = 0,
138 template <
class MessageType>
142 return (
dynamic_cast<MessageType *
>(
this) != 0);
145 template <
class MessageType>
149 MessageType *m =
dynamic_cast<MessageType *
>(
this);
bool enqueued() const
Check is message has been enqueued.
const void * datachunk() const
Get pointer to data.
interface_fieldtype_t
Interface field type.
InterfaceFieldIterator fields_end()
Invalid iterator.
void set_id(unsigned int message_id)
Set message ID.
void mark_enqueued()
Mark message as being enqueued.
message_data_ts_t * data_ts
data timestamp aliasing pointer
const char * sender_thread_name() const
Get sender of message.
const Time * time_enqueued() const
Get time when message was enqueued.
Message(const char *type)
Constructor.
Interface * interface() const
Get transmitting interface.
unsigned int sender_id() const
Get ID of sender.
Timestamp data, must be present and first entries for each interface data structs!...
InterfaceFieldIterator fields()
Get iterator over all fields of this interface instance.
Interface field info list.
void set_hops(unsigned int hops)
Set number of hops.
unsigned int datasize() const
Get size of data.
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
const char * type() const
Get message type.
unsigned int num_fields() const
Get the number of fields in the message.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
virtual ~Message()
Destructor.
Message & operator=(const Message &m)
Assign this message to given message.
MessageType * as_type()
Cast message to given type if possible.
void set_from_chunk(const void *chunk)
Set from raw data chunk.
unsigned int hops() const
Get number of hops.
int64_t timestamp_usec
additional time microseconds
virtual Message * clone() const
Clone this message.
unsigned int id() const
Get message ID.
bool is_of_type()
Check if message has desired type.
unsigned int recipient() const
Get recipient memory serial.
int64_t timestamp_sec
time in seconds since Unix epoch