diff --git a/annotated.html b/annotated.html index 92cc0b660..16239c4ac 100644 --- a/annotated.html +++ b/annotated.html @@ -121,73 +121,77 @@  Cspatial_hash< Tuple< Types... >, std::enable_if_t<(std::is_arithmetic_v< Types > &&...), void > >Specialization for tuples  Cspatial_hash< Sophus::SE2d, void >  CThrunRecoveryProbabilityEstimatorRandom particle probability estimator - CBearingSensorModelInterfacePure abstract class representing the bearing sensor model interface - CLandmarkSensorModelInterfacePure abstract class representing a generic landmark sensor model - CLaserSensorModelInterface2dPure abstract class representing the laser sensor model interface - Ccompose_interfacesComposes multiple interfaces into a single interface type - CNullMixinInterfaceA null mixin interface. Meant to be the default value for an optional customization point - CNullMixinA null mixin that does nothing. Meant to be the default value for an optional customization point - CBaseParticleFilterInterfacePure abstract class representing the base particle filter interface - CBootstrapParticleFilterBase implementation of a particle filter - CRandomStateGeneratorA random state generator - CNaiveSamplerGeneration of samples from input particles - CAdaptiveSamplerParamParameters used to construct an AdaptiveSampler instance - CAdaptiveSamplerGeneration of samples from input particles with a recovery strategy - CFixedLimiterParamParameters used to construct a FixedLimiter instance - CFixedLimiterLimiter policy that takes a fixed number of particles - CKldLimiterParamParameters used to construct a KldLimiter instance - CKldLimiterLimiter policy that takes a number of particles defined by the KLD criteria - CStorageInterfacePure abstract class representing the storage interface - CStoragePolicyConfigurable storage policy - CDifferentialDriveModelParamParameters to construct a DifferentialDriveModel instance - CDifferentialDriveModelSampled odometry model for a differential drive - COmnidirectionalDriveModelParamParameters to construct an OmnidirectionalDriveModel instance - COmnidirectionalDriveModelSampled odometry model for an omnidirectional drive - CStationaryModelA stationary motion model - COdometryMotionModelInterface2dPure abstract class representing the odometry motion model interface - CpolicyForward declaration of policy - Cpolicy_baseImplementation detail for a policy base object - Cmultivariate_distribution_traitsForward declaration of the multivariate_distribution_traits class template - Cmultivariate_distribution_traits< T, std::enable_if_t< std::is_base_of_v< Eigen::EigenBase< T >, T > > >Specialization for types derived from Eigen::EigenBase - Cmultivariate_distribution_traits< T, std::enable_if_t< std::is_base_of_v< Sophus::SO2Base< T >, T > > >Specialization for types derived from Sophus::SO2Base - Cmultivariate_distribution_traits< T, std::enable_if_t< std::is_base_of_v< Sophus::SE2Base< T >, T > > >Specialization for types derived from Sophus::SE2Base - CMultivariateNormalDistributionParamMultivariate normal distribution parameter set class - CMultivariateNormalDistributionMultivariate normal distribution - CUniformFreeSpaceGridDistributionPrimary template for a uniform grid distribution - CUniformFreeSpaceGridDistribution< Sophus::SE2d >Specialization of uniform grid distribution for Sophus::SE2d - CBeamModelParamParameters used to construct a BeamSensorModel instance - CBeamSensorModelBeam sensor model for range finders - CBearingModelParamParameters used to construct a BearingSensorModel instance - CBearingSensorModelGeneric bearing sensor model, for both 2D and 3D state types - CBaseDenseGrid2Dense 2D grid base type - CLandmarkMapBasic 3D landmark map datatype - CBaseLaserScanLaser scan 2D base type - CBaseLinearGrid2Linear 2D grid base type - CBaseOccupancyGrid2Occupancy 2D grid base type - CBaseRegularGrid2Regularly spaced 2D grid base type - CValueGrid2Generic 2D linear value grid - CLandmarkModelParamParameters used to construct a LandmarkSensorModel instance (both 2D and 3D) - CLandmarkSensorModelGeneric landmark model for discrete detection sensors (both 2D and 3D) - CLikelihoodFieldModelParamParameters used to construct a LikelihoodFieldModel instance - CLikelihoodFieldModelLikelihood field sensor model for range finders - CTupleContainerPrimary template for a tuple of containers - CTupleContainer< InternalContainer, std::tuple< Types... > >An implementation of a tuple of containers, with an interface that looks like a container of tuples - CTupleVectorShorthand for a tuple of vectors with the default allocator - Cparticle_traitsCommon traits of all particle types. See Page requirements as well - CNumericHelper for creating strongly typed numeric types - Cis_tuple_likeMeta-function that returns true if T is a tuple-like type - Ctuple_indexMeta-function that returns the tuple index of the element whose type is T - Ctuple_index< T, TupleLike< Args... >, std::enable_if_t< is_tuple_like_v< std::decay_t< TupleLike< Args... > > > &&detail::tuple_index_found< T, Args... >()> >tuple_index specialization for tuples - Chas_single_elementMeta-function that returns true if there is a single element of type T in the tuple-like type - Chas_single_element< T, TupleLike< Args... >, std::enable_if_t< is_tuple_like_v< std::decay_t< TupleLike< Args... > > > &&detail::tuple_index_found< T, Args... >()> >has_single_element specialization for tuples - Cdecay_tuple_likeMeta-function that decays a tuple like type and its members - Cdecay_tuple_like< TupleLike< Args... >, std::enable_if_t< is_tuple_like_v< std::decay_t< TupleLike< Args... > > > > >decay_tuple_like specialization for tuples - CLandmarkMapBoundariesLandmark bearing detection data - CLandmarkPositionDetectionLandmark bearing detection data - CLandmarkBearingDetectionLandmark bearing detection data + CCircularArrayAn implementation of generic, non-threadsafe circular array + CTupleContainerPrimary template for a tuple of containers + CTupleContainer< InternalContainer, std::tuple< Types... > >An implementation of a tuple of containers, with an interface that looks like a container of tuples + CTupleVectorShorthand for a tuple of vectors with the default allocator + CBearingSensorModelInterfacePure abstract class representing the bearing sensor model interface + CLandmarkSensorModelInterfacePure abstract class representing a generic landmark sensor model + CLaserSensorModelInterface2dPure abstract class representing the laser sensor model interface + Ccompose_interfacesComposes multiple interfaces into a single interface type + CNullMixinInterfaceA null mixin interface. Meant to be the default value for an optional customization point + CNullMixinA null mixin that does nothing. Meant to be the default value for an optional customization point + CBaseParticleFilterInterfacePure abstract class representing the base particle filter interface + CBootstrapParticleFilterBase implementation of a particle filter + CRandomStateGeneratorA random state generator + CNaiveSamplerGeneration of samples from input particles + CAdaptiveSamplerParamParameters used to construct an AdaptiveSampler instance + CAdaptiveSamplerGeneration of samples from input particles with a recovery strategy + CFixedLimiterParamParameters used to construct a FixedLimiter instance + CFixedLimiterLimiter policy that takes a fixed number of particles + CKldLimiterParamParameters used to construct a KldLimiter instance + CKldLimiterLimiter policy that takes a number of particles defined by the KLD criteria + CStorageInterfacePure abstract class representing the storage interface + CStoragePolicyConfigurable storage policy + CDifferentialDriveModelParamParameters to construct a DifferentialDriveModel instance + CDifferentialDriveModelSampled odometry model for a differential drive + COmnidirectionalDriveModelParamParameters to construct an OmnidirectionalDriveModel instance + COmnidirectionalDriveModelSampled odometry model for an omnidirectional drive + CStationaryModelA stationary motion model + COdometryMotionModelInterface2dPure abstract class representing the odometry motion model interface + CpolicyForward declaration of policy + Cpolicy_baseImplementation detail for a policy base object + Cmultivariate_distribution_traitsForward declaration of the multivariate_distribution_traits class template + Cmultivariate_distribution_traits< T, std::enable_if_t< std::is_base_of_v< Eigen::EigenBase< T >, T > > >Specialization for types derived from Eigen::EigenBase + Cmultivariate_distribution_traits< T, std::enable_if_t< std::is_base_of_v< Sophus::SO2Base< T >, T > > >Specialization for types derived from Sophus::SO2Base + Cmultivariate_distribution_traits< T, std::enable_if_t< std::is_base_of_v< Sophus::SE2Base< T >, T > > >Specialization for types derived from Sophus::SE2Base + CMultivariateNormalDistributionParamMultivariate normal distribution parameter set class + CMultivariateNormalDistributionMultivariate normal distribution + CUniformFreeSpaceGridDistributionPrimary template for a uniform grid distribution + CUniformFreeSpaceGridDistribution< Sophus::SE2d >Specialization of uniform grid distribution for Sophus::SE2d + CBeamModelParamParameters used to construct a BeamSensorModel instance + CBeamSensorModelBeam sensor model for range finders + CBearingModelParamParameters used to construct a BearingSensorModel instance + CBearingSensorModelGeneric bearing sensor model, for both 2D and 3D state types + CBaseDenseGrid2Dense 2D grid base type + CLandmarkMapBasic 3D landmark map datatype + CBaseLaserScanLaser scan 2D base type + CBaseLinearGrid2Linear 2D grid base type + CBaseOccupancyGrid2Occupancy 2D grid base type + CBaseRegularGrid2Regularly spaced 2D grid base type + CValueGrid2Generic 2D linear value grid + CLandmarkModelParamParameters used to construct a LandmarkSensorModel instance (both 2D and 3D) + CLandmarkSensorModelGeneric landmark model for discrete detection sensors (both 2D and 3D) + CLikelihoodFieldModelParamParameters used to construct a LikelihoodFieldModel instance + CLikelihoodFieldModelLikelihood field sensor model for range finders + Cparticle_traitsCommon traits of all particle types. See Page requirements as well + CNumericHelper for creating strongly typed numeric types + Cis_tuple_likeMeta-function that returns true if T is a tuple-like type + Ctuple_indexMeta-function that returns the tuple index of the element whose type is T + Ctuple_index< T, TupleLike< Args... >, std::enable_if_t< is_tuple_like_v< std::decay_t< TupleLike< Args... > > > &&detail::tuple_index_found< T, Args... >()> >tuple_index specialization for tuples + Chas_single_elementMeta-function that returns true if there is a single element of type T in the tuple-like type + Chas_single_element< T, TupleLike< Args... >, std::enable_if_t< is_tuple_like_v< std::decay_t< TupleLike< Args... > > > &&detail::tuple_index_found< T, Args... >()> >has_single_element specialization for tuples + Cdecay_tuple_likeMeta-function that decays a tuple like type and its members + Cdecay_tuple_like< TupleLike< Args... >, std::enable_if_t< is_tuple_like_v< std::decay_t< TupleLike< Args... > > > > >decay_tuple_like specialization for tuples + CLandmarkMapBoundariesLandmark bearing detection data + CLandmarkPositionDetectionLandmark bearing detection data + CLandmarkBearingDetectionLandmark bearing detection data + CIndexingIteratorA random access iterator for any indexable container  Nstd - Cnumeric_limits< beluga::Numeric< T, PhantomType > >std::numeric_limits specialization for Numeric types - Chash< beluga::Numeric< T, PhantomType > >std::hash specialization for Numeric types + Ctuple_size< beluga::CircularArray< T, N, F > >std::tuple_size specialization for circular arrays + Ctuple_element< I, beluga::CircularArray< T, N, F > >std::tuple_element specialization for circular arrays + Cnumeric_limits< beluga::Numeric< T, PhantomType > >std::numeric_limits specialization for Numeric types + Chash< beluga::Numeric< T, PhantomType > >std::hash specialization for Numeric types diff --git a/beluga_8hpp.html b/beluga_8hpp.html index ba502a32b..466417570 100644 --- a/beluga_8hpp.html +++ b/beluga_8hpp.html @@ -76,13 +76,13 @@ More...

