![]() |
Home | Libraries | People | FAQ | More |
boost::extensions::adaptable_factory —
template<typename Interface, typename Info = std::string, typename TypeInfo = default_type_info> class adaptable_factory { public: // construct/copy/destruct adaptable_factory(); adaptable_factory(adaptable_factory< Interface > const &); adaptable_factory& operator=(adaptable_factory< Interface > const &); // public member functions Interface * create(boost::reflections::parameter_map &) const; function< Interface *()> get_function(boost::reflections::parameter_map &) const; std::map< TypeInfo, Info > get_missing_params(const boost::reflections::parameter_map &) const; bool is_valid() const; template<typename Derived, typename Params...> void set(Info) ; };
This class is a function object that returns new instances of type Interface, using factories that take parameters described in the variable length list Params...
adaptable_factory
public
construct/copy/destructadaptable_factory();
adaptable_factory(adaptable_factory< Interface > const & first);
adaptable_factory& operator=(adaptable_factory< Interface > const & first);
adaptable_factory public member functionsInterface * create(boost::reflections::parameter_map & map) const;
Returns an instance of Interface (but does NOT retain ownership of the instance).
| Parameters: |
|
||
| Requires: | is_valid() == true. |
||
| Postconditions: | None. |
||
| Returns: | An instance of Interface, if all of the needed parameters are found in map. |
function< Interface *()> get_function(boost::reflections::parameter_map & map) const;
std::map< TypeInfo, Info > get_missing_params(const boost::reflections::parameter_map & map) const;
Returns a map of the TypeInfo/Info pairs describing any parameters still needed before this function can be called.
| Parameters: |
|
||
| Requires: | is_valid() == true. |
||
| Postconditions: | None. |
||
| Returns: | TypeInfo/Info pairs for any missing parameters. |
bool is_valid() const;
Until set is called, a adaptable_factory cannot be used. This function can be used to determine if set has been called.
| Requires: | None. |
| Postconditions: | None. |
| Returns: | True if the adaptable_factory is initialized (ie, set has been called). |
template<typename Derived, typename Params...> void set(Info parameter_names...) ;
This sets the factory function to the constructor for type D. It takes as arguments Info about each parameter in the constructor.
| Requires: | None. |
| Postconditions: | None. Example: adaptable_factory<Base, int, int> f; f.set<Derived>(); |