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 <ArmarXCore/interface/observers/ObserverInterface.h>
29 
30 #include <deque>
31 #include <mutex>
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  */
46  virtual public DatafieldFilterBase
47  {
48  public:
50  DatafieldFilter(DatafieldFilter const& filter);
51 
52  // DatafieldFilterBase interface
53 
54  /**
55  * @brief Adds the given value to the data map, erases old values if maximum size was reached,
56  * and calculates the new filtered value.
57  * @param timestamp Timestamp at which the data value was taken.
58  * @param value The new data value.
59  */
60  void update(Ice::Long timestamp, const VariantBasePtr& value, const Ice::Current& c = Ice::emptyCurrent) override;
61 
62  /**
63  * @brief Retrieves the current, filtered value.
64  * Triggers calculates if if filtered value pointer is empty.
65  */
66  VariantBasePtr getValue(const Ice::Current& c = Ice::emptyCurrent) const override;
67 
68  /**
69  * @brief Checks whether the given type is supported.
70  * @param variantType
71  * @return
72  */
73  bool checkTypeSupport(VariantTypeId variantType, const Ice::Current& c = Ice::emptyCurrent) const override;
74  armarx::StringFloatDictionary getProperties(const Ice::Current& c = Ice::emptyCurrent) const override;
75  void setProperties(const armarx::StringFloatDictionary& newValues, const Ice::Current& c = Ice::emptyCurrent) override;
76  const TimeVariantBaseMap& getDataHistory() const;
77 
78  protected:
80  mutable std::mutex historyMutex;
81  };
82 
83 } // namespace armarx
84 
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:43
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:44
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
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:30
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:82
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:917
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:44
armarx::DatafieldFilter::getValue
VariantBasePtr getValue(const Ice::Current &c=Ice::emptyCurrent) const override
Retrieves the current, filtered value.
Definition: DatafieldFilter.cpp:70
armarx::DatafieldFilter::dataHistory
TimeVariantBaseMap dataHistory
Definition: DatafieldFilter.h:79
armarx::DatafieldFilter::historyMutex
std::mutex historyMutex
Definition: DatafieldFilter.h:80
Variant.h
armarx::DatafieldFilter::getDataHistory
const TimeVariantBaseMap & getDataHistory() const
Definition: DatafieldFilter.cpp:117
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28