#include <beluga/actions.hpp>
#include <beluga/algorithm.hpp>
+#include <beluga/containers.hpp>
#include <beluga/mixin.hpp>
#include <beluga/motion.hpp>
#include <beluga/policies.hpp>
#include <beluga/primitives.hpp>
#include <beluga/random.hpp>
#include <beluga/sensor.hpp>
-#include <beluga/tuple_vector.hpp>
#include <beluga/type_traits.hpp>
#include <beluga/views.hpp>
@@ -90,56 +90,56 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/beluga_8hpp__incl.map b/beluga_8hpp__incl.map index bc6f0df44..ae8d8b214 100644 --- a/beluga_8hpp__incl.map +++ b/beluga_8hpp__incl.map @@ -1,52 +1,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/beluga_8hpp__incl.md5 b/beluga_8hpp__incl.md5 index 7342aaa27..2a361a21b 100644 --- a/beluga_8hpp__incl.md5 +++ b/beluga_8hpp__incl.md5 @@ -1 +1 @@ -d11c011752a976d8feef1001b1368c17 \ No newline at end of file +af750808f9404fd8cf44174a6d207793 \ No newline at end of file diff --git a/beluga_8hpp__incl.png b/beluga_8hpp__incl.png index abd778970..715ec05a2 100644 Binary files a/beluga_8hpp__incl.png and b/beluga_8hpp__incl.png differ diff --git a/beluga_8hpp_source.html b/beluga_8hpp_source.html index 16b1e2b47..84e59f152 100644 --- a/beluga_8hpp_source.html +++ b/beluga_8hpp_source.html @@ -90,26 +90,26 @@
17 
23 #include <beluga/actions.hpp>
24 #include <beluga/algorithm.hpp>
-
25 #include <beluga/mixin.hpp>
-
26 #include <beluga/motion.hpp>
-
27 #include <beluga/policies.hpp>
-
28 #include <beluga/primitives.hpp>
-
29 #include <beluga/random.hpp>
-
30 #include <beluga/sensor.hpp>
-
31 #include <beluga/tuple_vector.hpp>
+
25 #include <beluga/containers.hpp>
+
26 #include <beluga/mixin.hpp>
+
27 #include <beluga/motion.hpp>
+
28 #include <beluga/policies.hpp>
+
29 #include <beluga/primitives.hpp>
+
30 #include <beluga/random.hpp>
+
31 #include <beluga/sensor.hpp>
32 #include <beluga/type_traits.hpp>
33 #include <beluga/views.hpp>
34 
35 #endif
Implementation of useful range actions.
Includes all beluga algorithms.
+
Implementation of efficient containers.
Implementation of mixin utilities and extensions.
Includes all Beluga motion models.
Implementation of useful policies.
Implementation of library primitives to abstract member access.
Includes all Beluga random distributions.
Includes all Beluga sensor models and their interfaces.
-
Implementation of a tuple of containers.
Includes all Beluga type traits.
Implementation of useful container views.
diff --git a/bresenham_8hpp_source.html b/bresenham_8hpp_source.html index 611197c99..1c5d0a912 100644 --- a/bresenham_8hpp_source.html +++ b/bresenham_8hpp_source.html @@ -145,9 +145,9 @@
97 
98  if (xspan_ < yspan_) {
99  using std::swap;
-
100  swap(x_, y_);
-
101  swap(xspan_, yspan_);
-
102  swap(xstep_, ystep_);
+
100  swap(x_, y_);
+
101  swap(xspan_, yspan_);
+
102  swap(xstep_, ystep_);
103  reversed_ = true;
104  }
105 
@@ -224,7 +224,7 @@
184  void step_to(Integer x, Integer y) {
185  if (reversed_) {
186  using std::swap;
-
187  swap(x, y);
+
187  swap(x, y);
188  }
189  current_point_.x() = x;
190  current_point_.y() = y;
@@ -285,6 +285,7 @@
265 } // namespace beluga
266 
267 #endif
+
beluga::swap
constexpr void swap(CircularArray< T, N, F > &a, CircularArray< T, N, G > &b)
Swaps arrays a and b.
Definition: circular_array.hpp:523
beluga::Bresenham2i::Line::iterator
Bresenham's 2D line drawing iterator, one cell at a time.
Definition: bresenham.hpp:53
beluga::Bresenham2i::Line::iterator::iterator
iterator()=default
Default constructor.
beluga::Bresenham2i::Line::iterator::difference_type
std::ptrdiff_t difference_type
Iterator difference type (as required by ranges::view_).
Definition: bresenham.hpp:68
diff --git a/circular__array_8hpp.html b/circular__array_8hpp.html new file mode 100644 index 000000000..5ceb650ae --- /dev/null +++ b/circular__array_8hpp.html @@ -0,0 +1,441 @@ + + + + + + + +Beluga: /__w/beluga/beluga/src/beluga/beluga/include/beluga/containers/circular_array.hpp File Reference + + + + + + + + + + +
+
+ + + + + + +
+
Beluga +
+
An extensible particle filter library.
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+Classes | +Typedefs | +Enumerations | +Functions
+
+
circular_array.hpp File Reference
+
+
+ +

Implementation of a generic circular array container. +More...

+
#include <array>
+#include <cstdint>
+#include <iterator>
+#include <stdexcept>
+#include <type_traits>
+#include <utility>
+#include <beluga/utility/indexing_iterator.hpp>
+
+Include dependency graph for circular_array.hpp:
+
+
+ + + + + + + + + + +
+
+This graph shows which files directly or indirectly include this file:
+
+
+ + + + + +
+
+

Go to the source code of this file.

+ + + + + + + + + + + +

+Classes

class  beluga::CircularArray< T, N, F >
 An implementation of generic, non-threadsafe circular array. More...
 
struct  std::tuple_size< beluga::CircularArray< T, N, F > >
 std::tuple_size specialization for circular arrays. More...
 
struct  std::tuple_element< I, beluga::CircularArray< T, N, F > >
 std::tuple_element specialization for circular arrays. More...
 
+ + + + + +

+Typedefs

template<typename T , std::size_t N>
using beluga::RollingWindow = CircularArray< T, N, CircularArrayFeatureFlags::kRolloverOnWrite|CircularArrayFeatureFlags::kExtrapolateOnRead|CircularArrayFeatureFlags::kLayoutReversal >
 Convenient type alias for a circular array that behaves like a rolling window. More...
 
+ + + + +

+Enumerations

enum class  beluga::CircularArrayFeatureFlags : int { kNone = 0x00 +, kRolloverOnWrite = 0x01 +, kExtrapolateOnRead = 0x02 +, kLayoutReversal = 0x04 + }
 Feature flags for circular arrays. More...
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

+constexpr CircularArrayFeatureFlags beluga::operator| (CircularArrayFeatureFlags lflag, CircularArrayFeatureFlags rflag)
 Bitwise OR operator overload to combine two feature flags in a single mask-like flag.
 
+constexpr bool beluga::operator& (CircularArrayFeatureFlags mask, CircularArrayFeatureFlags flag)
 Bitwise AND operator overload to check of the presence of a feature flag in a feature mask.
 
template<typename T , std::size_t N, CircularArrayFeatureFlags F>
CircularArray< T, N, F > & beluga::operator<< (CircularArray< T, N, F > &array, T value)
 Convenient stream operator overload to push a value to a circular array. More...
 
template<std::size_t I, class T , std::size_t N, CircularArrayFeatureFlags F>
constexpr T & beluga::get (CircularArray< T, N, F > &array) noexcept
 Gets an lvalue reference to the ith value in a given array. More...
 
template<std::size_t I, class T , std::size_t N, CircularArrayFeatureFlags F>
constexpr T && beluga::get (CircularArray< T, N, F > &&array) noexcept
 Gets an rvalue reference to the ith value in a given array. More...
 
template<std::size_t I, class T , std::size_t N, CircularArrayFeatureFlags F>
constexpr const T & beluga::get (const CircularArray< T, N, F > &array) noexcept
 Gets a constant lvalue reference to the ith value in a given array. More...
 
template<std::size_t I, class T , std::size_t N, CircularArrayFeatureFlags F>
constexpr const T && beluga::get (const CircularArray< T, N, F > &&array) noexcept
 Gets a constant rvalue reference to the ith value in a given array. More...
 
template<typename T , std::size_t N, CircularArrayFeatureFlags F, CircularArrayFeatureFlags G>
constexpr void beluga::swap (CircularArray< T, N, F > &a, CircularArray< T, N, G > &b)
 Swaps arrays a and b. More...
 
+

Detailed Description

+

Implementation of a generic circular array container.

+

Typedef Documentation

+ +

◆ RollingWindow

+ +
+
+
+template<typename T , std::size_t N>
+ + + + +
using beluga::RollingWindow = typedef CircularArray< T, N, CircularArrayFeatureFlags::kRolloverOnWrite | CircularArrayFeatureFlags::kExtrapolateOnRead | CircularArrayFeatureFlags::kLayoutReversal>
+
+ +

Convenient type alias for a circular array that behaves like a rolling window.

+

A rolling window automatically overwrites older values, it extrapolates its last value to always seem full, and it is accessed by the front.

+ +
+
+

Enumeration Type Documentation

+ +

◆ CircularArrayFeatureFlags

+ +
+
+ + + + + +
+ + + + +
enum beluga::CircularArrayFeatureFlags : int
+
+strong
+
+ +

Feature flags for circular arrays.

+ + + + +
Enumerator
kRolloverOnWrite 

! If enabled, older values in the array are overwritten by newer values if the array has reached its maximum size already.

+
kExtrapolateOnRead 

! If enabled, the back value is extrapolated for constant accesses up to the array maximum size.

+
kLayoutReversal 

! If enabled, the circular array memory layout is reversed so that values can be pushed to the front rather than the back of the array.

+
+ +
+
+

Function Documentation

+ +

◆ get() [1/4]

+ +
+
+
+template<std::size_t I, class T , std::size_t N, CircularArrayFeatureFlags F>
+ + + + + +
+ + + + + + + + +
constexpr T&& beluga::get (CircularArray< T, N, F > && array)
+
+constexprnoexcept
+
+ +

Gets an rvalue reference to the ith value in a given array.

+

This is an std::get overload that relies on argument-dependent lookup (ADL).

