diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-10-10 21:15:03 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-10-10 21:15:03 +0200 |
commit | 44deeb85c09451865c7d869f495a31f1b4348fec (patch) | |
tree | 4022df1d50a5d9b2d5cbbc05c5e56289965fc25a /src/modules/controllib/block/BlockParam.hpp | |
parent | 0cb8e782b0e2a6ca0dde4fac641e863c95d04511 (diff) | |
download | px4-firmware-44deeb85c09451865c7d869f495a31f1b4348fec.tar.gz px4-firmware-44deeb85c09451865c7d869f495a31f1b4348fec.tar.bz2 px4-firmware-44deeb85c09451865c7d869f495a31f1b4348fec.zip |
We compile with GCC 4.7.4
Diffstat (limited to 'src/modules/controllib/block/BlockParam.hpp')
-rw-r--r-- | src/modules/controllib/block/BlockParam.hpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/modules/controllib/block/BlockParam.hpp b/src/modules/controllib/block/BlockParam.hpp index 58a9bfc0d..36bc8c24b 100644 --- a/src/modules/controllib/block/BlockParam.hpp +++ b/src/modules/controllib/block/BlockParam.hpp @@ -69,22 +69,39 @@ protected: /** * Parameters that are tied to blocks for updating and nameing. */ -template<class T> -class __EXPORT BlockParam : public BlockParamBase + +class __EXPORT BlockParamFloat : public BlockParamBase +{ +public: + BlockParamFloat(Block *block, const char *name, bool parent_prefix=true) : + BlockParamBase(block, name, parent_prefix), + _val() { + update(); + } + float get() { return _val; } + void set(float val) { _val = val; } + void update() { + if (_handle != PARAM_INVALID) param_get(_handle, &_val); + } +protected: + float _val; +}; + +class __EXPORT BlockParamInt : public BlockParamBase { public: - BlockParam(Block *block, const char *name, bool parent_prefix=true) : + BlockParamInt(Block *block, const char *name, bool parent_prefix=true) : BlockParamBase(block, name, parent_prefix), _val() { update(); } - T get() { return _val; } - void set(T val) { _val = val; } + int get() { return _val; } + void set(int val) { _val = val; } void update() { if (_handle != PARAM_INVALID) param_get(_handle, &_val); } protected: - T _val; + int _val; }; } // namespace control |