VISR  0.11.6
Versatile Interactive Scene Renderer
index_sequence.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_RBBL_INDEX_SEQUENCE_HPP_INCLUDED
4 #define VISR_RBBL_INDEX_SEQUENCE_HPP_INCLUDED
5 
6 #include "export_symbols.hpp"
7 
8 #include <algorithm>
9 #include <ciso646>
10 #include <initializer_list>
11 #include <stdexcept>
12 #include <vector>
13 
14 namespace visr
15 {
16 namespace rbbl
17 {
18 
22 class VISR_RBBL_LIBRARY_SYMBOL IndexSequence
23 {
24 public:
25  using IndexType = std::size_t;
26 
27  using ContainerType = std::vector<IndexType>;
28 
32  IndexSequence();
33 
34  IndexSequence( std::initializer_list<IndexType> const & val );
35 
36  IndexSequence( std::string const & val );
37 
38  std::size_t size() const
39  {
40  return mIndices.size();
41  }
42 
44  {
45  return &mIndices[0];
46  }
47 
48  IndexType const * values() const
49  {
50  return &mIndices[0];
51  }
52 
53  ContainerType::const_iterator begin() const
54  {
55  return mIndices.begin();
56  }
57 
58  ContainerType::const_iterator end() const
59  {
60  return mIndices.end();
61  }
62 
63  ContainerType::iterator begin()
64  {
65  return mIndices.begin();
66  }
67 
68  ContainerType::iterator end()
69  {
70  return mIndices.end();
71  }
72 
76  IndexType & operator[]( std::size_t idx )
77  {
78  return mIndices[idx];
79  }
80 
84  IndexType const & operator[]( std::size_t idx ) const
85  {
86  return mIndices[idx];
87  }
88 
92  IndexType & at( std::size_t idx )
93  {
94  return mIndices.at( idx );
95  }
96 
100  IndexType const & at( std::size_t idx ) const
101  {
102  return mIndices.at( idx );
103  }
104 
108  void clear();
109 
110 
111 private:
112  ContainerType mIndices;
113 };
114 
115 } // namespace rbbl
116 } // namespace visr
117 
118 
119 #endif // VISR_RBBL_INDEX_SEQUENCE_HPP_INCLUDED
std::vector< IndexType > ContainerType
Definition: index_sequence.hpp:27
ContainerType::iterator begin()
Definition: index_sequence.hpp:63
IndexType const * values() const
Definition: index_sequence.hpp:48
ContainerType::const_iterator end() const
Definition: index_sequence.hpp:58
Definition: index_sequence.hpp:22
std::size_t IndexType
Definition: index_sequence.hpp:25
IndexType & operator[](std::size_t idx)
Definition: index_sequence.hpp:76
ContainerType::iterator end()
Definition: index_sequence.hpp:68
std::size_t size() const
Definition: index_sequence.hpp:38
IndexType & at(std::size_t idx)
Definition: index_sequence.hpp:92
Definition: options.cpp:10
IndexType * values()
Definition: index_sequence.hpp:43
IndexType const & at(std::size_t idx) const
Definition: index_sequence.hpp:100
ContainerType::const_iterator begin() const
Definition: index_sequence.hpp:53
IndexType const & operator[](std::size_t idx) const
Definition: index_sequence.hpp:84