stromx  0.8.0
Enum.h
1 /*
2 * Copyright 2011 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_ENUM_H
18 #define STROMX_RUNTIME_ENUM_H
19 
20 #include "stromx/runtime/Primitive.h"
21 
22 namespace stromx
23 {
24  namespace runtime
25  {
27  class STROMX_RUNTIME_API Enum : public UInt32
28  {
29  public:
31  Enum() : UInt32() {}
32 
34  explicit Enum(const unsigned int value) : UInt32(value) {}
35 
37  const Enum operator=(const unsigned int value)
38  {
39  *this = Enum(value);
40  return *this;
41  }
42 
43  virtual const VariantHandle & variant() const;
44  virtual const std::string & type() const { return TYPE; }
45  virtual Data* clone() const { return new Enum(*this); }
46 
47  private:
48  static const std::string TYPE;
49  };
50 
52  template <>
53  class STROMX_RUNTIME_API data_traits<Enum>
54  {
55  public:
56  static const VariantHandle & variant();
57  };
59  }
60 }
61 
62 #endif // STROMX_RUNTIME_ENUM_H
Abstract data object.
Definition: Data.h:53
Definition: VariantHandle.h:34
Enum(const unsigned int value)
Definition: Enum.h:34
virtual const std::string & type() const
Definition: Enum.h:44
Enum()
Definition: Enum.h:31
The stromx class library.
Definition: AdjustRgbChannels.cpp:29
const Enum operator=(const unsigned int value)
Definition: Enum.h:37
Value of an enumeration.
Definition: Enum.h:27
virtual Data * clone() const
Definition: Enum.h:45