CGPdocs

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 overloads
float const* ptr(float const& a)
source

Pointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).

double const* ptr(double const& a)
source

Pointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).

char const* ptr(char const& a)
source

Pointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).

short const* ptr(short const& a)
source

Pointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).

int const* ptr(int const& a)
source

Pointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).

long const* ptr(long const& a)
source

Pointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).

long long const* ptr(long long const& a)
source

Pointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).

unsigned char const* ptr(unsigned char const& a)
source

Pointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).

unsigned short const* ptr(unsigned short const& a)
source

Pointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).

unsigned int const* ptr(unsigned int const& a)
source

Pointer to the scalar value (uniform ptr() for generic code, e.g. to send data to OpenGL).

unsigned long const* ptr(unsigned long const& a)
source

Pointer 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)
source

Pointer 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)
source

Pointer to the first scalar of the vector content; the vector must not be empty (asserted in debug).

size

12 overloads
size_t size(float)
source
size_t size(double)
source
size_t size(char)
source
size_t size(short)
source
size_t size(int)
source
size_t size(long)
source
size_t size(long long)
source
size_t size(unsigned char)
source
size_t size(unsigned short)
source
size_t size(unsigned int)
source
size_t size(unsigned long)
source
size_t size(unsigned long long)
source

Number of elements of a scalar, always 1 (uniform size() for generic code).

size_in_memory

13 overloads
size_t size_in_memory(float a)
source

Size in bytes of a float value (sizeof).

size_t size_in_memory(double a)
source

Size in bytes of a double value (sizeof).

size_t size_in_memory(char a)
source

Size in bytes of a char value (sizeof).

size_t size_in_memory(short a)
source

Size in bytes of a short value (sizeof).

size_t size_in_memory(int a)
source

Size in bytes of a int value (sizeof).

size_t size_in_memory(long a)
source

Size in bytes of a long value (sizeof).

size_t size_in_memory(long long a)
source

Size in bytes of a long long value (sizeof).

size_t size_in_memory(unsigned char a)
source

Size in bytes of a unsigned char value (sizeof).

size_t size_in_memory(unsigned short a)
source

Size in bytes of a unsigned short value (sizeof).

size_t size_in_memory(unsigned int a)
source

Size in bytes of a unsigned int value (sizeof).

size_t size_in_memory(unsigned long a)
source

Size in bytes of a unsigned long value (sizeof).

size_t size_in_memory(unsigned long long a)
source

Size in bytes of a unsigned long long value (sizeof).

template <typename T>
size_t size_in_memory(std::vector<T> const& v)
source

Size 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.

CGP - Computer Graphics Programming.