mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
plugin: require name and add method to dump list
This commit is contained in:
parent
d63c2b30bf
commit
a194f8d0b2
4 changed files with 21 additions and 4 deletions
|
@ -101,7 +101,8 @@ protected:
|
|||
|
||||
class FpgaIpFactory : public Plugin {
|
||||
public:
|
||||
FpgaIpFactory()
|
||||
FpgaIpFactory(std::string concreteName) :
|
||||
Plugin(std::string("FPGA IP Factory: ") + concreteName)
|
||||
{ pluginType = Plugin::Type::FpgaIp; }
|
||||
|
||||
/// Returns a running and checked FPGA IP
|
||||
|
|
|
@ -66,6 +66,10 @@ private:
|
|||
class InterruptControllerFactory : public FpgaIpFactory {
|
||||
public:
|
||||
|
||||
InterruptControllerFactory() :
|
||||
FpgaIpFactory(getName())
|
||||
{}
|
||||
|
||||
FpgaIp* create()
|
||||
{ return new InterruptController; }
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
FpgaIp,
|
||||
};
|
||||
|
||||
Plugin();
|
||||
Plugin(std::string name);
|
||||
virtual ~Plugin();
|
||||
|
||||
// each plugin is a singleton, so copying is not allowed
|
||||
|
@ -53,6 +53,9 @@ public:
|
|||
virtual int parse(json_t *cfg);
|
||||
virtual void dump();
|
||||
|
||||
static void
|
||||
dumpList();
|
||||
|
||||
/** Find registered and loaded plugin with given name and type. */
|
||||
static Plugin *
|
||||
lookup(Type type, std::string name);
|
||||
|
|
|
@ -45,9 +45,9 @@ Plugin::pluginListBuffer;
|
|||
int Plugin::pluginListNiftyCounter;
|
||||
|
||||
|
||||
Plugin::Plugin() :
|
||||
Plugin::Plugin(std::string name) :
|
||||
pluginType(Plugin::Type::Unknown),
|
||||
name(""),
|
||||
name(name),
|
||||
description(""),
|
||||
path(""),
|
||||
state(STATE_INITIALIZED)
|
||||
|
@ -120,6 +120,15 @@ Plugin::dump()
|
|||
std::cout << " - " << this->name << ": " << this->description << std::endl;
|
||||
}
|
||||
|
||||
void
|
||||
Plugin::dumpList()
|
||||
{
|
||||
std::cout << "Registered plugins:" << std::endl;
|
||||
for(auto& p : pluginList) {
|
||||
std::cout << " - " << p->name << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
Plugin*
|
||||
Plugin::lookup(Plugin::Type type, std::string name)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue