Alexandria  2.25.0
SDC-CH common library for the Euclid project
GridCellManagerTraits.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2021 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
25 #ifndef GRIDCONTAINER_GRIDCELLMANAGERTRAITS_H
26 #define GRIDCONTAINER_GRIDCELLMANAGERTRAITS_H
27 
28 #include <memory>
29 #include <vector>
30 
31 namespace Euclid {
32 namespace GridContainer {
33 
49 template <typename GridCellManager>
51 
53  typedef typename GridCellManager::data_type data_type;
54 
57  typedef typename GridCellManager::iterator iterator;
58 
68 
76  static size_t size(const GridCellManager& cell_manager);
77 
86  static iterator begin(GridCellManager& cell_manager);
87 
96  static iterator end(GridCellManager& cell_manager);
97 
101  static const bool enable_boost_serialize = false;
102 
103 }; // end of GridCellManagerTraits
104 
113 template <typename T>
114 struct GridCellManagerTraits<std::vector<T>> {
115 
117  typedef T data_type;
118  typedef T& reference_type;
119  typedef T* pointer_type;
120 
124 
127 
129  static size_t size(const std::vector<T>& vector);
130 
132  static iterator begin(std::vector<T>& vector);
133 
135  static iterator end(std::vector<T>& vector);
136 
138  static const bool enable_boost_serialize = true;
139 
140 }; // end of GridCellManagerTraits vector specialization
141 
142 } // end of namespace GridContainer
143 } // end of namespace Euclid
144 
146 
147 #endif /* GRIDCONTAINER_GRIDCELLMANAGERTRAITS_H */
STL namespace.
T data_type
The type of the data kept by the GridCellManager.
static iterator begin(std::vector< T > &vector)
Returns an iterator at the first element of the vector.
static std::unique_ptr< std::vector< T > > factory(size_t size)
Returns a vector containing "size" default constructed elements.
static iterator end(std::vector< T > &vector)
Returns an iterator right after the last element of the vector.
static size_t size(const std::vector< T > &vector)
Returns the size of the vector.
Class used by the GridContainer to access the different CellManagers.
static size_t size(const GridCellManager &cell_manager)
static iterator end(GridCellManager &cell_manager)
GridCellManager::data_type data_type
The type of the data kept by the GridCellManager.
static std::unique_ptr< GridCellManager > factory(size_t size)
static iterator begin(GridCellManager &cell_manager)