/usr/include/tulip/WithDependency.h is in libtulip-dev 4.4.0dfsg2-2.
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 | /*
*
* This file is part of Tulip (www.tulip-software.org)
*
* Authors: David Auber and the Tulip development Team
* from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
*
* Tulip is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Tulip 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.
*
*/
#ifndef _TULIPWITHDEPENDENCY
#define _TULIPWITHDEPENDENCY
#include <list>
#include <string>
#include <typeinfo>
#include <tulip/tulipconf.h>
namespace tlp {
/**
* @ingroup Plugins
*
* @brief Represents a plugin's dependency to another plugin.
* In addition to maganing plugin registration, Tulip also handles a dependency mechanism between plugins.
* Every Tulip plugin inherits from the tlp::WithDependency interface which allows to declare that another plugin should be loaded in order for this plugin to run.
* When declaring a dependency, a plugin state the name and the version of the dependecy. This is done by calling tlp::WithDependency::addDependency()
*
* @see tlp::WithDependency
*/
struct Dependency {
/**
* @brief The name of the plug-in, as registered in the Tulip plug-in system.
*/
std::string pluginName;
/**
* @brief The required version of the plug-in.
*/
std::string pluginRelease;
/**
* @brief Constructs a new dependency.
*
* @param pName The name of the plug-in, as registered in the Tulip plug-in system.
* @param pRelease The required version of the plug-in.
*/
Dependency(std::string pName,
std::string pRelease):pluginName(pName),pluginRelease(pRelease) {
}
};
/**
* @ingroup Plugins
* @brief Describes the dependencies of a plug-in on other plug-ins, identified by their name and their version number.
*
* This allows to have a plug-in inner workings depend on other plug-ins without linking them statically, or hoping depended plug-in will be there.
*/
class WithDependency {
protected:
/**
* @brief The inner list of dependencies.
*/
std::list<Dependency> _dependencies;
public:
/**
* @brief Adds a dependency upon another plug-in.
*
* @param factory The type name of the plug-in (e.g. 'DoubleAlgorithm')
* @param name The name of the plug-in, as registered in the Tulip plug-in system.
* @param release The required version of the depended plug-in.
*/
void addDependency(const char *name,const char *release) {
_dependencies.push_back(Dependency(name, release));
}
/**
* @brief Gets the list of Dependencies of this plug-in.
*
* @return list<Dependency> The list of dependencies of this plug-in.
*/
const std::list<Dependency>& dependencies() const {
return _dependencies;
}
};
}
#endif
|