Factory.h
Go to the documentation of this file.
1 
20 #ifndef FACTORY_H_5WKLGPRB
21 #define FACTORY_H_5WKLGPRB
22 
23 #include "uscxml/Common.h"
24 
25 #include <string.h>
26 
27 #ifdef BUILD_AS_PLUGINS
28 #include "Pluma/Pluma.hpp"
29 #endif
30 
31 #include <memory>
32 #include <set>
33 #include <map>
34 #include <string>
35 #include <limits>
36 
37 namespace uscxml {
38 
39 class InterpreterImpl;
40 class IOProcessorImpl;
41 class IOProcessorCallbacks;
42 class DataModelImpl;
43 class DataModelCallbacks;
44 class InvokerImpl;
45 class InvokerCallbacks;
46 class ExecutableContentImpl;
47 
48 class USCXML_API Factory {
49 public:
50  Factory(Factory* parentFactory);
51  Factory(const std::string& pluginPath, Factory* parentFactory);
52 
53  void registerIOProcessor(IOProcessorImpl* ioProcessor);
54  void registerDataModel(DataModelImpl* dataModel);
55  void registerInvoker(InvokerImpl* invoker);
56  void registerExecutableContent(ExecutableContentImpl* executableContent);
57 
58  std::shared_ptr<DataModelImpl> createDataModel(const std::string& type, DataModelCallbacks* callbacks);
59  std::shared_ptr<IOProcessorImpl> createIOProcessor(const std::string& type, IOProcessorCallbacks* callbacks);
60  std::shared_ptr<InvokerImpl> createInvoker(const std::string& type, InvokerCallbacks* interpreter);
61  std::shared_ptr<ExecutableContentImpl> createExecutableContent(const std::string& localName, const std::string& nameSpace, InterpreterImpl* interpreter);
62 
63  bool hasDataModel(const std::string& type);
64  bool hasIOProcessor(const std::string& type);
65  bool hasInvoker(const std::string& type);
66  bool hasExecutableContent(const std::string& localName, const std::string& nameSpace);
67 
68  std::map<std::string, IOProcessorImpl*> getIOProcessors();
69 
70  void listComponents();
71 
72  static Factory* getInstance();
73 
74  static void setDefaultPluginPath(const std::string& path);
75  static std::string getDefaultPluginPath();
76 
77 protected:
78  std::map<std::string, DataModelImpl*> _dataModels;
79  std::map<std::string, std::string> _dataModelAliases;
80  std::map<std::string, IOProcessorImpl*> _ioProcessors;
81  std::map<std::string, std::string> _ioProcessorAliases;
82  std::map<std::string, InvokerImpl*> _invokers;
83  std::map<std::string, std::string> _invokerAliases;
84  std::map<std::pair<std::string, std::string>, ExecutableContentImpl*> _executableContent;
85 
86 
87 #ifdef BUILD_AS_PLUGINS
88  pluma::Pluma pluma;
89 #endif
90 
91  void registerPlugins();
92 
93  Factory(const std::string&);
94  ~Factory();
95  Factory* _parentFactory = NULL;
96  std::string _pluginPath;
97  static std::string _defaultPluginPath;
98  static Factory* _instance;
99 
100 };
101 
102 
103 }
104 
105 #endif /* end of include guard: FACTORY_H_5WKLGPRB */
Definition: Factory.h:48
Definition: Breakpoint.cpp:26
Abstract base class for all data-model implementations.
Definition: DataModelImpl.h:77
Abstract base class for all invokers.
Definition: InvokerImpl.h:59
Definition: InterpreterImpl.h:51
Abstract base class for IOProcessors implementations.
Definition: IOProcessorImpl.h:54
Callbacks available for every invoker.
Definition: InvokerImpl.h:43
Callbacks available for every data-model.
Definition: DataModelImpl.h:47
Callbacks available for every IO processor.
Definition: IOProcessorImpl.h:36
Abstract base class fo all elements of executable content.
Definition: ExecutableContentImpl.h:44