stromx  0.8.0
Factory.h
1 /*
2 * Copyright 2011 Thomas Fidler
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17 #ifndef STROMX_RUNTIME_FACTORY_H
18 #define STROMX_RUNTIME_FACTORY_H
19 
20 #include "stromx/runtime/AbstractFactory.h"
21 #include "stromx/runtime/Registry.h"
22 
23 namespace boost
24 {
25  class mutex;
26 }
27 
28 namespace stromx
29 {
30  namespace runtime
31  {
32  namespace impl
33  {
34  class MutexHandle;
35  }
36 
38  class STROMX_RUNTIME_API Factory : public Registry, public AbstractFactory
39  {
40  public:
41  Factory();
42 
48  Factory(const Factory & factory);
49 
50  virtual ~Factory();
51 
52  virtual void registerOperator(const OperatorKernel* const op);
53 
54  virtual void registerData(const Data* data);
55 
57  virtual OperatorKernel* newOperator(const std::string & package, const std::string & type) const;
58 
60  virtual Data* newData(const std::string & package, const std::string & type) const;
61 
63  virtual const std::vector<const OperatorKernel*> & availableOperators() const { return m_operators; }
64 
66  virtual const std::vector<const Data*> & availableData() const { return m_dataTypes; }
67 
68  private:
69  Factory & operator=(const Factory&);
70 
71  std::vector<const OperatorKernel*> m_operators;
72  std::vector<const Data*> m_dataTypes;
73  impl::MutexHandle* m_mutex;
74  };
75  }
76 }
77 
78 #endif // STROMX_RUNTIME_FACTORY_H
Abstract data object.
Definition: Data.h:53
Definition: Factory.h:23
Abstract registry of operator and data objects.
Definition: Registry.h:30
Factory of operator and data objects.
Definition: AbstractFactory.h:32
The stromx class library.
Definition: AdjustRgbChannels.cpp:29
virtual const std::vector< const OperatorKernel * > & availableOperators() const
Definition: Factory.h:63
Abstract operator kernel.
Definition: OperatorKernel.h:46
Factory of operator and data objects.
Definition: Factory.h:38
virtual const std::vector< const Data * > & availableData() const
Definition: Factory.h:66