47 #ifndef _MIRA_ABSTRACTCHANNEL_H_ 48 #define _MIRA_ABSTRACTCHANNEL_H_ 51 #include <boost/thread/mutex.hpp> 89 const std::string&
getID()
const {
return mID; }
99 int getTypeId()
const {
return mBuffer->getTypeId(); }
143 bool isTyped()
const {
return mBuffer->isTyped(); }
173 return !mSubscribers.empty() || mNrOfSubscribersWithoutChannelSubscriber > 0;
180 bool hasPublisher()
const;
197 void finishWrite(Slot* s);
203 void discardWrite(Slot* s);
210 template<
typename TargetType>
213 boost::mutex::scoped_lock lock(mPromoteMutex);
220 newBuffer = mBuffer->
promote<TargetType>();
223 MIRA_RETHROW(ex,
"while trying to promote channel '" << this->getID() <<
"'")
226 if(newBuffer!=oldBuffer) {
239 mUntypedBuffer = oldBuffer;
248 void dbgDump(
bool brief=
true) { mBuffer->dbgDump(mID, brief); }
271 template<
typename TargetType>
274 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:261
AbstractChannel * AbstractChannelPtr
Typedef for abstract channel pointers.
Definition: AbstractChannel.h:265
#define MIRA_RETHROW(ex, msg)
Macro for rethrowing an exception with file and line information and for adding additional informatio...
Definition: Exception.h:144
ChannelBufferBase * promote()
Promotes this buffer to the specified target type (if required).
Definition: ChannelBuffer.h:1187
std::list< AbstractChannelSubscriberPtr > mSubscribers
Definition: AbstractChannel.h:258
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:421
void setTypeMeta(TypeMetaPtr meta)
Sets the type meta information for the slots of the underlying channel buffer.
Definition: AbstractChannel.h:129
std::string mID
Definition: AbstractChannel.h:252
Commonly used exception classes.
ChannelBufferBase::Slot Slot
Definition: AbstractChannel.h:74
#define MIRA_FRAMEWORK_EXPORT
Definition: FrameworkExports.h:61
Definition: AbstractChannel.h:70
ChannelBufferBase * mUntypedBuffer
Definition: AbstractChannel.h:254
boost::mutex mPromoteMutex
Definition: AbstractChannel.h:256
const std::string & getID() const
Returns the channel id of this channel.
Definition: AbstractChannel.h:89
ChannelBufferBase * mBuffer
Definition: AbstractChannel.h:253
boost::shared_ptr< TypeMeta > TypeMetaPtr
Definition: MetaSerializer.h:309
Base class for exceptions.
Definition: Exception.h:194
Base class that manages the slots of channels by providing read and write access to them...
Definition: ChannelBuffer.h:133
Container for storing a single data element in the linked list.
Definition: ChannelBuffer.h:165
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:259
void dbgDump(bool brief=true)
Output the current buffer to console for debugging.
Definition: AbstractChannel.h:248
ChannelBufferBase * getBuffer()
Returns the underlying channel buffer.
Definition: AbstractChannel.h:149
Time mLastSlotTime
Definition: AbstractChannel.h:260
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
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:211
boost::mutex mSubscribersMutex
Definition: AbstractChannel.h:257