Samchon Framework for CPP
1.0.0
|
An Entity and a static list containing Entity objects. More...
#include <EntityList.hpp>
Public Member Functions | |
EntityList () | |
Default Constructor. More... | |
virtual void | construct (std::shared_ptr< library::XML > xml) override |
Construct data of the Entity from an XML object. More... | |
virtual auto | toXML () const -> std::shared_ptr< library::XML > override |
Get an XML object represents the EntityList. More... | |
![]() | |
virtual auto | TAG () const -> std::string=0 |
A tag name when represented by XML. More... | |
Entity () | |
Default Constructor. More... | |
virtual auto | key () const -> std::string |
Get a key that can identify the Entity uniquely. More... | |
![]() | |
IEntityGroup () | |
Default Constructor. More... | |
Additional Inherited Members | |
![]() | |
virtual auto | CHILD_TAG () const -> std::string=0 |
A tag name of children. More... | |
An Entity and a static list containing Entity objects.
EntityList is a static array containing children objects derived from an Entity class.
EntityList, its allocated memory space for each child is fixed and cannot contain derived a entity class from the child entity type. It has advantages on performance by direct accessment and static memory allocation for child, however, its increasement of performance is not eminent.
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).
If a data structure has recursive and hierarchical relationship, never use the EntityList. EntityList's memory allocation is static. The recursive relationship causes infinite memory allocation. It must generates stack overflow.
Use EntityGroup instead.
Unlike EntityArray containing children serialized, EntityList's static memory allocation and accessment for a child, its advantage doesn't seemed to have eminent advantage on performance. As there's not meaningful advantage but has only disadvantage that cannot containing derived objects, I'm planning to depreciate the EntityList in next generation.
Use SharedEntityList instead will be better I think.
Definition at line 52 of file EntityList.hpp.
samchon::protocol::EntityList< T >::EntityList | ( | ) |
Default Constructor.
|
inlineoverridevirtual |
Construct data of the Entity from an XML object.
Constructs the EntityList's own member variables only from the input XML object.
Do not consider about constructing children Entity objects' data in EntityList::construct(). Those children Entity objects' data will constructed by their own construct() method. Even insertion of XML objects representing children are done by abstract method of EntityList::toXML().
Constructs only data of EntityList's own.
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.
Definition at line 81 of file EntityList.hpp.
References samchon::protocol::IEntityGroup::CHILD_TAG().
|
inlineoverridevirtual |
Get an XML object represents the EntityList.
Archives the EntityList's own member variables only to the returned XML object.
Do not consider about archiving children Entity objects' data in EntityList::toXML(). Those children Entity objects will converted to XML object by their own toXML() method. The insertion of XML objects representing children are done by abstract method of EntityList::toXML().
Archives only data of EntityList's own.
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.
Definition at line 109 of file EntityList.hpp.
References samchon::protocol::IEntityGroup::CHILD_TAG(), and samchon::protocol::Entity::toXML().