+ +
+
+ +

◆ get() [2/4]

+ +
+
+
+template<std::size_t I, class T , std::size_t N, CircularArrayFeatureFlags F>
+ + + + + +
+ + + + + + + + +
constexpr T& beluga::get (CircularArray< T, N, F > & array)
+
+constexprnoexcept
+
+ +

Gets an lvalue reference to the ith value in a given array.

+

This is an std::get overload that relies on argument-dependent lookup (ADL).

+ +
+
+ +

◆ get() [3/4]

+ +
+
+
+template<std::size_t I, class T , std::size_t N, CircularArrayFeatureFlags F>
+ + + + + +
+ + + + + + + + +
constexpr const T&& beluga::get (const CircularArray< T, N, F > && array)
+
+constexprnoexcept
+
+ +

Gets a constant rvalue reference to the ith value in a given array.

+

This is an std::get overload that relies on argument-dependent lookup (ADL).

+ +
+
+ +

◆ get() [4/4]

+ +
+
+
+template<std::size_t I, class T , std::size_t N, CircularArrayFeatureFlags F>
+ + + + + +
+ + + + + + + + +
constexpr const T& beluga::get (const CircularArray< T, N, F > & array)
+
+constexprnoexcept
+
+ +

Gets a constant lvalue reference to the ith value in a given array.

+

This is an std::get overload that relies on argument-dependent lookup (ADL).

+ +
+
+ +

◆ operator<<()

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F>
+ + + + + + + + + + + + + + + + + + +
CircularArray<T, N, F>& beluga::operator<< (CircularArray< T, N, F > & array,
value 
)
+
+ +

Convenient stream operator overload to push a value to a circular array.

+

Functionally equivalent to a push_back() (or push_front() if the layout reversal feature is enabled).

+ +
+
+ +

◆ swap()

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F, CircularArrayFeatureFlags G>
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
constexpr void beluga::swap (CircularArray< T, N, F > & a,
CircularArray< T, N, G > & b 
)
+
+constexpr
+
+ +

Swaps arrays a and b.

+

This is an std::swap overload that relies on argument-dependent lookup (ADL).

