YARP
Yet Another Robot Platform
PointCloudBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #ifndef YARP_SIG_POINTCLOUDBASE_H
10 #define YARP_SIG_POINTCLOUDBASE_H
11 
13 
14 #include <cstring>
15 #include <map>
16 #include <vector>
17 
18 namespace yarp {
19 namespace sig {
20 
29 {
30 public:
31  virtual ~PointCloudBase() = default;
32 
38  virtual size_t wireSizeBytes() const = 0;
39 
45  virtual size_t dataSizeBytes() const = 0;
46 
51  virtual size_t size() const = 0;
52 
57  virtual const char* getRawData() const = 0;
58 
59  bool read(yarp::os::ConnectionReader& connection) override = 0;
60 
61  bool write(yarp::os::ConnectionWriter& writer) const override = 0;
62 
63  virtual int getBottleTag() const = 0;
64 
68  virtual size_t height() const;
69 
73  virtual size_t width() const;
74 
78  virtual int getPointType() const;
79 
80  yarp::os::Type getType() const override;
81 
85  virtual bool isOrganized() const;
86 
90  virtual inline bool isDense() const
91  {
92  return header.isDense != 0;
93  }
94 
95 protected:
96  PointCloudBase() = default;
97 
98  virtual void copyFromRawData(const char* dst, const char* source, std::vector<int>& recipe);
99 
100  virtual std::vector<int> getComposition(int type_composite) const;
101 
102  virtual size_t pointType2Size(int type) const;
103 
104  virtual size_t getOffset(int type_composite, int type_basic) const;
105 
107 };
108 
109 
110 } // namespace sig
111 } // namespace yarp
112 
113 #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:29
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:19
#define YARP_sig_API
Definition: api.h:21