YARP
Yet Another Robot Platform
PointCloudBase.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_SIG_POINTCLOUDBASE_H
7 #define YARP_SIG_POINTCLOUDBASE_H
8 
10 
11 #include <cstring>
12 #include <map>
13 #include <vector>
14 
15 namespace yarp {
16 namespace sig {
17 
26 {
27 public:
28  virtual ~PointCloudBase() = default;
29 
35  virtual size_t wireSizeBytes() const = 0;
36 
42  virtual size_t dataSizeBytes() const = 0;
43 
48  virtual size_t size() const = 0;
49 
54  virtual const char* getRawData() const = 0;
55 
56  bool read(yarp::os::ConnectionReader& connection) override = 0;
57 
58  bool write(yarp::os::ConnectionWriter& writer) const override = 0;
59 
60  virtual int getBottleTag() const = 0;
61 
65  virtual size_t height() const;
66 
70  virtual size_t width() const;
71 
75  virtual int getPointType() const;
76 
77  yarp::os::Type getType() const override;
78 
82  virtual bool isOrganized() const;
83 
87  virtual inline bool isDense() const
88  {
89  return header.isDense != 0;
90  }
91 
92 protected:
93  PointCloudBase() = default;
94 
95  virtual void copyFromRawData(const char* dst, const char* source, std::vector<int>& recipe);
96 
97  virtual std::vector<int> getComposition(int type_composite) const;
98 
99  virtual size_t pointType2Size(int type) const;
100 
101  virtual size_t getOffset(int type_composite, int type_basic) const;
102 
104 };
105 
106 
107 } // namespace sig
108 } // namespace yarp
109 
110 #endif
An interface for reading from a network connection.
An interface for writing to a network connection.
This is a base class for objects that can be both read from and be written to the YARP network.
Definition: Portable.h:26
The PointCloudBase class.
virtual size_t size() const =0
yarp::sig::PointCloudNetworkHeader header
virtual bool isDense() const
virtual ~PointCloudBase()=default
virtual const char * getRawData() const =0
Get the pointer to the data.
bool write(yarp::os::ConnectionWriter &writer) const override=0
Write this object to a network connection.
virtual int getBottleTag() const =0
virtual size_t dataSizeBytes() const =0
Get the size of the data in terms of number of bytes.
bool read(yarp::os::ConnectionReader &connection) override=0
Read this object from a network connection.
virtual size_t wireSizeBytes() const =0
Get the size of the data + the header in terms of number of bytes.
The yarp::sig::PointCloudNetworkHeader class.
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_sig_API
Definition: api.h:18