+ +
+
+
+ + + + diff --git a/circular__array_8hpp__dep__incl.map b/circular__array_8hpp__dep__incl.map new file mode 100644 index 000000000..d2d79fd21 --- /dev/null +++ b/circular__array_8hpp__dep__incl.map @@ -0,0 +1,5 @@ + + + + + diff --git a/circular__array_8hpp__dep__incl.md5 b/circular__array_8hpp__dep__incl.md5 new file mode 100644 index 000000000..7ab590331 --- /dev/null +++ b/circular__array_8hpp__dep__incl.md5 @@ -0,0 +1 @@ +e7293daa77f51ded48f9e090692e6b7f \ No newline at end of file diff --git a/circular__array_8hpp__dep__incl.png b/circular__array_8hpp__dep__incl.png new file mode 100644 index 000000000..0ab20e5a9 Binary files /dev/null and b/circular__array_8hpp__dep__incl.png differ diff --git a/circular__array_8hpp__incl.map b/circular__array_8hpp__incl.map new file mode 100644 index 000000000..15ca7032f --- /dev/null +++ b/circular__array_8hpp__incl.map @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/circular__array_8hpp__incl.md5 b/circular__array_8hpp__incl.md5 new file mode 100644 index 000000000..c6e461be5 --- /dev/null +++ b/circular__array_8hpp__incl.md5 @@ -0,0 +1 @@ +07a993256575862ebb1ffc2bb4c5176e \ No newline at end of file diff --git a/circular__array_8hpp__incl.png b/circular__array_8hpp__incl.png new file mode 100644 index 000000000..d115bcc64 Binary files /dev/null and b/circular__array_8hpp__incl.png differ diff --git a/circular__array_8hpp_source.html b/circular__array_8hpp_source.html new file mode 100644 index 000000000..5dd74e1b4 --- /dev/null +++ b/circular__array_8hpp_source.html @@ -0,0 +1,511 @@ + + + + + + + +Beluga: /__w/beluga/beluga/src/beluga/beluga/include/beluga/containers/circular_array.hpp Source File + + + + + + + + + + +
+
+ + + + + + +
+
Beluga +
+
An extensible particle filter library.
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
circular_array.hpp
+
+
+Go to the documentation of this file.
1 // Copyright 2024 Ekumen, Inc.
+
2 //
+
3 // Licensed under the Apache License, Version 2.0 (the "License");
+
4 // you may not use this file except in compliance with the License.
+
5 // You may obtain a copy of the License at
+
6 //
+
7 // http://www.apache.org/licenses/LICENSE-2.0
+
8 //
+
9 // Unless required by applicable law or agreed to in writing, software
+
10 // distributed under the License is distributed on an "AS IS" BASIS,
+
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
12 // See the License for the specific language governing permissions and
+
13 // limitations under the License.
+
14 
+
15 #ifndef BELUGA_CONTAINERS_CIRCULAR_ARRAY_HPP
+
16 #define BELUGA_CONTAINERS_CIRCULAR_ARRAY_HPP
+
17 
+
18 #include <array>
+
19 #include <cstdint>
+
20 #include <iterator>
+
21 #include <stdexcept>
+
22 #include <type_traits>
+
23 #include <utility>
+
24 
+ +
26 
+
32 namespace beluga {
+
33 
+
35 enum class CircularArrayFeatureFlags : int {
+
36  kNone = 0x00,
+
37  kRolloverOnWrite = 0x01,
+
39  kExtrapolateOnRead = 0x02,
+
41  kLayoutReversal = 0x04
+
43 };
+
44 
+ +
47  return static_cast<CircularArrayFeatureFlags>(
+
48  static_cast<typename std::underlying_type<CircularArrayFeatureFlags>::type>(lflag) |
+
49  static_cast<typename std::underlying_type<CircularArrayFeatureFlags>::type>(rflag));
+
50 }
+
51 
+ +
54  return static_cast<bool>(
+
55  static_cast<typename std::underlying_type<CircularArrayFeatureFlags>::type>(mask) &
+
56  static_cast<typename std::underlying_type<CircularArrayFeatureFlags>::type>(flag));
+
57 }
+
58 
+
60 
+
75 template <typename T, std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ +
77  public:
+
79  using value_type = T;
+
81  using size_type = std::size_t;
+
83  using difference_type = std::ptrdiff_t;
+ +
87  using const_reference = const value_type&;
+
89  using pointer = value_type*;
+
91  using const_pointer = const value_type*;
+
92 
+
94  using allocator_type = void;
+
95 
+ + +
101  using reverse_iterator = std::reverse_iterator<iterator>;
+
103  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+
104 
+
106 
+
109  CircularArray() = default;
+
110 
+
112 
+
122  template <
+
123  typename Iterator,
+
124  typename Sentinel,
+
125  typename = std::enable_if_t<std::is_same_v<T, typename std::iterator_traits<Iterator>::value_type>>>
+
126  CircularArray(Iterator first, Sentinel last) { // NOLINT(readability-non-const-parameter)
+
127  if constexpr (F & CircularArrayFeatureFlags::kLayoutReversal) {
+
128  tail_index_ = N - 1;
+
129  for (size_ = 0; size_ < N && first != last; ++size_, ++first) {
+
130  data_[tail_index_ - size_] = *first;
+
131  }
+
132  if constexpr (!(F & CircularArrayFeatureFlags::kRolloverOnWrite)) {
+
133  if (first != last) {
+
134  throw std::length_error{"Range does not fit in circular array"};
+
135  }
+
136  }
+
137  } else {
+
138  const auto n = static_cast<size_type>(std::distance(first, last));
+
139  if (n > N) {
+
140  if constexpr (!(F & CircularArrayFeatureFlags::kRolloverOnWrite)) {
+
141  throw std::length_error{"Range does not fit in circular array"};
+
142  } else {
+
143  std::advance(first, n - N);
+
144  }
+
145  }
+
146  for (size_ = 0; size_ < N && first != last; ++size_, ++first) {
+
147  data_[size_] = *first;
+
148  }
+
149  tail_index_ = size_ - 1;
+
150  }
+
151  }
+
152 
+
154 
+
162  template <std::size_t M, typename = std::enable_if_t<M >= 1 && M <= N>>
+
163  explicit CircularArray(T (&&data)[M]) : tail_index_(M - 1), size_(M) { // NOLINT(modernize-avoid-c-arrays)
+
164  if constexpr (F & CircularArrayFeatureFlags::kLayoutReversal) {
+
165  for (std::size_t i = 0; i < M; ++i)
+
166  data_[i] = data[M - i - 1];
+
167  } else {
+
168  for (std::size_t i = 0; i < M; ++i)
+
169  data_[i] = data[i];
+
170  }
+
171  }
+
172 
+
174  [[nodiscard]] constexpr iterator begin() noexcept { return iterator(this); }
+
176  [[nodiscard]] constexpr const_iterator begin() const noexcept { return const_iterator(this); }
+
178  [[nodiscard]] constexpr const_iterator cbegin() const noexcept { return const_iterator(this); }
+
179 
+
181  [[nodiscard]] constexpr iterator end() noexcept { return iterator(this, size()); }
+
183  [[nodiscard]] constexpr const_iterator end() const noexcept { return const_iterator(this, effective_size()); }
+
185  [[nodiscard]] constexpr const_iterator cend() const noexcept { return const_iterator(this, effective_size()); }
+
186 
+
188  [[nodiscard]] constexpr reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
+
190  [[nodiscard]] constexpr const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
+
192  [[nodiscard]] constexpr const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); }
+
193 
+
195  [[nodiscard]] constexpr reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
+
197  [[nodiscard]] constexpr const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
+
199  [[nodiscard]] constexpr const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); }
+
200 
+
202 
+
208  template <bool Enabled = !(F & CircularArrayFeatureFlags::kLayoutReversal)>
+
209  std::enable_if_t<Enabled> push_back(value_type value) {
+
210  static_assert(
+
211  !(F & CircularArrayFeatureFlags::kLayoutReversal),
+
212  "Cannot push_back() when the layout reversal feature is enabled.");
+
213  if constexpr (!(F & CircularArrayFeatureFlags::kRolloverOnWrite)) {
+
214  if (size_ == N) {
+
215  throw std::length_error{"Circular array reached its maximum size"};
+
216  }
+
217  }
+
218  if (++tail_index_ == N)
+
219  tail_index_ = 0;
+
220  data_[tail_index_] = std::move(value);
+
221  size_ = std::min(size_ + 1, N);
+
222  }
+
223 
+
225 
+
231  template <bool Enabled = F& CircularArrayFeatureFlags::kLayoutReversal>
+
232  std::enable_if_t<Enabled> push_front(value_type value) {
+
233  static_assert(
+
234  F & CircularArrayFeatureFlags::kLayoutReversal,
+
235  "Cannot push_front() when the layout reversal feature is not enabled.");
+
236  if constexpr (!(F & CircularArrayFeatureFlags::kRolloverOnWrite)) {
+
237  if (size_ == N) {
+
238  throw std::length_error{"Circular array reached its maximum size"};
+
239  }
+
240  }
+
241  if (++tail_index_ == N)
+
242  tail_index_ = 0;
+
243  data_[tail_index_] = std::move(value);
+
244  size_ = std::min(size_ + 1, N);
+
245  }
+
246 
+
248 
+
253  template <bool Enabled = F& CircularArrayFeatureFlags::kLayoutReversal>
+
254  std::enable_if_t<Enabled> pop_back() noexcept {
+
255  --size_;
+
256  }
+
257 
+
259 
+
264  template <bool Enabled = !(F & CircularArrayFeatureFlags::kLayoutReversal)>
+
265  std::enable_if_t<Enabled> pop_front() noexcept {
+
266  --size_;
+
267  }
+
268 
+
270 
+
273  [[nodiscard]] constexpr reference back() noexcept {
+
274  if constexpr (F & CircularArrayFeatureFlags::kLayoutReversal) {
+
275  return data_[head_index()];
+
276  } else {
+
277  return data_[tail_index_];
+
278  }
+
279  }
+
281 
+
284  [[nodiscard]] constexpr const_reference back() const noexcept {
+
285  if constexpr (F & CircularArrayFeatureFlags::kLayoutReversal) {
+
286  return data_[head_index()];
+
287  } else {
+
288  return data_[tail_index_];
+
289  }
+
290  }
+
291 
+
293 
+
296  [[nodiscard]] constexpr reference front() noexcept {
+
297  if constexpr (F & CircularArrayFeatureFlags::kLayoutReversal) {
+
298  return data_[tail_index_];
+
299  } else {
+
300  return data_[head_index()];
+
301  }
+
302  }
+
303 
+
305 
+
308  [[nodiscard]] constexpr const_reference front() const noexcept {
+
309  if constexpr (F & CircularArrayFeatureFlags::kLayoutReversal) {
+
310  return data_[tail_index_];
+
311  } else {
+
312  return data_[head_index()];
+
313  }
+
314  }
+
315 
+
317 
+
320  [[nodiscard]] constexpr reference at(size_type index) {
+
321  if (index >= effective_size()) {
+
322  throw std::out_of_range{"Index out of circular array range"};
+
323  }
+
324  return (*this)[index];
+
325  }
+
326 
+
328 
+
331  [[nodiscard]] constexpr const_reference at(size_type index) const {
+
332  if (index >= effective_size()) {
+
333  throw std::out_of_range{"Index out of circular array range"};
+
334  }
+
335  return (*this)[index];
+
336  }
+
337 
+
339 
+
342  [[nodiscard]] constexpr reference operator[](size_type index) noexcept {
+
343  if constexpr (F & CircularArrayFeatureFlags::kLayoutReversal) {
+
344  return data_[static_cast<size_type>(index > tail_index_) * N + tail_index_ - index];
+
345  } else {
+
346  return data_[static_cast<size_type>(size_ - index > tail_index_ + 1) * N + tail_index_ - (size_ - index - 1)];
+
347  }
+
348  }
+
349 
+
351 
+
354  [[nodiscard]] constexpr const_reference operator[](size_type index) const noexcept {
+
355  if constexpr (F & CircularArrayFeatureFlags::kExtrapolateOnRead) {
+
356  index = std::min(index, size_ - 1);
+
357  }
+
358  if constexpr (F & CircularArrayFeatureFlags::kLayoutReversal) {
+
359  return data_[static_cast<size_type>(index > tail_index_) * N + tail_index_ - index];
+
360  } else {
+
361  return data_[static_cast<size_type>(size_ - index > tail_index_ + 1) * N + tail_index_ - (size_ - index - 1)];
+
362  }
+
363  }
+
364 
+
366 
+
372  void fill(const T& value) {
+
373  while (size_ < N) {
+
374  tail_index_ = (tail_index_ + 1) % N;
+
375  data_[tail_index_] = value;
+
376  ++size_;
+
377  }
+
378  }
+
379 
+
381 
+
384  void clear() noexcept { size_ = 0; }
+
385 
+
387 
+
392  template <CircularArrayFeatureFlags G>
+
393  void swap(CircularArray<T, N, G>& other) noexcept(std::is_nothrow_swappable_v<T>) {
+
394  using std::swap;
+
395  swap(data_, other.data_);
+
396  swap(size_, other.size_);
+
397  swap(tail_index_, other.tail_index_);
+
398  }
+
399 
+
400  template <typename U, std::size_t M, CircularArrayFeatureFlags G>
+
401  friend class CircularArray;
+
402 
+
404 
+
408  [[nodiscard]] constexpr T* data() noexcept { return data_.data(); }
+
409 
+
411 
+
415  [[nodiscard]] constexpr const T* data() const noexcept { return data_.data(); }
+
416 
+
418  [[nodiscard]] constexpr bool full() const noexcept { return size_ == N; }
+
419 
+
421  [[nodiscard]] constexpr bool empty() const noexcept { return size_ == 0U; }
+
422 
+
424  [[nodiscard]] constexpr size_type size() const noexcept { return size_; }
+
425 
+
427  [[nodiscard]] constexpr size_type max_size() const noexcept { return N; }
+
428 
+
430 
+
436  [[nodiscard]] constexpr size_type effective_size() const noexcept {
+
437  if constexpr (F & CircularArrayFeatureFlags::kExtrapolateOnRead) {
+
438  return static_cast<size_type>(size_ > 0) * N;
+
439  } else {
+
440  return size_;
+
441  }
+
442  }
+
443 
+
444  private:
+
445  // Computes the head index of the array.
+
446  [[nodiscard]] constexpr size_type head_index() const noexcept {
+
447  return static_cast<size_type>(size_ > tail_index_ + 1) * N + tail_index_ - size_ + 1;
+
448  }
+
449 
+
450  std::array<T, N> data_;
+
451  size_type tail_index_{0U};
+
452  size_type size_{0U};
+
453 };
+
454 
+
456 
+
460 template <typename T, std::size_t N>
+ +
462  T,
+
463  N,
+
464  CircularArrayFeatureFlags::kRolloverOnWrite | CircularArrayFeatureFlags::kExtrapolateOnRead |
+
465  CircularArrayFeatureFlags::kLayoutReversal>;
+
466 
+
468 
+
472 template <typename T, std::size_t N, CircularArrayFeatureFlags F>
+ +
474  if constexpr (F & CircularArrayFeatureFlags::kLayoutReversal) {
+
475  array.push_front(std::move(value));
+
476  } else {
+
477  array.push_back(std::move(value));
+
478  }
+
479  return array;
+
480 }
+
481 
+
483 
+
486 template <std::size_t I, class T, std::size_t N, CircularArrayFeatureFlags F>
+
487 constexpr T& get(CircularArray<T, N, F>& array) noexcept {
+
488  return array[I];
+
489 }
+
490 
+
492 
+
495 template <std::size_t I, class T, std::size_t N, CircularArrayFeatureFlags F>
+
496 constexpr T&& get(CircularArray<T, N, F>&& array) noexcept {
+
497  return array[I];
+
498 }
+
499 
+
501 
+
504 template <std::size_t I, class T, std::size_t N, CircularArrayFeatureFlags F>
+
505 constexpr const T& get(const CircularArray<T, N, F>& array) noexcept {
+
506  return array[I];
+
507 }
+
508 
+
510 
+
513 template <std::size_t I, class T, std::size_t N, CircularArrayFeatureFlags F>
+
514 constexpr const T&& get(const CircularArray<T, N, F>&& array) noexcept {
+
515  return array[I];
+
516 }
+
517 
+
519 
+
522 template <typename T, std::size_t N, CircularArrayFeatureFlags F, CircularArrayFeatureFlags G>
+ +
524  a.swap(b);
+
525 }
+
526 
+
527 } // namespace beluga
+
528 
+
529 namespace std {
+
530 
+
532 template <typename T, std::size_t N, beluga::CircularArrayFeatureFlags F>
+
533 struct tuple_size<beluga::CircularArray<T, N, F>> : std::integral_constant<std::size_t, N> {};
+
534 
+
536 template <std::size_t I, typename T, std::size_t N, beluga::CircularArrayFeatureFlags F>
+
537 struct tuple_element<I, beluga::CircularArray<T, N, F>> {
+
538  using type = T;
+
539 };
+
540 
+
541 } // namespace std
+
542 
+
543 #endif
+
CircularArrayFeatureFlags
Feature flags for circular arrays.
Definition: circular_array.hpp:35
+ + + +
constexpr bool operator&(CircularArrayFeatureFlags mask, CircularArrayFeatureFlags flag)
Bitwise AND operator overload to check of the presence of a feature flag in a feature mask.
Definition: circular_array.hpp:53
+
constexpr CircularArrayFeatureFlags operator|(CircularArrayFeatureFlags lflag, CircularArrayFeatureFlags rflag)
Bitwise OR operator overload to combine two feature flags in a single mask-like flag.
Definition: circular_array.hpp:46
+
constexpr T & get(CircularArray< T, N, F > &array) noexcept
Gets an lvalue reference to the ith value in a given array.
Definition: circular_array.hpp:487
+
constexpr void swap(CircularArray< T, N, F > &a, CircularArray< T, N, G > &b)
Swaps arrays a and b.
Definition: circular_array.hpp:523
+
CircularArray< T, N, F > & operator<<(CircularArray< T, N, F > &array, T value)
Convenient stream operator overload to push a value to a circular array.
Definition: circular_array.hpp:473
+
An implementation of generic, non-threadsafe circular array.
Definition: circular_array.hpp:76
+
void swap(CircularArray< T, N, G > &other) noexcept(std::is_nothrow_swappable_v< T >)
Swaps array with another.
Definition: circular_array.hpp:393
+
CircularArray(Iterator first, Sentinel last)
Constructs array from a pair of iterators.
Definition: circular_array.hpp:126
+
constexpr const_iterator cend() const noexcept
Returns a constant iterator pointing past the back of the array.
Definition: circular_array.hpp:185
+
value_type & reference
Value reference type of the array.
Definition: circular_array.hpp:85
+
constexpr const_reference at(size_type index) const
Returns a constant reference to the array value at the given index.
Definition: circular_array.hpp:331
+
constexpr reference at(size_type index)
Returns a reference to the array value at the given index.
Definition: circular_array.hpp:320
+
constexpr size_type effective_size() const noexcept
Returns the effective array size.
Definition: circular_array.hpp:436
+
constexpr const_iterator begin() const noexcept
Returns a constant iterator pointing to the front of the array.
Definition: circular_array.hpp:176
+
const value_type * const_pointer
Constant value pointer type of the arra.y.
Definition: circular_array.hpp:91
+
std::enable_if_t< Enabled > pop_back() noexcept
Pops a value from the back of the array.
Definition: circular_array.hpp:254
+
constexpr size_type max_size() const noexcept
Returns the maximum array size.
Definition: circular_array.hpp:427
+
void clear() noexcept
Clears array.
Definition: circular_array.hpp:384
+
constexpr reference back() noexcept
Returns a reference to the value at the back of the array.
Definition: circular_array.hpp:273
+
constexpr const_reverse_iterator rbegin() const noexcept
Returns a constant reverse iterator pointing to the back of the array.
Definition: circular_array.hpp:190
+
std::enable_if_t< Enabled > pop_front() noexcept
Pops a value from the front of the array.
Definition: circular_array.hpp:265
+
value_type * pointer
Value pointer type of the array.
Definition: circular_array.hpp:89
+
constexpr const_reverse_iterator crend() const noexcept
Returns a constant reverse iterator pointing past the front of the array.
Definition: circular_array.hpp:199
+
IndexingIterator< CircularArray< T, N, F > > iterator
Iterator type of the array.
Definition: circular_array.hpp:97
+
std::enable_if_t< Enabled > push_back(value_type value)
Pushes a value to the back of the array.
Definition: circular_array.hpp:209
+
constexpr iterator end() noexcept
Returns an iterator pointing past the back of the array.
Definition: circular_array.hpp:181
+
constexpr const_reverse_iterator crbegin() const noexcept
Returns a constant reverse iterator pointing to the back of the array.
Definition: circular_array.hpp:192
+
constexpr const T * data() const noexcept
Returns a constant pointer to the underlying array data.
Definition: circular_array.hpp:415
+
constexpr bool full() const noexcept
Returns true if the array is full, false otherwise.
Definition: circular_array.hpp:418
+
std::ptrdiff_t difference_type
Size difference type of the array.
Definition: circular_array.hpp:83
+
CircularArray()=default
Default constructor.
+
constexpr bool empty() const noexcept
Returns true if the array is empty, false otherwise.
Definition: circular_array.hpp:421
+
constexpr const_reverse_iterator rend() const noexcept
Returns a constant reverse iterator pointing past the front of the array.
Definition: circular_array.hpp:197
+
constexpr const_reference front() const noexcept
Returns a constant reference to the value at the front of the array.
Definition: circular_array.hpp:308
+
constexpr reference operator[](size_type index) noexcept
Returns a reference to the array value at the given index.
Definition: circular_array.hpp:342
+
constexpr const_reference back() const noexcept
Returns a constant reference to the value at the back of the array.
Definition: circular_array.hpp:284
+
std::reverse_iterator< const_iterator > const_reverse_iterator
Constant reverse iterator type of the array.
Definition: circular_array.hpp:103
+
CircularArray(T(&&data)[M])
Constructs array from an aggregate.
Definition: circular_array.hpp:163
+
constexpr size_type size() const noexcept
Returns the current array size.
Definition: circular_array.hpp:424
+
constexpr reverse_iterator rbegin() noexcept
Returns a reverse iterator pointing to the back of the array.
Definition: circular_array.hpp:188
+
std::size_t size_type
Size type of the array.
Definition: circular_array.hpp:81
+
constexpr T * data() noexcept
Returns a pointer to the underlying array data.
Definition: circular_array.hpp:408
+
void fill(const T &value)
Fills array to its maximum size with a given value.
Definition: circular_array.hpp:372
+
std::enable_if_t< Enabled > push_front(value_type value)
Pushes a value at the front of the array.
Definition: circular_array.hpp:232
+
IndexingIterator< const CircularArray< T, N, F > > const_iterator
Constant iterator type of the array.
Definition: circular_array.hpp:99
+
constexpr reference front() noexcept
Returns a reference to the value at the front of the array.
Definition: circular_array.hpp:296
+
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator type of the array.
Definition: circular_array.hpp:101
+
void allocator_type
Allocator type of the array (required in range-v3 10.0).
Definition: circular_array.hpp:94
+
constexpr iterator begin() noexcept
Returns an iterator pointing to the front of the array.
Definition: circular_array.hpp:174
+
T value_type
Value type of the array.
Definition: circular_array.hpp:79
+
constexpr const_reference operator[](size_type index) const noexcept
Returns a constant reference to the array value at the given index.
Definition: circular_array.hpp:354
+
constexpr const_iterator end() const noexcept
Returns a constant iterator pointing past the back of the array.
Definition: circular_array.hpp:183
+
const value_type & const_reference
Constant value reference type of the array.
Definition: circular_array.hpp:87
+
constexpr reverse_iterator rend() noexcept
Returns a reverse iterator pointing past the front of the array.
Definition: circular_array.hpp:195
+
constexpr const_iterator cbegin() const noexcept
Returns a constant iterator pointing to the front of the array.
Definition: circular_array.hpp:178
+
A random access iterator for any indexable container.
Definition: indexing_iterator.hpp:38
+
Implementation of a random access iterator for indexable containers.
+
T type
! Always T since circular arrays are homogeneous.
Definition: circular_array.hpp:538
+
+ + + + diff --git a/classbeluga_1_1CircularArray-members.html b/classbeluga_1_1CircularArray-members.html new file mode 100644 index 000000000..cfaf718cc --- /dev/null +++ b/classbeluga_1_1CircularArray-members.html @@ -0,0 +1,133 @@ + + + + + + + +Beluga: Member List + + + + + + + + + + +
+
+ + + + + + +
+
Beluga +
+
An extensible particle filter library.
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
beluga::CircularArray< T, N, F > Member List
+
+
+ +

