GCC Code Coverage Report


Directory: ./
File: include/parametric-curves/abstract-curve.hpp
Date: 2025-04-07 13:04:42
Exec Total Coverage
Lines: 5 11 45.5%
Branches: 0 4 0.0%

Line Branch Exec Source
1 /**
2 * \file AbstractCurve.hpp
3 * \brief interface for a Curve of arbitrary dimension.
4 * \author Steve T.
5 * \version 0.1
6 * \date 06/17/2013
7 *
8 * Interface for a curve
9 */
10 #include <cstddef>
11 #include <iostream>
12
13 #ifndef _parameteric_curves_abstract_curve_hpp
14 #define _parameteric_curves_abstract_curve_hpp
15
16 namespace parametriccurves {
17 /// \struct AbstractCurve
18 /// \brief Represents a curve of dimension Dim
19 /// is Safe is false, no verification is made on the evaluation of the curve.
20 template <typename Numeric, typename Point>
21 struct AbstractCurve {
22 typedef Point point_t;
23 typedef Numeric time_t;
24 typedef Numeric num_t;
25
26 public:
27 /* Constructors - destructors */
28 114 AbstractCurve(time_t t_min_, time_t t_max_) : t_min(t_min_), t_max(t_max_) {}
29 11 AbstractCurve() {}
30 68 virtual ~AbstractCurve() {}
31
32 public:
33 /// \brief Evaluation of the cubic spline at time t.
34 /// \param t : the time when to evaluate the spine
35 /// \param return : the value x(t)
36 virtual const point_t operator()(const time_t& t) const = 0;
37
38 /// \brief Evaluation of the derivative spline at time t.
39 /// \param t : the time when to evaluate the spline
40 /// \param order : order of the derivative
41 /// \param return : the value x(t)
42 virtual const point_t derivate(const time_t& t,
43 const std::size_t& order) const = 0;
44
45 public:
46 /*Getters*/
47 244 virtual const time_t tmin() const { return t_min; }
48 122 virtual const time_t tmax() const { return t_max; }
49 virtual bool checkRange(const time_t t) const {
50 return (t >= t_min) && (t <= t_max);
51 }
52
53 /* Setters */
54 virtual bool setInitialPoint(const point_t& /*x_init*/) = 0;
55 virtual bool setInitialPoint(const num_t& /*x_init*/) = 0;
56
57 virtual bool setTimePeriod(const time_t& traj_time_) {
58 t_min = 0.0;
59 t_max = traj_time_;
60 return true;
61 }
62
63 protected:
64 time_t t_min;
65 time_t t_max;
66 };
67 } // namespace parametriccurves
68 #endif //_STRUCT_CURVE_ABC
69