Samchon Framework for CPP  1.0.0
UniqueEntityArray.hpp
1 #pragma once
2 
3 #include <samchon/protocol/EntityGroup.hpp>
4 #include <vector>
5 
6 namespace samchon
7 {
8 namespace protocol
9 {
33  template <typename _Ty = Entity>
34  using UniqueEntityArray =
35  EntityGroup
36  <
37  std::vector<std::unique_ptr<_Ty>>,
38  _Ty, std::unique_ptr<_Ty>
39  >;
40 };
41 };
42 
43 /* ------------------------------------------------------------------------------
44  MACROS
45 ------------------------------------------------------------------------------ */
46 //HEADER
47 #define UNIQUE_ENTITY_ARRAY_ELEMENT_ACCESSOR_HEADER(CHILD_TYPE) \
48 auto operator[](size_t) const -> CHILD_TYPE*; \
49 auto at(size_t) const -> CHILD_TYPE*; \
50 auto get(const samchon::std::string&) const -> CHILD_TYPE*;
51 
52 //BODY
53 #define UNIQUE_ENTITY_ARRAY_ELEMENT_ACCESSOR_BODY(THIS_TYPE, CHILD_TYPE) \
54 auto THIS_TYPE::operator[](size_t x) const -> CHILD_TYPE* { return dynamic_cast<CHILD_TYPE*>(container_type::operator[](x).get()); }; \
55 auto THIS_TYPE::at(size_t x) const -> CHILD_TYPE* { return dynamic_cast<CHILD_TYPE*>(container_type::at(x).get()); }; \
56 auto THIS_TYPE::get(const samchon::std::string &key) const -> CHILD_TYPE* { return dynamic_cast<CHILD_TYPE*>(samchon::protocol::EntityGroup<container_type, entity_type, value_type>::get(key).get()); }
EntityGroup< std::vector< std::unique_ptr< _Ty >>, _Ty, std::unique_ptr< _Ty > > UniqueEntityArray
An EntityGroup with vector container and children capsuled in unique pointers.
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7