24 #ifndef __INTERFACE_MESSAGE_H_ 25 #define __INTERFACE_MESSAGE_H_ 27 #include <interface/field_iterator.h> 28 #include <interface/types.h> 29 #include <core/utils/refcount.h> 30 #include <core/exceptions/software.h> 32 #define __INTERFACE_MESSAGE_TYPE_SIZE 32 41 class InterfaceFieldIterator;
55 unsigned int id()
const;
56 void set_id(
unsigned int message_id);
64 const char *
type()
const;
74 unsigned int hops()
const;
86 template <
class MessageType>
94 template <
class MessageType>
98 unsigned int __message_id;
101 Time *__time_enqueued;
103 unsigned int recipient_interface_mem_serial;
104 unsigned int sender_interface_instance_serial;
107 char *_sender_thread_name;
108 unsigned int _sender_id;
114 unsigned int __num_fields;
121 size_t length,
void *value,
const char *enumtype = 0,
136 template <
class MessageType>
140 return (dynamic_cast<MessageType *>(
this) != 0);
144 template <
class MessageType>
148 MessageType *m =
dynamic_cast<MessageType *
>(
this);
Interface field iterator.
const char * sender_thread_name() const
Get sender of message.
const Time * time_enqueued() const
Get time when message was enqueued.
void * data_ptr
Pointer to memory that contains local data.
Interface * interface() const
Get transmitting interface.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
unsigned int id() const
Get message ID.
void mark_enqueued()
Mark message as being enqueued.
Interface field info list.
Fawkes library namespace.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
A class for handling time.
Base class for all Fawkes BlackBoard interfaces.
bool enqueued() const
Check is message has been enqueued.
InterfaceFieldIterator fields_end()
Invalid iterator.
const void * datachunk() const
Get pointer to data.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
Message(const char *type)
Constructor.
unsigned int sender_id() const
Get ID of sender.
virtual ~Message()
Destructor.
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
MessageType * as_type()
Cast message to given type if possible.
Reference counting base class.
unsigned int recipient() const
Get recipient memory serial.
InterfaceFieldIterator fields()
Get iterator over all fields of this interface instance.
bool is_of_type()
Check if message has desired type.
int64_t timestamp_sec
time in seconds since Unix epoch
unsigned int datasize() const
Get size of data.
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.
void set_hops(unsigned int hops)
Set number of hops.
interface_fieldtype_t
Interface field type.
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
const char * type() const
Get message type.
Message & operator=(const Message &m)
Assign this message to given message.
void set_id(unsigned int message_id)
Set message ID.
virtual Message * clone() const
Clone this message.