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 "opencmiss/zinc/streamregion.h"
13 #include "opencmiss/zinc/field.hpp"
14 #include "opencmiss/zinc/region.hpp"
15 #include "opencmiss/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  inline cmzn_streaminformation_region_id getDerivedId() const
58  {
59  return reinterpret_cast<cmzn_streaminformation_region_id>(this->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 
80  {
81  FILE_FORMAT_INVALID = CMZN_STREAMINFORMATION_REGION_FILE_FORMAT_INVALID,
83  FILE_FORMAT_AUTOMATIC = CMZN_STREAMINFORMATION_REGION_FILE_FORMAT_AUTOMATIC,
88  FILE_FORMAT_EX = CMZN_STREAMINFORMATION_REGION_FILE_FORMAT_EX,
90  FILE_FORMAT_FIELDML = CMZN_STREAMINFORMATION_REGION_FILE_FORMAT_FIELDML
92  };
93 
95  {
96  RECURSION_MODE_INVALID = CMZN_STREAMINFORMATION_REGION_RECURSION_MODE_INVALID,
98  RECURSION_MODE_ON = CMZN_STREAMINFORMATION_REGION_RECURSION_MODE_ON,
100  RECURSION_MODE_OFF = CMZN_STREAMINFORMATION_REGION_RECURSION_MODE_OFF
102  };
103 
111  int hasAttribute(Attribute attribute)
112  {
113  return cmzn_streaminformation_region_has_attribute(getDerivedId(),
114  static_cast<cmzn_streaminformation_region_attribute>(attribute));
115  }
116 
123  double getAttributeReal(Attribute attribute)
124  {
125  return cmzn_streaminformation_region_get_attribute_real(getDerivedId(),
126  static_cast<cmzn_streaminformation_region_attribute>(attribute));
127  }
128 
140  int setAttributeReal(Attribute attribute, double value)
141  {
142  return cmzn_streaminformation_region_set_attribute_real(getDerivedId(),
143  static_cast<cmzn_streaminformation_region_attribute>(attribute), value);
144  }
145 
154  int hasResourceAttribute(const Streamresource& resource, Attribute attribute)
155  {
156  return cmzn_streaminformation_region_has_resource_attribute(
157  getDerivedId(), resource.getId(),
158  static_cast<cmzn_streaminformation_region_attribute>(attribute));
159  }
160 
168  double getResourceAttributeReal(const Streamresource& resource,
169  Attribute attribute)
170  {
171  return cmzn_streaminformation_region_get_resource_attribute_real(
172  getDerivedId(), resource.getId(),
173  static_cast<cmzn_streaminformation_region_attribute>(attribute));
174  }
175 
188  Attribute attribute, double value)
189  {
190  return cmzn_streaminformation_region_set_resource_attribute_real(
191  getDerivedId(), resource.getId(),
192  static_cast<cmzn_streaminformation_region_attribute>(attribute), value);
193  }
194 
202  {
203  return static_cast<FileFormat>(
204  cmzn_streaminformation_region_get_file_format(getDerivedId()));
205  }
206 
214  int setFileFormat(FileFormat fileFormat)
215  {
216  return cmzn_streaminformation_region_set_file_format(getDerivedId(),
217  static_cast<cmzn_streaminformation_region_file_format>(fileFormat));
218  }
219 
228  {
229  return static_cast<Field::DomainTypes>(
230  cmzn_streaminformation_region_get_resource_domain_types(
231  getDerivedId(), resource.getId()));
232  }
233 
257  int setResourceDomainTypes(const Streamresource& resource, Field::DomainTypes domainTypes)
258  {
259  return cmzn_streaminformation_region_set_resource_domain_types(
260  getDerivedId(), resource.getId(),
261  static_cast<cmzn_field_domain_types>(domainTypes));
262  }
263 
275  int setFieldNames(int numberOfNames, const char **fieldNames)
276  {
277  return cmzn_streaminformation_region_set_field_names(getDerivedId(),
278  numberOfNames, fieldNames);
279  }
280 
293  int setResourceFieldNames(const Streamresource& resource, int numberOfNames,
294  const char **fieldNames)
295  {
296  return cmzn_streaminformation_region_set_resource_field_names(getDerivedId(),
297  resource.getId(), numberOfNames, fieldNames);
298  }
299 
311  int setRecursionMode(RecursionMode recursionMode)
312  {
313  return cmzn_streaminformation_region_set_recursion_mode(getDerivedId(),
314  static_cast<cmzn_streaminformation_region_recursion_mode>(recursionMode));
315  }
316 
327  int setResourceRecursionMode(const Streamresource& resource, RecursionMode recursionMode)
328  {
329  return cmzn_streaminformation_region_set_resource_recursion_mode(getDerivedId(),
330  resource.getId(), static_cast<cmzn_streaminformation_region_recursion_mode>(recursionMode));
331  }
332 
341  char *getResourceGroupName(const Streamresource& resource)
342  {
343  return cmzn_streaminformation_region_get_resource_group_name(getDerivedId(),
344  resource.getId());
345  }
346 
359  int setResourceGroupName(const Streamresource& resource, const char *groupName)
360  {
361  return cmzn_streaminformation_region_set_resource_group_name(getDerivedId(),
362  resource.getId(), groupName);
363  }
364 
365 };
366 
368 {
369  return StreaminformationRegion(cmzn_streaminformation_cast_region(id));
370 }
371 
373 {
374  return StreaminformationRegion(reinterpret_cast<cmzn_streaminformation_region_id>(
375  cmzn_region_create_streaminformation_region(id)));
376 }
377 
378 inline int Region::read(const StreaminformationRegion& streaminformationRegion)
379 {
380  return cmzn_region_read(id, streaminformationRegion.getDerivedId());
381 }
382 
383 inline int Region::write(const StreaminformationRegion& streaminformationRegion)
384 {
385  return cmzn_region_write(id, streaminformationRegion.getDerivedId());
386 }
387 
388 } // namespace Zinc
389 }
390 
391 #endif
RecursionMode
Definition: streamregion.hpp:94
bool isValid() const
Definition: streamregion.hpp:47
char * getResourceGroupName(const Streamresource &resource)
Definition: streamregion.hpp:341
int setResourceDomainTypes(const Streamresource &resource, Field::DomainTypes domainTypes)
Definition: streamregion.hpp:257
Field::DomainTypes getResourceDomainTypes(const Streamresource &resource)
Definition: streamregion.hpp:227
int setResourceFieldNames(const Streamresource &resource, int numberOfNames, const char **fieldNames)
Definition: streamregion.hpp:293
FileFormat getFileFormat()
Definition: streamregion.hpp:201
A description of a resource for reading from or writing to.
Definition: stream.hpp:37
int setResourceAttributeReal(const Streamresource &resource, Attribute attribute, double value)
Definition: streamregion.hpp:187
double getResourceAttributeReal(const Streamresource &resource, Attribute attribute)
Definition: streamregion.hpp:168
FileFormat
Definition: streamregion.hpp:79
A region-specific stream information object.
Definition: streamregion.hpp:31
int hasAttribute(Attribute attribute)
Definition: streamregion.hpp:111
Base type listing resources and options for stream I/O.
Definition: stream.hpp:213
cmzn_streaminformation_region_id getDerivedId() const
Definition: streamregion.hpp:57
StreaminformationRegion createStreaminformationRegion()
Definition: streamregion.hpp:372
int setRecursionMode(RecursionMode recursionMode)
Definition: streamregion.hpp:311
int write(const StreaminformationRegion &streaminformationRegion)
Definition: streamregion.hpp:383
StreaminformationRegion castRegion()
Definition: streamregion.hpp:367
int DomainTypes
Definition: field.hpp:232
int setAttributeReal(Attribute attribute, double value)
Definition: streamregion.hpp:140
int setResourceRecursionMode(const Streamresource &resource, RecursionMode recursionMode)
Definition: streamregion.hpp:327
int hasResourceAttribute(const Streamresource &resource, Attribute attribute)
Definition: streamregion.hpp:154
int setFieldNames(int numberOfNames, const char **fieldNames)
Definition: streamregion.hpp:275
int read(const StreaminformationRegion &streaminformationRegion)
Definition: streamregion.hpp:378
cmzn_streamresource_id getId() const
Definition: stream.hpp:89
int setFileFormat(FileFormat fileFormat)
Definition: streamregion.hpp:214
Attribute
Definition: streamregion.hpp:66
double getAttributeReal(Attribute attribute)
Definition: streamregion.hpp:123
int setResourceGroupName(const Streamresource &resource, const char *groupName)
Definition: streamregion.hpp:359