Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
mock_drivers::ROSComms< T > Class Template Reference

Class which serves as an abstraction of a pub/sub framework. More...

#include <ROSComms.h>

Collaboration diagram for mock_drivers::ROSComms< T >:
Collaboration graph

Public Member Functions

bool getLatch ()
 Returns the latched status of this data stream. More...
 
int getQueueSize ()
 Returns the data stream queue size. More...
 
std::string getTopic ()
 Returns the name string (topic) associated with the data stream. More...
 
CommTypes getCommType ()
 returns the comms type of this object More...
 
void callback (T msg)
 Callback function which is triggered to pass data into this comms abstraction. More...
 
getTemplateType ()
 Returns an instance of the type this object is parameterized on. This is used for forwarding the data type. More...
 
 ROSComms ()
 Default constructor. More...
 
 ROSComms (CommTypes ct, bool latch, int qs, std::string t)
 Publisher constructor. More...
 
 ROSComms (std::function< void(T)> cbf, CommTypes ct, bool latch, int qs, std::string t)
 Publisher constructor. More...
 

Private Attributes

std::function< void(T)> callback_function_
 
CommTypes comm_type_
 
bool latch_
 
int queue_size_
 
std::string topic_
 

Detailed Description

template<typename T>
class mock_drivers::ROSComms< T >

Class which serves as an abstraction of a pub/sub framework.

Template Parameters
TMessage type. This should be a base message type and does not support services. For example t = std_msgs/Float64

Definition at line 42 of file ROSComms.h.

Constructor & Destructor Documentation

◆ ROSComms() [1/3]

template<typename T >
mock_drivers::ROSComms< T >::ROSComms

Default constructor.

Definition at line 22 of file ROSComms.ipp.

22 {
23
24};

◆ ROSComms() [2/3]

template<typename T >
mock_drivers::ROSComms< T >::ROSComms ( CommTypes  ct,
bool  latch,
int  qs,
std::string  t 
)

Publisher constructor.

Constructor for a publisher ROSComms.

Parameters
ctThe comms type which should be pub
latchThe latched status of this publication
qsThe queue size of this publication
tThe name of the topic

Definition at line 28 of file ROSComms.ipp.

29{
30 comm_type_ = ct;
31 latch_ = latch;
32 queue_size_ = qs;
33 topic_ = t;
34};

◆ ROSComms() [3/3]

template<typename T >
mock_drivers::ROSComms< T >::ROSComms ( std::function< void(T)>  cbf,
CommTypes  ct,
bool  latch,
int  qs,
std::string  t 
)

Publisher constructor.

Constructor for a subscriber ROSComms.

Parameters
ctThe comms type which should be pub
latchThe latched status of this publication
qsThe queue size of this publication
tThe name of the topic

Definition at line 38 of file ROSComms.ipp.

39{
41 comm_type_ = ct;
42 latch_ = latch;
43 queue_size_ = qs;
44 topic_ = t;
45};
std::function< void(T)> callback_function_
Definition: ROSComms.h:45

Member Function Documentation

◆ callback()

template<typename T >
void mock_drivers::ROSComms< T >::callback ( msg)

Callback function which is triggered to pass data into this comms abstraction.

Used to call the ROSComms callback function.

Parameters
msgThe message to pass

Definition at line 57 of file ROSComms.ipp.

58{
59 // call the callback_function_ function
60 this->callback_function_(msg);
61}

◆ getCommType()

template<typename T >
CommTypes mock_drivers::ROSComms< T >::getCommType ( )
inline

returns the comms type of this object

Returns
Comms type enum

Definition at line 87 of file ROSComms.h.

88 {
89 return comm_type_;
90 }

◆ getLatch()

template<typename T >
bool mock_drivers::ROSComms< T >::getLatch ( )
inline

Returns the latched status of this data stream.

Returns
True if latched. False otherwise

Definition at line 57 of file ROSComms.h.

58 {
59 return latch_;
60 }

◆ getQueueSize()

template<typename T >
int mock_drivers::ROSComms< T >::getQueueSize ( )
inline

Returns the data stream queue size.

Returns
Size of data stream queue

Definition at line 67 of file ROSComms.h.

68 {
69 return queue_size_;
70 }

◆ getTemplateType()

template<typename T >
T mock_drivers::ROSComms< T >::getTemplateType ( )

Returns an instance of the type this object is parameterized on. This is used for forwarding the data type.

Returns
Instance of T

◆ getTopic()

template<typename T >
std::string mock_drivers::ROSComms< T >::getTopic ( )
inline

Returns the name string (topic) associated with the data stream.

Returns
Topic name

Definition at line 77 of file ROSComms.h.

78 {
79 return topic_;
80 }

Member Data Documentation

◆ callback_function_

template<typename T >
std::function<void(T)> mock_drivers::ROSComms< T >::callback_function_
private

Definition at line 45 of file ROSComms.h.

◆ comm_type_

template<typename T >
CommTypes mock_drivers::ROSComms< T >::comm_type_
private

Definition at line 46 of file ROSComms.h.

◆ latch_

template<typename T >
bool mock_drivers::ROSComms< T >::latch_
private

Definition at line 47 of file ROSComms.h.

◆ queue_size_

template<typename T >
int mock_drivers::ROSComms< T >::queue_size_
private

Definition at line 48 of file ROSComms.h.

◆ topic_

template<typename T >
std::string mock_drivers::ROSComms< T >::topic_
private

Definition at line 49 of file ROSComms.h.


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