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

Standard message of network I/O. More...

#include <Invoke.hpp>

Collaboration diagram for samchon::protocol::Invoke:

Public Member Functions

 Invoke (const std::string &listener)
 Construct from a listener. More...
 
virtual void construct (std::shared_ptr< library::XML > xml) override
 Construct data of the Entity from an XML object. More...
 
template<typename T , typename... _Args>
 Invoke (const std::string &listener, const T &val, const _Args &...args)
 Construct from arguments. More...
 
auto getListener () const -> std::string
 Get listener. More...
 
void setListener (const std::string &val)
 Set listener. More...
 
virtual auto CHILD_TAG () const -> std::string override
 A tag name of children. More...
 
virtual auto toXML () const -> std::shared_ptr< library::XML > override
 Get an XML object represents the EntityGroup. More...
 
- Public Member Functions inherited from samchon::protocol::EntityGroup< Container, T, Key >
auto find (const typename child_type::key_type &key) -> typename container_type::iterator
 Get iterator to element. More...
 
auto find (const typename child_type::key_type &key) const -> typename container_type::const_iterator
 Get const iterator to element. More...
 
auto has (const typename child_type::key_type &key) const -> bool
 Indicates whether a container has an object having the specified identifier. More...
 
auto count (const typename child_type::key_type &key) const -> size_t
 Count elements with a specific key. More...
 
auto get (const typename child_type::key_type &key) -> typename container_type::value_type &
 Access the element by specified identifier(key). More...
 
auto get (const typename child_type::key_type &key) const -> const typename container_type::value_type &
 Access the const element by specified identifier(key). More...
 
- Public Member Functions inherited from samchon::protocol::Entity< Key >
virtual auto key () const -> Key
 Get a key that can identify the Entity uniquely. More...
 

Protected Member Functions

virtual auto createChild (std::shared_ptr< library::XML >) -> InvokeParameter *override
 Factory method of a child Entity. More...
 

Protected Attributes

std::string listener
 Represent who listens, often be a function name. More...
 

Detailed Description

Standard message of network I/O.

Invoke is a class used in network I/O in protocol package of Samchon Framework.

The Invoke message has an XML structure like the result screen of provided example in below. We can enjoy lots of benefits by the normalized and standardized message structure used in network I/O.

The greatest advantage is that we can make any type of network system, even how the system is enourmously complicated. As network communication message is standardized, we only need to concentrate on logical relationships between network systems. We can handle each network system like a object (class) in OOD. And those relationships can be easily designed by using design pattern.

In Samchon Framework, you can make any type of network system with basic 3 + 1 componenets (IProtocol, Server and IClient + ServerConnector), by implemens or inherits them, like designing classes of S/W architecture.

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

Definition at line 35 of file Invoke.hpp.

Constructor & Destructor Documentation

samchon::protocol::Invoke::Invoke ( const std::string &  listener)
inline

Construct from a listener.

Parameters
listenerRepresents who listens the Invoke message. Almost same with Function name

Definition at line 60 of file Invoke.hpp.

References listener.

template<typename T , typename... _Args>
samchon::protocol::Invoke::Invoke ( const std::string &  listener,
const T &  val,
const _Args &...  args 
)
inline

Construct from arguments.

Template Parameters
_TyType of an argument which represents a parameter
_ArgsLeft varadic template arguments' types

Creates Invoke and InvokeParameter(s) at the same time by varadic template method.

By the varadic template constructor, you can't specify name of each InvokeParameter, but specify type and value of each InvokeParameter. If you try to record the Invoke to Database, the name of InvokeParameter will be NULL.

Note

By the varadic template constructor, name of InovkeParameter(s) will be omitted. Because of name, an identifier of an InvokeParameter, is omitted, you can't access to InvokeParameter by Invoke::has() or Invoke::get().

Parameters
listenerA string represents who listens the Invoke message. Almost same with name of a function.
valA value to be a parameter of Invoke
argsLeft arguments to be parameters of Invoke

Definition at line 107 of file Invoke.hpp.

Member Function Documentation

virtual void samchon::protocol::Invoke::construct ( std::shared_ptr< library::XML xml)
inlineoverridevirtual

Construct data of the Entity from an XML object.

Constructs the EntityGroup's own member variables only from the input XML object.

Do not consider about constructing children Entity objects' data in EntityGroup::construct(). Those children Entity objects' data will constructed by their own construct() method. Even insertion of XML objects representing children are done by abstract method of EntityGroup::toXML().

Constructs only data of EntityGroup's own.

[Inherited]

Reimplemented from samchon::protocol::EntityGroup< Container, T, Key >.

Definition at line 67 of file Invoke.hpp.

References samchon::protocol::EntityGroup< Container, T, Key >::construct().

Here is the call graph for this function:

virtual auto samchon::protocol::Invoke::createChild ( std::shared_ptr< library::XML ) -> InvokeParameter *override
inlineoverrideprotectedvirtual

Factory method of a child Entity.

EntityGroup::createChild() is a factory method creating a new child Entity which is belonged to the EntityGroup. This method is called by EntityGroup::construct(). The children construction methods Entity::construct() will be called by abstract method of the EntityGroup::construct().

Returns
A new child Entity belongs to EntityGroup.

Implements samchon::protocol::EntityGroup< Container, T, Key >.

Definition at line 75 of file Invoke.hpp.

auto samchon::protocol::Invoke::getListener ( ) const -> std::string
inline

Get listener.

Definition at line 142 of file Invoke.hpp.

References listener.

void samchon::protocol::Invoke::setListener ( const std::string &  val)
inline

Set listener.

Definition at line 150 of file Invoke.hpp.

virtual auto samchon::protocol::Invoke::CHILD_TAG ( ) const -> std::string
inlineoverridevirtual

A tag name of children.

< TAG>
     <CHILD_TAG />
     <CHILD_TAG />
</TAG>

Implements samchon::protocol::EntityGroupBase.

Definition at line 162 of file Invoke.hpp.

virtual auto samchon::protocol::Invoke::toXML ( ) const -> std::shared_ptr<library::XML>
inlineoverridevirtual

Get an XML object represents the EntityGroup.

Archives the EntityGroup's own member variables only to the returned XML object.

Do not consider about archiving children Entity objects' data in EntityGroup::toXML(). Those children Entity objects will converted to XML object by their own toXML() method. The insertion of XML objects representing children are done by abstract method of EntityGroup::toXML().

Archives only data of EntityGroup's own.

[Inherited]

Reimplemented from samchon::protocol::EntityGroup< Container, T, Key >.

Definition at line 167 of file Invoke.hpp.

References samchon::protocol::EntityGroup< Container, T, Key >::toXML().

Here is the call graph for this function:

Member Data Documentation

std::string samchon::protocol::Invoke::listener
protected

Represent who listens, often be a function name.

Definition at line 45 of file Invoke.hpp.

Referenced by getListener(), and Invoke().


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