This is the complete list of members for beluga::CircularArray< T, N, F >, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
allocator_type typedefbeluga::CircularArray< T, N, F >
at(size_type index)beluga::CircularArray< T, N, F >inline
at(size_type index) constbeluga::CircularArray< T, N, F >inline
back() noexceptbeluga::CircularArray< T, N, F >inline
back() const noexceptbeluga::CircularArray< T, N, F >inline
begin() noexceptbeluga::CircularArray< T, N, F >inline
begin() const noexceptbeluga::CircularArray< T, N, F >inline
cbegin() const noexceptbeluga::CircularArray< T, N, F >inline
cend() const noexceptbeluga::CircularArray< T, N, F >inline
CircularArray (defined in beluga::CircularArray< T, N, F >)beluga::CircularArray< T, N, F >friend
CircularArray()=defaultbeluga::CircularArray< T, N, F >
CircularArray(Iterator first, Sentinel last)beluga::CircularArray< T, N, F >inline
CircularArray(T(&&data)[M])beluga::CircularArray< T, N, F >inlineexplicit
clear() noexceptbeluga::CircularArray< T, N, F >inline
const_iterator typedefbeluga::CircularArray< T, N, F >
const_pointer typedefbeluga::CircularArray< T, N, F >
const_reference typedefbeluga::CircularArray< T, N, F >
const_reverse_iterator typedefbeluga::CircularArray< T, N, F >
crbegin() const noexceptbeluga::CircularArray< T, N, F >inline
crend() const noexceptbeluga::CircularArray< T, N, F >inline
data() noexceptbeluga::CircularArray< T, N, F >inline
data() const noexceptbeluga::CircularArray< T, N, F >inline
difference_type typedefbeluga::CircularArray< T, N, F >
effective_size() const noexceptbeluga::CircularArray< T, N, F >inline
empty() const noexceptbeluga::CircularArray< T, N, F >inline
end() noexceptbeluga::CircularArray< T, N, F >inline
end() const noexceptbeluga::CircularArray< T, N, F >inline
fill(const T &value)beluga::CircularArray< T, N, F >inline
front() noexceptbeluga::CircularArray< T, N, F >inline
front() const noexceptbeluga::CircularArray< T, N, F >inline
full() const noexceptbeluga::CircularArray< T, N, F >inline
iterator typedefbeluga::CircularArray< T, N, F >
max_size() const noexceptbeluga::CircularArray< T, N, F >inline
operator[](size_type index) noexceptbeluga::CircularArray< T, N, F >inline
operator[](size_type index) const noexceptbeluga::CircularArray< T, N, F >inline
pointer typedefbeluga::CircularArray< T, N, F >
pop_back() noexceptbeluga::CircularArray< T, N, F >inline
pop_front() noexceptbeluga::CircularArray< T, N, F >inline
push_back(value_type value)beluga::CircularArray< T, N, F >inline
push_front(value_type value)beluga::CircularArray< T, N, F >inline
rbegin() noexceptbeluga::CircularArray< T, N, F >inline
rbegin() const noexceptbeluga::CircularArray< T, N, F >inline
reference typedefbeluga::CircularArray< T, N, F >
rend() noexceptbeluga::CircularArray< T, N, F >inline
rend() const noexceptbeluga::CircularArray< T, N, F >inline
reverse_iterator typedefbeluga::CircularArray< T, N, F >
size() const noexceptbeluga::CircularArray< T, N, F >inline
size_type typedefbeluga::CircularArray< T, N, F >
swap(CircularArray< T, N, G > &other) noexcept(std::is_nothrow_swappable_v< T >)beluga::CircularArray< T, N, F >inline
value_type typedefbeluga::CircularArray< T, N, F >
+ + + + diff --git a/classbeluga_1_1CircularArray.html b/classbeluga_1_1CircularArray.html new file mode 100644 index 000000000..8c2baa6c2 --- /dev/null +++ b/classbeluga_1_1CircularArray.html @@ -0,0 +1,1002 @@ + + + + + + + +Beluga: beluga::CircularArray< T, N, F > Class Template Reference + + + + + + + + + + +
+
+ + + + + + +
+
Beluga +
+
An extensible particle filter library.
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+Public Types | +Public Member Functions | +List of all members
+
+
beluga::CircularArray< T, N, F > Class Template Reference
+
+
+ +

An implementation of generic, non-threadsafe circular array. + More...

+ +

#include <circular_array.hpp>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Types

+using value_type = T
 Value type of the array.
 
+using size_type = std::size_t
 Size type of the array.
 
+using difference_type = std::ptrdiff_t
 Size difference type of the array.
 
+using reference = value_type &
 Value reference type of the array.
 
+using const_reference = const value_type &
 Constant value reference type of the array.
 
+using pointer = value_type *
 Value pointer type of the array.
 
+using const_pointer = const value_type *
 Constant value pointer type of the arra.y.
 
+using allocator_type = void
 Allocator type of the array (required in range-v3 10.0).
 
+using iterator = IndexingIterator< CircularArray< T, N, F > >
 Iterator type of the array.
 
+using const_iterator = IndexingIterator< const CircularArray< T, N, F > >
 Constant iterator type of the array.
 
+using reverse_iterator = std::reverse_iterator< iterator >
 Reverse iterator type of the array.
 
+using const_reverse_iterator = std::reverse_iterator< const_iterator >
 Constant reverse iterator type of the array.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 CircularArray ()=default
 Default constructor. More...
 
template<typename Iterator , typename Sentinel , typename = std::enable_if_t<std::is_same_v<T, typename std::iterator_traits<Iterator>::value_type>>>
 CircularArray (Iterator first, Sentinel last)
 Constructs array from a pair of iterators. More...
 
template<std::size_t M>
 CircularArray (T(&&data)[M])
 Constructs array from an aggregate. More...
 
+constexpr iterator begin () noexcept
 Returns an iterator pointing to the front of the array.
 
+constexpr const_iterator begin () const noexcept
 Returns a constant iterator pointing to the front of the array.
 
+constexpr const_iterator cbegin () const noexcept
 Returns a constant iterator pointing to the front of the array.
 
