C++ API

The following API was auto-generated from source code using Doxygen and Breathe Doxygen.

namespace pixelpipes

Typedefs

typedef Sequence<uchar> ByteSequence
typedef Span<uchar> ByteSpan
typedef View<uchar> ByteView
typedef SliceIterator<View<uchar>> ReadonlySliceIterator
typedef SliceIterator<Span<uchar>> WriteableSliceIterator
typedef Pointer<Buffer> BufferReference
typedef Pointer<StringList> StringListReference
struct PIXELPIPES_API pixelpipes::Point2D Point2D
struct PIXELPIPES_API pixelpipes::Rectangle Rectangle
struct PIXELPIPES_API pixelpipes::Point3D Point3D
struct PIXELPIPES_API pixelpipes::View2D View2D
typedef struct pixelpipes::View3D View3D
typedef Pointer<Module> ModuleReference
typedef Function<void(ModuleReference)> ModuleCallback
typedef void (*ModuleInitializer)()
typedef Pointer<Operation> OperationReference
using EvaluateFunction = TokenReference (*)(const TokenList&)
typedef Sequence<Type> OperationArguments
typedef Function<OperationReference(TokenList)> OperationConstructor
typedef Function<OperationDescription()> OperationDescriber
typedef struct pixelpipes::OutputDescription OutputDescription
typedef void (*TokenWriter)(const TokenReference&, std::ostream&)
typedef TokenReference (*TokenReader)(std::istream&)
typedef Pointer<Tensor> TensorReference
typedef Scalar<int> IntegerScalar
typedef Scalar<float> FloatScalar
typedef Scalar<bool> BooleanScalar
typedef Scalar<char> CharScalar
typedef Scalar<short> ShortScalar
typedef Scalar<ushort> UShortScalar
typedef Vector<float> FloatVector
typedef Vector<int> IntegerVector
typedef Vector<bool> BooleanVector
typedef Matrix<float> FloatMatrix
typedef Matrix<int> IntegerMatrix
typedef Matrix<bool> BooleanMatrix
typedef Pointer<Token> TokenReference
typedef View<TokenReference> TokenList
typedef Pointer<List> ListReference
using uchar = unsigned char
using ushort = unsigned short
using Type = pixelpipes::details::Type
typedef Sequence<size_t> SizeSequence
typedef Span<size_t> SizeSpan
typedef View<size_t> Sizes
typedef std::map<std::string, int> EnumerationMap

Enums

enum class ComparisonOperation

Values:

enumerator EQUAL
enumerator LOWER
enumerator LOWER_EQUAL
enumerator GREATER
enumerator GREATER_EQUAL
enumerator NOT_EQUAL
enum class LogicalOperation

Values:

enumerator AND
enumerator OR
enumerator NOT
enum class ArithmeticOperation

Values:

enumerator ADD
enumerator SUBTRACT
enumerator MULTIPLY
enumerator DIVIDE
enumerator POWER
enumerator MODULO
enum class SamplingDistribution

Values:

enumerator Normal
enumerator Uniform
enum class ContextData

Values:

enumerator SampleIndex
enumerator OperationIndex
enumerator RandomSeed
enum class OperationTrait

Values:

enumerator Default
enumerator Compute
enumerator Access
enumerator Stateful
enumerator Forward
enum class DataType

Values:

enumerator Boolean
enumerator Char
enumerator Short
enumerator UnsignedShort
enumerator Integer
enumerator Float

Functions

