33 #ifndef WALLAROO_CLASS_H_
34 #define WALLAROO_CLASS_H_
53 template <
class P1,
class P2 >
58 typedef cxx0x::shared_ptr< Part >
Ptr;
59 typedef cxx0x::function< Ptr( const P1& p1, const P2& p2 ) >
FactoryMethod;
70 return( fm( p1, p2 ) ) ;
79 typename Classes::const_iterator i = Registry().find( name );
80 if ( i != Registry().end() )
86 typedef cxx0x::unordered_map< std::string, Class< P1, P2 > > Classes;
87 template <
class T,
class T1,
class T2 >
friend class Registration;
88 static void Register(
const std::string& s,
const FactoryMethod& m )
90 Registry().insert( std::make_pair( s,
Class( m ) ) );
92 static Classes& Registry()
94 static Classes registry;
100 Class( FactoryMethod m ) :
117 typedef cxx0x::shared_ptr< Part >
Ptr;
137 typename Classes::const_iterator i = Registry().find( name );
138 if ( i != Registry().end() )
144 typedef cxx0x::unordered_map< std::string, Class< P, void > > Classes;
146 static void Register(
const std::string& s,
const FactoryMethod& m )
148 Registry().insert( std::make_pair( s,
Class( m ) ) );
150 static Classes& Registry()
152 static Classes registry;
158 Class( FactoryMethod m ) :
176 typedef cxx0x::shared_ptr< Part >
Ptr;
188 p -> Source( plugin );
199 Classes::const_iterator i = Registry().find( name );
200 if ( i != Registry().end() )
206 cxx0x::shared_ptr< Plugin > plugin;
207 typedef cxx0x::unordered_map< std::string, Class< void, void > > Classes;
210 static void Register(
const std::string& s,
const FactoryMethod& m )
212 Registry().insert( std::make_pair( s,
Class( m ) ) );
214 static void Register(
const std::string& s,
const FactoryMethod& m,
const cxx0x::shared_ptr< Plugin >& plugin )
216 Registry().insert( std::make_pair( s,
Class( m, plugin ) ) );
218 static Classes& Registry()
220 static Classes registry;
226 Class( FactoryMethod m ) :
230 Class( FactoryMethod m,
const cxx0x::shared_ptr< Plugin >& p ) :
244 template <
class T,
class P1 =
void,
class P2 =
void >
257 #endif // WALLAROO_CLASS_H_
cxx0x::shared_ptr< Part > Ptr
Definition: class.h:176
Ptr NewInstance(const P &p) const
Definition: class.h:125
cxx0x::function< Ptr() > FactoryMethod
Definition: class.h:177
Registration(const std::string &name)
Definition: class.h:248
Ptr NewInstance() const
Definition: class.h:183
Ptr NewInstance(const P1 &p1, const P2 &p2) const
Definition: class.h:67
cxx0x::shared_ptr< Part > Ptr
Definition: class.h:58
cxx0x::function< Ptr(const P &p) > FactoryMethod
Definition: class.h:118
static Class ForName(const std::string &name)
Definition: class.h:135
static Class ForName(const std::string &name)
Definition: class.h:77
Definition: dynamic_loader.h:60
cxx0x::function< Ptr(const P1 &p1, const P2 &p2) > FactoryMethod
Definition: class.h:59
cxx0x::shared_ptr< Part > Ptr
Definition: class.h:117
Definition: attribute.h:45
static Class ForName(const std::string &name)
Definition: class.h:197