JeVois
1.20
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Tweet
parametermacros.C
Go to the documentation of this file.
1
2
#ifndef JEVOIS_DOXYGEN
3
4
// Convenience macro to define a Parameter type. All the ... args are passed to ParameterDef
5
#define JEVOIS_DECLARE_PARAMETER(ParamName, ParamType, ...) \
6
struct ParamName : public virtual jevois::ParameterRegistry, public jevois::ParameterCore<ParamType> \
7
{ \
8
typedef ParamType type; \
9
\
10
inline ParamName() : jevois::ParameterCore<ParamType>(jevois::ParameterDef<ParamType>(#ParamName, __VA_ARGS__)) \
11
{ jevois::ParameterRegistry::addParameter(this); } \
12
\
13
inline virtual ~ParamName() \
14
{ jevois::ParameterRegistry::removeParameter(this); } \
15
\
16
inline virtual jevois::Component const * owner() const override \
17
{ return dynamic_cast<jevois::Component const *>(static_cast<jevois::ParameterRegistry const *>(this)); } \
18
};
19
20
// Convenience macro to define a Parameter type with callback. All the ... args are passed to ParameterDef
21
#define JEVOIS_DECLARE_PARAMETER_WITH_CALLBACK(ParamName, ParamType, ...) \
22
struct ParamName : public virtual jevois::ParameterRegistry, public jevois::ParameterCore<ParamType> \
23
{ \
24
typedef ParamType type; \
25
\
26
virtual void onParamChange(ParamName const & param, ParamType const & newval) = 0; \
27
\
28
inline ParamName() : jevois::ParameterCore<ParamType>(jevois::ParameterDef<ParamType>(#ParamName, __VA_ARGS__)) \
29
{ setCallback([this](ParamType const & newval) { this->onParamChange(*this, newval); }); \
30
jevois::ParameterRegistry::addParameter(this); } \
31
\
32
inline virtual ~ParamName() \
33
{ jevois::ParameterRegistry::removeParameter(this); } \
34
\
35
inline virtual jevois::Component const * owner() const override \
36
{ return dynamic_cast<jevois::Component const *>(static_cast<jevois::ParameterRegistry const *>(this)); } \
37
};
38
39
#endif
40
doc
snip
parametermacros.C
Please help us improve this page: Edit it on
GitHub
or
email us your edits and suggestions.
Generated by
1.8.17