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;
186 void removeSubscriber();
203 void finishWrite(Slot* s);
209 void discardWrite(Slot* s);
216 template<
typename TargetType>
219 boost::mutex::scoped_lock lock(mPromoteMutex);
226 newBuffer = mBuffer->
promote<TargetType>();
229 MIRA_RETHROW(ex,
"while trying to promote channel '" << this->getID() <<
"'")
232 if(newBuffer!=oldBuffer) {
245 mUntypedBuffer = oldBuffer;
254 void dbgDump(
bool brief=
true) { mBuffer->dbgDump(mID, brief); }
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:148
ChannelBufferBase * promote()
Promotes this buffer to the specified target type (if required).
Definition: ChannelBuffer.h:1206
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:416
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:258
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:260
boost::mutex mPromoteMutex
Definition: AbstractChannel.h:262
const std::string & getID() const
Returns the channel id of this channel.
Definition: AbstractChannel.h:89
ChannelBufferBase * mBuffer
Definition: AbstractChannel.h:259
boost::shared_ptr< TypeMeta > TypeMetaPtr
Definition: MetaSerializer.h:309
Base class for exceptions.
Definition: Exception.h:199
Base class that manages the slots of channels by providing read and write access to them...
Definition: ChannelBuffer.h:134
Container for storing a single data element in the linked list.
Definition: ChannelBuffer.h:166
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
void dbgDump(bool brief=true)
Output the current buffer to console for debugging.
Definition: AbstractChannel.h:254
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
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
boost::mutex mSubscribersMutex
Definition: AbstractChannel.h:263