DatafieldFilter.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 #include <deque>
28 #include <mutex>
29 
30 #include <ArmarXCore/interface/observers/ObserverInterface.h>
32 
33 namespace armarx
34 {
35  const Ice::Current staticIceCurrent = Ice::emptyCurrent;
36  using TimeVariantBaseMap = std::deque<std::pair<long, VariantBasePtr>>;
37 
38  /**
39  * @class DatafieldFilter
40  * @ingroup ObserverFilters
41  * @brief The DatafieldFilter class is the base class for all filters
42  * and filter implementation should derive from this class.
43  * For usage explanation see \ref Observers-Filters.
44  */
45  class DatafieldFilter : virtual public DatafieldFilterBase
46  {
47  public:
49  DatafieldFilter(DatafieldFilter const& filter);
50 
51  // DatafieldFilterBase interface
52 
53  /**
54  * @brief Adds the given value to the data map, erases old values if maximum size was reached,
55  * and calculates the new filtered value.
56  * @param timestamp Timestamp at which the data value was taken.
57  * @param value The new data value.
58  */
60  const VariantBasePtr& value,
61  const Ice::Current& c = Ice::emptyCurrent) override;
62 
63  /**
64  * @brief Retrieves the current, filtered value.
65  * Triggers calculates if if filtered value pointer is empty.
66  */
67  VariantBasePtr getValue(const Ice::Current& c = Ice::emptyCurrent) const override;
68 
69  /**
70  * @brief Checks whether the given type is supported.
71  * @param variantType
72  * @return
73  */
74  bool checkTypeSupport(VariantTypeId variantType,
75  const Ice::Current& c = Ice::emptyCurrent) const override;
76  armarx::StringFloatDictionary
77  getProperties(const Ice::Current& c = Ice::emptyCurrent) const override;
78  void setProperties(const armarx::StringFloatDictionary& newValues,
79  const Ice::Current& c = Ice::emptyCurrent) override;
80  const TimeVariantBaseMap& getDataHistory() const;
81 
82  protected:
84  mutable std::mutex historyMutex;
85  };
86 
87 } // namespace armarx
armarx::DatafieldFilter
The DatafieldFilter class is the base class for all filters and filter implementation should derive f...
Definition: DatafieldFilter.h:45
armarx::TimeVariantBaseMap
std::deque< std::pair< long, VariantBasePtr > > TimeVariantBaseMap
Definition: DatafieldFilter.h:36
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::staticIceCurrent
const Ice::Current staticIceCurrent
Definition: DatafieldFilter.h:35
IceInternal::Handle<::armarx::VariantBase >
armarx::DatafieldFilter::update
void update(Ice::Long timestamp, const VariantBasePtr &value, const Ice::Current &c=Ice::emptyCurrent) override
Adds the given value to the data map, erases old values if maximum size was reached,...
Definition: DatafieldFilter.cpp:41
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
armarx::DatafieldFilter::setProperties
void setProperties(const armarx::StringFloatDictionary &newValues, const Ice::Current &c=Ice::emptyCurrent) override
Definition: DatafieldFilter.cpp:103
armarx::DatafieldFilter::DatafieldFilter
DatafieldFilter()
Definition: DatafieldFilter.cpp:31
armarx::DatafieldFilter::checkTypeSupport
bool checkTypeSupport(VariantTypeId variantType, const Ice::Current &c=Ice::emptyCurrent) const override
Checks whether the given type is supported.
Definition: DatafieldFilter.cpp:81
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:918
timestamp
std::string timestamp()
Definition: CartographerAdapter.cpp:85
armarx::DatafieldFilter::getProperties
armarx::StringFloatDictionary getProperties(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: DatafieldFilter.cpp:96
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:43
armarx::DatafieldFilter::getValue
VariantBasePtr getValue(const Ice::Current &c=Ice::emptyCurrent) const override
Retrieves the current, filtered value.
Definition: DatafieldFilter.cpp:68
armarx::DatafieldFilter::dataHistory
TimeVariantBaseMap dataHistory
Definition: DatafieldFilter.h:83
armarx::DatafieldFilter::historyMutex
std::mutex historyMutex
Definition: DatafieldFilter.h:84
Variant.h
armarx::DatafieldFilter::getDataHistory
const TimeVariantBaseMap & getDataHistory() const
Definition: DatafieldFilter.cpp:119
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27