CVB++ 14.0
LinearAccessData Class Referencefinal

Linear access properties. More...

#include <cvb/vpat.hpp>

Inherits ValueAccessBase< LinearAccessData >.

Classes

class  Column
 A single column. More...
 
class  Row
 A single row. More...
 

Public Member Functions

 LinearAccessData () noexcept=default
 Creates a default linear access data set. More...
 
LinearAccessData NewMoved (const Cvb::Rect< int > newAoi) const noexcept
 Creates a new, moved linear access object. More...
 
std::uint8_tBasePtr () const noexcept
 Linear access base pointer. More...
 
std::intptr_t XInc () const noexcept
 X-increment for linear access. More...
 
std::intptr_t YInc () const noexcept
 Y-increment for linear access. More...
 
CVB_FORCE_INLINE int Width () const noexcept
 Gets the pixel width of the underlying plane. More...
 
bool Valid () const noexcept
 Gets whether this linear access object is valid. More...
 
 operator bool () const noexcept
 Gets whether this linear access object is valid. More...
 
CVB_FORCE_INLINE const void * operator() (int x, int y) const noexcept
 Coordinate pixel access operator. More...
 
CVB_FORCE_INLINE void * operator() (int x, int y) noexcept
 Coordinate pixel access operator. More...
 
CVB_FORCE_INLINE const void * operator[] (int idx) const noexcept
 Index pixel access operator. More...
 
CVB_FORCE_INLINE void * operator[] (int idx) noexcept
 Index pixel access operator. More...
 
Row RowAt (int y) const noexcept
 Gets the LinearAccessData::Row at y. More...
 
Column ColumnAt (int x) const noexcept
 Gets the LinearAccessData::Column at x. More...
 
- Public Member Functions inherited from ValueAccessBase< LinearAccessData >
const Type & Value (int x, int y) const noexcept
 Gets a pixel value at a given position. More...
 
Type & Value (int x, int y) noexcept
 Gets a settable pixel value at a given position. More...
 
const Type & Value (Point2D< int > position) const noexcept
 Gets a pixel value at a given position. More...
 
Type & Value (Point2D< int > position) noexcept
 Gets a settable pixel value at a given position. More...
 

Static Public Member Functions

template<class PLANE_T >
static LinearAccessData FromPlane (const PLANE_T &plane) noexcept
 Tries to get a valid LinearAccessData from the given plane. More...
 
static LinearAccessData FromVpat (const Vpat &access, Cvb::Size2D< int > size, Cvb::DataType dataType) noexcept
 Tries to get a valid LinearAccessData trait from the given vpat. More...
 
static LinearAccessData FromPtr (std::uint8_t *basePtr, std::intptr_t xInc, std::intptr_t yInc, int width) noexcept
 Creates LinearAccessData from the given pointer and increments. More...
 

Related Functions

(Note that these are not member functions.)

bool operator!= (const LinearAccessData &lhs, const LinearAccessData &rhs) noexcept
 Inequality operator. More...
 
bool operator== (const LinearAccessData &lhs, const LinearAccessData &rhs) noexcept
 Equality operator. More...
 
template<class... ACCESSES>
bool IsInterleaved (size_t bytesPerPixel, const LinearAccessData &access0, const LinearAccessData &access1, const ACCESSES &... accs) noexcept
 Returns whether the LinearAccesses are directly interleaved. More...
 

Detailed Description

Linear access properties.

Constructor & Destructor Documentation

◆ LinearAccessData()

LinearAccessData ( )
defaultnoexcept

Creates a default linear access data set.

Exceptions
Doesnot throw any exception.

Member Function Documentation

◆ BasePtr()

std::uint8_t * BasePtr ( ) const
inlinenoexcept

Linear access base pointer.

Returns
The base pointer.
Exceptions
Doesnot throw any exception.

Remember, that the increments to be added to the base pointer, are given in bytes, not in pixels. BasePtr by design points to the pixel at location (0,0).

◆ ColumnAt()

Column ColumnAt ( int  x) const
inlinenoexcept

Gets the LinearAccessData::Column at x.

Precondition
x must be between 0 and less than the allowed width.
Parameters
[in]xPixel column.
Returns
Column object at line x.

◆ FromPlane()

LinearAccessData FromPlane ( const PLANE_T &  plane)
inlinestaticnoexcept

Tries to get a valid LinearAccessData from the given plane.

Can be extended to support custom plane types T by implementing Cvb::PlaneTraits<T>.

Template Parameters
PLANE_TThe type of the plane to get the access from.
Parameters
[in]planePlane to access.
Returns
Valid LinearAccessData if linear access possible; invalid one otherwise.

◆ FromPtr()

static LinearAccessData FromPtr ( std::uint8_t basePtr,
std::intptr_t  xInc,
std::intptr_t  yInc,
int  width 
)
inlinestaticnoexcept

