Errors and memory
Report errors and warnings, size in memory and raw pointer of the base types.
Compute 1
std::string index_out_of_bounds_message(
long long index,
long long axis_size,
std::string const& axis_label,
std::string const& container_type
)Builds the standard out-of-bounds error message for one axis, with a hint for negative indices, empty containers and too-large indices.
Access 38
ptr
13 overloadsfloat const* ptr(float const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
double const* ptr(double const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
char const* ptr(char const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
short const* ptr(short const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
int const* ptr(int const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
long const* ptr(long const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
long long const* ptr(long long const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
unsigned char const* ptr(unsigned char const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
unsigned short const* ptr(unsigned short const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
unsigned int const* ptr(unsigned int const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
unsigned long const* ptr(unsigned long const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
unsigned long long const* ptr(unsigned long long const& a)sourcePointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).
template <typename T>
auto const* ptr(std::vector<T> const& v)sourcePointer to the first scalar of the vector content; the vector must not be empty (asserted in debug).
size
12 overloadssize_t size(float)sourcesize_t size(double)sourcesize_t size(char)sourcesize_t size(short)sourcesize_t size(int)sourcesize_t size(long)sourcesize_t size(long long)sourcesize_t size(unsigned char)sourcesize_t size(unsigned short)sourcesize_t size(unsigned int)sourcesize_t size(unsigned long)sourcesize_t size(unsigned long long)sourceNumber of elements of a scalar, always 1 (uniform size() for generic code).
size_in_memory
13 overloadssize_t size_in_memory(float a)sourceSize in bytes of a float value (sizeof).
size_t size_in_memory(double a)sourceSize in bytes of a double value (sizeof).
size_t size_in_memory(char a)sourceSize in bytes of a char value (sizeof).
size_t size_in_memory(short a)sourceSize in bytes of a short value (sizeof).
size_t size_in_memory(int a)sourceSize in bytes of a int value (sizeof).
size_t size_in_memory(long a)sourceSize in bytes of a long value (sizeof).
size_t size_in_memory(long long a)sourceSize in bytes of a long long value (sizeof).
size_t size_in_memory(unsigned char a)sourceSize in bytes of a unsigned char value (sizeof).
size_t size_in_memory(unsigned short a)sourceSize in bytes of a unsigned short value (sizeof).
size_t size_in_memory(unsigned int a)sourceSize in bytes of a unsigned int value (sizeof).
size_t size_in_memory(unsigned long a)sourceSize in bytes of a unsigned long value (sizeof).
size_t size_in_memory(unsigned long long a)sourceSize in bytes of a unsigned long long value (sizeof).
template <typename T>
size_t size_in_memory(std::vector<T> const& v)sourceSize in bytes of the vector content, summed over its elements.
Other 3
void call_error(
std::string const& error,
std::string const& message,
std::string const& filename,
std::string const& function_name,
int line
)Reports an error with its location and failed condition, then aborts (or throws std::logic_error if CGP_ERROR_EXCEPTION is defined); called by the assert_cgp and error_cgp macros.
void call_warning(
std::string const& message_id,
std::string const& extra,
std::string const& filename,
std::string const& function_name,
int line
)Prints a warning with its location, at most cgp_warning::max_warning times per message id; called by the warning_cgp macro.
template <typename T>
void currently_unused(T const&)No-op that marks a variable as intentionally unused to silence compiler warnings.