+constexpr iterator end () noexcept
 Returns an iterator pointing past the back of the array.
 
+constexpr const_iterator end () const noexcept
 Returns a constant iterator pointing past the back of the array.
 
+constexpr const_iterator cend () const noexcept
 Returns a constant iterator pointing past the back of the array.
 
+constexpr reverse_iterator rbegin () noexcept
 Returns a reverse iterator pointing to the back of the array.
 
+constexpr const_reverse_iterator rbegin () const noexcept
 Returns a constant reverse iterator pointing to the back of the array.
 
+constexpr const_reverse_iterator crbegin () const noexcept
 Returns a constant reverse iterator pointing to the back of the array.
 
+constexpr reverse_iterator rend () noexcept
 Returns a reverse iterator pointing past the front of the array.
 
+constexpr const_reverse_iterator rend () const noexcept
 Returns a constant reverse iterator pointing past the front of the array.
 
+constexpr const_reverse_iterator crend () const noexcept
 Returns a constant reverse iterator pointing past the front of the array.
 
template<bool Enabled = !(F & CircularArrayFeatureFlags::kLayoutReversal)>
std::enable_if_t< Enabled > push_back (value_type value)
 Pushes a value to the back of the array. More...
 
template<bool Enabled = F& CircularArrayFeatureFlags::kLayoutReversal>
std::enable_if_t< Enabled > push_front (value_type value)
 Pushes a value at the front of the array. More...
 
template<bool Enabled = F& CircularArrayFeatureFlags::kLayoutReversal>
std::enable_if_t< Enabled > pop_back () noexcept
 Pops a value from the back of the array. More...
 
template<bool Enabled = !(F & CircularArrayFeatureFlags::kLayoutReversal)>
std::enable_if_t< Enabled > pop_front () noexcept
 Pops a value from the front of the array. More...
 
constexpr reference back () noexcept
 Returns a reference to the value at the back of the array. More...
 
constexpr const_reference back () const noexcept
 Returns a constant reference to the value at the back of the array. More...
 
constexpr reference front () noexcept
 Returns a reference to the value at the front of the array. More...
 
constexpr const_reference front () const noexcept
 Returns a constant reference to the value at the front of the array. More...
 
constexpr reference at (size_type index)
 Returns a reference to the array value at the given index. More...
 
constexpr const_reference at (size_type index) const
 Returns a constant reference to the array value at the given index. More...
 
constexpr reference operator[] (size_type index) noexcept
 Returns a reference to the array value at the given index. More...
 
constexpr const_reference operator[] (size_type index) const noexcept
 Returns a constant reference to the array value at the given index. More...
 
void fill (const T &value)
 Fills array to its maximum size with a given value. More...
 
void clear () noexcept
 Clears array. More...
 
template<CircularArrayFeatureFlags G>
void swap (CircularArray< T, N, G > &other) noexcept(std::is_nothrow_swappable_v< T >)
 Swaps array with another. More...
 
constexpr T * data () noexcept
 Returns a pointer to the underlying array data. More...
 
constexpr const T * data () const noexcept
 Returns a constant pointer to the underlying array data. More...
 
+constexpr bool full () const noexcept
 Returns true if the array is full, false otherwise.
 
+constexpr bool empty () const noexcept
 Returns true if the array is empty, false otherwise.
 
+constexpr size_type size () const noexcept
 Returns the current array size.
 
+constexpr size_type max_size () const noexcept
 Returns the maximum array size.
 
constexpr size_type effective_size () const noexcept
 Returns the effective array size. More...
 
+

Detailed Description

+

template<typename T, std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+class beluga::CircularArray< T, N, F >

+ +

An implementation of generic, non-threadsafe circular array.

+

Modelled after std::array. Its maximum size is fixed at compile-time. Most operations are O(1) but for a few that exhibit worse case O(N) (not considering the complexity of move-construction and move-assignment of array elements of type T). Additionally, it features optional indexing reversal (making it a LIFO rather than a FIFO data structure), optional back value extrapolation for constant read accesses, and optional rollover on write accesses (i.e. overwriting the oldest value when pushing to an array instance that is full).

+
Template Parameters
+ + + + +
TElement type. It must be default constructible, move constructible, and move assignable.
NMaximum size. It must be a positive integer.
FArray feature flags, to enable optional functionality. It defaults to none.
+
+
+

Constructor & Destructor Documentation

+ +

◆ CircularArray() [1/3]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + +
beluga::CircularArray< T, N, F >::CircularArray ()
+
+default
+
+ +

Default constructor.

+

Array will be functionally empty but storage will be default initialized.

+ +
+
+ +

◆ CircularArray() [2/3]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+
+template<typename Iterator , typename Sentinel , typename = std::enable_if_t<std::is_same_v<T, typename std::iterator_traits<Iterator>::value_type>>>
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
beluga::CircularArray< T, N, F >::CircularArray (Iterator first,
Sentinel last 
)
+
+inline
+
+ +

Constructs array from a pair of iterators.

+

Functionally equivalent to repeated push_back() operations or push_front() operations in reverse if the layout reversal feature is enabled. That is, both range and array layouts match.

+
Parameters
+ + + +
firstIterator to the beginning of a range.
lastSentinel for the end of a range.
+
+
+
Exceptions
+ + +
std::length_errorIf the range does not fit in the array (and the rollover on write feature is not enabled).
+
+
+ +
+
+ +

◆ CircularArray() [3/3]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+
+template<std::size_t M>
+ + + + + +
+ + + + + + + + +
beluga::CircularArray< T, N, F >::CircularArray (T(&&) data[M])
+
+inlineexplicit
+
+ +

Constructs array from an aggregate.

+

Functionally equivalent to repeated push_back() operations or push_front() operations in reverse if the layout reversal feature is enabled. That is, both aggregate and array layouts match.

+
Parameters
+ + +
dataAggregate data to initialize the array with. Its size must be in the [1, N] interval.
+
+
+ +
+
+

Member Function Documentation

+ +

◆ at() [1/2]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + + +
constexpr reference beluga::CircularArray< T, N, F >::at (size_type index)
+
+inlineconstexpr
+
+ +

Returns a reference to the array value at the given index.

+
Exceptions
+ + +
std::out_of_rangeIf index is past the array's effective size.
+
+
+ +
+
+ +

◆ at() [2/2]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + + +
constexpr const_reference beluga::CircularArray< T, N, F >::at (size_type index) const
+
+inlineconstexpr
+
+ +

Returns a constant reference to the array value at the given index.

+
Exceptions
+ + +
std::out_of_rangeIf index is past the array effective size.
+
+
+ +
+
+ +

◆ back() [1/2]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + +
constexpr const_reference beluga::CircularArray< T, N, F >::back () const
+
+inlineconstexprnoexcept
+
+ +

Returns a constant reference to the value at the back of the array.

+

Behavior is undefined when accessing the back of an empty array.

+ +
+
+ +

◆ back() [2/2]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + +
constexpr reference beluga::CircularArray< T, N, F >::back ()
+
+inlineconstexprnoexcept
+
+ +

Returns a reference to the value at the back of the array.

+

Behavior is undefined when accessing the back of an empty array.

+ +
+
+ +

◆ clear()

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + +
void beluga::CircularArray< T, N, F >::clear ()
+
+inlinenoexcept
+
+ +

Clears array.

+

No value destructors are invoked.

+ +
+
+ +

◆ data() [1/2]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + +
constexpr const T* beluga::CircularArray< T, N, F >::data () const
+
+inlineconstexprnoexcept
+
+ +

Returns a constant pointer to the underlying array data.

+

Note that a circular array does not feature a contiguous layout in memory. Indices and distances between them for the array do not map to its data.

+ +
+
+ +

◆ data() [2/2]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + +
constexpr T* beluga::CircularArray< T, N, F >::data ()
+
+inlineconstexprnoexcept
+
+ +

Returns a pointer to the underlying array data.

+

Note that a circular array does not feature a contiguous layout in memory. Indices and distances between them for the array do not map to its data.

+ +
+
+ +

◆ effective_size()

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + +
constexpr size_type beluga::CircularArray< T, N, F >::effective_size () const
+
+inlineconstexprnoexcept
+
+ +

Returns the effective array size.

+

Nominally, the effective array size is equal to the array size. If the last value extrapolation feature is enabled, however, the effective array size can only be 0 or N, when the array is empty and when the array is non-empty respectively.

+ +
+
+ +

◆ fill()

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + + +
void beluga::CircularArray< T, N, F >::fill (const T & value)
+
+inline
+
+ +

Fills array to its maximum size with a given value.

+

Functionally equivalent to repeated push_back() operations or push_front() operations if the layout reversal feature is enabled until the array reaches its maximum size. Existing values are kept. Filling an array that is full is a no-op.

+ +
+
+ +

◆ front() [1/2]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + +
constexpr const_reference beluga::CircularArray< T, N, F >::front () const
+
+inlineconstexprnoexcept
+
+ +

Returns a constant reference to the value at the front of the array.

+

Behavior is undefined when accessing the front of an empty array.

+ +
+
+ +

◆ front() [2/2]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + +
constexpr reference beluga::CircularArray< T, N, F >::front ()
+
+inlineconstexprnoexcept
+
+ +

Returns a reference to the value at the front of the array.

+

Behavior is undefined when accessing the front of an empty array.

+ +
+
+ +

◆ operator[]() [1/2]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + + +
constexpr const_reference beluga::CircularArray< T, N, F >::operator[] (size_type index) const
+
+inlineconstexprnoexcept
+
+ +

Returns a constant reference to the array value at the given index.

+

Behavior is undefined when index is greater than or equal to the array effective size.

+ +
+
+ +

◆ operator[]() [2/2]

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+ + + + + +
+ + + + + + + + +
constexpr reference beluga::CircularArray< T, N, F >::operator[] (size_type index)
+
+inlineconstexprnoexcept
+
+ +

Returns a reference to the array value at the given index.

+

Behavior is undefined when index is greater than or equal to the array size.

+ +
+
+ +

◆ pop_back()

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+
+template<bool Enabled = F& CircularArrayFeatureFlags::kLayoutReversal>
+ + + + + +
+ + + + + + + +
std::enable_if_t<Enabled> beluga::CircularArray< T, N, F >::pop_back ()
+
+inlinenoexcept
+
+ +

Pops a value from the back of the array.

+

Only available when the layout reversal feature is enabled. Behavior is undefined when popping from the back of an empty array. No destructors are invoked on the value popped.

+ +
+
+ +

◆ pop_front()

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+
+template<bool Enabled = !(F & CircularArrayFeatureFlags::kLayoutReversal)>
+ + + + + +
+ + + + + + + +
std::enable_if_t<Enabled> beluga::CircularArray< T, N, F >::pop_front ()
+
+inlinenoexcept
+
+ +

Pops a value from the front of the array.

+

Only available when the layout reversal feature is not enabled. Behavior is undefined when popping from the front of an empty array. No destructors are invoked on the value popped.

+ +
+
+ +

