Samchon Framework for CPP
1.0.0
|
A role belongs to an external system. More...
#include <ExternalSystemRole.hpp>
Public Member Functions | |
ExternalSystemRole (ExternalSystem *) | |
Construct from external system driver. More... | |
virtual void | construct (std::shared_ptr< library::XML >) override |
Construct data of the Entity from an XML object. More... | |
auto | getSystem () const -> ExternalSystem * |
Get an external system driver. More... | |
virtual auto | key () const -> std::string override |
Get a key that can identify the Entity uniquely. More... | |
auto | hasSendListener (const std::string &) const -> bool |
Test whether has a listener for send in the role. More... | |
auto | hasReplyListener (const std::string &) const -> bool |
Test whether has a listener for reply in the role. More... | |
virtual void | sendData (std::shared_ptr< Invoke >) override |
Send a message. More... | |
virtual auto | TAG () const -> std::string override |
A tag name when represented by XML. More... | |
virtual auto | toXML () const -> std::shared_ptr< library::XML > override |
Get an XML object represents the Entity. More... | |
![]() | |
Entity () | |
Default Constructor. More... | |
![]() | |
IProtocol () | |
Default Constructor. More... | |
virtual void | replyData (std::shared_ptr< Invoke >) |
Reply a message. More... | |
Protected Attributes | |
std::string | name |
A name representing the role. More... | |
std::set< std::string > | replyListeners |
Listeners to reply in the role. More... | |
std::set< std::string > | sendListeners |
Listeners to send in the role. More... | |
Private Attributes | |
ExternalSystem * | system |
A driver of external system containing the ExternalSystemRole. More... | |
A role belongs to an external system.
ExternalSystemRole is a 'control' class groupping methods, handling Invoke messages interacting with an external system that the ExternalSystemRole is belonged to, by a subject or unit of a module.
ExternalSystemRole can be a "logical proxy" for an ExternalSystem which is containing the ExternalSystemRole. Of course, the ExternalSystemRole is belonged to an ExternalSystem. However, if you access an ExternalSystemRole from an ExternalSystemArray directly, not passing by a belonged ExternalSystem, and send an Invoke message even you're not knowing which ExternalSystem is related in, the ExternalSystemRole acted a role of proxy.
It's called as "Proxy pattern". With the pattern, you can only concentrate on ExternalSystemRole itself, what to do with Invoke message, irrespective of the ExternalSystemRole is belonged to which ExternalSystem.
Definition at line 39 of file ExternalSystemRole.hpp.
ExternalSystemRole::ExternalSystemRole | ( | ExternalSystem * | system | ) |
Construct from external system driver.
system | A driver of external system the ExternalSystemRole is belonged to. |
Definition at line 11 of file ExternalSystemRole.cpp.
References system.
|
overridevirtual |
Construct data of the Entity from an XML object.
Overrides the construct() method and fetch data of member variables from the XML.
By recommended guidance, data representing member variables are contained in properties of the put XML object.
xml | An xml used to construct data of entity |
Implements samchon::protocol::Entity.
Reimplemented in samchon::protocol::master::DistributedSystemRole.
Definition at line 17 of file ExternalSystemRole.cpp.
References name, replyListeners, and sendListeners.
Referenced by samchon::protocol::master::DistributedSystemRole::construct().
auto ExternalSystemRole::getSystem | ( | ) | const -> ExternalSystem* |
Get an external system driver.
Definition at line 38 of file ExternalSystemRole.cpp.
References system.
|
overridevirtual |
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.
Reimplemented from samchon::protocol::Entity.
Definition at line 42 of file ExternalSystemRole.cpp.
References name.
Referenced by hasReplyListener(), and hasSendListener().
auto ExternalSystemRole::hasSendListener | ( | const std::string & | ) | const -> bool |
Test whether has a listener for send in the role.
Definition at line 47 of file ExternalSystemRole.cpp.
References key(), and sendListeners.
auto ExternalSystemRole::hasReplyListener | ( | const std::string & | ) | const -> bool |
Test whether has a listener for reply in the role.
Definition at line 51 of file ExternalSystemRole.cpp.
References key(), and replyListeners.
|
overridevirtual |
Send a message.
Sends Invoke message to a network system or shifts the responsibility to related chain.
invoke | An Invoke message to send to a network system |
Reimplemented from samchon::protocol::IProtocol.
Reimplemented in samchon::protocol::master::DistributedSystemRole.
Definition at line 59 of file ExternalSystemRole.cpp.
References samchon::protocol::IClient::sendData(), and system.
Referenced by samchon::protocol::ExternalSystemArray::sendData().
|
overridevirtual |
A tag name when represented by XML.
Implements samchon::protocol::Entity.
Definition at line 67 of file ExternalSystemRole.cpp.
|
overridevirtual |
Get an XML object represents the Entity.
Returns an XML object that can represents the Entity containing member variables into properties.
A member variable (not object, but atomic value like number, string or date) is categorized as a property within the framework of entity side. Thus, when overriding a toXML() method and archiving member variables to an XML object to return, puts each variable to be a property belongs to only an XML object.
Don't archive the member variable of atomic value to XML::value causing enormouse creation of XML objects to number of member variables. An Entity must be represented by only an XML instance (tag).
Standard Usage | Non-standard usage abusing value |
---|---|
<memberList> <member id='jhnam88' name='Jeongho+Nam' birthdate='1988-03-11' /> <member id='master' name='Administartor' birthdate='2011-07-28' /> </memberList> | <member> <id>jhnam88</id> <name>Jeongho+Nam</name> <birthdate>1988-03-11</birthdate> </member> |
Reimplemented from samchon::protocol::Entity.
Reimplemented in samchon::protocol::master::DistributedSystemRole.
Definition at line 72 of file ExternalSystemRole.cpp.
References name, replyListeners, sendListeners, and samchon::protocol::Entity::toXML().
Referenced by samchon::protocol::master::DistributedSystemRole::toXML().
|
private |
A driver of external system containing the ExternalSystemRole.
Definition at line 50 of file ExternalSystemRole.hpp.
Referenced by ExternalSystemRole(), getSystem(), and sendData().
|
protected |
A name representing the role.
Definition at line 56 of file ExternalSystemRole.hpp.
Referenced by construct(), key(), and toXML().
|
protected |
Listeners to reply in the role.
Definition at line 61 of file ExternalSystemRole.hpp.
Referenced by construct(), hasReplyListener(), and toXML().
|
protected |
Listeners to send in the role.
Definition at line 66 of file ExternalSystemRole.hpp.
Referenced by construct(), hasSendListener(), and toXML().