fipa_acl  1.4
Public Member Functions | List of all members
fipa::acl::UserdefParam Class Reference

overloaded equality operator for UserdefParam class objects More...

#include <userdef_param.h>

Public Member Functions

 UserdefParam ()
 
 UserdefParam (const std::string &name, const std::string &value="")
 
UserdefParamoperator= (const UserdefParam &other)
 
bool operator== (const UserdefParam &other) const
 
const std::string & getValue () const
 
void setValue (const std::string &value)
 
const std::string & getName () const
 
void setName (const std::string &name)
 the method checks whether the passed name string is a word or not(according to the fipa spec) More...
 
std::string toString () const
 

Detailed Description

overloaded equality operator for UserdefParam class objects

Implements the general User-defined parameters, which are present throughout the fipa specifications(FIPA at http://www.fipa.org).

Definition at line 25 of file userdef_param.h.

Constructor & Destructor Documentation

fipa::acl::UserdefParam::UserdefParam ( )

Default constructor

Definition at line 17 of file userdef_param.cpp.

18  : mName()
19  , mValue()
20 {
21 }
fipa::acl::UserdefParam::UserdefParam ( const std::string &  name,
const std::string &  value = "" 
)

Constructor for a userdefined parameter of a given name

Parameters
nameName of the userdefined parameter
valueValue of the userdefined parameter

Definition at line 23 of file userdef_param.cpp.

24  : mName(name)
25  , mValue(value)
26 {
27 }

Member Function Documentation

const std::string& fipa::acl::UserdefParam::getName ( ) const
inline

Get the name of the userdefined parameter

Returns
name

Definition at line 77 of file userdef_param.h.

77 { return mName; }
const std::string& fipa::acl::UserdefParam::getValue ( ) const
inline

Get value of the userdefined parameter

Returns
value of the userdefined parameter

Definition at line 65 of file userdef_param.h.

65 { return mValue; }
UserdefParam & fipa::acl::UserdefParam::operator= ( const UserdefParam other)

Assignment operator

Definition at line 29 of file userdef_param.cpp.

30 {
31  if(this != &other)
32  {
33  mName = other.mName;
34  mValue = other.mValue;
35  }
36 
37  return *this;
38 }
bool fipa::acl::UserdefParam::operator== ( const UserdefParam other) const

Comparision operator

Definition at line 40 of file userdef_param.cpp.

41 {
42  return mName == other.mName && mValue == other.mValue;
43 }
void fipa::acl::UserdefParam::setName ( const std::string &  name)

the method checks whether the passed name string is a word or not(according to the fipa spec)

Parameters
nameName to set for the userdefined parameter
Exceptions
std::runtime_errorif name is not valid

Definition at line 45 of file userdef_param.cpp.

46 {
47  if ( (name.find_first_of(illegalWordChars) != std::string::npos) || (illegalWordStart.find_first_of(name.c_str()[0]) != std::string::npos) )
48  {
49  throw std::runtime_error("Illegal name for userdefined-parameter");
50  }
51  mName = name;
52 }
const std::string illegalWordStart
Definition: acl_message.cpp:40
const std::string illegalWordChars
Definition: acl_message.cpp:39
void fipa::acl::UserdefParam::setValue ( const std::string &  value)
inline

Set the value associated with the userdefined parameter

Parameters
valueValue of the userdefined parameter

Definition at line 71 of file userdef_param.h.

71 { mValue = value; }
std::string fipa::acl::UserdefParam::toString ( ) const

Stringify object

Returns
string presentation

Definition at line 54 of file userdef_param.cpp.

55 {
56  return mName + ": " + mValue;
57 }

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