CVB++ 14.0
Plane Class Reference

Plane information container. More...

#include <cvb/plane.hpp>

Inherits IArray.

Public Member Functions

 Plane (const ImagePlane &imagePlane, PlaneRole role=PlaneRole::Undefined)
 Creates a plane from an image plane. More...
 
void * Handle () const noexcept
 Classic API image handle. More...
 
int Rank () const noexcept override
 Gets the number of dimensions of this plane. More...
 
PlaneRole Role () const noexcept
 Get the meaning of this plane. More...
 
class DataType DataType () const noexcept override
 Gets the data type of the plane. More...
 
std::intptr_t Increment (int dimension) const
 Gets the offset in bytes to move to the next element in the given dimension. More...
 
int Length (int dimension) const
 Gets the number of elements in the given dimension. More...
 
std::uint8_tBasePtr () const
 Get the pointer to the first element of this plane. More...
 
virtual void * Handle () const noexcept=0
 Classic API image handle. More...
 
virtual class DataType DataType () const noexcept=0
 Data type descriptor for this array. More...
 
virtual int Rank () const noexcept=0
 Gets the number of dimensions for this array. More...
 

Static Public Member Functions

static PlanePtr FromImagePlane (const ImagePlane &imagePlane, PlaneRole role=PlaneRole::Undefined)
 Creates a plane from an image plane. More...
 
static PlanePtr FromHandle (HandleGuard< Plane > &&guard)
 Creates a plane from a classic API handle. More...
 

Related Functions

(Note that these are not member functions.)

template<class VISITOR , class... PLNS>
auto Visit (VISITOR &&visitor, const Plane &plane, const PLNS &... planes)
 Creates a Cvb::Block based on the plane and planes objects' access traits and pixel type and calls the given visitor with it. More...
 
template<class T , class VISITOR , class... PLNS>
auto VisitAs (VISITOR &&visitor, const Plane &plane, const PLNS &... planes)
 Creates a Cvb::Block based on the plane and planes objects' access traits and given pixel type T and calls the given visitor with it. More...
 

Detailed Description

Plane information container.

Plane describes a (not necessarily contiguous) data container.

Constructor & Destructor Documentation

◆ Plane()

CVB_BEGIN_INLINE_NS Plane ( const ImagePlane imagePlane,
PlaneRole  role = PlaneRole::Undefined 
)
inline

Creates a plane from an image plane.

Parameters
[in]imagePlaneThe image plane.
[in]roleThe role of this plane.
Exceptions
Anyexception derived from std::exception including CvbException.

The image plane's image shares its buffer ownership with this plane. The image plane must support linear access.

Member Function Documentation

◆ BasePtr()

std::uint8_t * BasePtr ( ) const
inline

Get the pointer to the first element of this plane.

Returns
A pointer to the first element.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ DataType()

class DataType DataType ( ) const
inlineoverridevirtualnoexcept

Gets the data type of the plane.

Datatype identifies a single component's memory layout.

Returns
DataType specifying the components layout.

Implements IArray.

◆ FromHandle()

static PlanePtr FromHandle ( HandleGuard< Plane > &&  guard)
inlinestatic

Creates a plane from a classic API handle.

Parameters
[in]guardLife time guard for C-API handle.

◆ FromImagePlane()

static PlanePtr FromImagePlane ( const ImagePlane imagePlane,
PlaneRole  role = PlaneRole::Undefined 
)
inlinestatic

Creates a plane from an image plane.

Parameters
[in]imagePlaneThe image plane.
[in]roleThe role of this plane.
Returns
A pointer to the new plane.
Exceptions
Anyexception derived from std::exception including CvbException.

The image plane's imag shares its buffer ownership with this plane. The image plane must support linear access.

Examples
Cvb/CppPointCloudAcquisition.

◆ Handle()

void * Handle ( ) const
inlinevirtualnoexcept

Classic API image handle.

Returns
Classic API handle.
Exceptions
Doesnot throw any exception.

It is normally not necessary to work with this handle.

Implements IArray.

◆ Increment()

std::intptr_t Increment ( int  dimension) const
inline

Gets the offset in bytes to move to the next element in the given dimension.

Parameters
[in]dimensionDimension to access the increment for.
Returns
The increment in bytes.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Length()

int Length ( int  dimension) const
inline

Gets the number of elements in the given dimension.

Parameters
[in]dimensionDimension to access the length for.
Returns
int Number of elements.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Rank()

int Rank ( ) const
inlineoverridevirtualnoexcept

Gets the number of dimensions of this plane.

A normal image has two dimensions (width and height) and thus would return two. A sparse point list (e.g. from a Coord3D_ABC8 PFNC buffer) would return a rank of one.

Returns
Number of dimensions in this plane.

Implements IArray.

◆ Role()

PlaneRole Role ( ) const
inlinenoexcept

Get the meaning of this plane.

Returns
The meaning of this plane.
Exceptions
Doesnot throw any exception.

Friends And Related Function Documentation

◆ Visit()

auto Visit ( VISITOR &&  visitor,
const Plane plane,
const PLNS &...  planes 
)
related

Creates a Cvb::Block based on the plane and planes objects' access traits and pixel type and calls the given visitor with it.

Remarks
Currently only point clouds are supported, where LinearAccess is supported. If only a single plane is given, either a ArrayPlaneBlock<T> or a LinearPlaneBlock<T> is given as argument to the visitor.
If more than one plane is given, the visitor must either be callable with a single Block or with exactly as many Blocks as there are plane arguments. In the single argument case, the Block will either be a ArrayPlaneBlock<LinearValue<T, NumPlanes>>, LinearPlaneBlock<LinearValue<T, NumPlanes>> or a ScatterBlock<T, NumPlanes>. In the multiple argument case, the Blocks will all either be ArrayPlaneBlock<T> or LinearPlaneBlock<T> depending on whether all the planes' memory is continuous or not.
If the planes are interleaved in the argument order, a ArrayPlaneBlock<LinearValue<T, NumPlanes>> or LinearPlaneBlock<LinearValue<T, NumPlanes>> is used, providing performance optimizations. Otherwise ScatterBlock<RefValue<T, NumPlanes>, NumPlanes> is used.
Template Parameters
VISITORThe visitor functor.
Parameters
[in]visitorThe visiting functor. May either have one argument or exactly as many arguments as planes are given.
[in]planeThe first plane to visit.
[in]planesMore planes to visit.
Returns
Whatever visitor returns.
Exceptions
std::domain_errorif properties of the planes differ.

◆ VisitAs()

auto VisitAs ( VISITOR &&  visitor,
const Plane plane,
const PLNS &...  planes 
)
related

Creates a Cvb::Block based on the plane and planes objects' access traits and given pixel type T and calls the given visitor with it.

Remarks
Currently only point clouds are supported, where LinearAccess is supported. The visitor must be callable with a single Block<PointT, AccessTrait> as argument.
If the planes are interleaved in the argument order, a ArrayPlaneBlock<PointT> or LinearPlaneBlock<PointT> is used, providing performance optimizations. Otherwise ScatterBlock<PointT, N> is used.
If T is an arithmetic type, the behavior is equivalent to Visit, except the component type is not dispatched and instead T is used. In this case, PointT will be LinearValue<T, NumPlanes> or RefValue<T, NumPlanes>. Otherwise T will be used as PointT directly.
Template Parameters
VISITORThe visitor functor.
Parameters
[in]visitorThe visiting functor. May either have one argument or exactly as many arguments as planes are given.
[in]planeThe first plane to visit.
[in]planesMore planes to visit.
Returns
Whatever visitor returns.
Exceptions
std::domain_errorif properties of the planes differ.