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>
25 
29 
31 
33 
34 
36 {
37 
38  class Writer
39  {
40  public:
41  Writer(armem::client::MemoryNameSystem& memoryNameSystem);
42  virtual ~Writer() = default;
43 
44 
46  void connect();
47 
48  std::optional<armem::MemoryID> commit(const ObjectAttachment& attachment);
49  std::optional<armem::MemoryID> commit(const ArticulatedObjectAttachment&);
50 
51  private:
52 
53  struct Properties
54  {
55  std::string memoryName = "Object";
56  std::string coreAttachmentsSegmentName = "Attachments";
57  std::string providerName = "AttachmentProvider";
58 
59  bool allowClassCreation = false;
60  } properties;
61 
62  const std::string propertyPrefix = "mem.obj.articulated.";
63 
64  armem::client::MemoryNameSystem& memoryNameSystem;
65 
66  armem::client::Writer memoryWriter;
67  std::mutex memoryWriterMutex;
68 
69  armem::client::Reader memoryReader;
70  std::mutex memoryReaderMutex;
71  };
72 
73 
74 } // 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:40
armarx::armem::attachment::Writer
Definition: Writer.h:38
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:58
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
RobotReader.h
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 >
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:22
MemoryNameSystem.h
armarx::armem::attachment::Writer::registerPropertyDefinitions
void registerPropertyDefinitions(armarx::PropertyDefinitionsPtr &def)
Definition: Writer.cpp:26