RDB 2
Public Member Functions | List of all members
riegl::rdb::pointcloud::QuerySelect Class Reference

Point select query. More...

#include <querySelect.hpp>

Public Member Functions

 QuerySelect ()
 Default constructor. More...
 
 QuerySelect (riegl::rdb::PointcloudData *pointcloud, const std::vector< GraphNode::ID > *nodes, const std::string &filter)
 Constructor. More...
 
 operator bool () const
 Check if query is not null. More...
 
bool valid () const
 Check if query is not null. More...
 
void close ()
 Finish query. More...
 
void bind (const std::string &attribute, const DataType dataType, void *buffer, const std::int32_t stride=0)
 Bind attribute buffer. More...
 
template<typename ValueType >
void bindBuffer (const std::string &attribute, ValueType &buffer, const std::int32_t stride=0)
 Bind attribute buffer. More...
 
template<typename ValueType >
void bindBuffer (const std::string &attribute, ValueType *buffer, const std::int32_t stride=0)
 Bind attribute buffer. More...
 
template<typename ObjectType , typename MemberPointer >
void bindMember (const std::string &attribute, ObjectType &object, const MemberPointer member)
 Bind attribute buffer. More...
 
template<typename ObjectType , typename MemberPointer >
void bindMember (const std::string &attribute, ObjectType &object, const MemberPointer member, const std::size_t index)
 Bind attribute buffer. More...
 
std::uint32_t next (std::uint32_t count)
 Select points. More...
 
std::uint32_t progress () const
 Progress. More...
 

Detailed Description

Point select query.

This class can be used to select (read) attributes of existing points.

See also
riegl::rdb::Pointcloud::select()
Note
You either must delete the query object or call close() before the parent Pointcloud instance is closed/deleted!
Examples
rdb-example-03-select-points.cpp, rdb-example-04-update-points.cpp, and rdb-example-05-remove-points.cpp.

Definition at line 69 of file querySelect.hpp.

Constructor & Destructor Documentation

◆ QuerySelect() [1/2]

riegl::rdb::pointcloud::QuerySelect::QuerySelect ( )
explicit

Default constructor.

Creates a null query - i.e. the query cannot be used to read points.

See also
riegl::rdb::Pointcloud::select()

◆ QuerySelect() [2/2]

riegl::rdb::pointcloud::QuerySelect::QuerySelect ( riegl::rdb::PointcloudData *  pointcloud,
const std::vector< GraphNode::ID > *  nodes,
const std::string &  filter 
)
explicit

Constructor.

Creates a query prepared for reading points.

Note
You cannot create new QuerySelect objects this way, use riegl::rdb::Pointcloud::select() instead.

Member Function Documentation

◆ bind()

void riegl::rdb::pointcloud::QuerySelect::bind ( const std::string &  attribute,
const DataType  dataType,
void *  buffer,
const std::int32_t  stride = 0 
)

Bind attribute buffer.

Use this function to define a target buffer for a point attribute. Exactly one buffer can be defined for an attribute (i.e. only the most recently defined buffer will be used).

The buffer is expected to be n*s*d bytes large, where n is the number of points defined in next(), s is the size of one element as defined by 'dataType' and d is the number of attribute dimensions (elements).

Note
This function just stores the buffer pointer. So make sure that the buffer remains valid until you call next().
See also
riegl::rdb::pointcloud::PointAttributes
Parameters
[in]attributeattribute name
[in]dataTypebuffer data type
[in]bufferbuffer location
[in]stridebytes between beginnings of successive elements (0: auto)

◆ bindBuffer() [1/2]

template<typename ValueType >
void riegl::rdb::pointcloud::QuerySelect::bindBuffer ( const std::string &  attribute,
ValueType &  buffer,
const std::int32_t  stride = 0 
)
inline

Bind attribute buffer.

Use this function to define a target buffer for a point attribute. Exactly one buffer can be defined for an attribute (i.e. only the most recently defined buffer will be used).

The buffer is expected to be n*s*d bytes large, where n is the number of points defined in next(), s is the size of one element as defined by 'dataType' and d is the number of attribute dimensions (elements).

