49 #include <boost/shared_ptr.hpp> 60 #ifndef _MIRA_CHANNELSUBSCRIBER_H_ 61 #define _MIRA_CHANNELSUBSCRIBER_H_ 69 class ConcreteChannel;
81 template<
typename T,
typename ChannelRead>
96 mLastTimestamp(
Time::invalid()) {}
106 assert(mChannel==NULL);
127 assert(mChannel!=NULL);
128 std::string channelid = mChannel->getID();
135 auto r = mChannel->read();
136 Time n = r.getTimestamp();
137 if (mLastTimestamp != n)
148 ex.
message(),
"Exception while invoking subscriber")) {
152 catch(std::exception& ex) {
154 ex.what(),
"Exception while invoking subscriber")) {
164 boost::function<void (ChannelRead)> mInvokeFn;
ChannelSubscriber(DispatcherThread *dispatcher, boost::function< void(ChannelRead)> invokeFn, DiagnosticsModulePtr diagnosticsModule=NULL)
Definition: ChannelSubscriber.h:90
AbstractChannelPtr getChannel()
Returns the channel this subscriber is attached to.
Definition: ChannelSubscriber.h:99
Base class for all channel subscribers.
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
void attachChannel(ChannelType *channel)
Attaches this subscriber to the specified channel.
Definition: ChannelSubscriber.h:105
Definition: ChannelReadWrite.h:67
An object that allows read access to data of a channel.
Definition: ChannelReadWrite.h:494
ConcreteChannel< T > ChannelType
Definition: ChannelSubscriber.h:86
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:418
virtual void run(DispatcherThread *dispatcher)
Called from dispatcher thread this runnable is attached to, whenever the runnable should be executed...
Definition: ChannelSubscriber.h:119
Definition: AbstractChannel.h:70
std::string message() const MIRA_NOEXCEPT_OR_NOTHROW
Similar to what().
bool mEnabled
Is the subscriber enabled.
Definition: AbstractChannelSubscriber.h:117
DiagnosticsModulePtr mDiagnosticsModule
Definition: Runnable.h:105
boost::shared_ptr< IRunnable > IRunnablePtr
a runnable pointer
Definition: Runnable.h:63
Base class for exceptions.
Definition: Exception.h:199
Class that can be used whenever you want to have ONE thread where several handlers are assigned to...
Definition: DispatcherThread.h:131
#define MIRA_LOG_EXCEPTION(level, ex)
Log the specified exception, including all information that the exception object carries.
Definition: LoggingAux.h:107
virtual void detachChannel()
Detaches this subscriber from the channel.
Definition: ChannelSubscriber.h:113
bool error(const std::string &category, const std::string &message, const std::string &trText="")
Signal an error in a category.
Definition: AbstractChannelSubscriber.h:70
Definition: LoggingCore.h:75
Base class for all framework channels.
Implements AbstractChannelSubscriber for a concrete data type.
Definition: ChannelSubscriber.h:82
Base class for modules that want to use diagnostics and set the current status.
Definition: Status.h:138
Status and status management classes used for diagnostics.
void ok(const std::string &category="")
Signal that a category contains no more errors.