C++ mpi module for stochmagnet_main Package
CORE_StringsList.h
1 #ifndef CORE_StringsList_H
2 #define CORE_StringsList_H
3 
4 #include "CORE_VectorList.h"
5 
6 
12 class CORE_StringsList : public CORE_VectorList<tString,CORE_StringsList> {
13 
14 
15 private:
16 
17  // CONSTRUCTORS
18 public:
22  }
26  CORE_StringsList(const std::initializer_list<tString>& list) {
27  copy(list);
28  }
32  CORE_StringsList(std::initializer_list<tString>&& list) {
33  copy(list);
34  }
35 
39  explicit CORE_StringsList(const tIndex& n) : CORE_VectorList<tString,CORE_StringsList>(n) {
40 
41 
42  }
43 
44 
45 
46 
47 
48  // DESTRUCTORS
51  virtual ~CORE_StringsList() {
52  }
53 
54 
55 private:
56 
57 
58  // ----------------
59  // New constructors
60  // ----------------
61 public:
65  static inline CORE_UniquePointer<CORE_StringsList> New() {
66  return CORE_UniquePointer<CORE_StringsList>(new CORE_StringsList(),
68  };
69 
73  virtual CORE_UniquePointer<CORE_List<tString,tIndex,CORE_StringsList>> newInstance() const override {
74  return New();
75  }
76 
77  //operator
78  //========
79 public:
87  virtual tMemSize getMemorySize() const override {
88  return sizeof(*this)+getContentsMemorySize();
89  }
98  virtual tMemSize getContentsMemorySize() const override {
100  std::for_each(cbegin(),cend(),
101  [&](const auto& s) {
102  mem+=s.size();
103  });
104  return mem;
105  }
106 
107 
108  //assignment operators
109  //====================
113  CORE_StringsList& operator=(const std::initializer_list<tString>& values) {
114  copy(values);
115  return (*this);
116  }
120  CORE_StringsList& operator=(std::initializer_list<tString>&& values) {
121  copy(values);
122  return (*this);
123  }
124 
125  //copy methods
126  //============
127 
128 
129 
130 
131 
132  //transform methods
133  //==================
134 
135 
136 
137 private:
138 
139 
140 
141 
142 
143 };
144 
145 
146 
147 #endif
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
this class describes an array of dynamical size with implementation of method defined in CORE_TBaseAr...
Definition: CORE_StringsList.h:12
static CORE_UniquePointer< CORE_StringsList > New()
return a unique pointer of the class
Definition: CORE_StringsList.h:65
virtual ~CORE_StringsList()
destroy the instance this
Definition: CORE_StringsList.h:51
CORE_StringsList(const tIndex &n)
build an array of size n
Definition: CORE_StringsList.h:39
CORE_StringsList(const std::initializer_list< tString > &list)
build a copy of list
Definition: CORE_StringsList.h:26
CORE_StringsList & operator=(const std::initializer_list< tString > &values)
initialize the array to the values of list
Definition: CORE_StringsList.h:113
virtual tMemSize getContentsMemorySize() const override
return nthe memory size of the included associations
Definition: CORE_StringsList.h:98
virtual CORE_UniquePointer< CORE_List< tString, tIndex, CORE_StringsList > > newInstance() const override
create a New instance within an unique smart pointer
Definition: CORE_StringsList.h:73
virtual tMemSize getMemorySize() const override
return the memory size of the class and the memory size of all its attributes/associations
Definition: CORE_StringsList.h:87
CORE_StringsList(std::initializer_list< tString > &&list)
build a copy of list
Definition: CORE_StringsList.h:32
CORE_StringsList & operator=(std::initializer_list< tString > &&values)
initialize the array to the values of list
Definition: CORE_StringsList.h:120
CORE_StringsList()
build an instance of class
Definition: CORE_StringsList.h:21
this class describes a list K -> T whre I is the implemented class
Definition: CORE_VectorList.h:12
void copy(const Self &cpy)
copy the container
Definition: CORE_VectorList.h:205
constexpr auto cend() const
return end iterator for reading
Definition: CORE_VectorList.h:136
constexpr auto cbegin() const
return begin iterator for reading
Definition: CORE_VectorList.h:130
virtual tMemSize getContentsMemorySize() const override
return the memory size of the included associations
Definition: CORE_VectorList.h:65