◆ push_back()

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+
+template<bool Enabled = !(F & CircularArrayFeatureFlags::kLayoutReversal)>
+ + + + + +
+ + + + + + + + +
std::enable_if_t<Enabled> beluga::CircularArray< T, N, F >::push_back (value_type value)
+
+inline
+
+ +

Pushes a value to the back of the array.

+

Only available when the layout reversal feature is not enabled.

+
Exceptions
+ + +
std::length_errorIf the array is full and the rollover on write feature is not enabled.
+
+
+ +
+
+ +

◆ push_front()

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+
+template<bool Enabled = F& CircularArrayFeatureFlags::kLayoutReversal>
+ + + + + +
+ + + + + + + + +
std::enable_if_t<Enabled> beluga::CircularArray< T, N, F >::push_front (value_type value)
+
+inline
+
+ +

Pushes a value at the front of the array.

+

Only available when the layout reversal feature is enabled.

+
Exceptions
+ + +
std::length_errorIf the array is full and the rollover on write feature is not enabled.
+
+
+ +
+
+ +

◆ swap()

+ +
+
+
+template<typename T , std::size_t N, CircularArrayFeatureFlags F = CircularArrayFeatureFlags::kNone>
+
+template<CircularArrayFeatureFlags G>
+ + + + + +
+ + + + + + + + +
void beluga::CircularArray< T, N, F >::swap (CircularArray< T, N, G > & other)
+
+inlinenoexcept
+
+ +

Swaps array with another.

+

Arrays being swapped may not necessarily have the same features enabled. This is most relevant when arrays differ in layout direction, as swapping two such arrays effectively reverses their elements.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/classbeluga_1_1IndexingIterator-members.html b/classbeluga_1_1IndexingIterator-members.html new file mode 100644 index 000000000..2a4604e45 --- /dev/null +++ b/classbeluga_1_1IndexingIterator-members.html @@ -0,0 +1,110 @@ + + + + + + + +Beluga: Member List + + + + + + + + + + +
+
+ + + + + + +
+
Beluga +
+
An extensible particle filter library.
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
beluga::IndexingIterator< Indexable, Index > Member List
+
+
+ +

This is the complete list of members for beluga::IndexingIterator< Indexable, Index >, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
difference_type typedefbeluga::IndexingIterator< Indexable, Index >
IndexingIterator()=defaultbeluga::IndexingIterator< Indexable, Index >explicit
IndexingIterator(Indexable *indexable, Index cursor=Index{})beluga::IndexingIterator< Indexable, Index >inlineexplicit
IndexingIterator(Indexable &indexable, Index cursor=Index{})beluga::IndexingIterator< Indexable, Index >inlineexplicit
iterator_category typedefbeluga::IndexingIterator< Indexable, Index >
operator!=(const IndexingIterator &other) const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator*() const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator+(difference_type offset) const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator+(difference_type offset, const IndexingIterator &iterator)beluga::IndexingIterator< Indexable, Index >friend
operator++(int) noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator++() noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator+=(difference_type offset) noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator-(difference_type offset) const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator-(const IndexingIterator &other) const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator--(int) noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator--() noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator-=(difference_type offset) noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator->() const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator<(const IndexingIterator &other) const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator<=(const IndexingIterator &other) const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator==(const IndexingIterator &other) const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator>(const IndexingIterator &other) const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator>=(const IndexingIterator &other) const noexceptbeluga::IndexingIterator< Indexable, Index >inline
operator[](difference_type offset) const noexceptbeluga::IndexingIterator< Indexable, Index >inline
pointer typedefbeluga::IndexingIterator< Indexable, Index >
reference typedefbeluga::IndexingIterator< Indexable, Index >
value_type typedefbeluga::IndexingIterator< Indexable, Index >
+ + + + diff --git a/classbeluga_1_1IndexingIterator.html b/classbeluga_1_1IndexingIterator.html new file mode 100644 index 000000000..696b2a97a --- /dev/null +++ b/classbeluga_1_1IndexingIterator.html @@ -0,0 +1,463 @@ + + + + + + + +Beluga: beluga::IndexingIterator< Indexable, Index > Class Template Reference + + + + + + + + + + +
+
+ + + + + + +
+
Beluga +
+
An extensible particle filter library.
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+Public Types | +Public Member Functions | +Friends | +List of all members
+
+
beluga::IndexingIterator< Indexable, Index > Class Template Reference
+
+
+ +

A random access iterator for any indexable container. + More...

+ +

#include <indexing_iterator.hpp>

+ + + + + + + + + + + + + + + + + +

+Public Types

+using value_type = std::remove_cv_t< std::remove_reference_t< decltype(std::declval< Indexable >()[std::declval< Index >()])> >
 Value type of the iterator.
 
+using reference = decltype(std::declval< Indexable >()[std::declval< Index >()])
 Value reference type of the iterator.
 
+using pointer = decltype(std::addressof(std::declval< Indexable >()[std::declval< Index >()]))
 Value pointer type of the iterator.
 
+using difference_type = std::make_signed_t< decltype(std::declval< Index >() - std::declval< Index >())>
 Signed difference type of the iterator.
 
+using iterator_category = std::random_access_iterator_tag
 Category of the iterator.
 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

IndexingIterator ()=default
 Default constructor. Iterator will point nowhere.
 
IndexingIterator (Indexable *indexable, Index cursor=Index{})
 Constructs iterator given a pointer to an indexable container and a cursor index on it.
 
IndexingIterator (Indexable &indexable, Index cursor=Index{})
 Constructs iterator given a reference to an indexable container and a cursor index on it.
 
+IndexingIterator operator++ (int) noexcept
 Post-increments iterator position in the target container.
 
+IndexingIteratoroperator++ () noexcept
 Pre-increments iterator position in the target container.
 
+IndexingIterator operator-- (int) noexcept
 Post-decrements iterator position in the target container.
 
+IndexingIteratoroperator-- () noexcept
 Pre-decrements iterator position in the target container.
 
+IndexingIteratoroperator+= (difference_type offset) noexcept
 Forwards iterator position a given offset, in-place.
 
+IndexingIterator operator+ (difference_type offset) const noexcept
 Forwards iterator position a given offset, yielding a modified copy.
 
+IndexingIteratoroperator-= (difference_type offset) noexcept
 Rewinds iterator position a given offset, in-place.
 
+IndexingIterator operator- (difference_type offset) const noexcept
 Rewinds iterator position a given offset, yielding a modified copy.
 
+difference_type operator- (const IndexingIterator &other) const noexcept
 Computes the difference (i.e. the distance) between the positions of this iterator and another.
 
reference operator[] (difference_type offset) const noexcept
 Dereferences iterator at a given offset from its current position. More...
 
reference operator* () const noexcept
 Dereferences iterator at its current position. More...
 
pointer operator-> () const noexcept
 Dereferences iterator at its current position and yields a pointer to it. More...
 
bool operator< (const IndexingIterator &other) const noexcept
 Checks if iterator position is strictly before that of another. More...
 
bool operator<= (const IndexingIterator &other) const noexcept
 Checks if iterator position is before or equal to that of another. More...
 
bool operator> (const IndexingIterator &other) const noexcept
 Checks if iterator position is strictly after that of another. More...
 
bool operator>= (const IndexingIterator &other) const noexcept
 Checks if iterator position is after or equal to that of another. More...
 
bool operator== (const IndexingIterator &other) const noexcept
 Checks if iterator position is equal to that of another. More...
 
+bool operator!= (const IndexingIterator &other) const noexcept
 Checks if iterator position is not equal to that of another.
 
+ + + + +

+Friends

+IndexingIterator operator+ (difference_type offset, const IndexingIterator &iterator)
 Forwards iterator a given offset, yielding a modified copy.
 
+

Detailed Description

+

template<class Indexable, class Index = typename Indexable::size_type>
+class beluga::IndexingIterator< Indexable, Index >

+ +

A random access iterator for any indexable container.

+

It can provide a pair of iterators for any container type that supports subscripting with an integral-like index.

+
Template Parameters
+ + + +
IndexableContainer type, potentially const. It must support subscripting.
IndexContainer index type. It must be default constructible and integral-like. Defaults to the indexable container size type, if defined.
+
+
+

Member Function Documentation

+ +

◆ operator*()

+ +
+
+
+template<class Indexable , class Index = typename Indexable::size_type>
+ + + + + +
+ + + + + + + +
reference beluga::IndexingIterator< Indexable, Index >::operator* () const
+
+inlinenoexcept
+
+ +

Dereferences iterator at its current position.

+

Behavior is undefined if the iterator is past the limits of the target container.

+ +
+
+ +

◆ operator->()

+ +
+
+
+template<class Indexable , class Index = typename Indexable::size_type>
+ + + + + +
+ + + + + + + +
pointer beluga::IndexingIterator< Indexable, Index >::operator-> () const
+
+inlinenoexcept
+
+ +

Dereferences iterator at its current position and yields a pointer to it.

+

Behavior is undefined if the iterator is past the limits of the target container.

+ +
+
+ +

◆ operator<()

+ +
+
+
+template<class Indexable , class Index = typename Indexable::size_type>
+ + + + + +
+ + + + + + + + +
bool beluga::IndexingIterator< Indexable, Index >::operator< (const IndexingIterator< Indexable, Index > & other) const
+
+inlinenoexcept
+
+ +

Checks if iterator position is strictly before that of another.

+

Can only be true for iterators that have the same target container.

+ +
+
+ +

◆ operator<=()

+ +
+
+
+template<class Indexable , class Index = typename Indexable::size_type>
+ + + + + +
+ + + + + + + + +
bool beluga::IndexingIterator< Indexable, Index >::operator<= (const IndexingIterator< Indexable, Index > & other) const
+
+inlinenoexcept
+
+ +

Checks if iterator position is before or equal to that of another.

+

Can only be true for iterators that have the same target container.

+ +
+
+ +

◆ operator==()

+ +
+
+
+template<class Indexable , class Index = typename Indexable::size_type>
+ + + + + +
+ + + + + + + + +
bool beluga::IndexingIterator< Indexable, Index >::operator== (const IndexingIterator< Indexable, Index > & other) const
+
+inlinenoexcept
+
+ +

Checks if iterator position is equal to that of another.

+

Can only be true for iterators that have the same target container.

+ +
+
+ +

◆ operator>()

+ +
+
+
+template<class Indexable , class Index = typename Indexable::size_type>
+ + + + + +
+ + + + + + + + +
bool beluga::IndexingIterator< Indexable, Index >::operator> (const IndexingIterator< Indexable, Index > & other) const
+
+inlinenoexcept
+
+ +

Checks if iterator position is strictly after that of another.

+

Can only be true for iterators that have the same target container.

+ +
+
+ +

◆ operator>=()

+ +
+
+
+template<class Indexable , class Index = typename Indexable::size_type>
+ + + + + +
+ + + + + + + + +
bool beluga::IndexingIterator< Indexable, Index >::operator>= (const IndexingIterator< Indexable, Index > & other) const
+
+inlinenoexcept
+
+ +

Checks if iterator position is after or equal to that of another.

+

Can only be true for iterators that have the same target container.

