Observable Reference
Generic observable objects for C++
Classes | Macros | Typedefs | Functions
Private

These classes are internal to the library, they may change at any time. More...

Classes

class  observable::detail::collection< ValueType >
 Thread-safe collection that can store arbitrary items and apply a functor over them. More...
 
class  observable::expr::expression_evaluator
 Expression evaluators can be used to manually evaluate multiple expressions at the same time. More...
 
class  observable::expr::expression< ValueType, EvaluatorType >
 Expressions manage expression tree evaluation and results. More...
 
struct  observable::expr::immediate_evaluator
 Evaluator used for expressions that are updated immediately, whenever an expression node changes. More...
 
class  observable::expr::expression< ValueType, immediate_evaluator >
 Specialized expression that is updated immediately, whenever an expression node changes. More...
 
class  observable::expr::expression_node< ResultType >
 Expression nodes can form a tree to evaluate arbitrary expressions. More...
 
struct  observable::expr::is_expression_node< T >
 Check if a type is an expression node. More...
 
struct  observable::expr::expr_detail::is_observable< T >
 Check if a type is either an expression_node or an observable value<ValueType, EqualityComparator>. More...
 
struct  observable::expr::expr_detail::are_any_observable< T >
 Check if any of the provided types are observable. More...
 
struct  observable::expr::expr_detail::val_type< T >
 Extract the value type from an expression_node or observable value<ValueType, EqualityComparator>. More...
 
struct  observable::expr::expr_detail::result_node< Op, Args >
 Computes the type of the expression_node created for an expression with callable Op and corresponding arguments. More...
 
struct  observable::is_value< T >
 Check if a type is a value. More...
 

Macros

#define OBSERVABLE_DEFINE_UNARY_OP(OP)
 Create a unary operator. More...
 
#define OBSERVABLE_DEFINE_BINARY_OP(OP)
 Create a binary operator. More...
 

Typedefs

template<typename CallableType , typename ObserverType >
using observable::detail::is_compatible_with_observer = std::is_convertible< CallableType, std::function< ObserverType > >
 Check if a callable type is compatible with an observer type. More...
 
template<typename CallableType , typename SubjectType >
using observable::detail::is_compatible_with_subject = is_compatible_with_observer< CallableType, typename SubjectType::observer_type >
 Check if a callable type can be used to subscribe to a subject. More...
 
template<typename T >
using observable::expr::expr_detail::val_type_t = typename val_type< T >::type
 Convenience typedef for extracting the value type from an expression_node or observable value<ValueType, EqualityComparator>. More...
 
template<typename Op , typename ... Args>
using observable::expr::expr_detail::result_node_t = typename result_node< Op, Args ... >::type
 Type of the expression_node created for an expression with callable Op and corresponding arguments. More...
 

Functions

template<typename T >
auto observable::expr::expr_detail::make_node (T &&val)
 Create a node from a regular type. More...
 
template<typename T , typename ... R>
auto observable::expr::expr_detail::make_node (value< T, R ... > &val)
 Create a node from an observable value reference. More...
 
template<typename T >
auto observable::expr::expr_detail::make_node (expression_node< T > &&node)
 Create a node from a temporary expression_node. More...
 
template<typename Op , typename ... Args>
auto observable::expr::expr_detail::make_node (Op &&op, Args &&... args)
 Create a node from an operator and an arbitrary number of arguments. More...
 

Detailed Description

These classes are internal to the library, they may change at any time.

You should not use these classes in your code.

Macro Definition Documentation

◆ OBSERVABLE_DEFINE_UNARY_OP

#define OBSERVABLE_DEFINE_UNARY_OP (   OP)
Value:
template <typename ... T> \
inline auto operator OP (value<T ...> & arg) \
noexcept(noexcept(OP arg.get())) \
-> expression_node<std::decay_t<decltype(OP arg.get())>> \
{ \
return expr_detail::make_node([](auto && v) { return (OP v); }, arg); \
} \
\
template <typename T> \
inline auto operator OP (expression_node<T> && arg) \
noexcept(noexcept(OP arg.get())) \
-> expression_node<std::decay_t<decltype(OP arg.get())>> \
{ \
return expr_detail::make_node([](auto && v) { return (OP v); }, \
std::move(arg)); \
}
auto make_node(T &&val)
Create a node from a regular type.
Definition: utility.hpp:104

Create a unary operator.

◆ OBSERVABLE_DEFINE_BINARY_OP

#define OBSERVABLE_DEFINE_BINARY_OP (   OP)

Create a binary operator.

Typedef Documentation

◆ is_compatible_with_observer

template<typename CallableType , typename ObserverType >
using observable::detail::is_compatible_with_observer = typedef std::is_convertible< CallableType, std::function<ObserverType> >

Check if a callable type is compatible with an observer type.

A callable is compatible with an observer type if the callable can be stored inside a std::function<ObserverType>.

Template Parameters
CallableTypeThe type to check if it is compatible with the ObserverType.
ObserverTypeThe type of the observer to check against.

The static member value will be true, if the CallableType is compatible with the ObserverType.

◆ is_compatible_with_subject

template<typename CallableType , typename SubjectType >
using observable::detail::is_compatible_with_subject = typedef is_compatible_with_observer< CallableType, typename SubjectType::observer_type>

Check if a callable type can be used to subscribe to a subject.

A callable can be used to subscribe to a subject if the callable is compatible with the subject's observer_type type.

Template Parameters
CallableTypeThe type to check if it can be used to subscribe to the provided subject.
SubjectTypeThe subject to check against.

The static member value will be true if, the CallableType can be used with the SubjectType.

◆ val_type_t

template<typename T >
using observable::expr::expr_detail::val_type_t = typedef typename val_type<T>::type

Convenience typedef for extracting the value type from an expression_node or observable value<ValueType, EqualityComparator>.

See also
val_type

◆ result_node_t

template<typename Op , typename ... Args>
using observable::expr::expr_detail::result_node_t = typedef typename result_node<Op, Args ...>::type

Type of the expression_node created for an expression with callable Op and corresponding arguments.

Function Documentation

◆ make_node() [1/4]

template<typename T >
auto observable::expr::expr_detail::make_node ( T &&  val)
inline

Create a node from a regular type.

◆ make_node() [2/4]

template<typename T , typename ... R>
auto observable::expr::expr_detail::make_node ( value< T, R ... > &  val)
inline

Create a node from an observable value reference.

◆ make_node() [3/4]

template<typename T >
auto observable::expr::expr_detail::make_node ( expression_node< T > &&  node)
inline

Create a node from a temporary expression_node.

◆ make_node() [4/4]

template<typename Op , typename ... Args>
auto observable::expr::expr_detail::make_node ( Op &&  op,
Args &&...  args 
)
inline

Create a node from an operator and an arbitrary number of arguments.