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.
port_drayage_plugin::OperationID Class Reference

Helper class containing an enum for valid port drayage MobilityOperation message operation IDs and a function that converts each operation enum value to a human-readable string. More...

#include <port_drayage_worker.hpp>

Collaboration diagram for port_drayage_plugin::OperationID:
Collaboration graph

Public Types

enum  Operation {
  PICKUP , DROPOFF , ENTER_STAGING_AREA , EXIT_STAGING_AREA ,
  ENTER_PORT , EXIT_PORT , PORT_CHECKPOINT , HOLDING_AREA ,
  DEFAULT_OPERATION
}
 Enum containing possible operation IDs used to define destinations for port drayage. More...
 

Public Member Functions

 OperationID (enum Operation op)
 Standard constructor for OperationID. More...
 
OperationID::Operation getOperationID () const
 Getter function to obtain the Operation enum associated with this object. More...
 
std::string operationToString () const
 Function to convert this object's 'operation_enum_' to a human-readable string. More...
 

Private Attributes

const Operation operation_enum_ = Operation::DEFAULT_OPERATION
 

Friends

std::ostream & operator<< (std::ostream &output, const OperationID &oid)
 Stream operator for this object. More...
 
bool operator== (const std::string &lhs, const OperationID &rhs)
 Overloaded == operator for comparision with String objects. More...
 

Detailed Description

Helper class containing an enum for valid port drayage MobilityOperation message operation IDs and a function that converts each operation enum value to a human-readable string.

Definition at line 66 of file port_drayage_worker.hpp.

Member Enumeration Documentation

◆ Operation

Enum containing possible operation IDs used to define destinations for port drayage.

Enumerator
PICKUP 
DROPOFF 
ENTER_STAGING_AREA 
EXIT_STAGING_AREA 
ENTER_PORT 
EXIT_PORT 
PORT_CHECKPOINT 
HOLDING_AREA 
DEFAULT_OPERATION 

Definition at line 72 of file port_drayage_worker.hpp.

Constructor & Destructor Documentation

◆ OperationID()

port_drayage_plugin::OperationID::OperationID ( enum Operation  op)
inline

Standard constructor for OperationID.

Parameters
opOperation enum associated with this object.

Definition at line 88 of file port_drayage_worker.hpp.

88 :
89 operation_enum_(op) {};

Member Function Documentation

◆ getOperationID()

OperationID::Operation port_drayage_plugin::OperationID::getOperationID ( ) const

Getter function to obtain the Operation enum associated with this object.

Returns
Operation enum associated with this object.

Definition at line 21 of file port_drayage_worker.cpp.

21 {
22 return operation_enum_;
23 }

References operation_enum_.

◆ operationToString()

std::string port_drayage_plugin::OperationID::operationToString ( ) const

Function to convert this object's 'operation_enum_' to a human-readable string.

Returns
A human-readable string representing this object's 'operation_enum_'.

Definition at line 25 of file port_drayage_worker.cpp.

25 {
26
27 // Convert operation enum into a human-readable string
28 switch(operation_enum_) {
29 case Operation::PICKUP: return "PICKUP";
30 case Operation::DROPOFF: return "DROPOFF";
31 case Operation::ENTER_STAGING_AREA: return "ENTER_STAGING_AREA";
32 case Operation::EXIT_STAGING_AREA: return "EXIT_STAGING_AREA";
33 case Operation::ENTER_PORT: return "ENTER_PORT";
34 case Operation::EXIT_PORT: return "EXIT_PORT";
35 case Operation::PORT_CHECKPOINT: return "PORT_CHECKPOINT";
36 case Operation::HOLDING_AREA: return "HOLDING_AREA";
37 default:
38 RCLCPP_WARN_STREAM(rclcpp::get_logger("OperationID"), "Conversion of an unsupported operation enum value to a string.");
39 return "UNSUPPORTED_OPERATION_ID";
40 }
41 }

References operation_enum_.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  output,
const OperationID oid 
)
friend

Stream operator for this object.

Definition at line 106 of file port_drayage_worker.hpp.

106 {
107 return output << oid.operationToString();
108 }

◆ operator==

bool operator== ( const std::string &  lhs,
const OperationID rhs 
)
friend

Overloaded == operator for comparision with String objects.

Definition at line 113 of file port_drayage_worker.hpp.

113 {
114 return lhs == rhs.operationToString();
115 }

Member Data Documentation

◆ operation_enum_

const Operation port_drayage_plugin::OperationID::operation_enum_ = Operation::DEFAULT_OPERATION
private

Definition at line 119 of file port_drayage_worker.hpp.

Referenced by getOperationID(), and operationToString().


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