Public Member Functions | Public Attributes | Protected Member Functions | List of all members
TestLazyPubSub Class Reference
Inheritance diagram for TestLazyPubSub:
Inheritance graph
[legend]

Public Member Functions

ros::PublishergetPub ()
 
ros::SubscribergetSub ()
 
 TestLazyPubSub (const ::std::string &topicIn, const ::std::string &topicOut, const ::ros::NodeHandle &nh={}, const size_t inQueueSize=10, const size_t outQueueSize=10)
 
- Public Member Functions inherited from cras::GenericLazyPubSub
 GenericLazyPubSub (const ::ros::NodeHandle &nh, const ::std::string &topicIn, const ::std::string &topicOut, CallbackType callback, ::ros::SubscribeOptions subscribeOptions={}, const ::cras::LogHelperPtr &logHelper=::std::make_shared<::cras::NodeLogHelper >())
 Create the pair of lazy subscriber and publisher (with the same node handle used for input and output and both using queue size of 10). More...
 
 GenericLazyPubSub (const ::ros::NodeHandle &nh, const ::std::string &topicIn, const ::std::string &topicOut, size_t inQueueSize, size_t outQueueSize, CallbackType callback, ::ros::SubscribeOptions subscribeOptions={}, const ::cras::LogHelperPtr &logHelper=::std::make_shared<::cras::NodeLogHelper >())
 Create the pair of lazy subscriber and publisher (with the same node handle used for input and output). More...
 
 GenericLazyPubSub (const ::ros::NodeHandle &nh, const ::std::string &topicIn, const ::std::string &topicOut, size_t queueSize, CallbackType callback, ::ros::SubscribeOptions subscribeOptions={}, const ::cras::LogHelperPtr &logHelper=::std::make_shared<::cras::NodeLogHelper >())
 Create the pair of lazy subscriber and publisher (with the same node handle and queue size used for input and output). More...
 
 GenericLazyPubSub (const ::ros::NodeHandle &nhIn, const ::std::string &topicIn, const ::ros::NodeHandle &nhOut, const ::std::string &topicOut, CallbackType callback, ::ros::SubscribeOptions subscribeOptions={}, const ::cras::LogHelperPtr &logHelper=::std::make_shared<::cras::NodeLogHelper >())
 Create the pair of lazy subscriber and publisher (with input and output queue size of 10). More...
 
 GenericLazyPubSub (const ::ros::NodeHandle &nhIn, const ::std::string &topicIn, const ::ros::NodeHandle &nhOut, const ::std::string &topicOut, size_t inQueueSize, size_t outQueueSize, CallbackType callback, ::ros::SubscribeOptions subscribeOptions={}, const ::cras::LogHelperPtr &logHelper=::std::make_shared<::cras::NodeLogHelper >())
 Create the pair of lazy subscriber and publisher. More...
 
 GenericLazyPubSub (const ::ros::NodeHandle &nhIn, const ::std::string &topicIn, const ::ros::NodeHandle &nhOut, const ::std::string &topicOut, size_t queueSize, CallbackType callback, ::ros::SubscribeOptions subscribeOptions={}, const ::cras::LogHelperPtr &logHelper=::std::make_shared<::cras::NodeLogHelper >())
 Create the pair of lazy subscriber and publisher (with equal input and output queue size). More...
 
- Public Member Functions inherited from cras::ConditionalSubscriber
 ConditionalSubscriber (ConnectFn connectFn, const ::cras::LogHelperPtr &logHelper=::std::make_shared<::cras::NodeLogHelper >())
 Create the conditional subscriber. More...
 
 ConditionalSubscriber (ConnectFn connectFn, DisconnectFn disconnectFn, const ::cras::LogHelperPtr &logHelper=::std::make_shared<::cras::NodeLogHelper >())
 Create the conditional subscriber. More...
 
bool isLazy () const
 Tell whether this subscriber has the lazy behavior enabled. More...
 
bool isSubscribed () const
 Whether the subscriber is currently subscribed to its topic or not. More...
 
void setLazy (bool lazy)
 Set whether the subscriber behaves in the lazy way. More...
 
virtual ~ConditionalSubscriber ()
 Destroy this object and unsubscribe the subscriber if it was subscribed. More...
 
- Public Member Functions inherited from cras::HasLogger
::cras::LogHelperConstPtr getCrasLogger () const
 
 HasLogger (const ::cras::LogHelperPtr &log)
 
void setCrasLogger (const ::cras::LogHelperPtr &log)
 

Public Attributes

size_t numProcessed {0}
 
- Public Attributes inherited from cras::GenericLazyPubSub
const typedef ::ros::MessageEvent<::topic_tools::ShapeShifter const > & CallbackMessageType
 Signature of the subscriber's callback. More...
 

Protected Member Functions

void processMessage (const ros::MessageEvent< topic_tools::ShapeShifter const > &event, ros::Publisher &pub)
 
