47 #ifndef _MIRA_ABSTRACTCHANNEL_H_ 48 #define _MIRA_ABSTRACTCHANNEL_H_ 51 #include <boost/thread/mutex.hpp> 89 const std::string&
getID()
const {
return mID; }
216 template<
typename TargetType>
232 if(newBuffer!=oldBuffer) {
277 template<
typename TargetType>
280 channel->
promote<TargetType>();
Classes for managing a channels internal buffer (slots).
bool hasSubscriber() const
Returns true, if this channel has at least one subscriber.
Definition: AbstractChannel.h:172
uint64 getNrOfDataChanges() const
Returns the number of times data was written to this channel.
Definition: AbstractChannel.h:165
Base class for all channel subscribers.
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
std::string Typename
Definition: Typename.h:60
uint64 mNrOfDataChanges
Definition: AbstractChannel.h:267
AbstractChannel * AbstractChannelPtr
Typedef for abstract channel pointers.
Definition: AbstractChannel.h:271
#define MIRA_RETHROW(ex, msg)
Macro for rethrowing an exception with file and line information and for adding additional informatio...
Definition: Exception.h:144
virtual void setTypename(const Typename &name)=0
Sets the Typename of the slot values.
ChannelBufferBase * promote()
Promotes this buffer to the specified target type (if required).
Definition: ChannelBuffer.h:1223
TypeMetaPtr getTypeMeta() const
Returns the meta information for the slots type.
Definition: ChannelBuffer.h:329
std::list< AbstractChannelSubscriberPtr > mSubscribers
Definition: AbstractChannel.h:264
int getTypeId() const
Returns the non-portable typeid of the items that are stored in the slots of the underlying channel b...
Definition: AbstractChannel.h:99
void fixateType()
Calling this method will fix the type of the underlying ChannelBuffer.
Definition: AbstractChannel.h:138
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:418
void setTypeMeta(TypeMetaPtr meta)
Sets the type meta information for the slots of the underlying channel buffer.
Definition: AbstractChannel.h:129
~AbstractChannel()
Destructor (KEEP NON VIRTUAL!)
std::string mID
Definition: AbstractChannel.h:258
Commonly used exception classes.
void setTypeMeta(TypeMetaPtr meta)
Sets the meta information of the slot's type.
Definition: ChannelBuffer.h:334
bool hasPublisher() const
Returns true, if this channel has at least one publisher.
ChannelBufferBase::Slot Slot
Definition: AbstractChannel.h:74
Definition: AbstractChannel.h:70
ChannelBufferBase * mUntypedBuffer
Definition: AbstractChannel.h:260
boost::mutex mPromoteMutex
Definition: AbstractChannel.h:262
const std::string & getID() const
Returns the channel id of this channel.
Definition: AbstractChannel.h:89
virtual void fixateType()=0
Calling this method will fix the type of the ChannelBuffer.
ChannelBufferBase * mBuffer
Definition: AbstractChannel.h:259
boost::shared_ptr< TypeMeta > TypeMetaPtr
Definition: MetaSerializer.h:309
void dbgDump(const std::string &prefix, bool brief=true)
Base class for exceptions.
Definition: Exception.h:195
AbstractChannel(const std::string &id, ChannelBufferBase *buffer)
Constructs a new channel with the given id and the specified underlying channel buffer.
Base class that manages the slots of channels by providing read and write access to them...
Definition: ChannelBuffer.h:132
Container for storing a single data element in the linked list.
Definition: ChannelBuffer.h:164
Time getLastSlotTime() const
Returns the timestamp of the data in the slot that was last written to this channel or an invalid tim...
Definition: AbstractChannel.h:160
TypeMetaPtr getTypeMeta() const
Returns the type meta information for the slots of the underlying channel buffer. ...
Definition: AbstractChannel.h:123
uint32 mNrOfSubscribersWithoutChannelSubscriber
Definition: AbstractChannel.h:265
std::size_t getSize() const
Returns the size of the buffer.
void dbgDump(bool brief=true)
Output the current buffer to console for debugging.
Definition: AbstractChannel.h:254
void finishWrite(Slot *s)
Is called by ChannelWrite to signal that data was changed.
void removeSubscriber()
Removes a subscriber that has not subscribed using a channel subscriber, (i.e.
ChannelBufferBase * getBuffer()
Returns the underlying channel buffer.
Definition: AbstractChannel.h:149
Time mLastSlotTime
Definition: AbstractChannel.h:266
Typename getTypename() const
Returns the platform independent typename of the items that are stored in the slots of the underlying...
Definition: AbstractChannel.h:107
boost::shared_ptr< AbstractChannelSubscriber > AbstractChannelSubscriberPtr
Definition: AbstractChannelSubscriber.h:120
bool isTyped() const
Returns true, if the channel is typed and false, if it is untyped.
Definition: AbstractChannel.h:143
void setTypename(const Typename &name)
Sets the typename of the items that are stored in the slots of the underlying channel buffer...
Definition: AbstractChannel.h:117
void discardWrite(Slot *s)
Is called by ChannelWrite to signal that this slot is discarded.
virtual Typename getTypename() const =0
Returns the Typename of the slot values, in contrast to getTypeId() the Typename is portable and uniq...
std::size_t getNrOfSlots() const
Returns the number of slots this channel contains.
Definition: AbstractChannel.h:154
void promote()
Promote the channel to TargetType.
Definition: AbstractChannel.h:217
virtual int getTypeId() const =0
Returns typeid of the slot values, the allocator creates.
virtual bool isTyped() const =0
Returns true, if the channel is typed and false, if it is untyped.
boost::mutex mSubscribersMutex
Definition: AbstractChannel.h:263