Samchon Framework for CPP
1.0.0
|
A packer planning the best packaging. More...
#include <Packer.hpp>
Public Member Functions | |
Packer () | |
Default Constructor. More... | |
Packer (shared_ptr< ProductArray > productArray) | |
Construct from products and wrapper. More... | |
Packer (const Packer &packer) | |
Copy Constructor. More... | |
auto | productSize () const -> size_t |
Get number of products to package. More... | |
auto | calcPrice () const -> int |
Calculate price of the wrappers. More... | |
void | optimize (size_t start=0, size_t size=-1) |
Find the best packaging method. More... | |
virtual auto | TAG () const -> string override |
A tag name when represented by XML. More... | |
virtual auto | CHILD_TAG () const -> string override |
A tag name of children. More... | |
virtual auto | toXML () const -> shared_ptr< XML > override |
Get an XML object represents the EntityGroup. More... | |
auto | toString () const -> string |
Return a string represents an packaging method. More... | |
![]() | |
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... | |
![]() | |
Entity () | |
Default Constructor. More... | |
virtual auto | key () const -> std::string |
Get a key that can identify the Entity uniquely. More... | |
![]() | |
IEntityGroup () | |
Default Constructor. More... | |
Protected Attributes | |
shared_ptr< ProductArray > | productArray |
Prodcut(s) to package in some Wrapper(s) More... | |
Additional Inherited Members | |
![]() | |
virtual auto | createChild (std::shared_ptr< library::XML >) -> entity_type *=0 |
Factory method of a child Entity. More... | |
A packer planning the best packaging.
Retrieves the solution of packaging by combination permuation and factorial case.
Be careful about number of products and wrappers.
The time complexity of Packer overs O(m^n). Elapsed time of calculation increases enourmously. Do not use Packer if the digits of number of products or wrappers overs 2.
Definition at line 36 of file Packer.hpp.
|
inline |
Default Constructor.
Definition at line 55 of file Packer.hpp.
|
inline |
Construct from products and wrapper.
productArray | Product(s) to input some Wrapper |
wrapperArray | Type of Wrapper(s) to be used |
Definition at line 67 of file Packer.hpp.
|
inline |
Copy Constructor.
Copy constructor of Packer does not copy children items.
Only copies member variables(productArray, wrapperArray) of Packer's.
Definition at line 80 of file Packer.hpp.
|
inline |
Get number of products to package.
Definition at line 109 of file Packer.hpp.
|
inline |
Calculate price of the wrappers.
Definition at line 117 of file Packer.hpp.
|
inline |
Find the best packaging method.
Definition at line 132 of file Packer.hpp.
References samchon::library::CaseGenerator::size().
Referenced by samchon::example::interaction::PackerSlave::optimize(), and toString().
|
inlineoverridevirtual |
A tag name when represented by XML.
Implements samchon::protocol::Entity.
Definition at line 183 of file Packer.hpp.
|
inlineoverridevirtual |
A tag name of children.
< TAG>
<CHILD_TAG />
<CHILD_TAG />
</TAG>
Implements samchon::protocol::IEntityGroup.
Definition at line 187 of file Packer.hpp.
|
inlineoverridevirtual |
Get an XML object represents the EntityGroup.
Archives the EntityGroup's own member variables only to the returned XML object.
Do not consider about archiving children Entity objects' data in EntityGroup::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 EntityGroup::toXML().
Archives only data of EntityGroup'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::EntityGroup< _Container, _ETy, T >.
Definition at line 192 of file Packer.hpp.
Referenced by samchon::example::interaction::Chief::callPacker(), and samchon::example::interaction::PackerSlave::optimize().
|
inline |
Return a string represents an packaging method.
Definition at line 203 of file Packer.hpp.
References optimize(), and toString().
Referenced by samchon::example::interaction::PackerSlave::optimize(), samchon::example::interaction::Reporter::printPacker(), and toString().
|
protected |
Prodcut(s) to package in some Wrapper(s)
Definition at line 46 of file Packer.hpp.