ecto
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ecto::tendrils Class Reference

The tendrils are a collection for the ecto::tendril class, addressable by a string key. More...

#include <tendrils.hpp>

Inheritance diagram for ecto::tendrils:
Inheritance graph
[legend]
Collaboration diagram for ecto::tendrils:
Collaboration graph
[legend]

Public Types

typedef std::map< std::string, tendril_ptrstorage_type
 
typedef storage_type::iterator iterator
 
typedef storage_type::const_iterator const_iterator
 
typedef storage_type::value_type value_type
 
typedef storage_type::key_type key_type
 
typedef storage_type::size_type size_type
 
typedef storage_type::difference_type difference_type
 
typedef storage_type::key_compare key_compare
 

Public Member Functions

 tendrils ()
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator find (const std::string &name)
 
const_iterator find (const std::string &name) const
 
void clear ()
 
size_type size () const
 
size_type count (const std::string &name) const
 
void erase (iterator pos)
 
void erase (const key_type &k)
 
template<typename InputIterator >
void insert (InputIterator first, InputIterator last)
 
std::pair< iterator, bool > insert (const value_type &v)
 
key_compare key_comp () const
 
template<typename T >
spore< T > declare (const std::string &name)
 Declare a tendril of a certain type, with only a name, no doc, or default values. More...
 
template<typename T >
spore< T > declare (const std::string &name, const std::string &doc)
 
template<typename T >
spore< T > declare (const std::string &name, const std::string &doc, const T &default_val)
 
template<typename T , typename CellImpl >
spore< T > declare (spore< T > CellImpl::*ptm, const std::string &name, const std::string &doc="", const typename spore< T >::value_type &default_val=typename spore< T >::value_type())
 
template<typename Impl >
void realize_potential (Impl *cookie)
 
tendril_ptr declare (const std::string &name, tendril_ptr t)
 
template<typename T >
T & get (const std::string &name) const
 get the given type that is stored at the given key. Will throw if there is a type mismatch. More...
 
const tendril_ptroperator[] (const std::string &name) const
 Grabs the tendril at the key. More...
 
tendril_ptroperator[] (const std::string &name)
 
void print_doc (std::ostream &out, const std::string &tendrils_name) const
 Print the tendrils documentation string, in rst format. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int)
 

Private Types

typedef boost::signals2::signal< void(void *, const tendrils *)> sig_t
 

Private Member Functions

void doesnt_exist (const std::string &name) const
 
 tendrils (const tendrils &)
 

Private Attributes

storage_type storage
 
sig_t static_bindings_
 

Detailed Description

The tendrils are a collection for the ecto::tendril class, addressable by a string key.

Member Typedef Documentation

typedef storage_type::const_iterator ecto::tendrils::const_iterator
typedef storage_type::difference_type ecto::tendrils::difference_type
typedef storage_type::iterator ecto::tendrils::iterator
typedef storage_type::key_compare ecto::tendrils::key_compare
typedef storage_type::key_type ecto::tendrils::key_type
typedef boost::signals2::signal<void(void*, const tendrils*)> ecto::tendrils::sig_t
private
typedef storage_type::size_type ecto::tendrils::size_type
typedef std::map<std::string, tendril_ptr> ecto::tendrils::storage_type
typedef storage_type::value_type ecto::tendrils::value_type

Constructor & Destructor Documentation

ecto::tendrils::tendrils ( )
ecto::tendrils::tendrils ( const tendrils )
private

Member Function Documentation

iterator ecto::tendrils::begin ( )
inline
const_iterator ecto::tendrils::begin ( ) const
inline
void ecto::tendrils::clear ( )
inline
size_type ecto::tendrils::count ( const std::string &  name) const
inline
template<typename T >
spore<T> ecto::tendrils::declare ( const std::string &  name)
inline

Declare a tendril of a certain type, with only a name, no doc, or default values.

Template Parameters
Tthe type of tendril to declare.
Parameters
nameThe key for the tendril. Must be unique.
Returns
A typed holder for the tendril.
template<typename T >
spore<T> ecto::tendrils::declare ( const std::string &  name,
const std::string &  doc 
)
inline
See also
tendrils::declare
Parameters
nameThe key for the tendril. Must be unique.
docThe doc string for the tendril.
Returns
See also
tendrils::declare
template<typename T >
spore<T> ecto::tendrils::declare ( const std::string &  name,
const std::string &  doc,
const T &  default_val 
)
inline
See also
tendrils::declare
Parameters
nameThe key for the tendril. Must be unique.
docThe doc string for the tendril.
default_valA default value for the tendril.
Returns
See also
tendrils::declare
template<typename T , typename CellImpl >
spore<T> ecto::tendrils::declare ( spore< T > CellImpl::*  ptm,
const std::string &  name,
const std::string &  doc = "",
const typename spore< T >::value_type default_val = typename spore<T>::value_type() 
)
inline

Sig is a function object that looks like: struct Callback { typedef void result_type; void operator()(const boost::signals2::connection &conn, void* cookie, const tendrils* tdls) const { conn.disconnect();//for one time callbacks do your thang. } };

This will be called by realize_potential(cookie). Typically cookie is of type CellImplementation.

Convenience function for static registration of pointer to members that are of type spore<T>

tendril_ptr ecto::tendrils::declare ( const std::string &  name,
tendril_ptr  t 
)

Runtime declare function.

Parameters
name
t
Returns
void ecto::tendrils::doesnt_exist ( const std::string &  name) const
private
iterator ecto::tendrils::end ( )
inline
const_iterator ecto::tendrils::end ( ) const
inline
void ecto::tendrils::erase ( iterator  pos)
inline
void ecto::tendrils::erase ( const key_type k)
inline
iterator ecto::tendrils::find ( const std::string &  name)
inline
const_iterator ecto::tendrils::find ( const std::string &  name) const
inline
template<typename T >
T& ecto::tendrils::get ( const std::string &  name) const
inline

get the given type that is stored at the given key. Will throw if there is a type mismatch.

Template Parameters
TThe compile time type to attempt to get from the tendrils.
Parameters
nameThe key value
Returns
A reference to the value, no copy is done.
template<typename InputIterator >
void ecto::tendrils::insert ( InputIterator  first,
InputIterator  last 
)
inline
std::pair<iterator, bool> ecto::tendrils::insert ( const value_type v)
inline
key_compare ecto::tendrils::key_comp ( ) const
inline
const tendril_ptr& ecto::tendrils::operator[] ( const std::string &  name) const

Grabs the tendril at the key.

Parameters
nameThe key for the desired tendril.
Returns
A shared pointer to the tendril. this throws if the key is not in the tendrils object
tendril_ptr& ecto::tendrils::operator[] ( const std::string &  name)
void ecto::tendrils::print_doc ( std::ostream &  out,
const std::string &  tendrils_name 
) const

Print the tendrils documentation string, in rst format.

Parameters
outThe stream to print to.
tendrils_nameThe name used as a label, for the tendrils.
template<typename Impl >
void ecto::tendrils::realize_potential ( Impl *  cookie)
inline
template<class Archive >
void ecto::tendrils::serialize ( Archive &  ar,
const unsigned  int 
)
size_type ecto::tendrils::size ( ) const
inline

Member Data Documentation

sig_t ecto::tendrils::static_bindings_
private
storage_type ecto::tendrils::storage
private

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