Samchon Framework for CPP  1.0.0
samchon::protocol::ExternalSystemArray Class Referenceabstract

An array of ExternalSystem(s). More...

#include <ExternalSystemArray.hpp>

Collaboration diagram for samchon::protocol::ExternalSystemArray:

Public Member Functions

 ExternalSystemArray ()
 Default Constructor. More...
 
virtual void start ()=0
 Start interaction. More...
 
auto hasRole (const std::string &) const -> bool
 Test whether has a role. More...
 
auto getRole (const std::string &) const -> std::shared_ptr< ExternalSystemRole >
 Get a role. More...
 
virtual void sendData (std::shared_ptr< Invoke >) override
 Sends an Invoke message to related ExternalSystem(s). More...
 
virtual void replyData (std::shared_ptr< Invoke >) override
 Handle replied Invoke message. More...
 
virtual auto TAG () const -> std::string override
 A tag name when represented by XML. More...
 
virtual auto CHILD_TAG () const -> std::string override
 A tag name of children. More...
 
- Public Member Functions inherited from samchon::protocol::EntityGroup< _Container, _ETy, T >
 EntityGroup ()
 Default Constructor. More...
 
virtual void construct (std::shared_ptr< library::XML > xml)
 Construct data of the Entity from an XML object. More...
 
auto has (const std::string &key) const -> bool
 Indicates whether a container has an object having the specified identifier. More...
 
auto get (const std::string &key) -> value_type &
 Access the element by specified identifier(key). More...
 
auto get (const std::string &key) const -> const value_type &
 Access the const element by specified identifier(key). More...
 
virtual auto toXML () const -> std::shared_ptr< library::XML >
 Get an XML object represents the EntityGroup. More...
 
- Public Member Functions inherited from samchon::protocol::Entity
 Entity ()
 Default Constructor. More...
 
virtual auto key () const -> std::string
 Get a key that can identify the Entity uniquely. More...
 
- Public Member Functions inherited from samchon::protocol::IEntityGroup
 IEntityGroup ()
 Default Constructor. More...
 
- Public Member Functions inherited from samchon::protocol::IProtocol
 IProtocol ()
 Default Constructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from samchon::protocol::EntityGroup< _Container, _ETy, T >
virtual auto createChild (std::shared_ptr< library::XML >) -> entity_type *=0
 Factory method of a child Entity. More...
 

Detailed Description

An array of ExternalSystem(s).

ExternalSystemArray is an abstract class containing and managing external system drivers.

Also, ExternalSystemArray can access to ExternalSystemRole(s) directly. With the method, you can use an ExternalSystemRole as "logical proxy" of an ExternalSystem. 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.

ExternalSystemArray::getRole("something")->sendData(invoke);
protocol_external_system.png
Example Sources
See also
samchon::protocol
Author
Jeongho Nam http://samchon.org

Definition at line 44 of file ExternalSystemArray.hpp.

Constructor & Destructor Documentation

ExternalSystemArray::ExternalSystemArray ( )

Default Constructor.

Definition at line 18 of file ExternalSystemArray.cpp.

Member Function Documentation

virtual void samchon::protocol::ExternalSystemArray::start ( )
pure virtual

Start interaction.

An abstract method starting interaction with external systems.

If external systems are servers, starts connection to them, else clients, opens a server and accepts the external systems. You can addict your own procudures of starting drivers, but if you directly override method of abstract ExternalSystemArray, be careful about virtual inheritance.

Implemented in samchon::example::interaction::Master, samchon::protocol::master::DistributedSystemArray, samchon::protocol::master::DistributedSystemArrayMediator, samchon::example::interaction::Chief, samchon::protocol::master::ParallelSystemArrayMediator, samchon::protocol::ExternalClientArray, samchon::protocol::master::DistributedClientArrayMediator, samchon::protocol::master::ParallelClientArrayMediator, samchon::protocol::master::DistributedClientArray, samchon::protocol::master::DistributedServerArrayMediator, samchon::protocol::master::ParallelServerArrayMediator, samchon::protocol::master::DistributedServerArray, and samchon::protocol::ExternalServerArray.

auto ExternalSystemArray::hasRole ( const std::string &  name) const -> bool

Test whether has a role.

Parameters
nameName of an ExternalSystemRole
Returns
Whether has or not

Definition at line 26 of file ExternalSystemArray.cpp.

auto ExternalSystemArray::getRole ( const std::string &  name) const -> std::shared_ptr<ExternalSystemRole>

Get a role.

Parameters
nameName of an ExternalSystemRole
Returns
A shared pointer of specialized role

Definition at line 34 of file ExternalSystemArray.cpp.

void ExternalSystemArray::sendData ( std::shared_ptr< Invoke )
overridevirtual

Sends an Invoke message to related ExternalSystem(s).

If listener of the Invoke message is registered on some ExternalSystemRole(s), sends the Invoke message to related ExternalSystem(s) (containing the ExternalSystemRole(s)). If cannot find any ExternalSystemRole, sends the Invoke message to all ExternalSystem(s) belongs to the ExternalSystemArray.

Parameters
invokeInvoke message to send

Reimplemented from samchon::protocol::IProtocol.

Definition at line 46 of file ExternalSystemArray.cpp.

References samchon::protocol::EntityGroup< _Container, _ETy, T >::has(), and samchon::protocol::ExternalSystemRole::sendData().

Here is the call graph for this function:

void ExternalSystemArray::replyData ( std::shared_ptr< Invoke )
overridevirtual

Handle replied Invoke message.

Nothing is defined in the ExternalSystemArray::replyData(). It's only for avoid the method to have a status "not overriden, abstract".

Parameters
invokeInvoke message to send

Reimplemented from samchon::protocol::IProtocol.

Definition at line 65 of file ExternalSystemArray.cpp.

auto ExternalSystemArray::TAG ( ) const -> std::string
overridevirtual

A tag name when represented by XML.

Returns
A tag name

Implements samchon::protocol::Entity.

Definition at line 73 of file ExternalSystemArray.cpp.

auto ExternalSystemArray::CHILD_TAG ( ) const -> std::string
overridevirtual

A tag name of children.

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

Implements samchon::protocol::IEntityGroup.

Definition at line 77 of file ExternalSystemArray.cpp.


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