29 #include <boost/shared_ptr.hpp> 30 #include <boost/type_traits.hpp> 32 #include <rsc/threading/SynchronizedQueue.h> 33 #include <rsc/misc/langutils.h> 35 #include "../Handler.h" 49 template<
class T,
class DisableEventWarning =
void>
52 boost::shared_ptr<rsc::threading::SynchronizedQueue<boost::shared_ptr<T> > >
58 (boost::is_same<DisableEventWarning, Event>::value || !boost::is_same<T, Event>::value),
59 "You probably do not want to use QueuePushHandler with type Event. \ 60 If you want to receive complete Event instances inside a queue, you need to use EventQueuePushHandler. \ 61 If you really want to use this class and want to get rid of this warning, define the second template parameter of this class to Event, too.");
70 boost::shared_ptr<rsc::threading::SynchronizedQueue<
71 boost::shared_ptr<T> > >
queue,
72 const std::string& method =
"") :
77 return "QueuePushHandler";
81 stream <<
"queue = " <<
queue;
85 queue->push(boost::static_pointer_cast<T>(event->getData()));
std::string getClassName() const
void printContents(std::ostream &stream) const
Asynchronously called handler interface on the client level.
QueuePushHandler(boost::shared_ptr< rsc::threading::SynchronizedQueue< boost::shared_ptr< T > > > queue, const std::string &method="")
Constructs a new instance.
boost::shared_ptr< rsc::threading::SynchronizedQueue< boost::shared_ptr< T > > > queue
A rsb::Handler for rsb::Listener s that pushes all received data on a rsc::SynchronizedQueue.
STATIC_ASSERT_WARN_TEMPLATE(QUEUE_PUSH_HANDLER_EVENT_WARNING,(boost::is_same< DisableEventWarning, Event >::value||!boost::is_same< T, Event >::value),"You probably do not want to use QueuePushHandler with type Event. \
If you want to receive complete Event instances inside a queue, you need to use EventQueuePushHandler. \
If you really want to use this class and want to get rid of this warning, define the second template parameter of this class to Event, too.")
void handle(EventPtr event)
Handle event.
boost::shared_ptr< Event > EventPtr