Apollo  6.0
Open source self driving car software
Public Member Functions | List of all members
apollo::cyber::Parameter Class Reference

A Parameter holds an apollo::cyber::proto::Param, It's more human-readable, you can use basic-value type and Protobuf values to construct a paramter. Parameter is identified by their name, and you can get Parameter content by call value() More...

#include <parameter.h>

Collaboration diagram for apollo::cyber::Parameter:
Collaboration graph

Public Member Functions

 Parameter ()
 Empty constructor. More...
 
 Parameter (const Parameter &parameter)
 copy constructor More...
 
 Parameter (const std::string &name)
 construct with paramter's name More...
 
 Parameter (const std::string &name, const bool bool_value)
 construct with paramter's name and bool value type More...
 
 Parameter (const std::string &name, const int int_value)
 construct with paramter's name and int value type More...
 
 Parameter (const std::string &name, const int64_t int_value)
 construct with paramter's name and int value type More...
 
 Parameter (const std::string &name, const float float_value)
 construct with paramter's name and float value type More...
 
 Parameter (const std::string &name, const double double_value)
 construct with paramter's name and double value type More...
 
 Parameter (const std::string &name, const std::string &string_value)
 construct with paramter's name and string value type More...
 
 Parameter (const std::string &name, const char *string_value)
 construct with paramter's name and char* value type More...
 
 Parameter (const std::string &name, const std::string &msg_str, const std::string &full_name, const std::string &proto_desc)
 use a protobuf type value to construct the parameter More...
 
 Parameter (const std::string &name, const google::protobuf::Message &msg)
 use a google::protobuf::Message type value to construct the parameter More...
 
void FromProtoParam (const Param &param)
 Parse a cyber::proto::Param object to cyber::parameter::Parameter object. More...
 
Param ToProtoParam () const
 Parse a cyber::parameter::Parameter object to cyber::proto::Param object. More...
 
ParamType Type () const
 Get the cyber:parameter::ParamType of this object. More...
 
std::string TypeName () const
 Get Paramter's type name, i.e. INT,DOUBLE,STRING or protobuf message's fullname. More...
 
std::string Descriptor () const
 Get Paramter's descriptor, only work on protobuf types. More...
 
const std::string Name () const
 Get the Parameter name. More...
 
bool AsBool () const
 Get Paramter as a bool value. More...
 
int64_t AsInt64 () const
 Get Paramter as an int64_t value. More...
 
double AsDouble () const
 et Paramter as a double value More...
 
const std::string AsString () const
 Get Paramter as a string value. More...
 
std::string DebugString () const
 show debug string More...
 
template<typename ValueType >
std::enable_if< std::is_base_of< google::protobuf::Message, ValueType >::value, ValueType >::type value () const
 Translate paramter value as a protobuf::Message. More...
 
template<typename ValueType >
std::enable_if< std::is_integral< ValueType >::value &&!std::is_same< ValueType, bool >::value, ValueType >::type value () const
 Translate paramter value to int type. More...
 
template<typename ValueType >
std::enable_if< std::is_floating_point< ValueType >::value, ValueType >::type value () const
 Translate paramter value to bool type. More...
 
template<typename ValueType >
std::enable_if< std::is_convertible< ValueType, std::string >::value, const std::string & >::type value () const
 Translate paramter value to string type. More...
 
template<typename ValueType >
std::enable_if< std::is_same< ValueType, bool >::value, bool >::type value () const
 Translate paramter value to bool type. More...
 

Detailed Description

A Parameter holds an apollo::cyber::proto::Param, It's more human-readable, you can use basic-value type and Protobuf values to construct a paramter. Parameter is identified by their name, and you can get Parameter content by call value()

Constructor & Destructor Documentation

◆ Parameter() [1/12]

apollo::cyber::Parameter::Parameter ( )

Empty constructor.

◆ Parameter() [2/12]

apollo::cyber::Parameter::Parameter ( const Parameter parameter)
explicit

copy constructor

◆ Parameter() [3/12]

apollo::cyber::Parameter::Parameter ( const std::string &  name)
explicit

construct with paramter's name

Parameters
nameParameter name

◆ Parameter() [4/12]

apollo::cyber::Parameter::Parameter ( const std::string &  name,
const bool  bool_value 
)

construct with paramter's name and bool value type

Parameters
nameParameter name
bool_valuebool value

◆ Parameter() [5/12]

apollo::cyber::Parameter::Parameter ( const std::string &  name,
const int  int_value 
)

construct with paramter's name and int value type

Parameters
nameParameter name
int_valueint value

◆ Parameter() [6/12]

apollo::cyber::Parameter::Parameter ( const std::string &  name,
const int64_t  int_value 
)

construct with paramter's name and int value type

Parameters
nameParameter name
int_valueint value

◆ Parameter() [7/12]

apollo::cyber::Parameter::Parameter ( const std::string &  name,
const float  float_value 
)

construct with paramter's name and float value type

Parameters
nameParameter name
float_valuefloat value

◆ Parameter() [8/12]

apollo::cyber::Parameter::Parameter ( const std::string &  name,
const double  double_value 
)

construct with paramter's name and double value type

