Samchon Framework for CPP
1.0.0
|
An entity, a standard data class. More...
#include <Entity.hpp>
Public Member Functions | |
virtual auto | TAG () const -> std::string=0 |
A tag name when represented by XML. More... | |
Entity () | |
Default Constructor. More... | |
virtual void | construct (std::shared_ptr< library::XML >)=0 |
Construct data of the Entity from an XML object. More... | |
virtual auto | key () const -> std::string |
Get a key that can identify the Entity uniquely. More... | |
virtual auto | toXML () const -> std::shared_ptr< library::XML > |
Get an XML object represents the Entity. More... | |
An entity, a standard data class.
Entity is a class for standardization of expression method using on network I/O by XML. If Invoke is a standard message protocol of Samchon Framework which must be kept, Entity is a recommended semi-protocol of message for expressing a data class. Following the semi-protocol Entity is not imposed but encouraged.
As we could get advantages from standardization of message for network I/O with Invoke, we can get additional advantage from standardizing expression method of data class with Entity. We do not need to know a part of network communication. Thus, with the Entity, we can only concentrate on entity's own logics and relationships between another entities. Entity does not need to how network communications are being done.
I say repeatedly. Expression method of Entity is recommended, but not imposed. It's a semi protocol for network I/O but not a essential protocol must be kept. The expression method of Entity, using on network I/O, is expressed by XML string.
If your own network system has a critical performance issue on communication data class, it would be better to using binary communication (with ByteArray or boost::serialization). Don't worry about the problem! Invoke also provides methods for binary data (ByteArray).
Definition at line 48 of file Entity.hpp.
Entity::Entity | ( | ) |
Default Constructor.
Definition at line 20 of file Entity.cpp.
|
pure virtual |
A tag name when represented by XML.
Implemented in samchon::protocol::InvokeParameter, samchon::example::packer::WrapperArray, samchon::example::packer::Packer, samchon::library::GAParameters, samchon::protocol::InvokeHistory, samchon::protocol::Invoke, samchon::example::tsp::GeometryPoint, samchon::example::tsp::Scheduler, samchon::example::tsp::Travel, samchon::namtree::NTCriteria, samchon::protocol::ExternalSystemArray, samchon::protocol::ExternalSystem, samchon::example::packer::Wrapper, samchon::protocol::ExternalSystemRole, samchon::namtree::NTParameter, samchon::namtree::NTParameterDetermined, samchon::protocol::SystemRole, samchon::example::packer::Product, samchon::protocol::master::ParallelSlaveSystemMediator, samchon::protocol::master::DistributedSlaveSystemMediator, samchon::example::packer::ProductArray, samchon::example::chat_service::ChatRoom, samchon::namtree::NTSide, samchon::protocol::InvokeHistoryArray, samchon::namtree::NTParameterArray, samchon::example::chat_service::ChatMessage, and samchon::library::FTInstance.
|
pure virtual |
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 |
Implemented in samchon::protocol::InvokeParameter, samchon::protocol::master::DistributedSystem, samchon::namtree::NTCriteria, samchon::namtree::NTFile, samchon::protocol::InvokeHistory, samchon::protocol::master::ParallelSystem, samchon::protocol::EntityGroup< _Container, _ETy, T >, samchon::protocol::ExternalSystem, samchon::protocol::EntityList< T >, samchon::protocol::ExternalSystemRole, samchon::protocol::EntityArray< T >, samchon::protocol::Invoke, samchon::protocol::master::DistributedSystemRole, samchon::protocol::master::PRInvokeHistory, samchon::protocol::master::DistributedSystemArray, samchon::example::chat_service::ChatMessage, samchon::namtree::INTExplore, samchon::namtree::NTParameterDetermined, samchon::protocol::master::ParallelSystemArrayMediator, samchon::protocol::master::DistributedSystemArrayMediator, samchon::namtree::NTParameter, samchon::protocol::SystemRole, samchon::namtree::NTSide, samchon::protocol::ExternalClientArray, samchon::protocol::ExternalServer, samchon::protocol::master::DistributedClientArrayMediator, samchon::protocol::master::ParallelClientArrayMediator, samchon::protocol::master::DistributedClientArray, samchon::protocol::master::DistributedServer, and samchon::protocol::master::ParallelServer.
Definition at line 23 of file Entity.cpp.
|
virtual |
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 in samchon::protocol::InvokeParameter, samchon::protocol::InvokeHistory, samchon::example::tsp::GeometryPoint, samchon::protocol::ExternalSystem, samchon::protocol::ExternalSystemRole, samchon::library::FTInstance, samchon::namtree::NTParameter, samchon::namtree::NTParameterDetermined, and samchon::protocol::SystemRole.
Definition at line 15 of file Entity.cpp.
Referenced by samchon::protocol::EntityGroup< _Container, _ETy, T >::construct(), samchon::protocol::EntityGroup< _Container, _ETy, T >::get(), samchon::protocol::master::DistributedSystemArray::getRole(), samchon::protocol::EntityGroup< _Container, _ETy, T >::has(), and samchon::protocol::master::DistributedSystemArray::hasRole().
|
virtual |
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 in samchon::protocol::InvokeParameter, samchon::protocol::EntityGroup< _Container, _ETy, T >, samchon::example::packer::WrapperArray, samchon::example::packer::Packer, samchon::library::GAParameters, samchon::protocol::InvokeHistory, samchon::protocol::Invoke, samchon::example::tsp::GeometryPoint, samchon::protocol::master::DistributedSystem, samchon::example::tsp::Scheduler, samchon::example::tsp::Travel, samchon::example::packer::Instance, samchon::namtree::NTCriteria, samchon::namtree::NTFile, samchon::protocol::ExternalSystem, samchon::protocol::master::DistributedSystemArray, samchon::example::packer::Wrapper, samchon::protocol::ExternalSystemRole, samchon::protocol::master::DistributedSystemRole, samchon::protocol::master::ParallelSystem, samchon::protocol::EntityList< T >, samchon::protocol::EntityArray< T >, samchon::example::chat_service::ChatRoom, samchon::protocol::master::PRInvokeHistory, samchon::library::FTInstance, samchon::namtree::INTExplore, samchon::namtree::NTParameter, samchon::namtree::NTParameterDetermined, samchon::protocol::master::ParallelSystemArrayMediator, samchon::example::chat_service::ChatMessage, samchon::protocol::master::DistributedSystemArrayMediator, samchon::protocol::SystemRole, samchon::protocol::ExternalClientArray, samchon::protocol::ExternalServer, samchon::library::FTFolder, samchon::namtree::NTSide, samchon::library::FTFile, samchon::protocol::master::DistributedClientArrayMediator, samchon::protocol::master::ParallelClientArrayMediator, samchon::protocol::master::DistributedClientArray, samchon::protocol::master::DistributedServer, and samchon::protocol::master::ParallelServer.
Definition at line 30 of file Entity.cpp.
Referenced by samchon::protocol::SystemRole::toXML(), samchon::example::chat_service::ChatMessage::toXML(), samchon::namtree::NTParameterDetermined::toXML(), samchon::namtree::INTExplore::toXML(), samchon::library::FTInstance::toXML(), samchon::example::chat_service::ChatRoom::toXML(), samchon::protocol::EntityArray< T >::toXML(), samchon::protocol::EntityList< T >::toXML(), samchon::protocol::ExternalSystemRole::toXML(), samchon::protocol::InvokeHistory::toXML(), samchon::library::GAParameters::toXML(), samchon::protocol::EntityGroup< _Container, _ETy, T >::toXML(), and samchon::protocol::InvokeParameter::toXML().