- Protected Member Functions inherited from cras::GenericLazyPubSub
void cb (const ::ros::MessageEvent<::topic_tools::ShapeShifter const > &event)
 Callback for the received messages from subscriber. It also handles publisher creation if none exists. More...
 
void connectCb (const ::ros::SingleSubscriberPublisher &)
 Callback that is called whenever someone (un)subscribes from the publisher. More...
 
virtual ::ros::AdvertiseOptions createAdvertiseOptions (const ::ros::MessageEvent<::topic_tools::ShapeShifter const > &event)
 Create ros::AdvertiseOptions from a message event. More...
 
bool shouldBeSubscribed () const override
 Returns true when the subscriber should be connected - i.e. either at the start, or when pub has clients. More...
 
void subscribe (::ros::Subscriber &sub)
 Perform the subscription to the input topic. More...
 
- Protected Member Functions inherited from cras::ConditionalSubscriber
void connectNoLock ()
 Connect the subscriber to its input. More...
 
void disconnectNoLock ()
 Disconnect the subscriber from its input. More...
 
void updateSubscription ()
 The callback called when the condition might have changed. More...
 
void updateSubscriptionNoLock ()
 The callback called when the condition might have changed. More...
 

Additional Inherited Members

- Public Types inherited from cras::GenericLazyPubSub
typedef ::boost::function< void(::cras::GenericLazyPubSub::CallbackMessageType, ::ros::Publisher &)> CallbackType
 Type of the user callback passed to this class. More...
 
- Public Types inherited from cras::ConditionalSubscriber
typedef ::std::function< void(::ros::Subscriber &sub)> ConnectFn
 Type of the function that connects the subscriber. More...
 
typedef ::std::function< void(::ros::Subscriber &sub)> DisconnectFn
 Type of the function that disconnects the subscriber. More...
 
- Protected Attributes inherited from cras::GenericLazyPubSub
::cras::optional<::ros::AdvertiseOptionsadvertiseOptions
 The options used when the publisher was created. nullopt before the publisher is created. More...
 
::cras::GenericLazyPubSub::CallbackType callback
 The user callback to be called when a message is received. More...
 
size_t inQueueSize
 Queue size of the input subscriber. More...
 
::ros::NodeHandle nhIn
 Node handle for topic subscription. More...
 
::ros::NodeHandle nhOut
 Node handle for topic publication. More...
 
size_t outQueueSize
 Queue size of the output publisher. More...
 
::ros::Publisher pub
 The output publisher. It will be invalid until first message is received. More...
 
::std::mutex pubCreateMutex
 Mutex protecting pub. More...
 
::ros::Subscriber sub
 The input subscriber. More...
 
const ::ros::SubscribeOptions subscribeOptions
 Options used when subscribing to the input topic. More...
 
::std::string topicIn
 Input topic (relative to nh). More...
 
::std::string topicOut
 Output topic (relative to nh). More...
 
- Protected Attributes inherited from cras::ConditionalSubscriber
ConnectFn connectFn
 The function used to establish connection. More...
 
mutable ::std::mutex connectMutex
 Mutex protecting sub and subscribed. More...
 
DisconnectFn disconnectFn
 The function used to close connection. More...
 
bool lazy {true}
 Whether the lazy behavior is enabled (if false, the subscriber is always subscribed). More...
 
::ros::Subscriber sub
 The underlying subscriber (valid only when subscribed is true). More...
 
bool subscribed {false}
 Whether the subscriber is currently subscribed to its topic or not. More...
 
- Protected Attributes inherited from cras::HasLogger
::cras::LogHelperPtr log
 

Detailed Description

Definition at line 56 of file test_generic_lazy_pubsub.cpp.

Constructor & Destructor Documentation

◆ TestLazyPubSub()

TestLazyPubSub::TestLazyPubSub ( const ::std::string &  topicIn,
const ::std::string &  topicOut,
const ::ros::NodeHandle nh = {},
const size_t  inQueueSize = 10,
const size_t  outQueueSize = 10 
)
inline

Definition at line 59 of file test_generic_lazy_pubsub.cpp.

Member Function Documentation

◆ getPub()

ros::Publisher& TestLazyPubSub::getPub ( )
inline

Definition at line 66 of file test_generic_lazy_pubsub.cpp.

◆ getSub()

ros::Subscriber& TestLazyPubSub::getSub ( )
inline

Definition at line 71 of file test_generic_lazy_pubsub.cpp.

◆ processMessage()

void TestLazyPubSub::processMessage ( const ros::MessageEvent< topic_tools::ShapeShifter const > &  event,
ros::Publisher pub 
)
inlineprotected

Definition at line 77 of file test_generic_lazy_pubsub.cpp.

Member Data Documentation

◆ numProcessed

size_t TestLazyPubSub::numProcessed {0}

Definition at line 85 of file test_generic_lazy_pubsub.cpp.


The documentation for this class was generated from the following file:


cras_topic_tools
Author(s): Martin Pecka
autogenerated on Sun Mar 2 2025 03:51:09