+ +
+
+ +

◆ operator[]()

+ +
+
+
+template<class Indexable , class Index = typename Indexable::size_type>
+ + + + + +
+ + + + + + + + +
reference beluga::IndexingIterator< Indexable, Index >::operator[] (difference_type offset) const
+
+inlinenoexcept
+
+ +

Dereferences iterator at a given offset from its current position.

+

Behavior is undefined for offsets that take the iterator past the limits of the target container.

+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/classbeluga_1_1TupleContainer.html b/classbeluga_1_1TupleContainer.html index 3815eb2c0..bfa2a4ea3 100644 --- a/classbeluga_1_1TupleContainer.html +++ b/classbeluga_1_1TupleContainer.html @@ -80,7 +80,7 @@

Primary template for a tuple of containers.


The documentation for this class was generated from the following file: diff --git a/classbeluga_1_1TupleContainer_3_01InternalContainer_00_01std_1_1tuple_3_01Types_8_8_8_01_4_01_4.html b/classbeluga_1_1TupleContainer_3_01InternalContainer_00_01std_1_1tuple_3_01Types_8_8_8_01_4_01_4.html index bf94a2333..8e2446784 100644 --- a/classbeluga_1_1TupleContainer_3_01InternalContainer_00_01std_1_1tuple_3_01Types_8_8_8_01_4_01_4.html +++ b/classbeluga_1_1TupleContainer_3_01InternalContainer_00_01std_1_1tuple_3_01Types_8_8_8_01_4_01_4.html @@ -401,7 +401,7 @@

tuple_vector.hpp +
  • /__w/beluga/beluga/src/beluga/beluga/include/beluga/containers/tuple_vector.hpp
  • diff --git a/classbeluga_1_1TupleVector.html b/classbeluga_1_1TupleVector.html index 5fdc61f95..f844e81b7 100644 --- a/classbeluga_1_1TupleVector.html +++ b/classbeluga_1_1TupleVector.html @@ -101,7 +101,7 @@

    Shorthand for a tuple of vectors with the default allocator.

    This is needed so we can define deduction guides for this type.


    The documentation for this class was generated from the following file: diff --git a/classes.html b/classes.html index bb0992537..3fa610c9f 100644 --- a/classes.html +++ b/classes.html @@ -77,7 +77,7 @@
    BaseDenseGrid2 (beluga)
    BaseLaserScan (beluga)
    BaseLinearGrid2 (beluga)
    BaseOccupancyGrid2 (beluga)
    BaseParticleFilterInterface (beluga)
    BaseRegularGrid2 (beluga)
    BeamModelParam (beluga)
    BeamSensorModel (beluga)
    BearingModelParam (beluga)
    BearingSensorModel (beluga)
    BearingSensorModelInterface (beluga)
    BootstrapParticleFilter (beluga)
    Bresenham2i (beluga)
    C
    -
    cluster_fn (beluga::cluster_detail)
    compose_interfaces (beluga)
    +
    CircularArray (beluga)
    cluster_fn (beluga::cluster_detail)
    compose_interfaces (beluga)
    D
    decay_tuple_like (beluga)
    decay_tuple_like< TupleLike< Args... >, std::enable_if_t< is_tuple_like_v< std::decay_t< TupleLike< Args... > > > > > (beluga)
    DifferentialDriveModel (beluga)
    DifferentialDriveModelParam (beluga)
    @@ -92,7 +92,7 @@
    has_single_element (beluga)
    has_single_element< T, TupleLike< Args... >, std::enable_if_t< is_tuple_like_v< std::decay_t< TupleLike< Args... > > > &&detail::tuple_index_found< T, Args... >()> > (beluga)
    hash< beluga::Numeric< T, PhantomType > > (std)
    I
    -
    is_tuple_like (beluga)
    Bresenham2i::Line::iterator (beluga)
    +
    IndexingIterator (beluga)
    is_tuple_like (beluga)
    Bresenham2i::Line::iterator (beluga)
    K
    KldLimiter (beluga)
    KldLimiterParam (beluga)
    @@ -119,7 +119,7 @@
    sample_base_fn (beluga::views::detail)
    sample_fn (beluga::views::detail)
    sample_view (beluga::views::detail)
    Bresenham2i::Line::iterator::sentinel (beluga)
    SimpleStateEstimator (beluga)
    SimpleStateEstimator< Mixin, Sophus::SE2d > (beluga)
    spatial_hash (beluga)
    spatial_hash< Sophus::SE2d, void > (beluga)
    spatial_hash< std::array< T, N >, std::enable_if_t< std::is_arithmetic_v< T >, void > > (beluga)
    spatial_hash< Tuple< Types... >, std::enable_if_t<(std::is_arithmetic_v< Types > &&...), void > > (beluga)
    state_fn (beluga::state_detail)
    StationaryModel (beluga)
    StorageInterface (beluga)
    StoragePolicy (beluga)
    T
    -
    take_evenly_fn (beluga::views::detail)
    take_while_kld_fn (beluga::views::detail)
    ThrunRecoveryProbabilityEstimator (beluga)
    tuple_index (beluga)
    tuple_index< T, TupleLike< Args... >, std::enable_if_t< is_tuple_like_v< std::decay_t< TupleLike< Args... > > > &&detail::tuple_index_found< T, Args... >()> > (beluga)
    TupleContainer (beluga)
    TupleContainer< InternalContainer, std::tuple< Types... > > (beluga)
    TupleVector (beluga)
    +
    take_evenly_fn (beluga::views::detail)
    take_while_kld_fn (beluga::views::detail)
    ThrunRecoveryProbabilityEstimator (beluga)
    tuple_element< I, beluga::CircularArray< T, N, F > > (std)
    tuple_index (beluga)
    tuple_index< T, TupleLike< Args... >, std::enable_if_t< is_tuple_like_v< std::decay_t< TupleLike< Args... > > > &&detail::tuple_index_found< T, Args... >()> > (beluga)
    tuple_size< beluga::CircularArray< T, N, F > > (std)
    TupleContainer (beluga)
    TupleContainer< InternalContainer, std::tuple< Types... > > (beluga)
    TupleVector (beluga)
    U
    UniformFreeSpaceGridDistribution (beluga)
    UniformFreeSpaceGridDistribution< Sophus::SE2d > (beluga)
    diff --git a/containers_8hpp.html b/containers_8hpp.html new file mode 100644 index 000000000..d2771c2d1 --- /dev/null +++ b/containers_8hpp.html @@ -0,0 +1,132 @@ + + + + + + + +Beluga: /__w/beluga/beluga/src/beluga/beluga/include/beluga/containers.hpp File Reference + + + + + + + + + + +
    +
    + + + + + + +
    +
    Beluga +
    +
    An extensible particle filter library.
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    containers.hpp File Reference
    +
    +
    + +

    Implementation of efficient containers. +More...

    +
    +Include dependency graph for containers.hpp:
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +This graph shows which files directly or indirectly include this file:
    +
    +
    + + + + +
    +
    +

    Go to the source code of this file.

    +

    Detailed Description

    +

    Implementation of efficient containers.

    +
    + + + + diff --git a/containers_8hpp__dep__incl.map b/containers_8hpp__dep__incl.map new file mode 100644 index 000000000..d0948ce33 --- /dev/null +++ b/containers_8hpp__dep__incl.map @@ -0,0 +1,4 @@ + + + + diff --git a/containers_8hpp__dep__incl.md5 b/containers_8hpp__dep__incl.md5 new file mode 100644 index 000000000..1ba1185bc --- /dev/null +++ b/containers_8hpp__dep__incl.md5 @@ -0,0 +1 @@ +d97c4e483c7f5908142a8cf2506d497d \ No newline at end of file diff --git a/containers_8hpp__dep__incl.png b/containers_8hpp__dep__incl.png new file mode 100644 index 000000000..a2e3773d7 Binary files /dev/null and b/containers_8hpp__dep__incl.png differ diff --git a/containers_8hpp__incl.map b/containers_8hpp__incl.map new file mode 100644 index 000000000..4910828cf --- /dev/null +++ b/containers_8hpp__incl.map @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/containers_8hpp__incl.md5 b/containers_8hpp__incl.md5 new file mode 100644 index 000000000..19078932f --- /dev/null +++ b/containers_8hpp__incl.md5 @@ -0,0 +1 @@ +c223ae295b0df94dce1fe39812375206 \ No newline at end of file diff --git a/containers_8hpp__incl.png b/containers_8hpp__incl.png new file mode 100644 index 000000000..b2fdfc659 Binary files /dev/null and b/containers_8hpp__incl.png differ diff --git a/containers_8hpp_source.html b/containers_8hpp_source.html new file mode 100644 index 000000000..8d7097d27 --- /dev/null +++ b/containers_8hpp_source.html @@ -0,0 +1,103 @@ + + + + + + + +Beluga: /__w/beluga/beluga/src/beluga/beluga/include/beluga/containers.hpp Source File + + + + + + + + + + +
    +
    + + + + + + +
    +
    Beluga +
    +
    An extensible particle filter library.
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    containers.hpp
    +
    +
    +Go to the documentation of this file.
    1 // Copyright 2024 Ekumen, Inc.
    +
    2 //
    +
    3 // Licensed under the Apache License, Version 2.0 (the "License");
    +
    4 // you may not use this file except in compliance with the License.
    +
    5 // You may obtain a copy of the License at
    +
    6 //
    +
    7 // http://www.apache.org/licenses/LICENSE-2.0
    +
    8 //
    +
    9 // Unless required by applicable law or agreed to in writing, software
    +
    10 // distributed under the License is distributed on an "AS IS" BASIS,
    +
    11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +
    12 // See the License for the specific language governing permissions and
    +
    13 // limitations under the License.
    +
    14 
    +
    15 #ifndef BELUGA_CONTAINERS_HPP
    +
    16 #define BELUGA_CONTAINERS_HPP
    +
    17 
    + + +
    20 
    +
    26 #endif
    +
    Implementation of a generic circular array container.
    +
    Implementation of a tuple of containers.
    +
    + + + + diff --git a/dir_000001_000006.html b/dir_000001_000005.html similarity index 79% rename from dir_000001_000006.html rename to dir_000001_000005.html index 08b0e164b..799a2e8e5 100644 --- a/dir_000001_000006.html +++ b/dir_000001_000005.html @@ -5,7 +5,7 @@ -Beluga: /__w/beluga/beluga/src/beluga/beluga/include/beluga -> interfaces Relation +Beluga: /__w/beluga/beluga/src/beluga/beluga/include/beluga -> containers Relation @@ -67,7 +67,7 @@
    -

    beluga → interfaces Relation

    File in include/belugaIncludes file in include/beluga/interfaces
    sensor.hppbearing_sensor_model_interface.hpp
    sensor.hpplandmark_sensor_model_interface.hpp
    sensor.hpplaser_sensor_model_interface_2d.hpp
    +

    beluga → containers Relation

    File in include/belugaIncludes file in include/beluga/containers
    containers.hppcircular_array.hpp
    containers.hpptuple_vector.hpp
    mixin / storage.hpptuple_vector.hpp