OpenCMISS-Zinc C++ API Documentation
fieldlogicaloperators.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_FIELDLOGICALOPERATORS_HPP__
10 #define CMZN_FIELDLOGICALOPERATORS_HPP__
11 
12 #include "opencmiss/zinc/fieldlogicaloperators.h"
13 #include "opencmiss/zinc/field.hpp"
14 #include "opencmiss/zinc/fieldmodule.hpp"
15 
16 namespace OpenCMISS
17 {
18 namespace Zinc
19 {
20 class FieldAnd : public Field
30 {
31 private:
32  // takes ownership of C handle, responsibility for destroying it
33  explicit FieldAnd(cmzn_field_id field_id) : Field(field_id)
34  { }
35 
36  friend FieldAnd Fieldmodule::createFieldAnd(const Field& sourceField1,
37  const Field& sourceField2);
38 
39 public:
40 
41  FieldAnd() : Field(0)
42  { }
43 
44 };
45 
46 inline FieldAnd operator&&(const Field& operand1, const Field& operand2)
47 {
48  return operand1.getFieldmodule().createFieldAnd(operand1, operand2);
49 }
50 class FieldEqualTo : public Field
60 {
61 private:
62  // takes ownership of C handle, responsibility for destroying it
63  explicit FieldEqualTo(cmzn_field_id field_id) : Field(field_id)
64  { }
65 
66  friend FieldEqualTo Fieldmodule::createFieldEqualTo(const Field& sourceField1,
67  const Field& sourceField2);
68 
69 public:
70 
71  FieldEqualTo() : Field(0)
72  { }
73 
74 };
75 class FieldGreaterThan : public Field
85 {
86 private:
87  // takes ownership of C handle, responsibility for destroying it
88  explicit FieldGreaterThan(cmzn_field_id field_id) : Field(field_id)
89  { }
90 
91  friend FieldGreaterThan Fieldmodule::createFieldGreaterThan(const Field& sourceField1,
92  const Field& sourceField2);
93 
94 public:
95 
96  FieldGreaterThan() : Field(0)
97  { }
98 
99 };
100 
101 inline FieldGreaterThan operator>(const Field& operand1, const Field& operand2)
102 {
103  return operand1.getFieldmodule().createFieldGreaterThan(operand1, operand2);
104 }
105 class FieldIsDefined : public Field
114 {
115 private:
116  // takes ownership of C handle, responsibility for destroying it
117  explicit FieldIsDefined(cmzn_field_id field_id) : Field(field_id)
118  { }
119 
120  friend FieldIsDefined Fieldmodule::createFieldIsDefined(const Field& sourceField);
121 
122 public:
123  FieldIsDefined() : Field(0)
124  { }
125 };
126 class FieldLessThan : public Field
136 {
137 private:
138  // takes ownership of C handle, responsibility for destroying it
139  explicit FieldLessThan(cmzn_field_id field_id) : Field(field_id)
140  { }
141 
142  friend FieldLessThan Fieldmodule::createFieldLessThan(const Field& sourceField1, const Field& sourceField2);
143 
144 public:
145 
146  FieldLessThan() : Field(0)
147  { }
148 
149 };
150 
151 inline FieldLessThan operator<(const Field& operand1, const Field& operand2)
152 {
153  return operand1.getFieldmodule().createFieldLessThan(operand1, operand2);
154 }
155 class FieldOr : public Field
165 {
166 private:
167  // takes ownership of C handle, responsibility for destroying it
168  explicit FieldOr(cmzn_field_id field_id) : Field(field_id)
169  { }
170 
171  friend FieldOr Fieldmodule::createFieldOr(const Field& sourceField1,
172  const Field& sourceField2);
173 
174 public:
175 
176  FieldOr() : Field(0)
177  { }
178 
179 };
180 
181 inline FieldOr operator||(const Field& operand1, const Field& operand2)
182 {
183  return operand1.getFieldmodule().createFieldOr(operand1, operand2);
184 }
185 class FieldNot : public Field
196 {
197 private:
198  // takes ownership of C handle, responsibility for destroying it
199  explicit FieldNot(cmzn_field_id field_id) : Field(field_id)
200  { }
201 
202  friend FieldNot Fieldmodule::createFieldNot(const Field& sourceField);
203 
204 public:
205 
206  FieldNot() : Field(0)
207  { }
208 
209 };
210 
211 inline FieldNot operator!(const Field& operand)
212 {
213  return operand.getFieldmodule().createFieldNot(operand);
214 }
215 class FieldXor : public Field
225 {
226 private:
227  // takes ownership of C handle, responsibility for destroying it
228  explicit FieldXor(cmzn_field_id field_id) : Field(field_id)
229  { }
230 
231  friend FieldXor Fieldmodule::createFieldXor(const Field& sourceField1,
232  const Field& sourceField2);
233 
234 public:
235 
236  FieldXor() : Field(0)
237  { }
238 
239 };
240 
241 inline FieldAnd Fieldmodule::createFieldAnd(const Field& sourceField1, const Field& sourceField2)
242 {
243  return FieldAnd(cmzn_fieldmodule_create_field_and(id,
244  sourceField1.getId(), sourceField2.getId()));
245 }
246 
247 inline FieldEqualTo Fieldmodule::createFieldEqualTo(const Field& sourceField1, const Field& sourceField2)
248 {
249  return FieldEqualTo(cmzn_fieldmodule_create_field_equal_to(id,
250  sourceField1.getId(), sourceField2.getId()));
251 }
252 
253 inline FieldGreaterThan Fieldmodule::createFieldGreaterThan(const Field& sourceField1, const Field& sourceField2)
254 {
255  return FieldGreaterThan(cmzn_fieldmodule_create_field_greater_than(id,
256  sourceField1.getId(), sourceField2.getId()));
257 }
258 
260 {
261  return FieldIsDefined(cmzn_fieldmodule_create_field_is_defined(id, sourceField.getId()));
262 }
263 
264 inline FieldLessThan Fieldmodule::createFieldLessThan(const Field& sourceField1, const Field& sourceField2)
265 {
266  return FieldLessThan(cmzn_fieldmodule_create_field_less_than(id,
267  sourceField1.getId(), sourceField2.getId()));
268 }
269 
270 inline FieldOr Fieldmodule::createFieldOr(const Field& sourceField1, const Field& sourceField2)
271 {
272  return FieldOr(cmzn_fieldmodule_create_field_or(id,
273  sourceField1.getId(), sourceField2.getId()));
274 }
275 
276 inline FieldNot Fieldmodule::createFieldNot(const Field& sourceField)
277 {
278  return FieldNot(cmzn_fieldmodule_create_field_not(id, sourceField.getId()));
279 }
280 
281 inline FieldXor Fieldmodule::createFieldXor(const Field& sourceField1, const Field& sourceField2)
282 {
283  return FieldXor(cmzn_fieldmodule_create_field_xor(id,
284  sourceField1.getId(), sourceField2.getId()));
285 }
286 
287 } // namespace Zinc
288 }
289 
290 #endif
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:51
FieldAnd createFieldAnd(const Field &sourceField1, const Field &sourceField2)
Definition: fieldlogicaloperators.hpp:241
FieldNot createFieldNot(const Field &sourceField)
Definition: fieldlogicaloperators.hpp:276
A field whose component values are 1 if that component of source_field_one OR source_field_two is non...
Definition: fieldlogicaloperators.hpp:224
FieldOr createFieldOr(const Field &sourceField1, const Field &sourceField2)
Definition: fieldlogicaloperators.hpp:270
cmzn_field_id getId() const
Definition: field.hpp:103
A field whose component values are 1 if that component of source_field_one AND source_field_two is no...
Definition: fieldlogicaloperators.hpp:29
A field whose component values are 1 if that component of source_field_one is less than the component...
Definition: fieldlogicaloperators.hpp:135
FieldXor createFieldXor(const Field &sourceField1, const Field &sourceField2)
Definition: fieldlogicaloperators.hpp:281
FieldIsDefined createFieldIsDefined(const Field &sourceField)
Definition: fieldlogicaloperators.hpp:259
A field whose component values are 1 if that component of the source_field is zero, 0 otherwise; effectively a component-wise logical not operator.
Definition: fieldlogicaloperators.hpp:195
A field returning 1 (true) at locations where the source field is defined and 0 (false) elsewhere...
Definition: fieldlogicaloperators.hpp:113
A field whose component values are 1 if that component of source_field_one EQUALS that component of s...
Definition: fieldlogicaloperators.hpp:59
FieldLessThan createFieldLessThan(const Field &sourceField1, const Field &sourceField2)
Definition: fieldlogicaloperators.hpp:264
The OpenCMISS namespace.
Definition: context.hpp:20
FieldGreaterThan createFieldGreaterThan(const Field &sourceField1, const Field &sourceField2)
Definition: fieldlogicaloperators.hpp:253
A field whose component values are 1 if that component of source_field_one is greater than the compon...
Definition: fieldlogicaloperators.hpp:84
A field whose component values are 1 if that component of source_field_one OR source_field_two is non...
Definition: fieldlogicaloperators.hpp:164
FieldEqualTo createFieldEqualTo(const Field &sourceField1, const Field &sourceField2)
Definition: fieldlogicaloperators.hpp:247
Fieldmodule getFieldmodule() const
Definition: fieldmodule.hpp:1786