Creates LinearAccessData from the given pointer and increments.

Parameters
[in]basePtrBase address of the memory.
[in]xIncstd::intptr_t X increment in bytes.
[in]yIncstd::intptr_t Y increment in bytes.
[in]widthint The number of elements in the plane in x direction.
Returns
Valid LinearAccessData if inputs are valid.

◆ FromVpat()

LinearAccessData FromVpat ( const Vpat access,
Cvb::Size2D< int >  size,
Cvb::DataType  dataType 
)
inlinestaticnoexcept

Tries to get a valid LinearAccessData trait from the given vpat.

Parameters
[in]accessBase address in conjunction with VPAT.
[in]sizeImage dimensions of the given VPAT access.
[in]dataTypeData type of the image of the given vpat.
Returns
Valid LinearAccessData if VPAT access is linear; invalid one otherwise.

◆ NewMoved()

LinearAccessData NewMoved ( const Cvb::Rect< int >  newAoi) const
inlinenoexcept

Creates a new, moved linear access object.

Precondition
Valid() == true
Parameters
[in]newAoiOffset and new size in pixels to move this linear access to.
Returns
New LinearAccessData object that is moved by (newAoi.Left(), newAoi.Top()).

◆ operator bool()

operator bool ( ) const
inlineexplicitnoexcept

Gets whether this linear access object is valid.

Returns
true if Scan0() is not nullptr, XInc() and YInc() are unequal 0.

◆ operator()() [1/2]

CVB_FORCE_INLINE const void * operator() ( int  x,
int  y 
) const
inlinenoexcept

Coordinate pixel access operator.

Precondition
Valid() == true
Parameters
[in]xX coordinate coefficient in pixels.
[in]yY coordinate coefficient in pixels.
Returns
Const pointer to pixel value.

◆ operator()() [2/2]

CVB_FORCE_INLINE void * operator() ( int  x,
int  y 
)
inlinenoexcept

Coordinate pixel access operator.

Precondition
Valid() == true
Parameters
[in]xX coordinate coefficient in pixels.
[in]yY coordinate coefficient in pixels.
Returns
Mutable pointer to pixel value.

◆ operator[]() [1/2]

CVB_FORCE_INLINE const void * operator[] ( int  idx) const
inlinenoexcept

Index pixel access operator.

Precondition
Valid() == true
Parameters
[in]idxPixel index.
Returns
Const pointer to pixel value.

◆ operator[]() [2/2]

CVB_FORCE_INLINE void * operator[] ( int  idx)
inlinenoexcept

Index pixel access operator.

Precondition
Valid() == true
Parameters
[in]idxPixel index.
Returns
Mutable pointer to pixel value.

◆ RowAt()

Row RowAt ( int  y) const
inlinenoexcept

Gets the LinearAccessData::Row at y.

Precondition
y must be between 0 and less than the allowed height.
Parameters
[in]yPixel row.
Returns
Row object at line y.

◆ Valid()

bool Valid ( ) const
inlinenoexcept

Gets whether this linear access object is valid.

Returns
true if Scan0() is not nullptr, XInc() and YInc() are unequal 0.

◆ Width()

CVB_FORCE_INLINE int Width ( ) const
inlinenoexcept

Gets the pixel width of the underlying plane.

Returns
Pixel width of the working plane.

◆ XInc()

std::intptr_t XInc ( ) const
inlinenoexcept

X-increment for linear access.

Returns
X-increment.
Exceptions
Doesnot throw any exception.

◆ YInc()

std::intptr_t YInc ( ) const
inlinenoexcept

Y-increment for linear access.

Returns
Y-increment
Exceptions
Doesnot throw any exception.

Friends And Related Function Documentation

◆ IsInterleaved()

bool IsInterleaved ( size_t  bytesPerPixel,
const LinearAccessData access0,
const LinearAccessData access1,
const ACCESSES &...  accs 
)
related

Returns whether the LinearAccesses are directly interleaved.

Parameters
[in]bytesPerPixelThe number of bytes required per pixel.
[in]access0First LinearAccessData to test.
[in]access1Second LinearAccessData to test.
[in]accsArbitrary number of other Linear Accesses.
Returns
true if interleaved, false if not

◆ operator!=()

bool operator!= ( const LinearAccessData lhs,
const LinearAccessData rhs 
)
related

Inequality operator.

Parameters
[in]lhsLeft hand side operand.
[in]rhsRight hand side operand.
Returns
true if lhs and rhs are unequal; false if equal.

◆ operator==()

bool operator== ( const LinearAccessData lhs,
const LinearAccessData rhs 
)
related

Equality operator.

Parameters
[in]lhsLeft hand side operand.
[in]rhsRight hand side operand.
Returns
true if lhs and rhs are equal; false if equal.