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

A role belongs to a system. More...

#include <SystemRole.hpp>

Collaboration diagram for samchon::protocol::SystemRole:

Public Member Functions

 SystemRole ()
 Default Constructor. More...
 
virtual void construct (std::shared_ptr< library::XML >) override
 Construct data of the Entity from an XML object. More...
 
virtual auto key () const -> std::string override
 Get a key that can identify the Entity uniquely. More...
 
auto hasListener (const std::string &) const -> bool
 Test whether has a listener in the role. 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...
 
- 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...
 
virtual void sendData (std::shared_ptr< Invoke >)
 Send a message. More...
 

Protected Attributes

std::string name
 A name representing the role. More...
 
std::set< std::string > listeners
 Listeners belongs to the role. More...
 

Detailed Description

A role belongs to a system.

SystemRole is an abstract and a 'control' class groupping methods, handling Invoke messages interacting with an system that the SystemRole is belonged to, by a subject or unit of a module.

Author
Jeongho Nam http://samchon.org

Definition at line 23 of file SystemRole.hpp.

Constructor & Destructor Documentation

SystemRole::SystemRole ( )

Default Constructor.

Definition at line 12 of file SystemRole.cpp.

Member Function Documentation

void SystemRole::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

Implements samchon::protocol::Entity.

Definition at line 17 of file SystemRole.cpp.

References listeners, and name.

auto SystemRole::key ( ) const -> std::string
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.

Returns
An identifier

Reimplemented from samchon::protocol::Entity.

Definition at line 33 of file SystemRole.cpp.

References name.

auto SystemRole::hasListener ( const std::string &  ) const -> bool

Test whether has a listener in the role.

Definition at line 38 of file SystemRole.cpp.

References listeners, and name.

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

A tag name when represented by XML.

Returns
A tag name

Implements samchon::protocol::Entity.

Definition at line 46 of file SystemRole.cpp.

auto SystemRole::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::Entity.

Definition at line 51 of file SystemRole.cpp.

References listeners, name, and samchon::protocol::Entity::toXML().

Here is the call graph for this function:

Member Data Documentation

std::string samchon::protocol::SystemRole::name
protected

A name representing the role.

Definition at line 33 of file SystemRole.hpp.

Referenced by construct(), hasListener(), key(), and toXML().

std::set<std::string> samchon::protocol::SystemRole::listeners
protected

Listeners belongs to the role.

Definition at line 38 of file SystemRole.hpp.

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


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