inline void verify(bool condition, std::string reason = std::string("Assertion failed"))
template<typename T>
View<T> make_view(const T *ptr, size_t size)
template<typename T, size_t N>
View<T> make_view(const T (&ar)[N])
template<typename Container>
auto make_view(const Container &c, size_t offset = 0) -> View<typename Container::value_type>
template<typename Container>
auto make_span(Container &c, size_t offset = 0) -> Span<typename Container::value_type>
template<class T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &v)
template<class T>
std::ostream &operator<<(std::ostream &os, const Span<T> &s)
template<typename T>
inline ByteSpan bytes(T &data)
template<>
inline BufferReference extract(const TokenReference &v)
template<>
inline TokenReference wrap(const std::string v)
template<>
inline TokenReference wrap(const std::vector<std::string> &v)
template<>
inline TokenReference wrap(const Span<std::string> &v)
template<typename A, typename B>
void copy_buffer(const A &source, B &destination)
inline std::ostream &operator<<(std::ostream &os, const Point2D &p)
inline std::ostream &operator<<(std::ostream &os, const Rectangle &p)
inline std::ostream &operator<<(std::ostream &os, const Point3D &p)
inline std::ostream &operator<<(std::ostream &os, const View2D &p)
inline std::ostream &operator<<(std::ostream &os, const View3D &p)
template<>
inline TokenReference wrap(const Point2D v)
template<>
inline TokenReference wrap(const Rectangle v)
template<>
inline TokenReference wrap(const Point3D v)
template<>
inline TokenReference wrap(const View2D v)
template<>
inline TokenReference wrap(const View3D v)
template<>
inline TokenReference wrap(const std::vector<Point2D> &v)
template<>
inline TokenReference wrap(const Sequence<Point2D> &v)
template<>
inline TokenReference wrap(Sequence<Point2D> v)
template<>
inline TokenReference wrap(const std::vector<Point3D> &v)
inline bool is_numeric_list(const ListReference &v)
inline bool is_rectangle(const ListReference &v)
inline OperationTrait operator|(OperationTrait a, OperationTrait b)
inline bool operator&(OperationTrait a, int b)
inline bool any_placeholder(const TokenList &tokens)
RandomGenerator PIXELPIPES_API make_generator (uint32_t seed)
RandomGenerator PIXELPIPES_API create_generator (TokenReference seed)
RandomGenerator PIXELPIPES_API create_generator (int seed)
OperationReference PIXELPIPES_API make_operation (const std::string key, const TokenList &inputs)
void PIXELPIPES_API register_operation (const std::string key, OperationConstructor constructor, OperationDescriber describer)
bool PIXELPIPES_API is_operation_registered (const std::string key)
Sequence< std::string > PIXELPIPES_API list_operations ()
template<typename OperationClass = Operation, typename ...Args>
void register_operation(const std::string key)
template<typename ...Args>
OperationReference make_operation(const std::string key, Args&&... args)
OperationDescription PIXELPIPES_API describe_operation (const std::string key)
ModuleReference PIXELPIPES_API operation_source (const std::string key)
OperationReference PIXELPIPES_API create_operation (const std::string key, const TokenList &inputs)
OperationReference PIXELPIPES_API create_operation (const std::string key, const std::initializer_list< TokenReference > &inputs)
std::string PIXELPIPES_API operation_name (const OperationReference &)
template<typename Run, Run fn_run, EvaluateFunction fn_eval, OperationTrait trait>
void register_operation_auto(const std::string &name)
template<typename Run, Run fn_run, EvaluateFunction fn_eval, OperationTrait trait>
void register_operation_manual(const std::string &name)
template<typename Operation, typename ...Args>
void register_operation_class(const std::string &name)
template<typename T, size_t... S>
TokenReference constant_shape(const TokenList &inputs)
bool PIXELPIPES_API is_output (OperationReference &op)
bool PIXELPIPES_API is_conditional (OperationReference &op)
bool PIXELPIPES_API is_constant (OperationReference &op)
bool PIXELPIPES_API is_context (OperationReference &op)
std::string PIXELPIPES_API visualize_pipeline (const Pipeline &pipeline)
void PIXELPIPES_API type_register_serializer (Type i, std::string_view name, TokenReader reader, TokenWriter writer)
void PIXELPIPES_API write_pipeline (const Pipeline &pipeline, std::ostream &drain, bool compress=true, bool relocatable=true)
void PIXELPIPES_API write_pipeline (const Pipeline &pipeline, const std::string &drain, bool compress=true, bool relocatable=true)
Pipeline PIXELPIPES_API read_pipeline (std::istream &source)
Pipeline PIXELPIPES_API read_pipeline (const std::string &source)
inline void check_error(std::ios &stream)
template<typename T>
T read_t(std::istream &source)
template<typename T>
void write_t(std::ostream &drain, T i)
template<>
inline void write_t(std::ostream &drain, bool b)
template<>
inline bool read_t(std::istream &source)
template<>
inline void write_t(std::ostream &drain, std::string s)
template<typename T>
inline void write_sequence(std::ostream &drain, const Span<T> &list)
template<typename T>
inline Sequence<T> read_sequence(std::istream &source)
inline SizeSequence generate_strides(const Sizes &shape, size_t element)
inline bool is_contiguous(const Sizes &shape, const Sizes &strides)
template<>
inline TokenReference wrap(const int v)
template<>
inline TokenReference wrap(const short v)
template<>
inline TokenReference wrap(const ushort v)
template<>
inline TokenReference wrap(const bool v)
template<>
inline TokenReference wrap(const char v)
template<>
inline TokenReference wrap(const float v)
template<typename T>
inline bool _extract_scalar(const TokenReference &v, T *value)
template<typename T>
inline TensorReference create_tensor(const Sizes &s)
TensorReference PIXELPIPES_API create_tensor (Type element, Sizes sizes)
TensorReference PIXELPIPES_API create_tensor (Shape s)
void PIXELPIPES_API copy_tensor (const TensorReference &in, const TensorReference &out)
template<>
inline TokenReference wrap(const Span<int> v)
template<>
inline TokenReference wrap(const Span<float> &v)
template<typename T>
inline TokenReference wrap(View<T> v)
template<typename T>
inline TokenReference wrap(const Sequence<T> &v)
template<>
inline TokenReference wrap(const std::vector<bool> &v)
template<>
inline TokenReference wrap(const std::vector<int> &v)
template<>
inline TokenReference wrap(const std::vector<float> &v)
template<>
inline TokenReference wrap(const std::vector<uchar> &v)
template<char>
inline TokenReference wrap(const std::vector<char> &v)
template<>
inline TokenReference wrap(const std::vector<short> &v)
template<>
inline TokenReference wrap(const std::vector<ushort> &v)
template<>
inline TokenReference wrap(const TensorReference &v)
inline Size get_size(const TokenReference &token)
template<>
inline TokenReference wrap(Size v)
template<typename T = Token>
Pointer<T> empty()
inline std::ostream &operator<<(std::ostream &os, const TokenReference &token)
template<typename T>
inline TokenReference wrap(T v)
template<>
inline TokenReference wrap(const TokenReference v)
template<typename T> constexpr Type PIXELPIPES_TYPE_API GetType () noexcept

