CMS 3D CMS Logo

AlignmentSurfaceDeformations.h
Go to the documentation of this file.
1 #ifndef AlignmentSurfaceDeformations_H
2 #define AlignmentSurfaceDeformations_H
3 
5 
6 #include <vector>
7 
9 
19 
21 public:
22  struct Item {
25  int m_index;
26 
28  };
29 
30  typedef std::vector<Item> ItemVector;
31  typedef std::vector<align::Scalar>::const_iterator ParametersConstIterator;
32  typedef std::pair<ParametersConstIterator, ParametersConstIterator> ParametersConstIteratorPair;
33 
36 
38  inline bool empty() const { return m_items.empty(); }
39 
41  bool add(align::ID rawId, int type, const std::vector<align::Scalar>& parameters) {
42  Item item;
43  item.m_rawId = rawId;
44  item.m_parametrizationType = type;
45  item.m_index = m_parameters.size();
46  m_items.push_back(item);
47 
48  m_parameters.reserve(m_parameters.size() + parameters.size());
49  std::copy(parameters.begin(), parameters.end(), std::back_inserter(m_parameters));
50 
51  return true;
52  }
53 
55  const ItemVector& items() const { return m_items; }
56 
61  pair.first = m_parameters.begin() + m_items[index].m_index;
62  if (index < m_items.size() - 1) {
63  pair.second = m_parameters.begin() + m_items[index + 1].m_index;
64  } else {
65  pair.second = m_parameters.end();
66  }
67  return pair;
68  }
69 
70 private:
71  std::vector<align::Scalar> m_parameters;
73 
75 };
76 
77 #endif // AlignmentSurfaceDeformations_H
uint32_t ID
Definition: Definitions.h:24
ParametersConstIteratorPair parameters(size_t index) const
bool empty() const
Test of empty vector without having to look into internals:
std::vector< align::Scalar > m_parameters
std::pair< ParametersConstIterator, ParametersConstIterator > ParametersConstIteratorPair
bool add(align::ID rawId, int type, const std::vector< align::Scalar > &parameters)
Add a new item.
#define COND_SERIALIZABLE
Definition: Serializable.h:39
std::vector< align::Scalar >::const_iterator ParametersConstIterator
const ItemVector & items() const
Get vector of all items.