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