41 #include <rsb/Factory.h> 42 #include <rsb/Handler.h> 43 #include <rsb/converter/Repository.h> 44 #include <rsb/converter/ProtocolBufferConverter.h> 46 #include <rst/generic/Value.pb.h> 47 #include <rst/generic/Dictionary.pb.h> 48 #include <rst/generic/KeyValuePair.pb.h> 62 typedef typename Informer::DataPtr
DataPtr;
63 typedef typename rsb::Scope
Scope;
81 typedef typename rsb::converter::ProtocolBufferConverter<T>
Converter;
85 rsb::converter::converterRepository<std::string>()->registerConverter(c);
90 #define REGISTER_RSBIOUtil_COMMON_TYPE(T,NAME,FULL_NAME) \ 92 struct RSBIOUtilDataExtra<T> : public RSBIOUtilDataBase<T>{ \ 93 static void register_type(){} \ 126 inline RSBIOUtil(
const std::string &mode,
const std::string &scope,
bool autoRegisterType=
true){
127 if(autoRegisterType){
128 static struct StaticTypeRegistration{
129 StaticTypeRegistration(){
132 } static_type_regitration;
137 rsb::Factory &factory = rsb::getFactory();
139 rsb::ParticipantConfig cfg = factory.getDefaultParticipantConfig();
142 }
else if(mode ==
"receive"){
144 typedef typename rsb::DataFunctionHandler<T> FHandler;
163 for(
typename std::map<std::string,typename Super::Callback>::iterator it =
Super::m_callbacks.begin();
176 typename std::map<std::string,typename Super::Callback>::iterator it =
Super::m_callbacks.find(
id);
180 WARNING_LOG(
"could not remove callback " <<
id <<
" callback was not registered");
193 if(scope.length())
init(scope);
197 inline operator bool()
const {
return !
isNull(); }
199 inline void init(
const std::string &scope){
228 if(scope.length())
init(scope);
233 inline operator bool()
const {
return !
isNull(); }
235 inline void init(
const std::string &scope){
241 impl->registerListenerCallback(cb,
id);
246 impl->unregisterListenerCallback(
id);
The General Function Template.
Definition: Function.h:284
Scope m_scope
Definition: RSBIOUtil.h:71
RSBIOUtilDataBase< T >::Callback Callback
Definition: RSBIOUtil.h:224
Definition: RSBIOUtil.h:57
Simple and ready to use RSB-Informer and RSB-Listener Interface.
Definition: RSBIOUtil.h:120
undocument this line if you encounter any issues!
Definition: Any.h:37
Class interface for un-copyable classes.
Definition: Uncopyable.h:64
utils::SmartPtr< RSBIOUtil< T > > impl
Definition: RSBIOUtil.h:187
void null_check(const std::string &fn) const
Definition: RSBIOUtil.h:214
Definition: RSBIOUtil.h:220
RSBListener(const std::string &scope="")
Definition: RSBIOUtil.h:227
REGISTER_RSBIOUtil_COMMON_TYPE(std::string, string, primitive.string)
void send(const T &t)
Definition: RSBIOUtil.h:203
bool isNull() const
Definition: RSBIOUtil.h:231
void send(const T &t)
Definition: RSBIOUtil.h:152
#define WARNING_LOG(x)
Definition: Macros.h:117
RSBIOUtilDataExtra< T > Super
Definition: RSBIOUtil.h:123
rsb::ListenerPtr ListenerPtr
Definition: RSBIOUtil.h:64
utils::SmartPtr< RSBIOUtil< T > > impl
Definition: RSBIOUtil.h:221
void null_check(const std::string &fn) const
Definition: RSBIOUtil.h:250
InformerPtr m_informer
Definition: RSBIOUtil.h:69
void init(const std::string &scope)
Definition: RSBIOUtil.h:235
Informer::Ptr InformerPtr
Definition: RSBIOUtil.h:61
ICLQt_API ImgROI data(ImgQ &r)
creates full ROI ROI-struct
rsb::Scope Scope
Definition: RSBIOUtil.h:63
Informer::DataPtr DataPtr
Definition: RSBIOUtil.h:62
bool isNull() const
Definition: RSBIOUtil.h:195
ListenerPtr m_listener
Definition: RSBIOUtil.h:72
void registerListenerCallback(typename Super::Callback cb, const std::string &id="default")
Definition: RSBIOUtil.h:169
void send(typename Super::DataPtr data)
Definition: RSBIOUtil.h:157
virtual ~RSBIOUtilDataBase()
Definition: RSBIOUtil.h:58
rsb::Informer< T > Informer
Definition: RSBIOUtil.h:60
std::map< std::string, Callback > m_callbacks
Definition: RSBIOUtil.h:75
void unregisterListenerCallback(const std::string &id="default")
Definition: RSBIOUtil.h:174
Definition: RSBIOUtil.h:186
void send(DataPtr data)
Definition: RSBIOUtil.h:208
RSBIOUtil(const std::string &mode, const std::string &scope, bool autoRegisterType=true)
creates an instance with given mode and scope
Definition: RSBIOUtil.h:126
RSBSender(const std::string &scope="")
Definition: RSBIOUtil.h:192
Base class for Exception handling in the ICL.
Definition: Exception.h:42
void unregisterCallback(const std::string &id="default")
Definition: RSBIOUtil.h:244
RSBIOUtilDataBase< T >::DataPtr DataPtr
Definition: RSBIOUtil.h:190
void handle(typename Super::DataPtr data)
Definition: RSBIOUtil.h:161
Mutex class of the ICL.
Definition: Mutex.h:54
DataPtr m_data
Definition: RSBIOUtil.h:70
void registerCallback(Callback cb, const std::string &id="default")
Definition: RSBIOUtil.h:239
RSBIOUtilDataBase< T >::DataPtr DataPtr
Definition: RSBIOUtil.h:225
Locks a mutex on the stack (mutex is unlocked when the stack's section is released.
Definition: Mutex.h:120
Specialization of the SmartPtrBase class for Pointers.
Definition: SmartPtr.h:75
void init(const std::string &scope)
Definition: RSBIOUtil.h:199
utils::Mutex m_mutex
Definition: RSBIOUtil.h:74
utils::Function< void, const T & > Callback
Callback type that is used for listener_callbacks.
Definition: RSBIOUtil.h:67