OpenCMISS-Zinc C++ API Documentation
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
timesequence.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_TIMESEQUENCE_HPP__
10 #define CMZN_TIMESEQUENCE_HPP__
11 
12 #include "zinc/timesequence.h"
13 
14 namespace OpenCMISS
15 {
16 namespace Zinc
17 {
18 
36 {
37 protected:
38  cmzn_timesequence_id id;
39 
40 public:
41 
42  Timesequence() : id(0)
43  { }
44 
45  // takes ownership of C handle, responsibility for destroying it
46  explicit Timesequence(cmzn_timesequence_id in_time_sequence_id) :
47  id(in_time_sequence_id)
48  { }
49 
50  Timesequence(const Timesequence& timeSequence) :
51  id(cmzn_timesequence_access(timeSequence.id))
52  { }
53 
54  Timesequence& operator=(const Timesequence& timeSequence)
55  {
56  cmzn_timesequence_id temp_id = cmzn_timesequence_access(timeSequence.id);
57  if (0 != id)
58  {
59  cmzn_timesequence_destroy(&id);
60  }
61  id = temp_id;
62  return *this;
63  }
64 
65  ~Timesequence()
66  {
67  if (0 != id)
68  {
69  cmzn_timesequence_destroy(&id);
70  }
71  }
72 
78  bool isValid() const
79  {
80  return (0 != id);
81  }
82 
88  cmzn_timesequence_id getId() const
89  {
90  return id;
91  }
92 
99  {
100  return cmzn_timesequence_get_number_of_times(id);
101  }
102 
109  double getTime(int timeIndex)
110  {
111  return cmzn_timesequence_get_time(id, timeIndex);
112  }
113 
124  int setTime(int timeIndex, double time)
125  {
126  return cmzn_timesequence_set_time(id, timeIndex, time);
127  }
128 
129 };
130 
131 inline bool operator==(const Timesequence& a, const Timesequence& b)
132 {
133  return a.getId() == b.getId();
134 }
135 
136 } // namespace Zinc
137 }
138 
139 #endif
bool isValid() const
Definition: timesequence.hpp:78
double getNumberOfTimes()
Definition: timesequence.hpp:98
A non-decreasing list of times at which nodal parameters can be stored.
Definition: timesequence.hpp:35
int setTime(int timeIndex, double time)
Definition: timesequence.hpp:124
cmzn_timesequence_id getId() const
Definition: timesequence.hpp:88
double getTime(int timeIndex)
Definition: timesequence.hpp:109