Writer.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @author Fabian Reister ( fabian dot reister at kit dot edu )
17  * @date 2021
18  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19  * GNU General Public License
20  */
21 
22 #pragma once
23 
24 #include <mutex>
26 
30 
31 // #include <RobotAPI/libraries/armem_robot_state/client/common/RobotReader.h>
32 
34 
35 
37 {
38 
39  class Writer
40  {
41  public:
42  Writer(armem::client::MemoryNameSystem& memoryNameSystem);
43  virtual ~Writer() = default;
44 
45 
47  void connect();
48 
49  std::optional<armem::MemoryID> commit(const ObjectAttachment& attachment);
50  std::optional<armem::MemoryID> commit(const ArticulatedObjectAttachment&);
51 
52  private:
53 
54  struct Properties
55  {
56  std::string memoryName = "Object";
57  std::string coreAttachmentsSegmentName = "Attachments";
58  std::string providerName = "AttachmentProvider";
59 
60  bool allowClassCreation = false;
61  } properties;
62 
63  const std::string propertyPrefix = "mem.obj.articulated.";
64 
65  armem::client::MemoryNameSystem& memoryNameSystem;
66 
67  armem::client::Writer memoryWriter;
68  std::mutex memoryWriterMutex;
69 
70  armem::client::Reader memoryReader;
71  std::mutex memoryReaderMutex;
72  };
73 
74 
75 } // namespace armarx::armem::attachment
armarx::armem::client::Reader
Reads data from a memory server.
Definition: Reader.h:24
Reader.h
Writer.h
armarx::armem::attachment::ObjectAttachment
ObjectAttachment describes a fixed transformation between an agent and an object.
Definition: types.h:100
armarx::armem::attachment::Writer::connect
void connect()
Definition: Writer.cpp:45
armarx::armem::attachment::Writer
Definition: Writer.h:39
types.h
armarx::armem::attachment::ArticulatedObjectAttachment
ArticulatedObjectAttachment describes a fixed transformation between an agent and an articulated obje...
Definition: types.h:121
armarx::armem::attachment::Writer::commit
std::optional< armem::MemoryID > commit(const ObjectAttachment &attachment)
Definition: Writer.cpp:63
armarx::armem::attachment::Writer::~Writer
virtual ~Writer()=default
armarx::armem::client::Writer
Helps a memory client sending data to a memory.
Definition: Writer.h:22
armarx::armem::attachment
Definition: Reader.cpp:22
armarx::armem::laser_scans::constants::memoryName
const std::string memoryName
Definition: constants.h:28
IceUtil::Handle< class PropertyDefinitionContainer >
forward_declarations.h
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:69
armarx::armem::attachment::Writer::Writer
Writer(armem::client::MemoryNameSystem &memoryNameSystem)
Definition: Writer.cpp:24
MemoryNameSystem.h
armarx::armem::attachment::Writer::registerPropertyDefinitions
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
Definition: Writer.cpp:30