GCC Code Coverage Report


Directory: ./
File: src/matrix/fir-filter.cpp
Date: 2024-08-13 12:13:25
Exec Total Coverage
Lines: 0 9 0.0%
Branches: 0 10 0.0%

Line Branch Exec Source
1 /*
2 * Copyright 2010,
3 * François Bleibel,
4 * Olivier Stasse,
5 *
6 * CNRS/AIST
7 *
8 */
9
10 #include <sot/core/factory.hh>
11 #include <sot/core/fir-filter.hh>
12
13 using dynamicgraph::Entity;
14 using dynamicgraph::EntityRegisterer;
15 using dynamicgraph::Vector;
16
17 #define SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN(sotClassType, sotSigType, \
18 sotCoefType, id, className) \
19 template <> \
20 std::string sotClassType<sotSigType, sotCoefType>::getTypeName(void) { \
21 return #sotSigType; \
22 } \
23 \
24 template <> \
25 const std::string sotClassType<sotSigType, sotCoefType>::CLASS_NAME = \
26 std::string(className) + "_" + #sotSigType + "_" + #sotCoefType; \
27 \
28 template <> \
29 const std::string &sotClassType<sotSigType, sotCoefType>::getClassName(void) \
30 const { \
31 return CLASS_NAME; \
32 } \
33 extern "C" { \
34 Entity *regFunction##_##id(const std::string &objname) { \
35 return new sotClassType<sotSigType, sotCoefType>(objname); \
36 } \
37 EntityRegisterer reg##_##id(std::string(className) + "_" + #sotSigType + \
38 "_" + #sotCoefType, \
39 &regFunction##_##id); \
40 }
41
42 namespace dynamicgraph {
43 namespace sot {
44 using dynamicgraph::command::Command;
45 using dynamicgraph::command::Value;
46
47 SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN(FIRFilter, double, double, double_double,
48 "FIRFilter")
49 SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN(FIRFilter, Vector, double, vec_double,
50 "FIRFilter")
51 SOT_FACTORY_TEMPLATE_ENTITY_PLUGIN(FIRFilter, Vector, Matrix, vec_mat,
52 "FIRFilter")
53
54 template <>
55 void FIRFilter<Vector, double>::reset_signal(Vector &res,
56 const Vector &sample) {
57 res.resize(sample.size());
58 res.fill(0);
59 }
60
61 template <>
62 void FIRFilter<Vector, Matrix>::reset_signal(Vector &res,
63 const Vector &sample) {
64 res.resize(sample.size());
65 res.fill(0);
66 }
67
68 } // namespace sot
69 } // namespace dynamicgraph
70
71 #include <sot/core/fir-filter-impl.hh>
72
73 #ifdef WIN32
74 #define DEFINE_SPECIFICATION(sotClassType, sotSigType, sotCoefType) \
75 sotClassType##sotSigType##sotCoefType:: \
76 sotClassType##sotSigType##sotCoefType(const std::string &name) \
77 : sotClassType<sotSigType, sotCoefType>(name){};
78
79 namespace dynamicgraph {
80 namespace sot {
81 typedef double Double;
82 typedef Value dynamicgraph::command::Value;
83 DEFINE_SPECIFICATION(FIRFilter, Double, Double)
84 DEFINE_SPECIFICATION(FIRFilter, Vector, Double)
85 DEFINE_SPECIFICATION(FIRFilter, Vector, Matrix)
86 } // namespace sot
87 } // namespace dynamicgraph
88 #endif // WIN32
89