OpenDaVINCI  4.16.0
SharedDataListener.h
Go to the documentation of this file.
1 
20 #ifndef OPENDAVINCI_TOOLS_RECORDER_SHAREDDATALISTENER_H_
21 #define OPENDAVINCI_TOOLS_RECORDER_SHAREDDATALISTENER_H_
22 
23 #include <map>
24 #include <memory>
25 #include <string>
26 
28 #include <memory>
31 #include "opendavinci/generated/odcore/data/SharedData.h"
32 #include "opendavinci/generated/odcore/data/image/SharedImage.h"
33 #include "opendavinci/generated/odcore/data/SharedPointCloud.h"
34 
35 namespace odcore { namespace data { class Container; } }
36 namespace odcore { namespace wrapper { class SharedMemory; } }
37 
38 namespace odtools {
39  namespace recorder {
40 
41 class SharedDataWriter;
42 
43  using namespace std;
44 
49  private:
57  SharedDataListener(const SharedDataListener &/*obj*/);
58 
67  SharedDataListener& operator=(const SharedDataListener &/*obj*/);
68 
69  public:
78  SharedDataListener(std::shared_ptr<ostream> out, const uint32_t &memorySegmentSize, const uint32_t &numberOfMemorySegments, const bool &threading);
79 
80  virtual ~SharedDataListener();
81 
82  virtual void add(odcore::data::Container &container);
83 
84  virtual void clear();
85 
86  virtual uint32_t getSize() const;
87 
88  virtual bool isEmpty() const;
89 
90  private:
99  bool copySharedMemoryToMemorySegment(const string &name, const odcore::data::Container &header);
100 
101  private:
102  bool m_threading;
103  unique_ptr<SharedDataWriter> m_sharedDataWriter;
104  map<string, odcore::data::SharedData> m_mapOfAvailableSharedData;
105  map<string, odcore::data::image::SharedImage> m_mapOfAvailableSharedImages;
106  map<string, odcore::data::SharedPointCloud> m_mapOfAvailableSharedPointCloud;
107 
108  map<uint32_t, char*> m_mapOfMemories;
109 
110  odcore::base::FIFOQueue m_bufferIn;
111  odcore::base::FIFOQueue m_bufferOut;
112 
113  uint32_t m_droppedSharedMemories;
114 
115  map<string, std::shared_ptr<odcore::wrapper::SharedMemory> > m_sharedPointers;
116 
117  std::shared_ptr<ostream> m_out;
118  };
119 
120  } // recorder
121 } // tools
122 
123 #endif /*OPENDAVINCI_TOOLS_RECORDER_SHAREDDATALISTENER_H_*/
Definition: Container.h:40
Definition: AbstractDataStore.h:34
Definition: SharedDataListener.h:48
Definition: FIFOQueue.h:38