Rumba C++ SDK
maquina::PlugDescriptor Class Reference

A plug descriptor to pass to the Registry::register_node() function. More...

#include <PlugDescriptor.h>

Classes

struct  ExternalDependencies
 A plug external dependency descriptor. More...
 
struct  InternalDependencies
 A plug internal dependency descriptor. More...
 

Public Types

enum  Flags {
  none = 0, cache = 1 << 0, time_varying = 1 << 1, serial = 1 << 3,
  graph_invisible = 1 << 8, hidden = 1 << 8, channel = 1 << 9, constant = 1 << 10,
  cache_exact = 1 << 11, main = 1 << 12, auto_connect = 1 << 13, no_input = 1 << 15,
  background = 1 << 30
}
 

Public Member Functions

 PlugDescriptor (const char *plug_name, const Value &default_value, uint32_t flags=serial, const char *ui="")
 Register an input plug. More...
 
 PlugDescriptor (const char *plug_name, const Value &default_value, uint32_t flags, const char *ui, const std::function< Value(EvalContext &)> &eval_handler, const std::vector< InternalDependencies > &intern_deps, PartialInvalidationPtr(*partial_invalidation_handler)(const Plug &plug, int dep, const PartialInvalidationPtr &pi)=nullptr, bool(*dyn_evaluate)(const ConditionalEvalContext &context, int dep)=nullptr, int first_extern_deps=-1, const std::vector< ExternalDependencies > &extern_deps={})
 Register an evaluated plug. More...
 

Public Attributes

std::string _plug_name
 
Value _default_value
 
uint32_t _flags = 0
 
std::string _ui
 
std::function< Value(EvalContext &)> _eval_handler
 
std::vector< InternalDependencies_intern_deps
 
PartialInvalidationPtr(* _partial_invalidation_handler )(const Plug &plug, int dep, const PartialInvalidationPtr &pi) = nullptr
 
bool(* _dyn_evaluate )(const ConditionalEvalContext &context, int dep) = nullptr
 
int _first_extern_deps = -1
 
std::vector< ExternalDependencies_extern_deps
 
bool _has_conditional_evaluation = false
 

Detailed Description

A plug descriptor to pass to the Registry::register_node() function.

Member Enumeration Documentation

◆ Flags

Enumerator
none 
cache 

This plug value should be keeped in memory because it takes time to be computed.

time_varying 

This plug is never constant.

serial 

This plug value should be serialized.

graph_invisible 

This plug should not be visible in the graph editor.

hidden 

This plug should be hidden in the UI by default.

channel 

This plug is a channel.

constant 

This plug is not animable (i.e no animation curve, only constant values)

cache_exact 

This plug is cached with the exact value.

main 

This plug is always visible.

auto_connect 

This plug may be connected automatically when the node is dropped over a connection.

no_input 

This plug cannot be connected with an input.

background 

This plug is evaluated by the background engine.

Constructor & Destructor Documentation

◆ PlugDescriptor() [1/2]

maquina::PlugDescriptor::PlugDescriptor ( const char *  plug_name,
const Value default_value,
uint32_t  flags = serial,
const char *  ui = "" 
)
inline

Register an input plug.

An input plug has a value, it is serialized. It can be connected in input or output.

Parameters
plug_namein The plug name
default_valuein The plug type and default value
flagsin A combinaison of PlugDescription::Flags flags
uiin A json string with display options used by the user interface

◆ PlugDescriptor() [2/2]

maquina::PlugDescriptor::PlugDescriptor ( const char *  plug_name,
const Value default_value,
uint32_t  flags,
const char *  ui,
const std::function< Value(EvalContext &)> &  eval_handler,
const std::vector< InternalDependencies > &  intern_deps,
PartialInvalidationPtr(*)(const Plug &plug, int dep, const PartialInvalidationPtr &pi)  partial_invalidation_handler = nullptr,
bool(*)(const ConditionalEvalContext &context, int dep)  dyn_evaluate = nullptr,
int  first_extern_deps = -1,
const std::vector< ExternalDependencies > &  extern_deps = {} 
)
inline

Register an evaluated plug.

An evaluated plug computes a value using a function, the eval handler. The plug has dependencies to compute the value. The dependencies can be internal or external. It's output can be connected to other plugs.

The internal dependencies are registered, they are not serialized.

The external dependencies connections are serialized. They are organized as an array of structure. Each element of the structure have a name, a type and a default value. The structure can be repeated in an array.

Parameters
plug_namein The plug name
default_valuein The plug type and default value
flagsin A combinaison of PlugDescription::Flags flags
uiin A json string with display options used by the user interface
eval_handlerin The evaluation handler to compute the plug value
intern_depsin The external dependencies description
partial_invalidation_handlerin The evaluation handler to compute the PartialInvalidation, if required
dyn_evaluatein An optional function to tell if the plug's dynamic dependencies must be evaluated. If the function returns true (default), the dynamic dependency is computed and is valid during the plug's evaluation. If the function returns false, the dynamic dependency is not computed and no value is passed to the plug's evaluation function. That dependence value is invalid and shall not be requested. The context object can be used to get information about the current plug evaluation.
first_extern_depsin index of the first external dependency
extern_depsin The external dependencies description

Member Data Documentation

◆ _default_value

Value maquina::PlugDescriptor::_default_value

◆ _dyn_evaluate

bool(* maquina::PlugDescriptor::_dyn_evaluate) (const ConditionalEvalContext &context, int dep) = nullptr

◆ _eval_handler

std::function<Value(EvalContext&)> maquina::PlugDescriptor::_eval_handler

◆ _extern_deps

std::vector<ExternalDependencies> maquina::PlugDescriptor::_extern_deps

◆ _first_extern_deps

int maquina::PlugDescriptor::_first_extern_deps = -1

◆ _flags

uint32_t maquina::PlugDescriptor::_flags = 0

◆ _has_conditional_evaluation

bool maquina::PlugDescriptor::_has_conditional_evaluation = false

◆ _intern_deps

std::vector<InternalDependencies> maquina::PlugDescriptor::_intern_deps

◆ _partial_invalidation_handler

PartialInvalidationPtr(* maquina::PlugDescriptor::_partial_invalidation_handler) (const Plug &plug, int dep, const PartialInvalidationPtr &pi) = nullptr

◆ _plug_name

std::string maquina::PlugDescriptor::_plug_name

◆ _ui

std::string maquina::PlugDescriptor::_ui

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