MemoryViewerModel.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2012-2025, 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 RobotStateComponent::
19 * @author Samet Soenmez (uewtt at student dot kit dot edu)
20 * @date 2025t
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#pragma once
26
27#include <string>
28#include <vector>
29#include <map>
30#include <future>
31#include <mutex>
32
33#include <ArmarXCore/interface/observers/ObserverInterface.h>
34#include <RobotAPI/interface/armem/mns/MemoryNameSystemInterface.h>
41
42
44{
45 /**
46 * @brief stores data that is used by the controllers
47 */
49 {
50 public:
51
53
54 std::vector<std::string> getEnabledMemories() const;
55 const armem::wm::Memory* getSingleMemoryData(const std::string& memoryName);
57
58 // Getter functions
59 std::map<std::string, armem::gui::ActiveMemoryState> activeMemoryStates();
62 bool initialized() const;
63 bool connected() const;
64 std::map<std::string, armem::client::Reader>& memoryReaders();
65 std::map<std::string, armem::client::Writer>& memoryWriters();
66 std::map<std::string, armem::client::Reader> memoryReadersCopy() const;
67 std::map<std::string, armem::client::Writer> memoryWritersCopy() const;
68 std::map<std::string, armem::wm::Memory>& memoryData();
69 std::map<std::string, armem::wm::Memory> memoryDataCopy() const;
70 int recursionDepth() const;
72 bool dropRemovedMemories() const;
73 bool dropDisabledMemories() const;
75
76 // Setter functions
77 void setMns(std::unique_ptr<armem::client::MemoryNameSystem> mns);
78 void setDebugObserver(const DebugObserverInterfacePrx& observer);
79 void setInitialized(bool val);
80 void setConnected(bool val);
81 void setMemoryReaders(std::map<std::string, armem::client::Reader> readers);
82 void setMemoryWriters(std::map<std::string, armem::client::Writer> writers);
83 void setMemoryData(std::map<std::string, armem::wm::Memory> data);
84 void setActiveMemoryStates(std::map<std::string, armem::gui::ActiveMemoryState>);
85 void setRecursionDepth(int value);
87 void setDropRemovedMemories(bool val);
88 void setDropDisabledMemories(bool val);
90
91
92 private:
93 std::unique_ptr<armem::client::MemoryNameSystem> _mns;
94
95 DebugObserverInterfacePrx _debugObserver;
96
97 std::atomic_bool _initialized = false;
98 std::atomic_bool _connected = false;
99
100 std::map<std::string, armem::client::Reader> _memoryReaders;
101 std::map<std::string, armem::client::Writer> _memoryWriters;
102
103 std::map<std::string, armem::wm::Memory> _memoryData;
104
105 std::map<std::string, armem::gui::ActiveMemoryState> _activeMemoryStates;
106 int _recursionDepth = 0;
108 bool _dropRemovedMemories = true;
109 bool _dropDisabledMemories = false;
111 mutable std::mutex _memoryDataMutex;
112 };
113}
The memory name system (MNS) client.
std::map< std::string, armem::client::Writer > memoryWritersCopy() const
armem::client::QueryInput queryInput() const
void setMemoryWriters(std::map< std::string, armem::client::Writer > writers)
const armem::wm::Memory * getSingleMemoryData(const std::string &memoryName)
std::map< std::string, armem::gui::ActiveMemoryState > activeMemoryStates()
std::vector< std::string > getEnabledMemories() const
void setMns(std::unique_ptr< armem::client::MemoryNameSystem > mns)
client::query::SnapshotSelector selector() const
void setSelector(client::query::SnapshotSelector selector)
void setMemoryReaders(std::map< std::string, armem::client::Reader > readers)
void setMemoryData(std::map< std::string, armem::wm::Memory > data)
std::map< std::string, armem::wm::Memory > & memoryData()
std::map< std::string, armem::client::Reader > & memoryReaders()
std::map< std::string, armem::client::Reader > memoryReadersCopy() const
void setDebugObserver(const DebugObserverInterfacePrx &observer)
std::map< std::string, armem::client::Writer > & memoryWriters()
void setActiveMemoryStates(std::map< std::string, armem::gui::ActiveMemoryState >)
void setDataMode(armem::query::DataMode dataMode)
armem::client::MemoryNameSystem & mns()
std::map< std::string, armem::wm::Memory > memoryDataCopy() const
Client-side working memory.
@ WithData
Get structure and ARON data.
Definition DataMode.h:9
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface > DebugObserverInterfacePrx
A query for parts of a memory.
Definition Query.h:24