OpenCMISS-Zinc C++ API Documentation
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
context.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 
10 #ifndef CMZN_CONTEXT_HPP__
11 #define CMZN_CONTEXT_HPP__
12 
13 #include "zinc/context.h"
14 
20 namespace OpenCMISS
21 {
27 namespace Zinc
28 {
29 class Fontmodule;
30 class Glyphmodule;
31 class Materialmodule;
32 class Region;
33 class Scenefiltermodule;
34 class Sceneviewermodule;
35 class Spectrummodule;
36 class Tessellationmodule;
37 class Timekeepermodule;
38 
47 class Context
48 {
49 private:
50 
51  cmzn_context_id id;
52 
53 public:
54 
55  Context() : id(0)
56  { }
57  // Creates a new zinc Context instance
58  Context(const char *contextName) :
59  id(cmzn_context_create(contextName))
60  { }
61 
62  // takes ownership of C handle, responsibility for destroying it
63  explicit Context(cmzn_context_id context_id) :
64  id(context_id)
65  { }
66 
67  Context(const Context& context) :
68  id(cmzn_context_access(context.id))
69  { }
70 
71  ~Context()
72  {
73  if (0 != id)
74  {
75  cmzn_context_destroy(&id);
76  }
77  }
78 
84  bool isValid() const
85  {
86  return (0 != id);
87  }
88 
89  Context& operator=(const Context& context)
90  {
91  cmzn_context_id temp_id = cmzn_context_access(context.id);
92  if (0 != id)
93  {
94  cmzn_context_destroy(&id);
95  }
96  id = temp_id;
97  return *this;
98  }
99 
105  cmzn_context_id getId() const
106  {
107  return id;
108  }
109 
118  int getVersion(int *versionOut3)
119  {
120  return cmzn_context_get_version(id, versionOut3);
121  }
122 
129  {
130  return cmzn_context_get_revision(id);
131  }
132 
144  {
145  return cmzn_context_get_version_string(id);
146  }
147 
159  inline Region createRegion();
160 
166  inline Region getDefaultRegion();
167 
173  inline Fontmodule getFontmodule();
174 
182  inline Glyphmodule getGlyphmodule();
183 
193 
201 
209 
217 
225 
233 
234 };
235 
236 } // namespace Zinc
237 }
238 
239 #endif /* CMZN_CONTEXT_HPP__ */
Fontmodule getFontmodule()
Definition: font.hpp:399
bool isValid() const
Definition: context.hpp:84
int getVersion(int *versionOut3)
Definition: context.hpp:118
Module managing all fonts.
Definition: font.hpp:268
Materialmodule getMaterialmodule()
Definition: material.hpp:444
int getRevision()
Definition: context.hpp:128
Glyphmodule getGlyphmodule()
Definition: glyph.hpp:806
A hierarchical block/namespace owning domains and fields.
Definition: region.hpp:33
Module managing all scene filters.
Definition: scenefilter.hpp:308
Region getDefaultRegion()
Definition: region.hpp:416
Module object for creating and managing scene viewers.
Definition: sceneviewer.hpp:1086
Sceneviewermodule getSceneviewermodule()
Definition: sceneviewer.hpp:1153
The context is the primary object created for each instance of Zinc.
Definition: context.hpp:47
Module managing all spectrums.
Definition: spectrum.hpp:847
Module managing all materials.
Definition: material.hpp:278
Timekeepermodule getTimekeepermodule()
Definition: timekeeper.hpp:289
Module managing all glyphs.
Definition: glyph.hpp:602
char * getVersionString()
Definition: context.hpp:143
Scenefiltermodule getScenefiltermodule()
Definition: scenefilter.hpp:500
Module managing all tessellation objects.
Definition: tessellation.hpp:247
Module for finding and managing timekeepers.
Definition: timekeeper.hpp:222
cmzn_context_id getId() const
Definition: context.hpp:105
Spectrummodule getSpectrummodule()
Definition: spectrum.hpp:986
Region createRegion()
Definition: region.hpp:421
Tessellationmodule getTessellationmodule()
Definition: tessellation.hpp:408