31 #include <boost/noncopyable.hpp> 32 #include <boost/function/function0.hpp> 33 #include <boost/make_shared.hpp> 41 void postregistration(
const std::string&,
const std::string&,
const std::string&);
48 typedef boost::shared_ptr<cell>(*factory_fn_t)();
58 boost::shared_ptr<cell>
construct_() {
return construct(); }
60 void declare_io_(
const ecto::tendrils& p, ecto::tendrils& i, ecto::tendrils& o)
66 template <
typename ModuleTag>
71 void add(nullary_fn_t f)
78 for (
unsigned j=0; j<regvec.size(); ++j)
95 template <
typename Module,
typename T>
105 return boost::shared_ptr<cell>(
new cell_t);
109 : name_(name), docstring_(docstring)
130 boost::shared_ptr<cell>
create(
const std::string& name);
136 #define ECTO_MODULETAG(MODULE) namespace ecto { namespace tag { struct MODULE; } } 137 #define ECTO_CELL(MODULE, TYPE, NAME, DOCSTRING) \ 138 ECTO_ASSERT_MODULE_NAME(MODULE) \ 139 ECTO_MODULETAG(MODULE) \ 140 namespace ecto{ namespace registry { \ 142 const ::ecto::registry::registrator< ::ecto::tag::MODULE,TYPE>& \ 143 ::ecto::registry::registrator< ::ecto::tag::MODULE,TYPE>::inst \ 144 (::ecto::registry::registrator< ::ecto::tag::MODULE,TYPE>(NAME, DOCSTRING)); \ 147 #define ECTO_INSTANTIATE_REGISTRY(MODULE) \ 148 ECTO_MODULETAG(MODULE) \ 149 template struct ::ecto::registry::module_registry< ::ecto::tag::MODULE>; 151 #define ECTO_REGISTER(MODULE) \ 152 ::ecto::registry::module_registry< ::ecto::tag::MODULE>::instance().go(); boost::shared_ptr< cell >(* factory_fn_t)()
Definition: registry.hpp:48
Definition: registry.hpp:53
void operator()() const
Definition: registry.hpp:122
static const registrator & inst
Definition: registry.hpp:126
declare_params_t declare_params
Definition: registry.hpp:55
static boost::shared_ptr< cell > create()
Definition: registry.hpp:103
declare_io_t declare_io
Definition: registry.hpp:56
factory_fn_t construct
Definition: registry.hpp:54
void register_factory_fn(const std::string &name, entry_t e)
module_registry()
Definition: registry.hpp:92
Definition: parameters.hpp:11
boost::function0< void > nullary_fn_t
Definition: registry.hpp:69
boost::shared_ptr< cell > create_initialized(const std::string &name)
void(* declare_io_t)(const ecto::tendrils &, ecto::tendrils &, ecto::tendrils &)
Definition: registry.hpp:50
void(* declare_params_t)(ecto::tendrils &)
Definition: registry.hpp:49
const char * docstring_
Definition: registry.hpp:99
void declare_params_(ecto::tendrils &t)
Definition: registry.hpp:59
void add(nullary_fn_t f)
Definition: registry.hpp:71
void declare_io_(const ecto::tendrils &p, ecto::tendrils &i, ecto::tendrils &o)
Definition: registry.hpp:60
boost::shared_ptr< cell > construct_()
Definition: registry.hpp:58
::ecto::cell_< T > cell_t
Definition: registry.hpp:101
void postregistration(const std::string &, const std::string &, const std::string &)
Definition: registry.hpp:96
const char * name_
Definition: registry.hpp:98
entry_t lookup(const std::string &name)
Definition: registry.hpp:67
std::vector< nullary_fn_t > regvec
Definition: registry.hpp:82
boost::shared_ptr< cell > create(const std::string &name)
registrator(const char *name, const char *docstring)
Definition: registry.hpp:108
The tendrils are a collection for the ecto::tendril class, addressable by a string key...
Definition: tendrils.hpp:53
void go()
Definition: registry.hpp:76
static module_registry & instance()
Definition: registry.hpp:84