Directory: | ./ |
---|---|
File: | unittest/factory/state.hpp |
Date: | 2025-01-16 08:47:40 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 6 | 6 | 100.0% |
Branches: | 4 | 6 | 66.7% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | ||
2 | // BSD 3-Clause License | ||
3 | // | ||
4 | // Copyright (C) 2019-2020, LAAS-CNRS, University of Edinburgh | ||
5 | // Copyright note valid unless otherwise stated in individual files. | ||
6 | // All rights reserved. | ||
7 | /////////////////////////////////////////////////////////////////////////////// | ||
8 | |||
9 | #ifndef CROCODDYL_STATE_FACTORY_HPP_ | ||
10 | #define CROCODDYL_STATE_FACTORY_HPP_ | ||
11 | |||
12 | #include "crocoddyl/core/numdiff/state.hpp" | ||
13 | #include "crocoddyl/core/state-base.hpp" | ||
14 | #include "crocoddyl/core/utils/exception.hpp" | ||
15 | #include "pinocchio_model.hpp" | ||
16 | |||
17 | namespace crocoddyl { | ||
18 | namespace unittest { | ||
19 | |||
20 | struct StateModelTypes { | ||
21 | enum Type { | ||
22 | StateVector, | ||
23 | StateMultibody_Hector, | ||
24 | StateMultibody_TalosArm, | ||
25 | StateMultibodyContact2D_TalosArm, | ||
26 | StateMultibody_HyQ, | ||
27 | StateMultibody_Talos, | ||
28 | StateMultibody_RandomHumanoid, | ||
29 | NbStateModelTypes | ||
30 | }; | ||
31 | 23 | static std::vector<Type> init_all() { | |
32 | 23 | std::vector<Type> v; | |
33 |
1/2✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
|
23 | v.reserve(NbStateModelTypes); |
34 |
2/2✓ Branch 0 taken 161 times.
✓ Branch 1 taken 23 times.
|
184 | for (int i = 0; i < NbStateModelTypes; ++i) { |
35 |
1/2✓ Branch 1 taken 161 times.
✗ Branch 2 not taken.
|
161 | 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, StateModelTypes::Type type); | ||
43 | |||
44 | class StateModelFactory { | ||
45 | public: | ||
46 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW | ||
47 | |||
48 | explicit StateModelFactory(); | ||
49 | ~StateModelFactory(); | ||
50 | |||
51 | boost::shared_ptr<crocoddyl::StateAbstract> create( | ||
52 | StateModelTypes::Type state_type) const; | ||
53 | }; | ||
54 | |||
55 | } // namespace unittest | ||
56 | } // namespace crocoddyl | ||
57 | |||
58 | #endif // CROCODDYL_STATE_FACTORY_HPP_ | ||
59 |