The function that returns the type id.

It uses the pointer to the static data member of a class template to achieve this. Altough the value is not predictible, it’s stable (I hope).

PIXELPIPES_API const char * type_name (Type t)
inline Size aggregate(const Sizes &sizes)
template<typename T>
inline std::string to_string(const T &s)
inline std::string to_string(const Size &t)
inline std::string to_string(const Type &t)
inline std::ostream &operator<<(std::ostream &os, const Sizes &s)
inline std::ostream &operator<<(std::ostream &os, const Shape &s)
template<typename T, size_t... sizes>
Shape make_shape()
inline size_t type_size(Type t)
template<typename T>
inline Shape ScalarType()
template<typename T>
inline Shape ListType(Size length)
inline Shape ListType(Type element, Size length)
inline Shape MatrixType(Type element, Size width, Size height)
inline Shape ImageType(Type element, Size width, Size height, Size channels)
Shape PIXELPIPES_API AnythingShape ()
EnumerationMap PIXELPIPES_API describe_enumeration (std::string &name)
void PIXELPIPES_API register_enumeration (const std::string &name, EnumerationMap mapping)
template<typename T>
inline void register_enumeration(const std::string &name)

Variables

static constexpr Type AnyType = 0

The type identifier for any type.

constexpr size_t unknown = ~0L
template<typename T>
class Span : public pixelpipes::View<T>

Subclassed by pixelpipes::Sequence< std::string >, pixelpipes::Sequence< pixelpipes::Size >, pixelpipes::Sequence< int >, pixelpipes::Sequence< TokenReference >, pixelpipes::Sequence< Type >, pixelpipes::Sequence< size_t >, pixelpipes::Sequence< T >

template<typename T>
class Sequence : public pixelpipes::Span<T>
class BaseException

Subclassed by pixelpipes::IllegalStateException, pixelpipes::ModuleException, pixelpipes::PipelineException, pixelpipes::SerializationException, pixelpipes::TypeException

class IllegalStateException : public pixelpipes::BaseException
template<typename Result, typename ...Args>
struct abstract_function
template<typename Func, typename Result, typename ...Args>
class concrete_function : public pixelpipes::abstract_function<Result, Args...>
template<typename Func>
struct func_filter
template<typename Result, typename ...Args>
struct func_filter<Result(Args...)>
template<typename signature>
class Function
template<typename Result, typename ...Args>
class Function<Result(Args...)>
template<typename ...Args>
class Function<void(Args...)>
template<typename T, typename D = std::default_delete<T>>
class Implementation
template<typename T>
class View

Subclassed by pixelpipes::Span< uchar >, pixelpipes::Span< T >

class Formatter
class RandomGenerator
template<typename C>
class SliceIterator
class Buffer : public virtual pixelpipes::Token

Subclassed by pixelpipes::FlatBuffer, pixelpipes::Tensor

