Samchon Framework for CPP  1.0.0
samchon::protocol::InvokeParameter Class Reference

A parameter of an Invoke. More...

#include <InvokeParameter.hpp>

Collaboration diagram for samchon::protocol::InvokeParameter:

Public Member Functions

 InvokeParameter ()
 Default Constructor. More...
 
 InvokeParameter (const std::string &name, const std::string &type, const std::string &val)
 Construct from arguments. More...
 
template<typename T >
 InvokeParameter (const std::string &name, const T &val)
 Construct with its name and a value. More...
 
 InvokeParameter (const std::string &name, std::string &&str)
 Construct from the name and a moved string. More...
 
 InvokeParameter (const std::string &name, ByteArray &&byte_array)
 Construct from name and a moved ByteArray. More...
 
virtual auto key () const -> std::string override
 Get a key that can identify the Entity uniquely. More...
 
auto getName () const -> std::string
 Get name. More...
 
auto getType () const -> std::string
 Get type. More...
 
template<typename T >
auto getValue () const -> T
 Get value. More...
 
auto getValueAsXML () const -> std::shared_ptr< library::XML >
 Get value as XML object. More...
 
template<typename T >
auto referValue () const -> const T &
 Reference value. More...
 
template<typename T >
auto moveValue () -> T
 Move value. More...
 

Protected Attributes

std::string name
 A name can represent the parameter. More...
 
std::string type
 Type of the parameter. More...
 
std::string str
 A string value if the type is "string" or "number". More...
 
std::shared_ptr< library::XMLxml
 An XML object if the type is "XML". More...
 
ByteArray byte_array
 A binary value if the type is "ByteArray". More...
 

Detailed Description

A parameter of an Invoke.

A parameter with its name, type and value in an Invoke message.

InvokeParameter supports 4 types pre-defined.

You can specify InvokeParameter to have some type which is not one of the basic 4 types, but values of the custom type must be enable to expressed by one of those types; number, string, XML and ByteArray.

Basic Components
Note

A member variable void* representing any type of value is deprecated.

Since C++11, method of void pointer (Declare a variable as void pointer whose type can not specified. And convert the pointer type to specified one for each case) is recommended to avoid.

As that reason, the void value was a candidate to be deprecated or to be replaced to boost::any. And the void value is really deprecated since version v1.0.

See also
IProtocol Protocol - Standard Message
Author
Jeongho Nam http://samchon.org

Definition at line 47 of file InvokeParameter.hpp.

Constructor & Destructor Documentation

samchon::protocol::InvokeParameter::InvokeParameter ( )
inline

Default Constructor.

Definition at line 94 of file InvokeParameter.hpp.

Referenced by InvokeParameter().

Here is the caller graph for this function:

samchon::protocol::InvokeParameter::InvokeParameter ( const std::string &  name,
const std::string &  type,
const std::string &  val 
)
inline

Construct from arguments.

Specifies all arguments of an InvokeParameter. You can specify a custom type, that is not one of number or string, but value of the type must be enable to expressed by a string.

If you want to express an object or container group, use XML instead; Invoke::InvokeParameter(string, XML).

Parameters
nameA name can represent the InvokeParameter
typeType of value in the InvokeParameter
valueA value capsuled by a string

Definition at line 112 of file InvokeParameter.hpp.

References name, and type.

template<typename T >
samchon::protocol::InvokeParameter::InvokeParameter ( const std::string &  name,
const T &  val 
)
inline

Construct with its name and a value.

Type of the InvokeParameter will be determined automatically.

Type supported in the template constructor:

  • number
    • (unsigned) short
    • (unsigned) long
    • (unsigned) long long
    • (unsigned) int
    • float
    • double
    • long double
  • string
  • XML
    • std::shared_ptr<library::XML>
    • Entity; protocol::Entity::toXML()
  • ByteArray
Template Parameters
_TyType of value

Definition at line 153 of file InvokeParameter.hpp.

References InvokeParameter(), and name.

Here is the call graph for this function:

samchon::protocol::InvokeParameter::InvokeParameter ( const std::string &  name,
std::string &&  str 
)
inline

Construct from the name and a moved string.

Definition at line 172 of file InvokeParameter.hpp.

References name.

samchon::protocol::InvokeParameter::InvokeParameter ( const std::string &  name,
ByteArray &&  byte_array 
)
inline

Construct from name and a moved ByteArray.

Definition at line 183 of file InvokeParameter.hpp.

References byte_array, name, str, samchon::WeakString::str(), and xml.

Here is the call graph for this function:

Member Function Documentation

virtual auto samchon::protocol::InvokeParameter::key ( ) const -> std::string
inlineoverridevirtual

Get a key that can identify the Entity uniquely.

If identifier of the Entity is not atomic value, returns a string represents the composite identifier. If identifier of the Entity is not string, converts the identifier to string and returns the string.

Returns
An identifier

Reimplemented from samchon::protocol::Entity<>.

Definition at line 266 of file InvokeParameter.hpp.

References name.

auto samchon::protocol::InvokeParameter::getName ( ) const -> std::string
inline

Get name.

Definition at line 274 of file InvokeParameter.hpp.

References name.

auto samchon::protocol::InvokeParameter::getType ( ) const -> std::string
inline

Get type.

Definition at line 282 of file InvokeParameter.hpp.

References type.

template<typename T >
auto samchon::protocol::InvokeParameter::getValue ( ) const -> T
inline

Get value.

Template Parameters
_TyType of value to get

Definition at line 292 of file InvokeParameter.hpp.

References byte_array, str, and xml.

auto samchon::protocol::InvokeParameter::getValueAsXML ( ) const -> std::shared_ptr<library::XML>
inline

Get value as XML object.

Same with getValue< std::shared_ptr<library::XML> >();

Definition at line 319 of file InvokeParameter.hpp.

References byte_array, moveValue(), referValue(), str, and xml.

Here is the call graph for this function:

template<typename T >
auto samchon::protocol::InvokeParameter::referValue ( ) const -> const T &

Reference value.

Template Parameters
_TyType of value to reference

Referenced by getValueAsXML().

Here is the caller graph for this function:

template<typename T >
auto samchon::protocol::InvokeParameter::moveValue ( ) -> T

Move value.

Template Parameters
_TyType of value to move

Referenced by getValueAsXML().

Here is the caller graph for this function:

Member Data Documentation

std::string samchon::protocol::InvokeParameter::name
protected

A name can represent the parameter.

Definition at line 58 of file InvokeParameter.hpp.

Referenced by getName(), InvokeParameter(), and key().

std::string samchon::protocol::InvokeParameter::type
protected

Type of the parameter.

List of pre-defined types

Definition at line 70 of file InvokeParameter.hpp.

Referenced by getType(), and InvokeParameter().

std::string samchon::protocol::InvokeParameter::str
protected

A string value if the type is "string" or "number".

Definition at line 75 of file InvokeParameter.hpp.

Referenced by getValue(), getValueAsXML(), and InvokeParameter().

std::shared_ptr<library::XML> samchon::protocol::InvokeParameter::xml
protected

An XML object if the type is "XML".

Definition at line 80 of file InvokeParameter.hpp.

Referenced by getValue(), getValueAsXML(), and InvokeParameter().

ByteArray samchon::protocol::InvokeParameter::byte_array
protected

A binary value if the type is "ByteArray".

Definition at line 85 of file InvokeParameter.hpp.

Referenced by getValue(), getValueAsXML(), and InvokeParameter().


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