C++ mpi module for stochmagnet_main Package
CORE_List.h
1 #ifndef CORE_List_H
2 #define CORE_List_H
3 
4 //inherited class header
5 #include "CORE_Collection.h"
6 
7 
11 template <typename T,typename K,class I>
12 class CORE_List : public CORE_Collection<T,I> {
13 
14 
15 private:
16 
17 
18 
19 
20  // CONSTRUCTORS
21 protected:
25 
26  }
27 
28  // DESTRUCTORS
31  virtual ~CORE_List() {
32  }
33 
34 
35 public:
36 
37  //memory method
38  //=============
39 
47  virtual tMemSize getMemorySize() const override {
48  return sizeof(*this)+this->getContentsMemorySize();
49  }
50 
51  //NEW Instance
52  //============
53 
54 
58  virtual CORE_UniquePointer<CORE_List<T,K,I>> newInstance() const=0;
59 
60  //accessor operators
61  //====================
62 public:
66  inline const T& operator[](const K& i) const {
67  return (*static_cast<I*>(this))[i];
68  };
72  inline T& operator[](const K& i) {
73  return (*static_cast<I*>(this))[i];
74  };
75 
76 
77 
78 
79  //acessor iterators
80  //==================
81 
82 
83 
84 
85 public:
86 
87 
88 
89  //allocation methods
90  //===================
91 
92 
93 
94  //assignment operators
95  //====================
96 
97 
98 
99  //copy methods
100  //============
101 
102 
103 
104  //initializers methods
105  //====================
106 
107 
108 
109  //accessor methods
110  //===================
111 
112 
113 
114 
115 
116 public:
117 
118 
119  //Data consistency
120  //=================
121 
125  inline tString getDataTypeName() const {
126  return functions_type::getTypeName<T>();
127  }
128 
129  //transformation methods
130  //=======================
131 
132 
135  inline void sort() {
136  directionalSort('i');
137  }
138 
142  inline void directionalSort(const tUChar& order) {
143  static_cast<I*>(this)->directionalSort(order);
144  }
145 
146  //string representation
147  //=====================
148 
149 
150 };
151 
152 
153 #endif
this class describes a general container of values of type T where implemented class is I
Definition: CORE_Collection.h:49
this class describes a list K -> T whre I is the implemented class
Definition: CORE_List.h:12
virtual tMemSize getMemorySize() const override
return the memory size of the class and the memory size of all its attributes/associations
Definition: CORE_List.h:47
CORE_List()
build an array of T*
Definition: CORE_List.h:24
void sort()
sort the list in the incresing order
Definition: CORE_List.h:135
virtual ~CORE_List()
destroy an array of T*
Definition: CORE_List.h:31
T & operator[](const K &i)
get the i-th element for writting. Do not verify the bounds
Definition: CORE_List.h:72
const T & operator[](const K &i) const
get the i-th element for reading. Do not verify the bounds
Definition: CORE_List.h:66
tString getDataTypeName() const
get the type of data
Definition: CORE_List.h:125
virtual CORE_UniquePointer< CORE_List< T, K, I > > newInstance() const =0
create a New instance within an unique smart pointer
void directionalSort(const tUChar &order)
sort the element
Definition: CORE_List.h:142
virtual tMemSize getContentsMemorySize() const
return nthe memory size of the included associations
Definition: CORE_Object.h:278