stromx  0.8.0
DataOperatorBase.h
1 /*
2 * Copyright 2015 Matthias Fuchs
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_DATAOPERATORBASE_H
18 #define STROMX_RUNTIME_DATAOPERATORBASE_H
19 
20 #include "stromx/runtime/Config.h"
21 #include "stromx/runtime/OperatorKernel.h"
22 #include "stromx/runtime/Primitive.h"
23 #include "stromx/runtime/RecycleAccess.h"
24 
25 namespace stromx
26 {
27  namespace runtime
28  {
29  class STROMX_RUNTIME_API DataOperatorBase : public OperatorKernel
30  {
31  public:
32  enum DataId
33  {
34  OUTPUT,
35  DATA_TYPE,
36  VALUE,
37  NUM_BASE_PARAMETERS
38  };
39 
40  DataOperatorBase(const std::string & type, const std::string & package,
41  const Version & version, const std::vector<const Parameter*>& parameters);
42  virtual ~DataOperatorBase();
43 
44  virtual void setParameter(const unsigned int id, const runtime::Data& value);
45  virtual const DataRef getParameter(const unsigned int id) const;
46  virtual void initialize();
47 
48  protected:
49  static const std::vector<const runtime::Parameter*> setupInitParameters();
50 
51  virtual const std::vector<const runtime::Parameter*> setupParameters();
52  const Data* valuePtr() const { return m_value; }
53  Data* resetValuePtr(Data* const value = 0);
54 
55  private:
56  static const std::vector<const runtime::Input*> setupInputs();
57  const std::vector<const runtime::Output*> setupOutputs();
58  void setDataType(const runtime::Enum & value);
59 
60  Enum m_type;
61  Data* m_value;
62  };
63  }
64 }
65 
66 #endif // STROMX_RUNTIME_DATAOPERATORBASE_H
A version of an operator or data type.
Definition: Version.h:46
Abstract data object.
Definition: Data.h:53
Reference to a data object.
Definition: DataRef.h:48
Definition: DataOperatorBase.h:29
Version version()
Returns the version of the stromx runtime library.
Definition: Runtime.cpp:54
The stromx class library.
Definition: AdjustRgbChannels.cpp:29
Abstract operator kernel.
Definition: OperatorKernel.h:46
Value of an enumeration.
Definition: Enum.h:27