SMACC
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | Private Attributes | List of all members
smacc::client_bases::SmaccPublisherClient Class Reference

#include <smacc_publisher_client.h>

Inheritance diagram for smacc::client_bases::SmaccPublisherClient:
Inheritance graph
Collaboration diagram for smacc::client_bases::SmaccPublisherClient:
Collaboration graph

Public Member Functions

 SmaccPublisherClient ()
 
virtual ~SmaccPublisherClient ()
 
template<typename MessageType >
void configure (std::string topicName)
 
template<typename MessageType >
void publish (const MessageType &msg)
 
- Public Member Functions inherited from smacc::ISmaccClient
 ISmaccClient ()
 
virtual ~ISmaccClient ()
 
virtual void initialize ()
 
virtual std::string getName () const
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename TComponent >
TComponent * getComponent ()
 
template<typename TComponent >
TComponent * getComponent (std::string name)
 
virtual smacc::introspection::TypeInfo::Ptr getType ()
 
ISmaccStateMachinegetStateMachine ()
 
template<typename TSmaccSignal , typename T >
void connectSignal (TSmaccSignal &signal, void(T::*callback)(), T *object)
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
void getComponents (std::vector< std::shared_ptr< ISmaccComponent > > &components)
 

Public Attributes

boost::optional< std::string > topicName
 
boost::optional< int > queueSize
 

Protected Attributes

ros::NodeHandle nh_
 
ros::Publisher pub_
 
- Protected Attributes inherited from smacc::ISmaccClient
std::map< ComponentKey, std::shared_ptr< smacc::ISmaccComponent > > components_
 

Private Attributes

bool initialized_
 

Additional Inherited Members

- Protected Member Functions inherited from smacc::ISmaccClient
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createComponent (TArgs... targs)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createNamedComponent (std::string name, TArgs... targs)
 
void setStateMachine (ISmaccStateMachine *stateMachine)
 
void setOrthogonal (ISmaccOrthogonal *orthogonal)
 

Detailed Description

Definition at line 16 of file smacc_publisher_client.h.

Constructor & Destructor Documentation

◆ SmaccPublisherClient()

smacc::client_bases::SmaccPublisherClient::SmaccPublisherClient ( )
inline

Definition at line 22 of file smacc_publisher_client.h.

References initialized_.

◆ ~SmaccPublisherClient()

virtual smacc::client_bases::SmaccPublisherClient::~SmaccPublisherClient ( )
inlinevirtual

Definition at line 27 of file smacc_publisher_client.h.

28 {
29 pub_.shutdown();
30 }

References pub_.

Member Function Documentation

◆ configure()

template<typename MessageType >
void smacc::client_bases::SmaccPublisherClient::configure ( std::string  topicName)
inline

Definition at line 33 of file smacc_publisher_client.h.

34 {
35 this->topicName = topicName;
36 if (!initialized_)
37 {
38 if (!this->topicName)
39 {
40 ROS_ERROR("topic publisher with no topic name set. Skipping advertising.");
41 return;
42 }
43 if (!queueSize)
44 queueSize = 1;
45
46 ROS_INFO_STREAM("[" << this->getName() << "] Client Publisher to topic: " << topicName);
47 pub_ = nh_.advertise<MessageType>(*(this->topicName), *queueSize);
48
49 this->initialized_ = true;
50 }
51 }
virtual std::string getName() const
Definition: client.cpp:34

References smacc::ISmaccClient::getName(), initialized_, nh_, pub_, queueSize, and topicName.

Here is the call graph for this function:

◆ publish()

template<typename MessageType >
void smacc::client_bases::SmaccPublisherClient::publish ( const MessageType &  msg)
inline

Definition at line 54 of file smacc_publisher_client.h.

55 {
56 pub_.publish(msg);
57 }

References pub_.

Member Data Documentation

◆ initialized_

bool smacc::client_bases::SmaccPublisherClient::initialized_
private

Definition at line 64 of file smacc_publisher_client.h.

Referenced by configure(), and SmaccPublisherClient().

◆ nh_

ros::NodeHandle smacc::client_bases::SmaccPublisherClient::nh_
protected

Definition at line 60 of file smacc_publisher_client.h.

Referenced by configure().

◆ pub_

ros::Publisher smacc::client_bases::SmaccPublisherClient::pub_
protected

Definition at line 61 of file smacc_publisher_client.h.

Referenced by configure(), publish(), and ~SmaccPublisherClient().

◆ queueSize

boost::optional<int> smacc::client_bases::SmaccPublisherClient::queueSize

Definition at line 20 of file smacc_publisher_client.h.

Referenced by configure().

◆ topicName

boost::optional<std::string> smacc::client_bases::SmaccPublisherClient::topicName

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