Samchon Framework for CPP  1.0.0
samchon::examples::packer::Wrapper Class Reference

A wrapper can contain products. More...

#include <Wrapper.hpp>

Collaboration diagram for samchon::examples::packer::Wrapper:

Public Member Functions

 Wrapper ()
 Default Constructor. More...
 
 Wrapper (const string &name, int price, int volume, int weight)
 Construct from argument of a wrapper. More...
 
 Wrapper (const Wrapper &wrapper)
 Copy Constructor. More...
 
auto tryInsert (shared_ptr< Product > product) -> bool
 Try to insert a product into the wrapper. More...
 
virtual auto toString () const -> string override
 Return a string represent the wrapper. More...
 
- Public Member Functions inherited from samchon::examples::packer::ProductArray
virtual auto CHILD_TAG () const -> string override
 A tag name of children. More...
 
- Public Member Functions inherited from samchon::protocol::EntityGroup< Container, T, Key >
virtual void construct (std::shared_ptr< library::XML > xml)
 Construct data of the Entity from an XML object. More...
 
auto find (const typename child_type::key_type &key) -> typename container_type::iterator
 Get iterator to element. More...
 
auto find (const typename child_type::key_type &key) const -> typename container_type::const_iterator
 Get const iterator to element. More...
 
auto has (const typename child_type::key_type &key) const -> bool
 Indicates whether a container has an object having the specified identifier. More...
 
auto count (const typename child_type::key_type &key) const -> size_t
 Count elements with a specific key. More...
 
auto get (const typename child_type::key_type &key) -> typename container_type::value_type &
 Access the element by specified identifier(key). More...
 
auto get (const typename child_type::key_type &key) const -> const typename container_type::value_type &
 Access the const element by specified identifier(key). More...
 
- Public Member Functions inherited from samchon::protocol::Entity< Key >
virtual auto key () const -> Key
 Get a key that can identify the Entity uniquely. More...
 
- Public Member Functions inherited from samchon::examples::packer::Instance
 Instance ()
 Default Constructor. More...
 
 Instance (const string &name, int price, int volume, int weight)
 Construct from instance. More...
 
auto get_name () const -> string
 Get name. More...
 
auto getPrice () const -> int
 Get price. More...
 
auto getVolume () const -> int
 Get volume. More...
 
auto getWeight () const -> int
 Get weight. More...
 
- Public Member Functions inherited from samchon::protocol::Entity< std::string >
virtual auto key () const -> std::string
 Get a key that can identify the Entity uniquely. More...
 

Additional Inherited Members

- Protected Member Functions inherited from samchon::protocol::EntityGroup< Container, T, Key >
virtual auto createChild (std::shared_ptr< library::XML >) -> child_type *=0
 Factory method of a child Entity. More...
 
- Protected Attributes inherited from samchon::examples::packer::Instance
string name
 Name represent the Instance. More...
 
int price
 Price of an instance -> 1,000 won. More...
 
int volume
 Volume of an instance -> 130 cm^3. More...
 
int weight
 Weight of an instance -> 1,200 g. More...
 

Detailed Description

A wrapper can contain products.

A wrapper containing products with its limitation of weight and volume.

example_packer.png
Author
Jeongho Nam http://samchon.org

Definition at line 27 of file Wrapper.hpp.

Constructor & Destructor Documentation

samchon::examples::packer::Wrapper::Wrapper ( )
inline

Default Constructor.

Definition at line 41 of file Wrapper.hpp.

samchon::examples::packer::Wrapper::Wrapper ( const string &  name,
int  price,
int  volume,
int  weight 
)
inline

Construct from argument of a wrapper.

Parameters
nameCategory name of a wrapper, can be identified
pricePrice of a wrapper
volumeLimited volume of a wrapper can put in.
weightLimited weight of a wrapper can put in.

Definition at line 55 of file Wrapper.hpp.

samchon::examples::packer::Wrapper::Wrapper ( const Wrapper wrapper)
inline

Copy Constructor.

Copy constructor of wrapper does not copy children items. Only copies arguments of Instance's.

Definition at line 66 of file Wrapper.hpp.

Member Function Documentation

auto samchon::examples::packer::Wrapper::tryInsert ( shared_ptr< Product product) -> bool
inline

Try to insert a product into the wrapper.

If the Wrapper has enough volume and limit of weight, inserts the Product into the Wrapper and returns true. If not enough, does not insert and just return false.

Parameters
productA product try to insert in.
Returns
Whether to success put in

Definition at line 91 of file Wrapper.hpp.

Referenced by samchon::examples::packer::WrapperArray::optimize().

Here is the caller graph for this function:

virtual auto samchon::examples::packer::Wrapper::toString ( ) const -> string
inlineoverridevirtual

Return a string represent the wrapper.

Returns a string of the Wrapper and Product(s) packaged in.

Returns
A string represents the Wrapper and contained Product(s).

Reimplemented from samchon::examples::packer::Instance.

Definition at line 134 of file Wrapper.hpp.

References samchon::examples::packer::Instance::toString().

Here is the call graph for this function:


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