Samchon Framework for CPP  1.0.0
samchon::protocol::master::DistributedSystemRole Class Reference

A role of distributed processing system. More...

#include <DistributedSystemRole.hpp>

Collaboration diagram for samchon::protocol::master::DistributedSystemRole:

Public Member Functions

 DistributedSystemRole ()
 Default Constructor. More...
 
virtual void construct (std::shared_ptr< library::XML >) override
 Construct data of the Entity from an XML object. More...
 
auto getSystem () const -> ExternalSystem *=delete
 Get an external system -> deprecated. More...
 
auto getPerformance () const -> double
 Get performance. More...
 
auto getAllocationHistoryList () const -> DSRoleHistoryList *
 Get allocation histories. More...
 
auto getInvokeHistoryArray () const -> DSInvokeHistoryArray *
 Get invoke histories. More...
 
virtual void sendData (std::shared_ptr< Invoke >) override
 Send a message. More...
 
virtual auto toXML () const -> std::shared_ptr< library::XML > override
 Get an XML object represents the Entity. More...
 
- Public Member Functions inherited from samchon::protocol::ExternalSystemRole
 ExternalSystemRole (ExternalSystem *)
 Construct from external system driver. 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 auto TAG () const -> std::string override
 A tag name when represented by XML. More...
 
- Public Member Functions inherited from samchon::protocol::Entity
 Entity ()
 Default Constructor. More...
 
- Public Member Functions inherited from samchon::protocol::IProtocol
 IProtocol ()
 Default Constructor. More...
 
virtual void replyData (std::shared_ptr< Invoke >)
 Reply a message. More...
 

Protected Attributes

std::set< DistributedSystem * > allocatedSystems
 Allocated systems of about the role, at now. More...
 
double performance
 A required performance index. More...
 
DSRoleHistoryList * allocationHistoryList
 A history log for archiving role allocation to a system. More...
 
DSInvokeHistoryArrayinvokeHistoryArray
 A history log for archiving elapsed time for each process. More...
 
- Protected Attributes inherited from samchon::protocol::ExternalSystemRole
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...
 

Detailed Description

A role of distributed processing system.

DistributedSystemRole is an ExternalSystemRole allocates for distributed processing system(s). Unlike the ExternalSystemRole, DistributedSystemRole can belonged to multiple DistributedSystem(s).

protocol_master_distributed_system.png
[Inherited]

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.

protocol_external_system.png
See also
samchon::protocol
Author
Jeongho Nam http://samchon.org

Definition at line 34 of file DistributedSystemRole.hpp.

Constructor & Destructor Documentation

DistributedSystemRole::DistributedSystemRole ( )

Default Constructor.

Definition at line 20 of file DistributedSystemRole.cpp.

References invokeHistoryArray.

Member Function Documentation

void DistributedSystemRole::construct ( std::shared_ptr< library::XML )
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.

Parameters
xmlAn xml used to construct data of entity

Reimplemented from samchon::protocol::ExternalSystemRole.

Definition at line 30 of file DistributedSystemRole.cpp.

References samchon::protocol::ExternalSystemRole::construct(), and performance.

Here is the call graph for this function:

auto samchon::protocol::master::DistributedSystemRole::getSystem ( ) const -> ExternalSystem *=delete
delete

Get an external system -> deprecated.

Unlike ExternalSysemRole, DistributedSystemRole can be belonged to multiple DistributedSystem(s). By that reason, the getSystem(), a getter of a single ExternalSystem is deprecated.

auto DistributedSystemRole::getPerformance ( ) const -> double

Get performance.

Definition at line 49 of file DistributedSystemRole.cpp.

References performance.

auto DistributedSystemRole::getAllocationHistoryList ( ) const -> DSRoleHistoryList*

Get allocation histories.

Definition at line 40 of file DistributedSystemRole.cpp.

References allocationHistoryList.

auto DistributedSystemRole::getInvokeHistoryArray ( ) const -> DSInvokeHistoryArray*

Get invoke histories.

Definition at line 44 of file DistributedSystemRole.cpp.

References invokeHistoryArray.

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

Send a message.

Sends Invoke message to a network system or shifts the responsibility to related chain.

Parameters
invokeAn Invoke message to send to a network system
Todo:
Not defined yet.

Reimplemented from samchon::protocol::ExternalSystemRole.

Definition at line 57 of file DistributedSystemRole.cpp.

auto DistributedSystemRole::toXML ( ) const -> std::shared_ptr<library::XML>
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>
Returns
An XML object representing the Entity.

Reimplemented from samchon::protocol::ExternalSystemRole.

Definition at line 66 of file DistributedSystemRole.cpp.

References invokeHistoryArray, performance, samchon::protocol::ExternalSystemRole::toXML(), and samchon::protocol::EntityGroup< _Container, _ETy, T >::toXML().

Here is the call graph for this function:

Member Data Documentation

std::set<DistributedSystem*> samchon::protocol::master::DistributedSystemRole::allocatedSystems
protected

Allocated systems of about the role, at now.

Definition at line 47 of file DistributedSystemRole.hpp.

double samchon::protocol::master::DistributedSystemRole::performance
protected

A required performance index.

Definition at line 52 of file DistributedSystemRole.hpp.

Referenced by construct(), getPerformance(), and toXML().

DSRoleHistoryList* samchon::protocol::master::DistributedSystemRole::allocationHistoryList
protected

A history log for archiving role allocation to a system.

Definition at line 57 of file DistributedSystemRole.hpp.

Referenced by getAllocationHistoryList().

DSInvokeHistoryArray* samchon::protocol::master::DistributedSystemRole::invokeHistoryArray
protected

A history log for archiving elapsed time for each process.

Definition at line 62 of file DistributedSystemRole.hpp.

Referenced by DistributedSystemRole(), getInvokeHistoryArray(), and toXML().


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