GyotoRegister.h File Reference

Gyoto registers. More...

#include <string>
#include "GyotoSmartPointer.h"

Go to the source code of this file.


class  Gyoto::Register::Entry
 Entry in a register (or a full register). More...


namespace  Gyoto

Namespace for the Gyoto library.

namespace  Gyoto::Register

Gyoto registers.




void Gyoto::Register::init (char const *pluglist=NULL)
 Initialise the various registers.
void Gyoto::Register::list ()
 List the various registers.
void * Gyoto::loadPlugin (char const *const plugname, int nofail=0)
 Load a plugin by name.
bool Gyoto::havePlugin (std::string plugname)
 Check whether a given plug-in has already been loaded.
void Gyoto::requirePlugin (std::string plugname, int nofail=0)
 Load a plugin by name, only if not loaded yet.

Detailed Description

Gyoto registers.

Gyoto::Register::Entry instances are used to map kind names to Gyoto::SmartPointee::Subcontractor_t functions used to instantiate objects from XML files through the Gyoto::Factory.

Define Documentation

#define GYOTO_GETSUBCONTRACTOR ( space   ) 
Gyoto::space::Subcontractor_t*                                  \
  Gyoto::space::getSubcontractor(std::string name, std::vector<std::string> &plugin, int errmode) { \
  for (size_t i=0; i<plugin.size(); ++i) {                              \
    GYOTO_DEBUG_EXPR(plugin[i]);                                        \
    Gyoto::requirePlugin(plugin[i]);                                    \
  }                                                                     \
  if (!Gyoto::space::Register_) throwError("No " GYOTO_STRINGIFY(space) " kind registered!"); \
  Subcontractor_t* sctr= NULL;                                          \
  std::string plg("");                                                  \
  if (!plugin.size()) {                                                 \
  sctr =                                                                \
    (Subcontractor_t*)Gyoto::space::Register_                           \
    -> getSubcontractor(name, plg, errmode);                            \
  plugin.push_back(plg);                                                \
  }                                                                     \
  for (size_t i=plugin.size()-1; i>=0 && sctr == NULL; --i) {           \
    sctr=                                                               \
      (Subcontractor_t*)Gyoto::space::Register_                         \
      -> getSubcontractor(name, plugin[i], 1);                          \
  }                                                                     \
  if (!errmode && !sctr) throwError ("Kind not found in the specified plug-ins: "+name); \
  return sctr;                                                          \

Generated on 23 Oct 2019 for Gyoto by  doxygen 1.6.1