20 #ifndef __GyotoRegister_H_ 21 #define __GyotoRegister_H_ 61 void init(
char const * pluglist = NULL );
83 void loadPlugin(
char const *
const plugname,
int nofail = 0);
84 bool havePlugin(std::string plugname);
85 void requirePlugin(std::string plugname,
int nofail = 0);
112 Entry(std::string name,
141 #define GYOTO_GETSUBCONTRACTOR(space) \ 142 Gyoto::space::Subcontractor_t* \ 143 Gyoto::space::getSubcontractor(std::string name, std::vector<std::string> &plugin, int errmode) { \ 144 for (size_t i=0; i<plugin.size(); ++i) { \ 145 GYOTO_DEBUG_EXPR(plugin[i]); \ 146 Gyoto::requirePlugin(plugin[i]); \ 148 if (!Gyoto::space::Register_) throwError("No " GYOTO_STRINGIFY(space) " kind registered!"); \ 149 Subcontractor_t* sctr= NULL; \ 150 std::string plg(""); \ 151 if (!plugin.size()) { \ 153 (Subcontractor_t*)Gyoto::space::Register_ \ 154 -> getSubcontractor(name, plg, errmode); \ 155 plugin.push_back(plg); \ 157 for (size_t i=plugin.size()-1; i>=0 && sctr == NULL; --i) { \ 159 (Subcontractor_t*)Gyoto::space::Register_ \ 160 -> getSubcontractor(name, plugin[i], 1); \ 162 if (!errmode && !sctr) throwError ("Kind not found in the specified plug-ins: "+name); \ Entry(std::string name, Gyoto::SmartPointee::Subcontractor_t *subcontractor, Entry *next)
Constructor.
Gyoto::SmartPointee::Subcontractor_t * getSubcontractor(std::string name, std::string &plugin, int errmode=0)
Get subcontractor for a given name.
std::string name_
Kind name for the entry, as found in the "kind" XML attribute.
Definition: GyotoRegister.h:100
Reference-counting pointers.
void Register(std::string name, Gyoto::Astrobj::Subcontractor_t *scp)
Make an Astrobj kind known to the Factory.
void init(char const *pluglist=NULL)
Initialise the various registers.
void list()
List the various registers.
void loadPlugin(char const *const plugname, int nofail=0)
Load a plugin by name.
Gyoto::SmartPointer< Gyoto::SmartPointee > Subcontractor_t(Gyoto::FactoryMessenger *, std::vector< std::string > const &)
A subcontractor builds an object upon order from the Factory.
Definition: GyotoSmartPointer.h:114
Register::Entry * next_
Next entry in the register, or NULL.
Definition: GyotoRegister.h:104
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
const std::string plugin_
Plug-in from which this Entry was loaded.
Definition: GyotoRegister.h:106
Gyoto::SmartPointee::Subcontractor_t * subcontractor_
Pointer to the Gyoto::SmartPointee::Subcontractor_t function that produces an object of this kind...
Definition: GyotoRegister.h:102
Entry in a register (or a full register)
Definition: GyotoRegister.h:94