YARP
Yet Another Robot Platform
PointCloudBase.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 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
yarp::sig::PointCloudBase::PointCloudBase
PointCloudBase()=default
yarp::os::Portable
This is a base class for objects that can be both read from and be written to the YARP network.
Definition: Portable.h:29
yarp::os::Type
Definition: Type.h:24
yarp::sig::PointCloudBase::isDense
virtual bool isDense() const
Definition: PointCloudBase.h:90
yarp::sig::PointCloudBase::~PointCloudBase
virtual ~PointCloudBase()=default
yarp::sig::PointCloudBase::read
bool read(yarp::os::ConnectionReader &connection) override=0
Read this object from a network connection.
yarp::sig::PointCloudBase::size
virtual size_t size() const =0
yarp::sig::PointCloudBase::getRawData
virtual const char * getRawData() const =0
Get the pointer to the data.
yarp::sig::PointCloudBase
The PointCloudBase class.
Definition: PointCloudBase.h:29
yarp::os::ConnectionWriter
An interface for writing to a network connection.
Definition: ConnectionWriter.h:40
yarp::sig::PointCloudBase::header
yarp::sig::PointCloudNetworkHeader header
Definition: PointCloudBase.h:106
yarp::sig::PointCloudNetworkHeader
The yarp::sig::PointCloudNetworkHeader class.
Definition: PointCloudNetworkHeader.h:26
YARP_sig_API
#define YARP_sig_API
Definition: api.h:19
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:40
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::sig::PointCloudBase::dataSizeBytes
virtual size_t dataSizeBytes() const =0
Get the size of the data in terms of number of bytes.
PointCloudNetworkHeader.h
yarp::sig::PointCloudBase::wireSizeBytes
virtual size_t wireSizeBytes() const =0
Get the size of the data + the header in terms of number of bytes.
yarp::sig::PointCloudBase::getBottleTag
virtual int getBottleTag() const =0
yarp::sig::PointCloudBase::write
bool write(yarp::os::ConnectionWriter &writer) const override=0
Write this object to a network connection.