blockfactory  0.8
A framework for wrapping algorithms for dataflow programming
FactorySingleton.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * GNU Lesser General Public License v2.1 or any later version.
7  */
8 
9 #ifndef BLOCKFACTORY_CORE_FACTORYSINGLETON_H
10 #define BLOCKFACTORY_CORE_FACTORYSINGLETON_H
11 
12 #include "BlockFactory/Core/Log.h"
13 #include "shlibpp/SharedLibrary.h"
14 #include "shlibpp/SharedLibraryClass.h"
15 
16 #include <memory>
17 
18 namespace blockfactory {
19  namespace core {
20  class Block;
21  class ClassFactorySingleton;
22  } // namespace core
23 } // namespace blockfactory
24 
36 {
37 private:
38 #ifndef DOXYGEN_SHOULD_SKIP_THIS
39  class Impl;
40  std::unique_ptr<Impl> pImpl;
41 #endif
42 
43 public:
44  using ClassFactory = shlibpp::SharedLibraryClassFactory<blockfactory::core::Block>;
45  using ClassFactoryPtr = std::shared_ptr<ClassFactory>;
46 
48  using ClassFactoryName = std::string;
49 
53  using ClassFactoryLibrary = std::string;
54 
56  using ClassFactoryData = std::pair<ClassFactoryLibrary, ClassFactoryName>;
57 
59  ~ClassFactorySingleton() = default;
60 
67 
77 
84  bool destroyFactory(const ClassFactoryData& factorydata);
85 
91  void extendPluginSearchPath(const std::string& path);
92 };
93 
94 #endif
std::string ClassFactoryName
Name of the factory associated to the class specified during its registration.
Definition: FactorySingleton.h:48
std::string ClassFactoryLibrary
Name of the library object independent from the OS.
Definition: FactorySingleton.h:53
void extendPluginSearchPath(const std::string &path)
Add path to search for plugins.
std::shared_ptr< ClassFactory > ClassFactoryPtr
Definition: FactorySingleton.h:45
shlibpp::SharedLibraryClassFactory< blockfactory::core::Block > ClassFactory
Definition: FactorySingleton.h:44
std::pair< ClassFactoryLibrary, ClassFactoryName > ClassFactoryData
Contains the data that indentifies a specific factory contained in a plugin library.
Definition: FactorySingleton.h:56
Class for interfacing with shlibpp plugin library.
Definition: FactorySingleton.h:35
Definition: Block.h:17
ClassFactoryPtr getClassFactory(const ClassFactoryData &factorydata)
Get a factory object associated to a registered class.
static ClassFactorySingleton & getInstance()
Get the singleton instance of the object.
bool destroyFactory(const ClassFactoryData &factorydata)
Ask to destroy a factory identified by the factory data.