Note
This function just stores the buffer pointer. So make sure that the buffer remains valid until you call next().
See also
riegl::rdb::pointcloud::PointAttributes
Parameters
[in]attributeattribute name
[in]bufferbuffer (data, pointer to data, std::array or std::vector)
[in]stridebytes between beginnings of successive elements (0: auto)
Examples
rdb-example-03-select-points.cpp, rdb-example-04-update-points.cpp, and rdb-example-05-remove-points.cpp.

Definition at line 142 of file querySelect.hpp.

◆ bindBuffer() [2/2]

template<typename ValueType >
void riegl::rdb::pointcloud::QuerySelect::bindBuffer ( const std::string &  attribute,
ValueType *  buffer,
const std::int32_t  stride = 0 
)
inline

Bind attribute buffer.

Use this function to define a target buffer for a point attribute. Exactly one buffer can be defined for an attribute (i.e. only the most recently defined buffer will be used).

The buffer is expected to be n*s*d bytes large, where n is the number of points defined in next(), s is the size of one element as defined by 'dataType' and d is the number of attribute dimensions (elements).

Note
This function just stores the buffer pointer. So make sure that the buffer remains valid until you call next().
See also
riegl::rdb::pointcloud::PointAttributes
Parameters
[in]attributeattribute name
[in]bufferbuffer (data, pointer to data, std::array or std::vector)
[in]stridebytes between beginnings of successive elements (0: auto)

Definition at line 153 of file querySelect.hpp.

◆ bindMember() [1/2]

template<typename ObjectType , typename MemberPointer >
void riegl::rdb::pointcloud::QuerySelect::bindMember ( const std::string &  attribute,
ObjectType &  object,
const MemberPointer  member 
)
inline

Bind attribute buffer.

This is a variant of bindBuffer() that allows to bind a member variable of an object as attribute buffer. The object can be part of a container that stores the objects contiguously (e.g. std::vector, std::array) and the stride is automatically derived from the object size.

See also
bindBuffer()
Parameters
[in]attributeattribute name
[in]objecte.g. first object of container
[in]memberobject member variable pointer

Definition at line 173 of file querySelect.hpp.

◆ bindMember() [2/2]

template<typename ObjectType , typename MemberPointer >
void riegl::rdb::pointcloud::QuerySelect::bindMember ( const std::string &  attribute,
ObjectType &  object,
const MemberPointer  member,
const std::size_t  index 
)
inline

Bind attribute buffer.

This is a variant of bindBuffer() that allows to bind a member variable of an object as attribute buffer. The object can be part of a container that stores the objects contiguously (e.g. std::vector, std::array) and the stride is automatically derived from the object size.

See also
bindBuffer()
Parameters
[in]attributeattribute name
[in]objecte.g. first object of container
[in]memberobject member variable pointer
[in]indexindex for array-like object members

Definition at line 187 of file querySelect.hpp.

◆ close()

void riegl::rdb::pointcloud::QuerySelect::close ( )

Finish query.

Call this function when done with reading points.

◆ next()

std::uint32_t riegl::rdb::pointcloud::QuerySelect::next ( std::uint32_t  count)

Select points.

Use this function to actually read the selected points from database and copy the attributes to the defined buffers.

Afterwards you may re-use the buffers or define new buffers with bind() and call next() again until all points have been read (i.e. next() returns zero).

If no buffers were bound, calling next() is still valid. This can be used for counting points - either all or just those that meet some filter criteria. If no filter is specified the total point count is equal to what you get with riegl::rdb::Pointcloud::stat().

Returns
the number of points read
Parameters
[in]countsize of target buffers in terms of points
Examples
rdb-example-03-select-points.cpp, rdb-example-04-update-points.cpp, and rdb-example-05-remove-points.cpp.

◆ operator bool()

riegl::rdb::pointcloud::QuerySelect::operator bool ( ) const

Check if query is not null.

See also
valid()

◆ progress()

std::uint32_t riegl::rdb::pointcloud::QuerySelect::progress ( ) const

Progress.

This function returns a coarse progress information in percent (0..100%). Since the total number of returned points is not known in advance, this value just reflects the progress of the (internal) index traversal.

Note
When the select query is used to count points (i.e. no buffers were bound), then this function always returns 0%.

◆ valid()

bool riegl::rdb::pointcloud::QuerySelect::valid ( ) const

Check if query is not null.

A null query cannot be used to read points.


The documentation for this class was generated from the following file: