Samchon Framework for CPP  1.0.0
NTFile.cpp
1 #include <samchon/namtree/NTFile.hpp>
2 # include <samchon/namtree/NTFactory.hpp>
3 # include <samchon/namtree/NTParameterArray.hpp>
4 
5 #include <vector>
6 #include <samchon/library/XML.hpp>
7 
8 using namespace std;
9 
10 using namespace samchon;
11 using namespace samchon::library;
12 using namespace samchon::protocol;
13 using namespace samchon::namtree;
14 
15 NTFile::NTFile(NTFactory *factory, FTFolder *parent)
16  : super(parent),
17  INTExplore()
18 {
19  this->factory = factory;
20  function = nullptr;
21  otherside = nullptr;
22 }
23 void NTFile::construct(shared_ptr<XML> xml)
24 {
25  super::construct(xml);
26  if (xml->has(parameterArray->TAG()) == true)
27  parameterArray->construct( xml->get(parameterArray->TAG())->at(0) );
28 }
29 
31 {
32  return parameterArray;
33 }
34 auto NTFile::getOtherside() const -> NTFile*
35 {
36  return otherside;
37 }
38 auto NTFile::getFunction() const -> SideFunction
39 {
40  return function;
41 }
42 
43 auto NTFile::toXML() const -> shared_ptr<XML>
44 {
45  shared_ptr<XML> &xml = super::toXML();
46  xml->push_back(parameterArray->toXML());
47 
48  if (otherside != nullptr)
49  xml->setProperty("othersideUID", otherside->key());
50 
51  return xml;
52 }
NTParameterArray * parameterArray
Metadata of parameters.
Definition: NTFile.hpp:70
An interface of file-tree.
Definition: FTInstance.hpp:22
virtual auto TAG() const -> std::string override
A tag name when represented by XML.
A factory for Nam-Tree objects.
Definition: NTFactory.hpp:52
Definition: RWMutex.hpp:4
Package of libraries.
Definition: library.hpp:84
auto getParameterArray() const -> NTParameterArray *
Get metadata of parameters.
Definition: NTFile.cpp:30
A file archiving metadata of a function.
Definition: NTFile.hpp:50
virtual auto toXML() const -> std::shared_ptr< library::XML >
Get an XML object represents the Entity.
Definition: FTFile.cpp:28
An interface for exploration.
Definition: INTExplore.hpp:25
auto getFunction() const -> SideFunction
Get function pointer.
Definition: NTFile.cpp:38
NTFactory * factory
A factory and manager class for nam-tree.
Definition: NTFile.hpp:65
virtual void construct(std::shared_ptr< library::XML >) override
Construct data of the Entity from an XML object.
Definition: NTFile.cpp:23
virtual auto toXML() const -> std::shared_ptr< library::XML >
Get an XML object represents the EntityGroup.
Package of network protocol and libraries.
Definition: protocol.hpp:185
auto getOtherside() const -> NTFile *
Get otherside file.
Definition: NTFile.cpp:34
Package of Nam-Tree.
Definition: namtree.hpp:93
NTFile * otherside
A file of otherside.
Definition: NTFile.hpp:86
XML is a class representing xml object.
Definition: XML.hpp:72
virtual void construct(std::shared_ptr< library::XML > xml)
Construct data of the Entity from an XML object.
Definition: EntityGroup.hpp:90
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7
virtual auto toXML() const -> std::shared_ptr< library::XML > override
Get an XML object represents the Entity.
Definition: NTFile.cpp:43
virtual auto key() const -> std::string
Get a key that can identify the Entity uniquely.
Definition: FTInstance.cpp:25