/usr/include/Gyoto/GyotoRegister.h is in libgyoto2-dev 0.2.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | /*
Copyright 2011, 2013 Thibaut Paumard
This file is part of Gyoto.
Gyoto is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gyoto is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GyotoRegister_H_
#define __GyotoRegister_H_
#include <string>
#include "GyotoSmartPointer.h"
/**
* \file GyotoRegister.h
* \brief Gyoto registers
*
* Gyoto::Register::Entry instances are used to map kind names to
* Gyoto::SmartPointee::Subcontractor_t functions used to instanciate
* objects from XML files through the Gyoto::Factory.
*/
namespace Gyoto {
/**
* \namespace Gyoto::Register
* \brief Gyoto registers
*
* Gyoto::Register::Entry instances are used to map kind names to
* Gyoto::SmartPointee::Subcontractor_t functions used to
* instanciate objects from XML files through the Gyoto::Factory.
*/
namespace Register {
/* Documented below */
class Entry;
/**
* \brief Initialise the various registers
*
* Normally called once at application start-up, Register::init()
* initiaizes the registers, loads the plug-ins, and fills the
* registers as appropriate.
*
* \param pluglist Coma-separated list of plug-ins to load. If
* NULL, default to the environment variable GYOTO_PLUGINS, if it
* exists. Else use GYOTO_DEFAULT_PLUGINS. Failing to load a
* plug-in prepended with "nofail:" is not fatal.
*/
void init( char const * pluglist = NULL );
/**
* \brief List the various registers
*/
void list();
}
/**
* \brief Load a plugin by name
*
* Uses dlopen to load the file libgyoto-<plugname>.so, looks for
* the function __Gyoto<plugname>Init inside it and run it.
* Plug-ins must be located in the runtime link search path, or in
* GYOTO_PREFIX/lib/gyoto/, or in
* GYOTO_PREFIX/lib/gyoto/GYOTO_SOVERS/.
*
* \param plugname Plug-in name.
* \param nofail Unless nofail evals to true, the inability to find
* a plug-in or to run the initialization function inside it throws
* an Gyoto::Error.
*/
void loadPlugin( char const * const plugname, int nofail = 0);
}
/**
* \brief Entry in a register (or a full register)
*
* A register is actually a chained list of Register::Entry
* instances.
*/
class Gyoto::Register::Entry {
/**
* \brief List the various registers
*/
friend void Gyoto::Register::list();
protected:
std::string name_;
///< Kind name for the entry, as found in the "kind" XML attribute
Gyoto::SmartPointee::Subcontractor_t* subcontractor_;
///< Pointer to the Gyoto::SmartPointee::Subcontractor_t function that produces an object of this kind
Register::Entry* next_;
///< Next entry in the register, or NULL
public:
/**
* \brief Constructor
*/
Entry(std::string name,
Gyoto::SmartPointee::Subcontractor_t* subcontractor,
Entry* next);
~Entry(); ///< Destructor
/**
* \brief Get subcontractor for a given name
*
* Search through the register for an Entry matching name and return
* the corresponding subcontractor.
*
* \param name Name of the kind to look for.
* \param errmode 1 if getSubContractor() should return NULL upon
* failure. Else a Gyoto::Error is thrown.
* \return Pointer to subcontractor function.
*/
Gyoto::SmartPointee::Subcontractor_t*
getSubcontractor(std::string name, int errmode=0);
};
#endif
|