Kigs Framework  Doc version 0.8
Open source multi purpose Rapid Application Development framework
maArray.h
1 #pragma once
2 
4 #include "AttributeModifier.h"
5 
6 /*
7  Conversions
8 */
9 
10 // set array values from braced string like : {1.0,0.0,2.0}
11 template<typename T> bool CoreConvertString2Array(const kstl::string &stringValue, T* const arrayValue, u32 arrayNbElements)
12 {
13  kstl::string::size_type posToParse = stringValue.find('{', 0);
14  bool hasBraces = (posToParse == 0);
15  if (hasBraces) posToParse++;
16  for (u32 i = 0; i<arrayNbElements; i++)
17  {
18  if (!hasBraces) posToParse = 0;
19  // End of string, return
20  if (posToParse >= stringValue.size()) return false;
21 
22  // search next separator : ',' or '}'
23  kstl::string::size_type nextPosToParse = 0;
24  nextPosToParse = stringValue.find(',', posToParse);
25 
26  if (nextPosToParse == kstl::string::npos)
27  {
28  nextPosToParse = stringValue.find('}', posToParse);
29  }
30 
31  if (nextPosToParse == kstl::string::npos) // next separator not found, go to the end of the string
32  {
33  nextPosToParse = stringValue.size();
34  }
35  kstl::string stringToConvert;
36  stringToConvert.assign(stringValue, posToParse, nextPosToParse - posToParse);
37  if (!CoreConvertString2Value<T>(stringToConvert, arrayValue[i])) return false;
38  posToParse = nextPosToParse + 1;
39  }
40  return true;
41 }
42 
43 template<typename T> bool CoreConvertArray2String(kstl::string& stringValue, const T* arrayValue, u32 arrayNbElements)
44 {
45  if (arrayNbElements)
46  {
47  stringValue = "{";
48  for (u32 i = 0; i<arrayNbElements; i++)
49  {
50  if (i != 0) stringValue += ",";
51  kstl::string value;
52  if (!CoreConvertValue2String<T>(value, arrayValue[i])) return false;
53  stringValue += value;
54  }
55  stringValue += "}";
56  return true;
57  }
58  return false;
59 }
60 
61 
62 template<typename T> void CoreCopyArray(T* const destArray, const T* srcArray, u32 arrayNbElements)
63 {
64  memcpy(destArray, srcArray, arrayNbElements * sizeof(T));
65 }
66 
67 // specialization for string
68 template<>
69 inline void CoreCopyArray<kstl::string>(kstl::string* const destArray, const kstl::string* srcArray, u32 arrayNbElements)
70 {
71  for (u32 i = 0; i<arrayNbElements; i++) destArray[i] = srcArray[i];
72 }
73 
74 template<typename Tdest, typename Tsrc>
75 void CoreCopyCastArray(Tdest* const destArray, const Tsrc* srcArray, u32 arrayNbElements)
76 {
77  for (u32 elem = 0; elem<arrayNbElements; elem++)
78  destArray[elem] = (Tdest)srcArray[elem];
79 
80 }
81 
82 // specialized
83 template<>
84 inline void CoreCopyCastArray<bool, kfloat>(bool* const destArray, const kfloat* srcArray, u32 arrayNbElements)
85 {
86  for (u32 elem = 0; elem<arrayNbElements; elem++)
87  destArray[elem] = (srcArray[elem] != (kfloat)0);
88 
89 }
90 
91 template<>
92 inline void CoreCopyCastArray<bool, s32>(bool* const destArray, const s32* srcArray, u32 arrayNbElements)
93 {
94  for (u32 elem = 0; elem<arrayNbElements; elem++)
95  destArray[elem] = (srcArray[elem] != (s32)0);
96 
97 }
98 
99 template<>
100 inline void CoreCopyCastArray<kfloat, bool>(kfloat* const destArray, const bool* srcArray, u32 arrayNbElements)
101 {
102  for (u32 elem = 0; elem<arrayNbElements; elem++)
103  destArray[elem] = (kfloat)(srcArray[elem] ? 1 : 0);
104 
105 }
106 
107 template<>
108 inline void CoreCopyCastArray<s32, bool>(s32* const destArray, const bool* srcArray, u32 arrayNbElements)
109 {
110  for (u32 elem = 0; elem<arrayNbElements; elem++)
111  destArray[elem] = (s32)(srcArray[elem] ? 1 : 0);
112 
113 }
114 
115 
116 // ****************************************
117 // * maArrayBase class
118 // * --------------------------------------
124 // ****************************************
125 
126 #ifndef COMMA
127 #define COMMA ,
128 #endif
129 
130 
131 // ****************************************
132 // * maArrayHeritage class
133 // * --------------------------------------
139 // ****************************************
140 
141 template<s32 notificationLevel, typename T, CoreModifiable::ATTRIBUTE_TYPE attributeElementType, u32 nbLines, u32 nbColumns> class maArrayHeritage : public CoreModifiableAttributeData<std::array<T, nbLines*nbColumns>>
142 {
143  template<s32 notiflevel>
145 
146 public:
147  using ArrayType = std::array<T, nbLines*nbColumns>;
148 
149  DECLARE_ATTRIBUTE_HERITAGE_NO_ASSIGN(maArrayHeritage, TemplateForPlacementNew, ArrayType, CoreModifiable::ATTRIBUTE_TYPE::ARRAY);
150 
151 
152 public:
153 
154  maArrayHeritage(CoreModifiable& owner, bool isInitAttribute, KigsID ID, T* vals)
155  : CoreModifiableAttributeData<ArrayType>(owner, isInitAttribute, ID)
156  {
157  setArrayValue(vals, nbLines*nbColumns);
158  }
159 
160  maArrayHeritage(CoreModifiable& owner, bool isInitAttribute, KigsID ID, T val0, T val1)
161  : CoreModifiableAttributeData<ArrayType>(owner, isInitAttribute, ID)
162  {
163  KIGS_ASSERT(nbColumns >= 2);
164  this->at(0, 0) = val0;
165  this->at(0, 1) = val1;
166  }
167  maArrayHeritage(CoreModifiable& owner, bool isInitAttribute, KigsID ID, T val0, T val1, T val2)
168  : CoreModifiableAttributeData<ArrayType>(owner, isInitAttribute, ID)
169  {
170  KIGS_ASSERT(nbColumns >= 3);
171  this->at(0, 0) = val0;
172  this->at(0, 1) = val1;
173  this->at(0, 2) = val2;
174  }
175  maArrayHeritage(CoreModifiable& owner, bool isInitAttribute, KigsID ID, T val0, T val1, T val2, T val3)
176  : CoreModifiableAttributeData<ArrayType>(owner, isInitAttribute, ID)
177  {
178  KIGS_ASSERT(nbColumns >= 4);
179  this->at(0, 0) = val0;
180  this->at(0, 1) = val1;
181  this->at(0, 2) = val2;
182  this->at(0, 3) = val3;
183  }
184 
185 
186  virtual bool CopyAttribute(const CoreModifiableAttribute& attribute) override
187  {
188  if (CoreModifiableAttributeData<ArrayType>::CopyAttribute(attribute)) return true;
189  if ((attribute.getNbArrayElements() == getNbArrayElements()) && (attribute.getArrayElementType() == getArrayElementType()))
190  {
191  attribute.getArrayValue(getArrayBuffer(), getNbArrayElements());
192  return true;
193  }
194  return false;
195  }
196 
197 
198 
199  T& operator[](u32 index) { return this->getElement(0, index); }
200  const T& operator[](u32 index) const { return this->getConstElement(0, index); }
201 
202  u32 getNbElements() const { return this->getNbArrayElements(); }
203 
204  T* getVector() { return mValue.data(); }
205  const T* getConstVector() const { return mValue.data(); }
206 
207 
208  const T& at(size_t line, size_t column) const { return mValue[line*nbColumns + column]; }
209  T& at(size_t line, size_t column) { return mValue[line*nbColumns + column]; }
210 
211  virtual u32 getNbArrayElements() const override { return nbLines*nbColumns; }
212  virtual u32 getNbArrayColumns() const override { return nbColumns; }
213  virtual u32 getNbArrayLines() const override { return nbLines; }
214 
215  //@Refactor identical
216  T* getArrayBuffer() { return mValue.data(); }
217  T* getArray() { return mValue.data(); }
218 
219  //@Refactor identical
220  const T* getConstArrayBuffer() const { return mValue.data(); }
221  const T* getConstArray() const { return mValue.data(); }
222 
223  T& getElement(u32 line, u32 column) { return at(line, column); }
224  const T& getConstElement(u32 line, u32 column) const { return at(line, column); }
225 
226  //@Issue this is wrong, is return the line not column like the method name implies
227  /*
228  const T* getConstColumn(u32 line) const { return mValue[line]; }
229  T* getColumn(u32 line) { return mValue[line]; }
230  */
231 
232  virtual CoreModifiable::ATTRIBUTE_TYPE getArrayElementType() const override { return attributeElementType; }
233 
234  void broadcastValue(const T &v)
235  {
236  for (auto& el : mValue)
237  {
238  el = v;
239  }
240  }
241 
242  virtual s32 size() const override { return nbLines*nbColumns; };
243 
244  virtual bool getValue(void*& value) const override { value = (void*)mValue.data(); return true; }
245 
246  virtual bool getValue(bool& value) const override { value = (s32)at(0, 0) != 0; return true; }
247  virtual bool getValue(s8& value) const override { value = (s8)at(0, 0); return true; }
248  virtual bool getValue(s16& value) const override { value = (s16)at(0, 0); return true; }
249  virtual bool getValue(s32& value) const override { value = (s32)at(0, 0); return true; }
250  virtual bool getValue(s64& value) const override { value = (s64)at(0, 0); return true; }
251  virtual bool getValue(u8& value) const override { value = (u8)at(0, 0); return true; }
252  virtual bool getValue(u16& value) const override { value = (u16)at(0, 0); return true; }
253  virtual bool getValue(u32& value) const override { value = (u32)at(0, 0); return true; }
254  virtual bool getValue(u64& value) const override { value = (u64)at(0, 0); return true; }
255  virtual bool getValue(kfloat& value) const override { value = (kfloat)at(0, 0); return true; }
256  virtual bool getValue(kdouble& value) const override { value = (kdouble)at(0, 0); return true; }
257 
258  virtual bool getValue(kstl::string& value) const override { return CoreConvertArray2String<T>(value, getConstArrayBuffer(), getNbArrayElements()); }
259 
260  virtual bool getValue(Point2D& value) const override { value.x = (kfloat)at(0, 0); value.y = (kfloat)at(0, 1); return true; }
261  virtual bool getValue(Point3D& value) const override { value.x = (kfloat)at(0, 0); value.y = (kfloat)at(0, 1); value.z = (kfloat)at(0, 2); return true; }
262  virtual bool getValue(Vector4D& value) const override { value.x = (kfloat)at(0, 0); value.y = (kfloat)at(0, 1); value.z = (kfloat)at(0, 2); value.w = (kfloat)at(0, 3); return true; }
263 
264  using CoreModifiableAttributeData<ArrayType>::setValue;
265 
266  bool setValue(const Point2D& pt) override
267  {
268  if (nbColumns < 2) return false;
269  at(0, 0) = (T)pt.x;
270  at(0, 1) = (T)pt.y;
271  DO_NOTIFICATION(notificationLevel);
272  return true;
273  }
274  bool setValue(const Point3D& pt) override
275  {
276  if (nbColumns < 3) return false;
277  at(0, 0) = (T)pt.x;
278  at(0, 1) = (T)pt.y;
279  at(0, 2) = (T)pt.z;
280  DO_NOTIFICATION(notificationLevel);
281  return true;
282  }
283  bool setValue(const Vector4D& pt) override
284  {
285  if (nbColumns < 4) return false;
286  at(0, 0) = (T)pt.x;
287  at(0, 1) = (T)pt.y;
288  at(0, 2) = (T)pt.z;
289  at(0, 3) = (T)pt.w;
290  DO_NOTIFICATION(notificationLevel);
291  return true;
292  }
293  bool setValue(Point2DI pt)
294  {
295  if (nbColumns < 2) return false;
296  at(0, 0) = (T)pt.x;
297  at(0, 1) = (T)pt.y;
298  DO_NOTIFICATION(notificationLevel);
299  return true;
300  }
301  bool setValue(Point3DI pt)
302  {
303  if (nbColumns < 3) return false;
304  at(0, 0) = (T)pt.x;
305  at(0, 1) = (T)pt.y;
306  at(0, 2) = (T)pt.z;
307  DO_NOTIFICATION(notificationLevel);
308  return true;
309  }
310 
311 
312  // direct access operators
313  auto& operator=(Point2D pt) {
314  if (nbColumns < 2) return *this;
315  at(0, 0) = (T)pt.x;
316  at(0, 1) = (T)pt.y;
317  return *this;
318  }
319  auto& operator=(Point3D pt)
320  {
321  if (nbColumns < 3) return *this;
322  at(0, 0) = (T)pt.x;
323  at(0, 1) = (T)pt.y;
324  at(0, 2) = (T)pt.z;
325  return *this;
326  }
327 
328  auto& operator=(Vector4D pt) {
329  if (nbColumns < 4) return *this;
330  at(0, 0) = (T)pt.x;
331  at(0, 1) = (T)pt.y;
332  at(0, 2) = (T)pt.z;
333  at(0, 3) = (T)pt.w;
334  return *this;
335  }
336 
337  auto& operator=(Point2DI pt) { setValue(pt); return *this; }
338  auto& operator=(Point3DI pt) { setValue(pt); return *this; }
339 
340 
341 
342 #define DECLARE_SET_VALUE_BROADCAST(type) virtual bool setValue(type value) override { if (isReadOnly()) { return false; } this->broadcastValue((T)value); DO_NOTIFICATION(notificationLevel); return true; }
343 
344  EXPAND_MACRO_FOR_BASE_TYPES(NOQUALIFIER, NOQUALIFIER, DECLARE_SET_VALUE_BROADCAST);
345 
346 #undef DECLARE_SET_VALUE_BROADCAST
347 
348  virtual bool setValue(const char* value) override { kstl::string localstr(value); return setValue(localstr); }
349  virtual bool setValue(const kstl::string& value) override
350  {
351  if (isReadOnly()) { return false; }
352  if (CoreConvertString2Array<T>(value, getArrayBuffer(), getNbArrayElements()))
353  {
354  DO_NOTIFICATION(notificationLevel);
355  return true;
356  }
357  return false;
358  }
359 
360  virtual operator Point2DI() const
361  {
362  Point2DI tmpValue(0, 0);
363  if ((nbLines == 1) && (nbColumns >= 2))
364  {
365  tmpValue.x = (s32)this->at(0, 0);
366  tmpValue.y = (s32)this->at(0, 1);
367  }
368  return tmpValue;
369  }
370 
371  virtual operator Point3DI() const
372  {
373  Point3DI tmpValue(0, 0, 0);
374  if ((nbLines == 1) && (nbColumns >= 3))
375  {
376  tmpValue.x = (s32)this->at(0, 0);
377  tmpValue.y = (s32)this->at(0, 1);
378  tmpValue.z = (s32)this->at(0, 2);
379  }
380  return tmpValue;
381  }
382 
383  virtual operator Point2D() const
384  {
385  Point2D tmpValue(0.0f, 0.0f);
386  if ((nbLines == 1) && (nbColumns >= 2))
387  {
388  tmpValue.x = (float)this->at(0, 0);
389  tmpValue.y = (float)this->at(0, 1);
390  }
391  return tmpValue;
392  }
393 
394  virtual operator Point3D() const
395  {
396  Point3D tmpValue(0.0f, 0.0f, 0.0f);
397  if ((nbLines == 1) && (nbColumns >= 3))
398  {
399  tmpValue.x = (float)this->at(0, 0);
400  tmpValue.y = (float)this->at(0, 1);
401  tmpValue.z = (float)this->at(0, 2);
402  }
403  return tmpValue;
404  }
405 
406  virtual operator Vector4D() const
407  {
408  Vector4D tmpValue(0.0f, 0.0f, 0.0f, 0.0f);
409  if ((nbLines == 1) && (nbColumns >= 4))
410  {
411  tmpValue.x = (float)this->at(0, 0);
412  tmpValue.y = (float)this->at(0, 1);
413  tmpValue.z = (float)this->at(0, 2);
414  tmpValue.w = (float)this->at(0, 3);
415  }
416  return tmpValue;
417  }
418 
419 
420 #define DECLARE_SETARRAYVALUE( b ) virtual bool setArrayValue(const b *value, u32 nbElements ) override {if(isReadOnly()){ return false; }\
421  if(nbElements>getNbArrayElements()){ return false;} \
422  CoreCopyCastArray<T,b>(getArrayBuffer(), value, nbElements); \
423  DO_NOTIFICATION(notificationLevel);\
424  return true;}
425 
426  EXPAND_MACRO_FOR_BASE_TYPES(NOQUALIFIER, NOQUALIFIER, DECLARE_SETARRAYVALUE);
427 
428 
429 #define DECLARE_SETARRAYELEMENTVALUE( b ) virtual bool setArrayElementValue(b value, u32 line, u32 column ) override {if(isReadOnly()){ return false; }\
430  if(line>=nbLines || column>=nbColumns){ return false;} \
431  at(line,column)=(T)value; \
432  DO_NOTIFICATION(notificationLevel); \
433  return true;}
434 
435  EXPAND_MACRO_FOR_NUMERIC_TYPES(NOQUALIFIER, NOQUALIFIER, DECLARE_SETARRAYELEMENTVALUE);
436 
437 
438 #undef DECLARE_SETARRAYVALUE
439 #undef DECLARE_SETARRAYELEMENTVALUE
440 
441  virtual bool setArrayElementValue(bool value, u32 line, u32 column) override
442  {
443  if (isReadOnly()) { return false; }
444  if (line >= nbLines || column >= nbColumns) { return false; }
445  at(line,column) = (T)(value ? 1 : 0);
446  DO_NOTIFICATION(notificationLevel);;
447  return true;
448  }
449 
450  virtual bool setArrayElementValue(const kstl::string &value, u32 line, u32 column) override
451  {
452  if (isReadOnly()) { return false; }
453  if (line >= nbLines || column >= nbColumns) return false;
454  if (CoreConvertString2Value<T>(value, this->at(line,column)))
455  {
456  DO_NOTIFICATION(notificationLevel);
457  return true;
458  }
459  return false;
460  }
461 
462 
463 
464 
465 
466 #define DECLARE_GETARRAYVALUE( b ) virtual bool getArrayValue(b * const value, u32 nbElements ) const override {if(nbElements>getNbArrayElements()){ return false;} \
467  CoreCopyCastArray<b,T>(value,getConstArrayBuffer(),nbElements); return true;}
468 
469 
470  EXPAND_MACRO_FOR_BASE_TYPES(NOQUALIFIER, NOQUALIFIER, DECLARE_GETARRAYVALUE);
471 
472 
473 #undef DECLARE_GETARRAYVALUE
474 
475 
476 #define DECLARE_GETARRAYELEMENTVALUE( b ) virtual bool getArrayElementValue(b& value, u32 line, u32 column ) const override { if(line>=nbLines || column>=nbColumns){ return false;} \
477  value=(b)at(line,column); return true;}
478 
479  EXPAND_MACRO_FOR_NUMERIC_TYPES(NOQUALIFIER, NOQUALIFIER, DECLARE_GETARRAYELEMENTVALUE);
480 
481 
482 #undef DECLARE_GETARRAYELEMENTVALUE
483 
484  virtual bool getArrayElementValue(bool& value, u32 line, u32 column) const override
485  {
486  if (line >= nbLines || column >= nbColumns) return false;
487  value = (at(line, column) != (T)0);
488  return true;
489  }
490 
491  virtual bool getArrayElementValue(kstl::string& value, u32 line, u32 column) const override
492  {
493  if (line >= nbLines || column >= nbColumns) return false;
494  return CoreConvertValue2String<T>(value, at(line, column));
495  }
496 
497 
498 
499 
500 };
501 
504 
509 
512 
513 
514 // ****************************************
515 // * maVector class
516 // * --------------------------------------
522 // ****************************************
523 /*
524 template<typename T, CoreModifiable::ATTRIBUTE_TYPE attributeElementType, u32 nbElements, typename ConvertsToType = T> class maVector : public maArrayBase<T, attributeElementType, 1, nbElements>
525 {
526 public:
527  typedef T* VectorType;
528  using maArrayBase::maArrayBase;
529 
530  maVector(CoreModifiable& owner, bool isInitAttribute, KigsID ID, T val0, T val1)
531  :maArrayBase<T, attributeElementType, 1, nbElements>(owner, isInitAttribute, ID)
532  {
533  at(0, 0) = val0;
534  at(0, 1) = val1;
535  }
536  maVector(CoreModifiable& owner, bool isInitAttribute, KigsID ID, T val0, T val1, T val2)
537  :maArrayBase<T, attributeElementType, 1, nbElements>(owner, isInitAttribute, ID)
538  {
539  at(0, 0) = val0;
540  at(0, 1) = val1;
541  at(0, 2) = val2;
542  }
543  maVector(CoreModifiable& owner, bool isInitAttribute, KigsID ID, T val0, T val1, T val2, T val3)
544  :maArrayBase<T, attributeElementType, 1, nbElements>(owner, isInitAttribute, ID)
545  {
546  at(0, 0) = val0;
547  at(0, 1) = val1;
548  at(0, 2) = val2;
549  at(0, 3) = val3;
550  }
551 
552 
553  u32 getNbElements() const { return getNbArrayElements(); }
554 
555  VectorType getVector() { return mValue.data(); }
556  const VectorType getConstVector() const { return mValue.data(); }
557 
558  T& operator[](u32 index) { return getElement(0, index); }
559  const T& operator[](u32 index) const { return getConstElement(0, index); }
560 
561  //@Issue no notifications
562  //assignments
563  VectorType operator=(const VectorType& value) { setVectorValue(value); return mValue.data(); }
564  VectorType operator=(const Point2D& value) { setValue(value); return mValue.data(); }
565  VectorType operator=(const Point3D& value) { setValue(value); return mValue.data(); }
566  VectorType operator=(const Vector4D& value) { setValue(value); return mValue.data(); }
567  VectorType operator+=(const VectorType& value)
568  {
569  if (nbElements>0) at(0,0) += value[0];
570  if (nbElements>1) at(0,1) += value[1];
571  if (nbElements>2) at(0,2) += value[2];
572  if (nbElements>3) at(0,3) += value[3];
573  return mValue.data();
574  }
575  VectorType& operator-=(const VectorType& value)
576  {
577  if (nbElements>0) at(0,0) -= value[0];
578  if (nbElements>1) at(0,1) -= value[1];
579  if (nbElements>2) at(0,2) -= value[2];
580  if (nbElements>3) at(0,3) -= value[3];
581  return mValue.data();
582  }
583  VectorType& operator+=(const Point3D& value)
584  {
585  if (nbElements>0) at(0,0) += value[0];
586  if (nbElements>1) at(0,1) += value[1];
587  if (nbElements>2) at(0,2) += value[2];
588  return mValue.data();
589  }
590  VectorType& operator-=(const Point3D& value)
591  {
592  if (nbElements>0) at(0,0) -= value[0];
593  if (nbElements>1) at(0,1) -= value[1];
594  if (nbElements>2) at(0,2) -= value[2];
595  return mValue.data();
596  }
597 
598  virtual bool setVectorValue(const VectorType& value)
599  {
600  return setArrayValue(value, getNbElements());
601  }
602 
603  virtual bool getVectorValue(VectorType& value) const
604  {
605  return getArrayValue(value, getNbElements());
606  }
607 
608  virtual bool setVectorElementValue(const T value, u32 index)
609  {
610  return setArrayElementValue(value, 0, index);
611  }
612  virtual bool getVectorElementValue(T& value, u32 index) const
613  {
614  return getArrayElementValue(value, 0, index);
615  }
616 
617  using maArrayBase<T, attributeElementType, 1, nbElements>::setValue;
618 
619 
620  //@Issue no notifications
621  void setValue(const Vector4D &P)
622  {
623  if (nbElements>0) at(0,0) = P.x;
624  if (nbElements>1) at(0,1) = P.y;
625  if (nbElements>2) at(0,2) = P.z;
626  if (nbElements>3) at(0,3) = P.w;
627  }
628 
629  void setValue(const Point3D &P)
630  {
631  if (nbElements>0) at(0,0) = P.x;
632  if (nbElements>1) at(0,1) = P.y;
633  if (nbElements>2) at(0,2) = P.z;
634  }
635 
636  void setValue(const Point2D &P)
637  {
638  if (nbElements>0) at(0,0) = P.x;
639  if (nbElements>1) at(0,1) = P.y;
640  }
641 
642 
643  //@Refactor this is the kind of stuff that should be in the math lib, not here
644  void ClampMax(const T& v)
645  {
646  if (nbElements>0 && at(0,0)>v) at(0,0) = v;
647  if (nbElements>1 && at(0,1)>v) at(0,1) = v;
648  if (nbElements>2 && at(0,2)>v) at(0,2) = v;
649  if (nbElements>3 && at(0,3)>v) at(0,3) = v;
650  }
651  //
652  void ClampMin(const T& v)
653  {
654  if (nbElements>0 && at(0,0)<v) at(0,0) = v;
655  if (nbElements>1 && at(0,1)<v) at(0,1) = v;
656  if (nbElements>2 && at(0,2)<v) at(0,2) = v;
657  if (nbElements>3 && at(0,3)<v) at(0,3) = v;
658  }
659 };
660 
661 */
662 
663 template<typename element_type, CoreModifiable::ATTRIBUTE_TYPE attribute_type, s32 nbElements>
665 
666 /*
667 typedef maVector<kfloat, CoreModifiable::FLOAT, 2, Point2D> maVect2DF;
668 typedef maVector<kfloat, CoreModifiable::FLOAT, 3, Point3D> maVect3DF;
669 typedef maVector<kfloat, CoreModifiable::FLOAT, 4, Vector4D> maVect4DF;
670 typedef maVector<kfloat, CoreModifiable::FLOAT, 16> maVect16DF;
671 
672 typedef maVector<s32, CoreModifiable::INT, 2> maVect2DI;
673 typedef maVector<s32, CoreModifiable::INT, 3> maVect3DI;
674 */
CoreModifiableAttribute::isReadOnly
virtual bool isReadOnly()
Read only attributes cannot be modified with setValue.
Definition: CoreModifiableAttribute.h:276
maArrayHeritage
CoreModifiableAttributeData for array with different level of notification.
Definition: maArray.h:141
CoreModifiable
Base class for Kigs framework objects. CoreModifiable class manage a list of attributes supporting re...
Definition: CoreModifiable.h:480
maVector
CoreModifiableAttributeData for vector array with one dimension.
CoreModifiableAttribute.h
Base template class for CoreModifiable attributes managing data.
CoreModifiableAttribute
Base class for all CoreModifiableAttribute . This class is just composed of virtual methods.
Definition: CoreModifiableAttribute.h:145