OpenCMISS-Zinc C++ API Documentation
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
streamregion.hpp
Go to the documentation of this file.
1 
4 /* OpenCMISS-Zinc Library
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #ifndef CMZN_STREAMREGION_HPP__
10 #define CMZN_STREAMREGION_HPP__
11 
12 #include "zinc/streamregion.h"
13 #include "zinc/field.hpp"
14 #include "zinc/region.hpp"
15 #include "zinc/stream.hpp"
16 
17 namespace OpenCMISS
18 {
19 namespace Zinc
20 {
21 
32 {
33 public:
35  { }
36 
37  // takes ownership of C handle, responsibility for destroying it
38  explicit StreaminformationRegion(cmzn_streaminformation_region_id streaminformation_region_id) :
39  Streaminformation(reinterpret_cast<cmzn_streaminformation_id>(streaminformation_region_id))
40  { }
41 
47  bool isValid() const
48  {
49  return (0 != id);
50  }
51 
57  cmzn_streaminformation_region_id getId() const
58  {
59  return reinterpret_cast<cmzn_streaminformation_region_id>(id);
60  }
61 
66  enum Attribute
67  {
68  ATTRIBUTE_INVALID = CMZN_STREAMINFORMATION_REGION_ATTRIBUTE_INVALID,
70  ATTRIBUTE_TIME = CMZN_STREAMINFORMATION_REGION_ATTRIBUTE_TIME
73  };
74 
82  int hasAttribute(Attribute attribute)
83  {
84  return cmzn_streaminformation_region_has_attribute(
85  reinterpret_cast<cmzn_streaminformation_region_id>(id),
86  static_cast<cmzn_streaminformation_region_attribute>(attribute));
87  }
88 
95  double getAttributeReal(Attribute attribute)
96  {
97  return cmzn_streaminformation_region_get_attribute_real(
98  reinterpret_cast<cmzn_streaminformation_region_id>(id),
99  static_cast<cmzn_streaminformation_region_attribute>(attribute));
100  }
101 
113  int setAttributeReal(Attribute attribute, double value)
114  {
115  return cmzn_streaminformation_region_set_attribute_real(
116  reinterpret_cast<cmzn_streaminformation_region_id>(id),
117  static_cast<cmzn_streaminformation_region_attribute>(attribute), value);
118  }
119 
128  int hasResourceAttribute(const Streamresource& resource, Attribute attribute)
129  {
130  return cmzn_streaminformation_region_has_resource_attribute(
131  reinterpret_cast<cmzn_streaminformation_region_id>(id), resource.getId(),
132  static_cast<cmzn_streaminformation_region_attribute>(attribute));
133  }
134 
142  double getResourceAttributeReal(const Streamresource& resource,
143  Attribute attribute)
144  {
145  return cmzn_streaminformation_region_get_resource_attribute_real(
146  reinterpret_cast<cmzn_streaminformation_region_id>(id), resource.getId(),
147  static_cast<cmzn_streaminformation_region_attribute>(attribute));
148  }
149 
162  Attribute attribute, double value)
163  {
164  return cmzn_streaminformation_region_set_resource_attribute_real(
165  reinterpret_cast<cmzn_streaminformation_region_id>(id), resource.getId(),
166  static_cast<cmzn_streaminformation_region_attribute>(attribute), value);
167  }
168 
169  Field::DomainTypes getResourceDomainTypes(const Streamresource& resource)
170  {
171  return static_cast<Field::DomainTypes>(
172  cmzn_streaminformation_region_get_resource_domain_types(
173  reinterpret_cast<cmzn_streaminformation_region_id>(id), resource.getId()));
174  }
175 
176  int setResourceDomainTypes(const Streamresource& resource, Field::DomainTypes domainTypes)
177  {
178  return cmzn_streaminformation_region_set_resource_domain_types(
179  reinterpret_cast<cmzn_streaminformation_region_id>(id), resource.getId(),
180  static_cast<cmzn_field_domain_types>(domainTypes));
181  }
182 
183 };
184 
186 {
187  return StreaminformationRegion(cmzn_streaminformation_cast_region(id));
188 }
189 
191 {
192  return StreaminformationRegion(reinterpret_cast<cmzn_streaminformation_region_id>(
193  cmzn_region_create_streaminformation_region(id)));
194 }
195 
196 inline int Region::read(const StreaminformationRegion& streaminformationRegion)
197 {
198  return cmzn_region_read(id, streaminformationRegion.getId());
199 }
200 
201 inline int Region::write(const StreaminformationRegion& streaminformationRegion)
202 {
203  return cmzn_region_write(id, streaminformationRegion.getId());
204 }
205 
206 } // namespace Zinc
207 }
208 
209 #endif
bool isValid() const
Definition: streamregion.hpp:47
A description of a resource for reading from or writing to.
Definition: stream.hpp:36
int setResourceAttributeReal(const Streamresource &resource, Attribute attribute, double value)
Definition: streamregion.hpp:161
double getResourceAttributeReal(const Streamresource &resource, Attribute attribute)
Definition: streamregion.hpp:142
A region-specific stream information object.
Definition: streamregion.hpp:31
int hasAttribute(Attribute attribute)
Definition: streamregion.hpp:82
Base type listing resources and options for stream I/O.
Definition: stream.hpp:193
StreaminformationRegion createStreaminformationRegion()
Definition: streamregion.hpp:190
int write(const StreaminformationRegion &streaminformationRegion)
Definition: streamregion.hpp:201
StreaminformationRegion castRegion()
Definition: streamregion.hpp:185
int DomainTypes
Definition: field.hpp:213
int setAttributeReal(Attribute attribute, double value)
Definition: streamregion.hpp:113
int hasResourceAttribute(const Streamresource &resource, Attribute attribute)
Definition: streamregion.hpp:128
int read(const StreaminformationRegion &streaminformationRegion)
Definition: streamregion.hpp:196
cmzn_streaminformation_region_id getId() const
Definition: streamregion.hpp:57
cmzn_streamresource_id getId() const
Definition: stream.hpp:88
Attribute
Definition: streamregion.hpp:66
double getAttributeReal(Attribute attribute)
Definition: streamregion.hpp:95