Parameters
nameParameter name
double_valuedouble value

◆ Parameter() [9/12]

apollo::cyber::Parameter::Parameter ( const std::string &  name,
const std::string &  string_value 
)

construct with paramter's name and string value type

Parameters
nameParameter name
string_valuestring value

◆ Parameter() [10/12]

apollo::cyber::Parameter::Parameter ( const std::string &  name,
const char *  string_value 
)

construct with paramter's name and char* value type

Parameters
nameParameter name
string_valuechar* value

◆ Parameter() [11/12]

apollo::cyber::Parameter::Parameter ( const std::string &  name,
const std::string &  msg_str,
const std::string &  full_name,
const std::string &  proto_desc 
)

use a protobuf type value to construct the parameter

Parameters
nameParameter name
msg_strprotobuf contents
full_namethe proto full name
proto_descthe proto's description

◆ Parameter() [12/12]

apollo::cyber::Parameter::Parameter ( const std::string &  name,
const google::protobuf::Message &  msg 
)

use a google::protobuf::Message type value to construct the parameter

Parameters
nameParameter name
msgprotobuf message

Member Function Documentation

◆ AsBool()

bool apollo::cyber::Parameter::AsBool ( ) const
inline

Get Paramter as a bool value.

Returns
true result
false result

◆ AsDouble()

double apollo::cyber::Parameter::AsDouble ( ) const
inline

et Paramter as a double value

Returns
double type result

◆ AsInt64()

int64_t apollo::cyber::Parameter::AsInt64 ( ) const
inline

Get Paramter as an int64_t value.

Returns
int64_t int64 type result

◆ AsString()

const std::string apollo::cyber::Parameter::AsString ( ) const
inline

Get Paramter as a string value.

Returns
const std::string Parameter's string expression

◆ DebugString()

std::string apollo::cyber::Parameter::DebugString ( ) const

show debug string

Returns
std::string Parameter's debug string

◆ Descriptor()

std::string apollo::cyber::Parameter::Descriptor ( ) const
inline

Get Paramter's descriptor, only work on protobuf types.

Returns
std::string the Parameter's type name

◆ FromProtoParam()

void apollo::cyber::Parameter::FromProtoParam ( const Param &  param)

Parse a cyber::proto::Param object to cyber::parameter::Parameter object.

Parameters
paramThe cyber::proto::Param object parse from A pointer to the target Parameter object
Returns
True if parse ok, otherwise False

◆ Name()

const std::string apollo::cyber::Parameter::Name ( ) const
inline

Get the Parameter name.

Returns
const std::string the Parameter's name

◆ ToProtoParam()

Param apollo::cyber::Parameter::ToProtoParam ( ) const

Parse a cyber::parameter::Parameter object to cyber::proto::Param object.

Returns
The target cyber::proto::Param object

◆ Type()

ParamType apollo::cyber::Parameter::Type ( ) const
inline

Get the cyber:parameter::ParamType of this object.

Returns
result cyber:parameter::ParameterType

◆ TypeName()

std::string apollo::cyber::Parameter::TypeName ( ) const
inline

Get Paramter's type name, i.e. INT,DOUBLE,STRING or protobuf message's fullname.

Returns
std::string the Parameter's type name

◆ value() [1/5]

template<typename ValueType >
std::enable_if< std::is_same< ValueType, bool >::value, bool >::type apollo::cyber::Parameter::value ( ) const

Translate paramter value as a protobuf::Message.

Template Parameters
ValueTypetype of the value
Returns
std::enable_if< std::is_base_of<google::protobuf::Message, ValueType>::value, ValueType>::type protobuf::Message type result

◆ value() [2/5]

template<typename ValueType >
std::enable_if<std::is_integral<ValueType>::value && !std::is_same<ValueType, bool>::value, ValueType>::type apollo::cyber::Parameter::value ( ) const

Translate paramter value to int type.

Template Parameters
ValueTypetype of the value
Returns
std::enable_if<std::is_integral<ValueType>::value && !std::is_same<ValueType, bool>::value, ValueType>::type int type result

◆ value() [3/5]

template<typename ValueType >
std::enable_if<std::is_floating_point<ValueType>::value, ValueType>::type apollo::cyber::Parameter::value ( ) const

Translate paramter value to bool type.

Template Parameters
ValueTypetype of the value
Returns
std::enable_if<std::is_floating_point<ValueType>::value, ValueType>::type floating type result

◆ value() [4/5]

template<typename ValueType >
std::enable_if<std::is_convertible<ValueType, std::string>::value, const std::string&>::type apollo::cyber::Parameter::value ( ) const

Translate paramter value to string type.

Template Parameters
ValueTypetype of the value
Returns
std::enable_if<std::is_convertible<ValueType, std::string>::value, const std::string&>::type string type result

◆ value() [5/5]

template<typename ValueType >
std::enable_if<std::is_same<ValueType, bool>::value, bool>::type apollo::cyber::Parameter::value ( ) const

Translate paramter value to bool type.

Template Parameters
ValueTypetype of the value
Returns
std::enable_if<std::is_same<ValueType, bool>::value, bool>::type bool type result

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