ecto
|
A tendril is the slender, winding organ of the ecto::cell that gives it its awesome type erasure and uber flexibility. More...
#include <tendril.hpp>
Classes | |
struct | Caller |
struct | Converter |
struct | ConverterImpl |
struct | ConverterImpl< none, _ > |
struct | empty_t |
struct | none |
A none type for tendril when the tendril is uninitialized. More... | |
Public Types | |
enum | { DEFAULT_VALUE =0, DIRTY, USER_SUPPLIED, REQUIRED, OPTIONAL, N_FLAGS } |
typedef boost::function1< void, tendril & > | TendrilJob |
Public Member Functions | |
tendril () | |
Creates a tendril that is initialized with the tendril::none type. This should be fairly cheap. More... | |
~tendril () | |
tendril (const tendril &rhs) | |
tendril & | operator= (const tendril &rhs) |
template<typename T > | |
tendril (const T &t, const std::string &doc) | |
A convenience constructor for creating a tendril that holds the given type. More... | |
std::string | type_name () const |
This is an unmangled type name for what ever tendril is holding. More... | |
const char * | type_id () const |
std::string | doc () const |
A doc string for this tendril, "foo is for the input
and will be mashed with spam.". More... | |
void | set_doc (const std::string &doc_str) |
The doc for this tendril is runtime defined, so you may want to update it. More... | |
template<typename T > | |
void | set_default_val (const T &val=T()) |
This sets the default value of the tendril. This is a. More... | |
void | required (bool b) |
bool | required () const |
template<typename T > | |
const T & | get () const |
template<typename T > | |
T & | get () |
template<typename T > | |
void | operator<< (const T &val) |
void | operator<< (const boost::python::object &obj) |
tendril & | operator<< (const tendril &rhs) |
template<typename T > | |
bool | is_type () const |
runtime check if the tendril is of the given type. More... | |
bool | same_type (const tendril &rhs) const |
Test if the given tendril is the same type as this one. More... | |
bool | compatible_type (const tendril &rhs) const |
void | enforce_compatible_type (const tendril &rhs) const |
template<typename T > | |
void | enforce_type () const |
runtime check if the tendril is of the given type, this will throw. More... | |
bool | user_supplied () const |
The value that this tendril holds was supplied by the user at some point. More... | |
void | user_supplied (bool v) |
bool | has_default () const |
The tendril was initialized with default value. More... | |
template<typename Signature > | |
boost::signals2::connection | connect (Signature slot) |
template<typename T > | |
tendril & | set_callback (typename boost::function1< void, T > cb) |
void | notify () |
Notify the callback, only if this is dirty. More... | |
bool | dirty () const |
void | dirty (bool) |
Set the tendril dirty, implying that the value has changed. More... | |
template<typename T > | |
void | operator>> (T &val) const |
void | operator>> (boost::python::object &obj) const |
void | operator>> (const tendril_ptr &rhs) const |
void | operator>> (tendril_ptr &rhs) const |
void | operator>> (tendril &rhs) const |
template<typename Archive > | |
void | serialize (Archive &ar, const unsigned int) |
Static Public Attributes | |
static const empty_t | empty |
Private Types | |
typedef boost::signals2::signal< void(tendril &)> | job_signal_t |
Private Member Functions | |
template<typename T > | |
const T & | unsafe_get () const |
template<typename T > | |
T & | unsafe_get () |
template<typename T > | |
void | set_holder (const T &t=T()) |
void | copy_holder (const tendril &rhs) |
Private Attributes | |
boost::any | holder_ |
const char * | type_ID_ |
std::string | doc_ |
std::bitset< N_FLAGS > | flags_ |
job_signal_t | jobs_ |
Converter * | converter |
Friends | |
template<typename T > | |
void | operator>> (const tendril_cptr &rhs, T &val) |
void | operator>> (const tendril_ptr &rhs, boost::python::object &obj) |
void | operator>> (const tendril_cptr &rhs, boost::python::object &obj) |
template<typename T > | |
void | operator<< (const tendril_ptr &lhs, const T &rhs) |
void | operator<< (const tendril_ptr &lhs, const tendril_ptr &rhs) |
void | operator<< (const tendril_ptr &lhs, const tendril_cptr &rhs) |
template<typename T > | |
tendril_ptr | make_tendril () |
A tendril is the slender, winding organ of the ecto::cell that gives it its awesome type erasure and uber flexibility.
Each tendril is a type erasing holder for any instance of any type, and allows introspection including its value, type, and doc string.
The tendril operates as a value holder, so treat it as such. If you would like to pass it around without copies, construct a pointer to tendril, perhaps with the make_tendril<T>() function.
Items held by the tendril must be copy constructible and copiable.
|
private |
typedef boost::function1<void, tendril&> ecto::tendril::TendrilJob |
ecto::tendril::tendril | ( | ) |
Creates a tendril that is initialized with the tendril::none type. This should be fairly cheap.
ecto::tendril::~tendril | ( | ) |
ecto::tendril::tendril | ( | const tendril & | rhs | ) |
|
inline |
A convenience constructor for creating a tendril that holds the given type.
T | The type to hide in this tendril |
t | default value for t |
doc | a documentation string |
bool ecto::tendril::compatible_type | ( | const tendril & | rhs | ) | const |
|
inline |
|
private |
bool ecto::tendril::dirty | ( | ) | const |
The tendril has likely been modified since the last time that notify has beend called. This gets unset after its changed-callbacks have fired
void ecto::tendril::dirty | ( | bool | ) |
Set the tendril dirty, implying that the value has changed.
std::string ecto::tendril::doc | ( | ) | const |
A doc string for this tendril, "foo is for the input and will be mashed with spam.".
void ecto::tendril::enforce_compatible_type | ( | const tendril & | rhs | ) | const |
|
inline |
runtime check if the tendril is of the given type, this will throw.
|
inline |
Given T this will get the type from the tendril, also enforcing type with an exception.
|
inline |
bool ecto::tendril::has_default | ( | ) | const |
The tendril was initialized with default value.
|
inline |
runtime check if the tendril is of the given type.
void ecto::tendril::notify | ( | ) |
Notify the callback, only if this is dirty.
|
inline |
void ecto::tendril::operator<< | ( | const boost::python::object & | obj | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void ecto::tendril::required | ( | bool | b | ) |
bool ecto::tendril::required | ( | ) | const |
bool ecto::tendril::same_type | ( | const tendril & | rhs | ) | const |
Test if the given tendril is the same type as this one.
rhs | The tendril to test against. |
void ecto::tendril::serialize | ( | Archive & | ar, |
const unsigned | int | ||
) |
|
inline |
Register a typed callback with the tendril... Will throw on wrong type.
cb | Will be called by the notify function, if the tendril is dirty. |
|
inline |
This sets the default value of the tendril. This is a.
val |
void ecto::tendril::set_doc | ( | const std::string & | doc_str | ) |
The doc for this tendril is runtime defined, so you may want to update it.
doc_str | A human readable description of the tendril. |
|
inlineprivate |
|
inline |
std::string ecto::tendril::type_name | ( | ) | const |
This is an unmangled type name for what ever tendril is holding.
|
inlineprivate |
|
inlineprivate |
bool ecto::tendril::user_supplied | ( | ) | const |
The value that this tendril holds was supplied by the user at some point.
void ecto::tendril::user_supplied | ( | bool | v | ) |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
|
private |
|
static |
|
private |
|
private |
|
private |
|
private |