24 #include <interface/message.h> 25 #include <interface/interface.h> 27 #include <core/threading/thread.h> 28 #include <core/threading/mutex.h> 29 #include <core/exceptions/software.h> 30 #include <utils/time/time.h> 69 __fieldinfo_list = NULL;
79 __time_enqueued =
new Time();
81 _transmit_via_iface = NULL;
82 sender_interface_instance_serial = 0;
83 recipient_interface_mem_serial = 0;
87 _sender_thread_name = strdup(t->
name());
89 _sender_thread_name = strdup(
"Unknown");
100 __hops = mesg.__hops;
102 __num_fields = mesg.__num_fields;
107 _type = strdup(mesg._type);
108 __time_enqueued =
new Time(mesg.__time_enqueued);
110 _transmit_via_iface = NULL;
111 sender_interface_instance_serial = 0;
112 recipient_interface_mem_serial = 0;
121 *info_dest = new_info;
123 info_dest = &((*info_dest)->next);
124 info_src = info_src->
next;
129 _sender_thread_name = strdup(t->
name());
131 _sender_thread_name = strdup(
"Unknown");
142 __hops = mesg->__hops;
144 __num_fields = mesg->__num_fields;
149 _type = strdup(mesg->_type);
150 _transmit_via_iface = NULL;
151 sender_interface_instance_serial = 0;
152 recipient_interface_mem_serial = 0;
153 __time_enqueued =
new Time(mesg->__time_enqueued);
162 *info_dest = new_info;
164 info_dest = &((*info_dest)->next);
165 info_src = info_src->
next;
170 _sender_thread_name = strdup(t->
name());
172 _sender_thread_name = strdup(
"Unknown");
180 free(_sender_thread_name);
182 delete __time_enqueued;
186 __fieldinfo_list = __fieldinfo_list->
next;
188 infol = __fieldinfo_list;
219 __message_id = message_id;
237 __time_enqueued->
stamp();
238 long sec = 0, usec = 0;
267 return __time_enqueued;
277 return recipient_interface_mem_serial;
337 return _sender_thread_name;
358 _transmit_via_iface = iface;
359 _sender_id = iface->
serial();
360 recipient_interface_mem_serial = iface->
mem_serial();
370 return _transmit_via_iface;
436 size_t length,
void *value,
const char *enumtype)
443 newinfo->
name = name;
445 newinfo->
value = value;
446 newinfo->
next = NULL;
448 if ( infol == NULL ) {
450 __fieldinfo_list = newinfo;
453 while ( infol->
next != NULL ) {
456 infol->
next = newinfo;
Interface field iterator.
void * data_ptr
Pointer to memory that contains local data.
virtual Message * clone() const
Clone this message.
bool enqueued() const
Check is message has been enqueued.
unsigned int hops() const
Get number of hops.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
unsigned short serial() const
Get instance serial of interface.
void mark_enqueued()
Mark message as being enqueued.
Interface field info list.
const char * type() const
Get message type.
Fawkes library namespace.
const char * name
Name of this field.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
unsigned int recipient() const
Get recipient memory serial.
interface_fieldinfo_t * next
next field, NULL if last
A class for handling time.
unsigned int datasize() const
Get size of data.
Thread class encapsulation of pthreads.
unsigned int id() const
Get message ID.
Base class for all Fawkes BlackBoard interfaces.
InterfaceFieldIterator fields_end()
Invalid iterator.
static Thread * current_thread_noexc()
Similar to current_thread, but does never throw an exception.
message_data_ts_t * data_ts
data timestamp aliasing pointer
void * value
Current value of this field.
unsigned int data_size
Size of memory needed to hold all data.
Message(const char *type)
Constructor.
unsigned int num_fields() const
Get the number of fields in the message.
virtual ~Message()
Destructor.
const char * sender_thread_name() const
Get sender of message.
void set_from_chunk(const void *chunk)
Set from raw data chunk.
unsigned int mem_serial() const
Get memory serial of interface.
unsigned int sender_id() const
Get ID of sender.
interface_fieldtype_t type
type of this field
int64_t timestamp_usec
additional time microseconds
void get_timestamp(long &sec, long &usec) const
Get time stamp.
Interface * interface() const
Get transmitting interface.
size_t length
Length of field (array, string)
InterfaceFieldIterator fields()
Get iterator over all fields of this interface instance.
const char * name() const
Get name of thread.
const Time * time_enqueued() const
Get time when message was enqueued.
void set_time(const timeval *tv)
Sets the time.
int64_t timestamp_sec
time in seconds since Unix epoch
const char * enumtype
text representation of enum type
const void * datachunk() const
Get pointer to data.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0)
Add an entry to the info list.
Time & stamp()
Set this time to the current time.
void set_hops(unsigned int hops)
Set number of hops.
interface_fieldtype_t
Interface field type.
Message & operator=(const Message &m)
Assign this message to given message.
void set_id(unsigned int message_id)
Set message ID.