class FlatBuffer : public pixelpipes::Buffer
class String : public pixelpipes::List
class StringList : public pixelpipes::List
#include <buffer.hpp>

String list.

struct Point2D
struct Rectangle
struct Point3D
struct View2D
struct View3D
class ModuleException : public pixelpipes::BaseException
class Module
class AddDirect
class AddModuleInitializer
class Operation

Subclassed by pixelpipes::OperationWrapper< Run, fn_run, fn_eval, o_trait, unpack >

template<typename Run, Run fn_run, EvaluateFunction fn_eval, OperationTrait o_trait, bool unpack>
class OperationWrapper : public pixelpipes::Operation
struct OperationDescription
template<typename OperationClass = Operation, typename ...Args>
struct OperationFactory
struct OutputDescription
class Metadata
class Pipeline
class PipelineCallback
class PipelineException : public pixelpipes::BaseException

Subclassed by pixelpipes::OperationException

class OperationException : public pixelpipes::PipelineException
class SerializationException : public pixelpipes::BaseException
class Serializer
class Tensor : public pixelpipes::List, public pixelpipes::Buffer

Subclassed by pixelpipes::ArrayTensor< T, 2 >, pixelpipes::ArrayTensor< T, 1 >, pixelpipes::ArrayTensor< T, N >, pixelpipes::Scalar< T >, pixelpipes::TensorView

template<typename T>
class Scalar : public pixelpipes::Tensor
template<typename T>
class Vector : public pixelpipes::ArrayTensor<T, 1>
template<typename T>
class Matrix : public pixelpipes::ArrayTensor<T, 2>
class TensorView : public pixelpipes::Tensor
template<typename T, size_t N>
class ArrayTensor : public pixelpipes::Tensor
class Token : public virtual details::RTTI, public enable_pointer_from_this<Token>

Subclassed by pixelpipes::Buffer, pixelpipes::ContainerToken< T >, pixelpipes::List, pixelpipes::Placeholder

class Placeholder : public pixelpipes::Token
#include <token.hpp>

Placeholder token is used to represent a token with unknown value, but known shape. It is used in inference phase.

template<typename T>
class ContainerToken : public pixelpipes::Token
class List : public virtual pixelpipes::Token

Subclassed by pixelpipes::GenericList, pixelpipes::String, pixelpipes::StringList, pixelpipes::Tensor

class GenericList : public pixelpipes::List
class TypeException : public pixelpipes::BaseException
struct Size
class Shape
namespace details

Typedefs

template<typename T>
using base_type = typename std::remove_cv<typename std::remove_reference<T>::type>
template<typename T>
using base_type_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type
template<typename ...T>
using tuple_with_base_types = std::tuple<typename base_type<T>::type...>
typedef TokenList::const_iterator ArgIterator
template<class T>
using inner_type_t = typename inner_type<T>::type

Functions

template<typename ...T>
tuple_with_base_types<T...> tuple_base_type(std::tuple<T...> const &t)
template<class Tuple, class T = std::decay_t<std::tuple_element_t<0, std::decay_t<Tuple>>>>
std::vector<T> to_vector(Tuple &&tuple)
template<class F, class Tuple, std::size_t... I>
constexpr decltype(auto) apply_impl(F &&f, TokenList inputs, Tuple t, std::index_sequence<I...>)
template<class F, class Tuple>
constexpr decltype(auto) apply(F &&f, TokenList inputs, Tuple t)
template<class T, class Tuple, std::size_t... I>
constexpr Pointer<T> make_from_tuple_impl(Tuple &&t, std::index_sequence<I...>)
template<class T, class Tuple>
constexpr Pointer<T> make_from_tuple(Tuple &&t)
template<typename FuncType, typename VecType, size_t... I, typename Traits = function_traits<FuncType>, typename ReturnT = typename Traits::output>
ReturnT do_call(FuncType func, VecType &args, std::index_sequence<I...>)
template<typename FuncType, typename VecType, typename Traits = function_traits<FuncType>, typename ReturnT = typename Traits::output>
ReturnT unpack_caller(FuncType func, VecType &args)
template<typename A>
std::tuple extract_args(ArgIterator current, ArgIterator end)
template<typename A, typename Arg>
tuple_with_base_types<Arg> extract_args(ArgIterator current, ArgIterator end)
template<typename A, typename First, typename Second, typename ...Args>
tuple_with_base_types<First, Second, Args...> extract_args(ArgIterator current, ArgIterator end)
template<typename T>
constexpr auto type_name()

Variables

constexpr std::string_view _undefined = "unsupported"