cgv
Loading...
Searching...
No Matches
cgv::data::informed_ptr Class Reference

This class provides methods to test if a stored pointer points to addresses of given variables or inside the range of object instances. More...

#include <informed_ptr.h>

Public Member Functions

 informed_ptr (const void *ptr)
 
const void * get () const
 
template<typename T >
bool operator== (const T *ptr) const
 Return true if the stored pointer is equal to the given pointer.
 
template<typename T >
bool is (const T *ptr) const
 Return true if the stored pointer is equal to the given pointer.
 
template<typename T >
bool points_to (const T &ref) const
 Return true if the stored pointer points to the given object.
 
template<typename T , typename... Ts>
bool points_to_one_of (const T &ref, const Ts &... refs) const
 Return true if the stored pointer points to one of the given objects.
 
template<typename T >
bool points_to_member_of (const T &ref) const
 Return true if the stored pointer points inside the address range of the given object.
 
template<typename T >
bool points_inside (const T *array, size_t n) const
 Return true if the stored pointer points to an element inside the given c-style array.
 
template<typename T , size_t N>
bool points_to_data_of (const std::array< T, N > &array) const
 Return true if the stored pointer points to an element of the data of the given std::array.
 
template<typename T >
bool points_to_data_of (const std::vector< T > &vector) const
 Return true if the stored pointer points to an element of the data of the given std::vector.
 
template<typename T >
bool is_in_range (const T *first, const T *last) const
 Return true if the stored pointer is inside the range [first, last).
 
template<typename T >
std::vector< T >::iterator find_in_data_of (std::vector< T > &vector) const
 Return iterator to the element in vector that the stored pointer points to or vector.end();.
 
template<typename T >
std::vector< T >::const_iterator find_in_data_of (const std::vector< T > &vector) const
 Return const iterator to the element in vector that the stored pointer points to or vector.end();.
 

Detailed Description

This class provides methods to test if a stored pointer points to addresses of given variables or inside the range of object instances.

Definition at line 10 of file informed_ptr.h.

Constructor & Destructor Documentation

◆ informed_ptr()

cgv::data::informed_ptr::informed_ptr ( const void *  ptr)
inline

Definition at line 12 of file informed_ptr.h.

Member Function Documentation

◆ find_in_data_of() [1/2]

template<typename T >
std::vector< T >::const_iterator cgv::data::informed_ptr::find_in_data_of ( const std::vector< T > &  vector) const
inline

Return const iterator to the element in vector that the stored pointer points to or vector.end();.

Definition at line 95 of file informed_ptr.h.

References find_in_data_of().

◆ find_in_data_of() [2/2]

template<typename T >
std::vector< T >::iterator cgv::data::informed_ptr::find_in_data_of ( std::vector< T > &  vector) const
inline

Return iterator to the element in vector that the stored pointer points to or vector.end();.

Definition at line 83 of file informed_ptr.h.

References is(), and points_to_data_of().

Referenced by find_in_data_of().

◆ get()

const void * cgv::data::informed_ptr::get ( ) const
inline

Definition at line 15 of file informed_ptr.h.

◆ is()

template<typename T >
bool cgv::data::informed_ptr::is ( const T *  ptr) const
inline

Return true if the stored pointer is equal to the given pointer.

Definition at line 27 of file informed_ptr.h.

References operator==().

Referenced by find_in_data_of(), and points_to().

◆ is_in_range()

template<typename T >
bool cgv::data::informed_ptr::is_in_range ( const T *  first,
const T *  last 
) const
inline

Return true if the stored pointer is inside the range [first, last).

Definition at line 77 of file informed_ptr.h.

◆ operator==()

template<typename T >
bool cgv::data::informed_ptr::operator== ( const T *  ptr) const
inline

Return true if the stored pointer is equal to the given pointer.

Definition at line 21 of file informed_ptr.h.

Referenced by is().

◆ points_inside()

template<typename T >
bool cgv::data::informed_ptr::points_inside ( const T *  array,
size_t  n 
) const
inline

Return true if the stored pointer points to an element inside the given c-style array.

Definition at line 59 of file informed_ptr.h.

◆ points_to()

template<typename T >
bool cgv::data::informed_ptr::points_to ( const T &  ref) const
inline

◆ points_to_data_of() [1/2]

template<typename T , size_t N>
bool cgv::data::informed_ptr::points_to_data_of ( const std::array< T, N > &  array) const
inline

Return true if the stored pointer points to an element of the data of the given std::array.

Definition at line 65 of file informed_ptr.h.

Referenced by find_in_data_of(), and cgv::overlay::transfer_function_editor::handle_member_change().

◆ points_to_data_of() [2/2]

template<typename T >
bool cgv::data::informed_ptr::points_to_data_of ( const std::vector< T > &  vector) const
inline

Return true if the stored pointer points to an element of the data of the given std::vector.

Definition at line 71 of file informed_ptr.h.

◆ points_to_member_of()

template<typename T >
bool cgv::data::informed_ptr::points_to_member_of ( const T &  ref) const
inline

Return true if the stored pointer points inside the address range of the given object.

Definition at line 53 of file informed_ptr.h.

Referenced by cgv::overlay::color_scale_legend::handle_member_change().

◆ points_to_one_of()

template<typename T , typename... Ts>
bool cgv::data::informed_ptr::points_to_one_of ( const T &  ref,
const Ts &...  refs 
) const
inline

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