GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: unittest/factory/activation.hpp Lines: 6 6 100.0 %
Date: 2024-02-13 11:12:33 Branches: 4 6 66.7 %

Line Branch Exec Source
1
///////////////////////////////////////////////////////////////////////////////
2
// BSD 3-Clause License
3
//
4
// Copyright (C) 2019-2021, LAAS-CNRS, University of Edinburgh
5
// Copyright note valid unless otherwise stated in individual files.
6
// All rights reserved.
7
///////////////////////////////////////////////////////////////////////////////
8
9
#ifndef CROCODDYL_ACTIVATION_FACTORY_HPP_
10
#define CROCODDYL_ACTIVATION_FACTORY_HPP_
11
12
#include "crocoddyl/core/activation-base.hpp"
13
#include "crocoddyl/core/numdiff/activation.hpp"
14
15
namespace crocoddyl {
16
namespace unittest {
17
18
struct ActivationModelTypes {
19
  enum Type {
20
    ActivationModelQuad,
21
    ActivationModelQuadFlatExp,
22
    ActivationModelQuadFlatLog,
23
    ActivationModelSmooth1Norm,
24
    ActivationModelSmooth2Norm,
25
    ActivationModelWeightedQuad,
26
    ActivationModelQuadraticBarrier,
27
    ActivationModelWeightedQuadraticBarrier,
28
    ActivationModel2NormBarrier,
29
    NbActivationModelTypes
30
  };
31
23
  static std::vector<Type> init_all() {
32
23
    std::vector<Type> v;
33
23
    v.reserve(NbActivationModelTypes);
34
230
    for (int i = 0; i < NbActivationModelTypes; ++i) {
35
207
      v.push_back((Type)i);
36
    }
37
23
    return v;
38
  }
39
  static const std::vector<Type> all;
40
};
41
42
std::ostream& operator<<(std::ostream& os, ActivationModelTypes::Type type);
43
44
class ActivationModelFactory {
45
 public:
46
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
47
48
  explicit ActivationModelFactory();
49
  ~ActivationModelFactory();
50
51
  boost::shared_ptr<crocoddyl::ActivationModelAbstract> create(
52
      ActivationModelTypes::Type activation_type, std::size_t nr = 5) const;
53
};
54
55
}  // namespace unittest
56
}  // namespace crocoddyl
57
58
#endif  // CROCODDYL_ACTIVATION_FACTORY_HPP_