Samchon Framework for CPP  1.0.0
samchon::example::packer::Instance Class Reference

A physical instance. More...

#include <Instance.hpp>

Collaboration diagram for samchon::example::packer::Instance:

Public Member Functions

 Instance ()
 Default Constructor. More...
 
 Instance (const string &name, int price, int volume, int weight)
 Construct from instance. More...
 
auto getName () 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...
 
virtual auto toXML () const -> shared_ptr< XML > override
 Get an XML object represents the Entity. More...
 
virtual auto toString () const -> string
 Return a string represents the Instance. More...
 
- Public Member Functions inherited from samchon::protocol::Entity
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...
 

Protected Attributes

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 physical instance.

A physical instance having its own name, price, volume and weight.

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

Definition at line 29 of file Instance.hpp.

Constructor & Destructor Documentation

samchon::example::packer::Instance::Instance ( )
inline

Default Constructor.

Definition at line 63 of file Instance.hpp.

samchon::example::packer::Instance::Instance ( const string &  name,
int  price,
int  volume,
int  weight 
)
inline

Construct from instance.

Parameters
nameName of the instance
pricePrice of the instance
volumeVolume of the instance
weightWeight of the instance

Definition at line 76 of file Instance.hpp.

Member Function Documentation

auto samchon::example::packer::Instance::getName ( ) const -> string
inline

Get name.

Definition at line 101 of file Instance.hpp.

auto samchon::example::packer::Instance::getPrice ( ) const -> int
inline

Get price.

Definition at line 109 of file Instance.hpp.

auto samchon::example::packer::Instance::getVolume ( ) const -> int
inline

Get volume.

Definition at line 117 of file Instance.hpp.

auto samchon::example::packer::Instance::getWeight ( ) const -> int
inline

Get weight.

Definition at line 125 of file Instance.hpp.

virtual auto samchon::example::packer::Instance::toXML ( ) const -> shared_ptr<XML>
inlineoverridevirtual

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.

Reimplemented in samchon::example::packer::Wrapper.

Definition at line 133 of file Instance.hpp.

Referenced by samchon::example::packer::Wrapper::toXML().

Here is the caller graph for this function:

virtual auto samchon::example::packer::Instance::toString ( ) const -> string
inlinevirtual

Return a string represents the Instance.

Reimplemented in samchon::example::packer::Wrapper, and samchon::example::packer::Product.

Definition at line 147 of file Instance.hpp.

References samchon::library::StringUtil::substitute().

Referenced by samchon::example::packer::Wrapper::toString().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

string samchon::example::packer::Instance::name
protected

Name represent the Instance.

Definition at line 39 of file Instance.hpp.

int samchon::example::packer::Instance::price
protected

Price of an instance -> 1,000 won.

Definition at line 44 of file Instance.hpp.

int samchon::example::packer::Instance::volume
protected

Volume of an instance -> 130 cm^3.

Definition at line 49 of file Instance.hpp.

int samchon::example::packer::Instance::weight
protected

Weight of an instance -> 1,200 g.

Definition at line 54 of file Instance.hpp.


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