OpenSplice ISO C++ 2 DCPS  v6.x
ISO C++ 2 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
UnionType.hpp
Go to the documentation of this file.
1 /* Copyright 2010, Object Management Group, Inc.
2 * Copyright 2010, PrismTech, Corp.
3 * Copyright 2010, Real-Time Innovations, Inc.
4 * All rights reserved.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 #ifndef OMG_DDS_CORE_XTYPES_T_UNION_TYPE_HPP_
19 #define OMG_DDS_CORE_XTYPES_T_UNION_TYPE_HPP_
20 
25 #include <vector>
26 
27 namespace dds
28 {
29 namespace core
30 {
31 namespace xtypes
32 {
33 template <typename DELEGATE>
35 
36 template <typename T, template <typename Q> class DELEGATE = detail::UnionType >
37 class UnionType;
38 }
39 }
40 }
41 
45 template <typename DELEGATE>
46 class dds::core::xtypes::TUnionForwardDeclaration : public dds::core::xtypes::DynamicType<DELEGATE>
47 {
48 public:
49  TUnionForwardDeclaration(const std::string& name);
50 };
51 
52 template <typename T, typename DELEGATE>
53 class dds::core::xtypes::UnionType : public dds::core::xtypes::DynamicType<DELEGATE<T> >
54 {
55 public:
56 
57  UnionType(
58  const std::string& name,
59  const TPrimitiveType<T>& discriminator_type,
60  const std::vector<UnionCase<T> >& cases);
61 
62  UnionType(
63  const std::string& name,
64  const TPrimitiveType<T>& discriminator_type,
65  const std::vector<UnionCase<T> >& cases,
66  const Annotation& annotation);
67 
68  UnionType(
69  const std::string& name,
70  const TPrimitiveType<T>& discriminator_type,
71  const std::vector<UnionCase<T> >& cases,
72  const std::vector<Annotation>& annotations);
73 
74 public:
75 
76  const std::vector<UnionCase<T> >& members() const;
77  const MemberType& member(uint32_t id) const;
78  const MemberType& member(const std::string& name) const;
79 
80  const std::vector<Annotation>& annotations() const;
81 
82  UnionType add_member(const UnionCase<T>& member) const;
83  UnionType remove_member(const UnionCase<T>& member) const;
84 
85  UnionType add_annotation(const Annotation& annotation) const;
86  UnionType remove_annotation(const Annotation& annotation) const;
87 
88 };
89 
90 #endif /* OMG_DDS_CORE_XTYPES_T_STRUCT_TYPE_HPP_ */
Definition: array.hpp:23
TUnionForwardDeclaration(const std::string &name)