Gyoto registers.
More...
#include <string>
#include <glob.h>
#include <filesystem>
#include "GyotoSmartPointer.h"
Go to the source code of this file.
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.
◆ GYOTO_GETSUBCONTRACTOR
| #define GYOTO_GETSUBCONTRACTOR |
( |
|
space | ) |
|
Defines the getSubcontractor() function for namespace space.
This macro is called for instance to define Gyoto::Metric::getSubcontractor(). A function defined this way will:
- load any mandatory (i.e. not prepended with "fallback:") plug-in listed in
plugin using requirePlugin();
- if the Gyoto::space::Register_ register is still empty at this point, load fallback (i.e. prepended with "fallback:") plug-ins listed in
plugin until it is not anymore;
- if
plugin is empty of contains only fallback plug-ins, look for a subcontractor matching name in the register; if a match is found, insert the name of the corresponding plug-in in plugin and return a pointer to the matching subcontractor;
- look for a subcontractor matching
name and one mandatory plug-in from plugin in the relevant register; if a match is found, return the subcontractor;
- for each fallback plugin
plg:
- try to load and look for a subcontractor matching
name and plg;
- try to find a file that matches
plg as a glob pattern, if one exists, try to load it as a plug-in and look for a subcontractor matching pname is it;
- try to find a file that matches
plg as a glob pattern, if one exists, try to load it as a plug-in and look for a subcontractor matching pname is it;
- try to find a file that matches
<directory>/libgyoto-<plg>.so for every directory in the plug-in path. If such a file exists, try to load it as a plug-in and look for a subcontractor matching pname is it; At any point, if a matching subcontracting subcontractor is found, return it.
Else,
- if
errmode is 1, return NULL;
- if
errmode is 0, throw a Gyoto::Error.
- Parameters
-
| [in] | space | a Gyoto namespace such as Metric, Astrobj, Spectrum or Spectrometer. |
◆ GYOTO_REGISTEREDPLUGINSSLASHKINDS
| #define GYOTO_REGISTEREDPLUGINSSLASHKINDS |
( |
|
space | ) |
|
Value:std::vector<std::string> \
Gyoto::space::Generic::registeredPluginsSlashKinds() { \
std::vector<std::string> retval; \
return retval; \
}
Gyoto::Register::Entry * Register_
The Astrobj register.
void pluginsSlashNames(std::vector< std::string > &retval) const
Get "plugin/name" for this and all subsequent entries.