Filter.h
Go to the documentation of this file.
1#pragma once
2
3// STD/STL
4#include <memory>
5#include <mutex>
6
7// Simox
8#include <SimoxUtility/json.h>
9
10// ArmarX
14
16{
18 {
19 public:
20 MemoryFilter() = default;
21 virtual ~MemoryFilter() = default;
22
23 virtual bool accept(const armem::wm::Memory& e) = 0;
24 virtual void configure(const nlohmann::json& json);
25 };
26
28 {
29 public:
30 SnapshotFilter() = default;
31 virtual ~SnapshotFilter() = default;
32
33 virtual bool accept(const armem::wm::EntitySnapshot& e, bool simulatedVersion = false) = 0;
34 virtual void configure(const nlohmann::json& json);
35
37 {
38 double accepted = 0;
39 double rejected = 0;
40 std::chrono::duration<double> additional_time = std::chrono::duration<double>::zero();
41 std::string additional_info = "";
43 std::chrono::high_resolution_clock::time_point start_time;
44 std::chrono::high_resolution_clock::time_point end_time;
46 std::string importance_type = "";
47 } stats;
48
49 virtual FilterStatistics getFilterStatistics();
50 virtual std::string getName();
51
52 /**
53 * @brief resetStatisticsForNewEpisode resets the parts of the statistics that are unique
54 * to one recording cycle (episode)
55 */
57
58 protected:
59 /// Mutex for thread-safe access to filter state (stats and derived class state)
60 /// Derived classes should lock this mutex when modifying mutable state
61 mutable std::mutex filterMutex_;
62 };
63} // namespace armarx::armem::server::ltm::processor
virtual void configure(const nlohmann::json &json)
Definition Filter.cpp:6
virtual bool accept(const armem::wm::Memory &e)=0
virtual bool accept(const armem::wm::EntitySnapshot &e, bool simulatedVersion=false)=0
virtual void configure(const nlohmann::json &json)
Definition Filter.cpp:11
std::mutex filterMutex_
Mutex for thread-safe access to filter state (stats and derived class state) Derived classes should l...
Definition Filter.h:61
void resetStatisticsForNewEpisode()
resetStatisticsForNewEpisode resets the parts of the statistics that are unique to one recording cycl...
Definition Filter.cpp:29
Client-side working memory entity snapshot.
Client-side working memory.
std::chrono::high_resolution_clock::time_point end_time
Definition Filter.h:44
aron::similarity::NDArraySimilarity::Type similarity_type
Definition Filter.h:42
std::chrono::high_resolution_clock::time_point start_time
Definition Filter.h:43