GL Studio API
gls_metadata_attributes.h
Go to the documentation of this file.
1 /*! \file
2  \brief Defines templated metadata classes for DisplayObjects and other uses.
3 
4  \par Copyright Information
5 
6  Copyright (c) 2015 by The DiSTI Corporation.<br>
7  11301 Corporate Blvd; Suite 100<br>
8  Orlando, Florida 32817<br>
9  USA<br>
10  <br>
11  All rights reserved.<br>
12 
13  This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19 
20  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26 
27  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35 
36  The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America.
38 
39 */
40 #ifndef _GLS_METADATA_ATTRIBUTES_H
41 #define _GLS_METADATA_ATTRIBUTES_H
42 
43 #include "disti_metadata.h"
44 #include <sstream>
45 #include <stdlib.h>
46 #include <limits.h>
47 #ifndef SGI
48 #include <cctype>
49 #endif
50 #include "gls_include.h"
51 
52 #include "vertex.h"
53 #include "util.h"
54 #include <string.h>
55 #include <stdarg.h>
56 #include "list.h"
57 #include "material.h"
58 #include "display.h"
59 #include "dynamic_array.h"
60 #include <assert.h>
61 
62 namespace disti
63 {
64 
65 // Force the attribute classes to be instanciated
66 // so that they will be exported from the dll
67 // NOTE: These are not necessary if the class is instanciated or specialized elsewhere - BB
68 //template class DistiAttribute<unsigned char>;
69 
70 // DistiAttribute<bool> Specialization
71 template <>
72 inline long DistiAttribute<bool>::ValueInt() { return (long)*_attribPtr; }
73 template <>
74 inline void DistiAttribute<bool>::ValueInt(long val) { *_attribPtr = (val != 0);CallCallback(); }
75 
76 template <>
77 inline std::ostream& DistiAttribute<bool>::WriteValue(std::ostream &outstr)
78 {
79  outstr << *_attribPtr;
80 
81  return outstr;
82 }
83 
84 // helper function used to remove converting int to bool performance warning on certain compilers
85 template< class T >
86 T ConvertToIntOrBool( int value )
87 {
88  return value;
89 }
90 template<>
91 inline bool ConvertToIntOrBool( int value )
92 {
93  return value != 0;
94 }
95 
96 template< class T >
97 T ReadValueAsIntOrBool( std::istream &instr )
98 {
99  std::string value;
100  instr >> value;
101  T temp;
102  if( strcasecmp( value.c_str(), "TRUE" ) == 0 )
103  {
104  temp = true;
105  }
106  else if ( strcasecmp( value.c_str(), "FALSE" ) == 0 )
107  {
108  temp = false;
109  }
110  else
111  {
112  // Check based on an integer value
113  temp = ConvertToIntOrBool<T>( atoi( value.c_str() ) );
114  }
115  return temp;
116 }
117 
118 template <>
119 inline std::istream& DistiAttribute<bool>::ReadValue(std::istream &instr)
120 {
121  *_attribPtr = ReadValueAsIntOrBool< bool >( instr );
122  CallCallback();
123  return instr;
124 }
125 
126 // DistiAttribute<int> Specialization
127 template <>
128 inline long DistiAttribute<int>::ValueInt() { return (long)*_attribPtr; }
129 template <>
130 inline void DistiAttribute<int>::ValueInt(long val) { *_attribPtr = (int)val; CallCallback();}
131 
132 // DistiAttribute<short> Specialization
133 template <>
134 inline long DistiAttribute<short>::ValueInt() { return (long)*_attribPtr; }
135 template <>
136 inline void DistiAttribute<short>::ValueInt(long val) { *_attribPtr = (short)val; CallCallback();}
137 
138 // DistiAttribute<unsigned short> Specialization
139 template <>
140 inline long DistiAttribute<unsigned short>::ValueInt() { return (long)*_attribPtr; }
141 template <>
142 inline void DistiAttribute<unsigned short>::ValueInt(long val) { *_attribPtr = (unsigned short)val; CallCallback();}
143 
144 // DistiAttribute<unsigned char> Specialization
145 template <>
146 inline long DistiAttribute<unsigned char>::ValueInt() { return (long)*_attribPtr; }
147 template <>
148 inline void DistiAttribute<unsigned char>::ValueInt(long val) { *_attribPtr = (unsigned char)val; CallCallback();}
149 
150 template <>
151 inline std::ostream& DistiAttribute<unsigned char>::WriteValue(std::ostream &outstr)
152 {
153  // If we don't cast to int, an actual character will be written. We want a number.
154  outstr << (int)*_attribPtr;
155  return outstr;
156 }
157 
158 template <>
159 inline std::istream& DistiAttribute<unsigned char>::ReadValue( std::istream& instr )
160 {
161  // If we don't cast to int, an actual character will be read. We want a number.
162  // Also, integer types should be able to read as TRUE or FALSE to preserve backwards compatibility for certain attributes (formerly handled by DistiAttributeUCharOrBool)
163  *_attribPtr = static_cast<unsigned char>( ReadValueAsIntOrBool<int>( instr ) );
164  CallCallback();
165  return instr;
166 }
167 
168 template <>
169 inline std::istream& DistiAttribute<int>::ReadValue( std::istream& instr )
170 {
171  // integer types should be able to read as TRUE or FALSE to preserve backwards compatibility for certain attributes (formerly handled by DistiAttributeUCharOrBool)
172  *_attribPtr = ReadValueAsIntOrBool<int>( instr );
173  CallCallback();
174  return instr;
175 }
176 
177 template <>
178 inline std::istream& DistiAttribute<unsigned int>::ReadValue( std::istream& instr )
179 {
180  // integer types should be able to read as TRUE or FALSE to preserve backwards compatibility for certain attributes (formerly handled by DistiAttributeUCharOrBool)
181  *_attribPtr = ReadValueAsIntOrBool<unsigned int>( instr );
182  CallCallback();
183  return instr;
184 }
185 
186 // DistiAttribute<float> Specialization
187 template <>
188 inline long DistiAttribute<float>::ValueInt() { return (long)*_attribPtr; }
189 
190 template <>
191 inline void DistiAttribute<float>::ValueInt(long val) { *_attribPtr = (float)val; CallCallback();}
192 
193 
194 /** Special case for transitioning from a bool to an int
195  * Reads True or False, or integers.
196  * Writes only integers.
197  */
198 class DistiAttributeUCharOrBool : public DistiAttribute<unsigned char>
199 {
200 public:
201  GLS_EXPORT DistiAttributeUCharOrBool(CallbackMethodCallerBase* callback, const AttributeName &name, unsigned char *attribPtr);
202  GLS_EXPORT DistiAttributeUCharOrBool(CallbackMethodCallerBase* callback, const AttributeName &name, unsigned char value);
203 
204  virtual GLS_EXPORT DistiAttributeBase& operator = (const DistiAttributeBase & oldClass);
205 
206  virtual GLS_EXPORT long ValueInt();
207  virtual GLS_EXPORT void ValueInt(long val);
208 
209  virtual GLS_EXPORT std::ostream& WriteValue(std::ostream &outstr);
210  virtual GLS_EXPORT std::istream& ReadValue(std::istream &instr);
211 };
212 
213 /** For fixed length float arrays
214  */
216 {
217  float *_array;
218  int _length;
219 public:
220  GLS_EXPORT DistiAttributeFloatArray(CallbackMethodCallerBase* callback, const AttributeName &name, float *floatArray, int length);
221  virtual GLS_EXPORT ~DistiAttributeFloatArray();
222 
223  virtual GLS_EXPORT bool OkToWrite() const;
224 
225  virtual GLS_EXPORT std::ostream& WriteValue(std::ostream &outstr);
226  virtual GLS_EXPORT std::istream& ReadValue(std::istream &instr);
227 };
228 
229 /** For fixed length double arrays
230  */
232 {
233  double *_array;
234  int _length;
235 public:
236  GLS_EXPORT DistiAttributeDoubleArray(CallbackMethodCallerBase* callback, const AttributeName &name, double *doubleArray, int length);
237  virtual GLS_EXPORT ~DistiAttributeDoubleArray();
238 
239  virtual GLS_EXPORT bool OkToWrite() const;
240 
241  virtual GLS_EXPORT std::ostream& WriteValue(std::ostream &outstr);
242  virtual GLS_EXPORT std::istream& ReadValue(std::istream &instr);
243 };
244 
245 /** An enumeration for Texture Mode */
246 static DistiAttributeEnumDefList TextureModeEnumList(
247  (char *)"TEXTURE_MAP_MODULATE",TEXTURE_MAP_MODULATE,
248  (char *)"TEXTURE_MAP_DECAL", TEXTURE_MAP_DECAL,
249  (char *)"TEXTURE_MAP_BLEND", TEXTURE_MAP_BLEND,
250  (char *)"TEXTURE_MAP_REPLACE", TEXTURE_MAP_REPLACE,
251  NULL);
252 
253 /** Disti Attribute Texture Mode Enum */
254 template<class containerClass> class DistiAttributeTextureModeEnum : public DistiAttributeEnum<containerClass,const int,int>
255 {
256 public:
258  using _BaseClass::_pairList;
259 
260  typedef void (containerClass::*SetMethodType)(const int);
261  typedef int (containerClass::*GetMethodType)();
262 
263  DistiAttributeTextureModeEnum<containerClass>(containerClass* frame,SetMethodType setMethod,GetMethodType getMethod,const AttributeName &name) :
264  DistiAttributeEnum<containerClass,const int,int>(frame,setMethod,getMethod,name)
265  {
266  _pairList = &TextureModeEnumList;
267  }
268 };
269 
270 /** An enumeration for Texture Filter */
271 static DistiAttributeEnumDefList TextureFilterEnumList(
272  (char *)"TEXTURE_FILTER_NEAREST", TEXTURE_FILTER_NEAREST,
273  (char *)"TEXTURE_FILTER_LINEAR", TEXTURE_FILTER_LINEAR,
274  (char *)"TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST", TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST,
275  (char *)"TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR", TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR,
276  (char *)"TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR", TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR,
277  (char *)"TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST", TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST,
278  NULL);
279 
280 /** Disti Attribute Texture Filter Enum */
281 template<class containerClass> class DistiAttributeTextureFilterEnum : public DistiAttributeEnum<containerClass,const int,int>
282 {
283 public:
285  using _BaseClass::_pairList;
286 
287  typedef void (containerClass::*SetMethodType)(const int);
288  typedef int (containerClass::*GetMethodType)();
289 
290  DistiAttributeTextureFilterEnum<containerClass>(containerClass* frame,SetMethodType setMethod, GetMethodType getMethod,const AttributeName &name) :
291  DistiAttributeEnum<containerClass,const int,int>(frame,setMethod,getMethod,name)
292  {
293  _pairList = &TextureFilterEnumList;
294  }
295 };
296 
297 /** An enumeration for Polygon Mode */
298 static DistiAttributeEnumDefList PolyModeEnumList(
299  (char *)"POLY_MODE_UNDEFINED", POLY_MODE_UNDEFINED,
300  (char *)"POLY_MODE_POINTS", POLY_MODE_POINTS,
301  (char *)"POLY_MODE_OUTLINE", POLY_MODE_OUTLINE,
302  (char *)"POLY_MODE_FILLED", POLY_MODE_FILLED,
303  (char *)"POLY_MODE_FILL_AND_OUTLINE",POLY_MODE_FILL_AND_OUTLINE,
304  NULL);
305 
306 /** Disti Attribute Poly Mode Enum */
307 template<class containerClass> class DistiAttributePolyModeEnum : public DistiAttributeEnum<containerClass,const int,int>
308 {
309 public:
311  using _BaseClass::_pairList;
312 
313  typedef void (containerClass::*SetMethodType)(const int);
314  typedef int (containerClass::*GetMethodType)();
315 
316  DistiAttributePolyModeEnum<containerClass>(containerClass* frame,SetMethodType setMethod, GetMethodType getMethod,const AttributeName &name) :
317  DistiAttributeEnum<containerClass,const int,int>(frame,setMethod,getMethod,name)
318  {
319  _pairList = &PolyModeEnumList;
320  }
321 };
322 
323 /** An enumeration for Polygon End Mode */
324 static DistiAttributeEnumDefList PolyEndEnumList(
325  (char *)"POLY_OPEN", POLY_OPEN,
326  (char *)"POLY_CLOSED", POLY_CLOSED,
327  NULL);
328 
329 /** Disti Attribute Poly End Enum */
330 template<class containerClass> class DistiAttributePolyEndEnum : public DistiAttributeEnum<containerClass,int,int>
331 {
332 public:
334  using _BaseClass::_pairList;
335 
336  typedef void (containerClass::*SetMethodType)(int);
337  typedef int (containerClass::*GetMethodType)();
338 
339  DistiAttributePolyEndEnum<containerClass>(containerClass* frame,SetMethodType setMethod, GetMethodType getMethod,const AttributeName &name) :
340  DistiAttributeEnum<containerClass,int,int>(frame, setMethod,getMethod,name)
341  {
342  _pairList = &PolyEndEnumList;
343  }
344 };
345 
346 /** An enumeration for Shading enum */
347 static DistiAttributeEnumDefList ShadingEnumList(
348  (char *)"FLAT", SHADING_FLAT,
349  (char *)"GOURAUD", SHADING_GOURAUD,
350  NULL);
351 
352 /** Disti Attribute Shading Enum */
353 template<class containerClass> class DistiAttributeShadingEnum : public DistiAttributeEnum<containerClass,const int,int>
354 {
355 public:
357  using _BaseClass::_pairList;
358 
359  typedef void (containerClass::*SetMethodType)(const int);
360  typedef int (containerClass::*GetMethodType)();
361 
362  DistiAttributeShadingEnum<containerClass>(containerClass* frame,SetMethodType setMethod, GetMethodType getMethod,const AttributeName &name) :
363  DistiAttributeEnum<containerClass,const int,int>(frame,setMethod,getMethod,name)
364  {
365  _pairList = &ShadingEnumList;
366  }
367 };
368 
369 /** An enumeration for ColorMaterialMode enum */
370 template<class containerClass> class DistiAttributeColorMaterialModeEnum : public DistiAttributeEnum<containerClass,const int,int>
371 {
372 public:
374  using _BaseClass::_pairList;
375 
376  typedef void (containerClass::*SetMethodType)(const int);
377  typedef int (containerClass::*GetMethodType)();
378 
379  DistiAttributeColorMaterialModeEnum<containerClass>(containerClass* frame,SetMethodType setMethod, GetMethodType getMethod,const AttributeName &name) :
380  DistiAttributeEnum<containerClass,const int,int>(frame,setMethod,getMethod,name)
381  {
382  static DistiAttributeEnumDefList ColorMaterialModeEnum(
383  (char *)"NO_COLOR_MATERIAL", NO_COLOR_MATERIAL,
384  (char *)"DIFFUSE_COLOR_MATERIAL", DIFFUSE_COLOR_MATERIAL,
385  (char *)"AMBIENT_COLOR_MATERIAL", AMBIENT_COLOR_MATERIAL,
386  (char *)"DIFFUSE_AND_AMBIENT_COLOR_MATERIAL", DIFFUSE_AND_AMBIENT_COLOR_MATERIAL,
387  (char *)"EMISSION_COLOR_MATERIAL", EMISSION_COLOR_MATERIAL,
388  (char *)"SPECULAR_COLOR_MATERIAL", SPECULAR_COLOR_MATERIAL,
389  NULL);
390 
391  _pairList = &ColorMaterialModeEnum;
392  }
393 
394  virtual GLS_EXPORT bool OkToWrite() const { return false; }
395 };
396 
397 /** An enumeration for Protection */
398 template<class containerClass> class DistiAttributeProtectionEnum : public DistiAttributeEnum<containerClass,const int,int>
399 {
400 public:
402  using _BaseClass::_pairList;
403 
404  typedef void (containerClass::*SetMethodType)(const int);
405  typedef int (containerClass::*GetMethodType)();
406 
407  DistiAttributeProtectionEnum<containerClass>(containerClass* frame,SetMethodType setMethod, GetMethodType getMethod,const AttributeName &name) :
408  DistiAttributeEnum<containerClass,const int,int>(frame,setMethod,getMethod,name)
409  {
410  static DistiAttributeEnumDefList ProtectionEnumList(
411  (char *)"PUBLIC", PUBLIC,
412  (char *)"PRIVATE", PRIVATE,
413  (char *)"PROTECTED", PROTECTED,
414  NULL);
415  _pairList = &ProtectionEnumList;
416 }
417 };
418 
419 /** An enumeration for Alpha Mode */
420 static DistiAttributeEnumDefList AlphaModeEnumList(
421  (char *)"ALPHA_MODE_UNDEFINED", ALPHA_MODE_UNDEFINED,
422  (char *)"ALPHA_MODE_OPAQUE", ALPHA_MODE_OPAQUE,
423  (char *)"ALPHA_MODE_2_LEVEL", ALPHA_MODE_2_LEVEL,
424  (char *)"ALPHA_MODE_256_LEVEL", ALPHA_MODE_256_LEVEL,
425  NULL);
426 
427 /** Disti Attribute Alpha Mode Enum */
428 template<class containerClass> class DistiAttributeAlphaModeEnum : public DistiAttributeEnum<containerClass,const int,int>
429 {
430 public:
432  using _BaseClass::_pairList;
433 
434  typedef void (containerClass::*SetMethodType)(const int);
435  typedef int (containerClass::*GetMethodType)();
436 
437  DistiAttributeAlphaModeEnum<containerClass>(containerClass* frame,SetMethodType setMethod, GetMethodType getMethod,const AttributeName &name) :
438  DistiAttributeEnum<containerClass,const int,int>(frame,setMethod,getMethod,name)
439  {
440  _pairList = &AlphaModeEnumList;
441  }
442 };
443 
444 /** An attribute for a char* string
445  */
447 {
448  char* _local;
449 protected:
450  char** _attribPtr;
451 public:
452 
453  // This constructor makes the bold assumption that it can modify the contents
454  // of the supplied char*, by realocating the memory.
455  GLS_EXPORT DistiAttributeString(CallbackMethodCallerBase* callback, const AttributeName &name, char **attribPtr);
456 
457  // Creates local storage, and will resize as needed
458  GLS_EXPORT DistiAttributeString(CallbackMethodCallerBase* callback, const AttributeName &name, char *initialValue);
459  virtual GLS_EXPORT ~DistiAttributeString();
460 
461  // Be careful with this
462  GLS_EXPORT char* LocalStorageString();
463  virtual GLS_EXPORT bool OkToWrite() const;
464 
465  virtual GLS_EXPORT std::ostream& WriteValue(std::ostream &outstr);
466  virtual GLS_EXPORT std::istream& ReadValue(std::istream &instr);
467 };
468 
469 /** Derived from DistiAttributeString, the only difference is that it
470  * reads and writes encoded strings instead of clear strings.
471  */
473 {
474 public:
475  GLS_EXPORT DistiAttributeEncodedString(CallbackMethodCallerBase* callback, const AttributeName &name, char **attribPtr);
476 
477  // Creates local storage, and will resize as needed
478  GLS_EXPORT DistiAttributeEncodedString(CallbackMethodCallerBase* callback, const AttributeName &name, char *initialValue);
479 
480  // Normally ValueString just returns the value of WriteValue, but for encoded strings
481  // this is probably not what we want, so have ValueString work with the unencoded string
482  virtual GLS_EXPORT std::string ValueString();
483  virtual GLS_EXPORT void ValueString(const std::string& s);
484 
485  virtual GLS_EXPORT std::ostream & WriteValue(std::ostream &outstr);
486  virtual GLS_EXPORT std::istream & ReadValue(std::istream &instr);
487 };
488 
489 /** Derived from DistiAttributeStdString, the only difference is that it
490  * reads and writes encoded strings instead of clear strings.
491  */
493 {
494 public:
495  GLS_EXPORT DistiAttributeEncodedStdString(CallbackMethodCallerBase* callback, const AttributeName &name, std::string *attribPtr);
496 
497  // Creates local storage, and will resize as needed
498  GLS_EXPORT DistiAttributeEncodedStdString(CallbackMethodCallerBase* callback, const AttributeName &name, std::string initialValue);
499 
500  virtual GLS_EXPORT bool OkToWrite() const;
501 
502  // Normally ValueString just returns the value of WriteValue, but for encoded strings
503  // this is probably not what we want, so have ValueString work with the unencoded string
504  virtual GLS_EXPORT std::string ValueString();
505  virtual GLS_EXPORT void ValueString(const std::string& s);
506 
507  virtual GLS_EXPORT std::ostream & WriteValue(std::ostream &outstr);
508  virtual GLS_EXPORT std::istream & ReadValue(std::istream &instr);
509 };
510 /** For fixed length char array */
512 {
513  char *_string;
514  int _length;
515 public:
516  GLS_EXPORT DistiAttributeFixedString(CallbackMethodCallerBase* callback, const AttributeName &name, char *string, int length);
517  virtual GLS_EXPORT ~DistiAttributeFixedString();
518 
519  virtual GLS_EXPORT std::ostream& WriteValue(std::ostream &outstr);
520  virtual GLS_EXPORT std::istream& ReadValue(std::istream &instr);
521 };
522 
523 /** Attribute for std::string */
524 class DistiAttributeStdString : public DistiAttribute<std::string>
525 {
526  std::string _localStorageString;
527 public:
528  // This constructor has the storage external
529  GLS_EXPORT DistiAttributeStdString(CallbackMethodCallerBase* callback, const AttributeName &name, std::string *attribPtr);
530 
531  // Creates local storage, and will resize as needed
532  GLS_EXPORT DistiAttributeStdString(CallbackMethodCallerBase* callback, const AttributeName &name, std::string initialValue);
533  virtual GLS_EXPORT ~DistiAttributeStdString();
534 
535  // Be carefull with this
536  GLS_EXPORT std::string* LocalStorageString();
537 
538  virtual GLS_EXPORT bool OkToWrite() const;
539 
540  virtual GLS_EXPORT std::ostream& WriteValue(std::ostream &outstr);
541  virtual GLS_EXPORT std::istream& ReadValue(std::istream &instr);
542 };
543 
544 /** Attribute for Location */
546 {
547 public:
548  GLS_EXPORT DistiAttributeLocation(CallbackMethodCallerBase* callback, const AttributeName &name, Vertex *attribPtr);
549  virtual GLS_EXPORT ~DistiAttributeLocation();
550 
551  virtual GLS_EXPORT std::ostream& WriteValue(std::ostream &outstr);
552  virtual GLS_EXPORT std::istream& ReadValue(std::istream &instr);
553 };
554 
555 /** Attribute for a dictionary of attributes */
557 {
558 protected:
559  DistiAttribDict *_dict;
560 public:
561  GLS_EXPORT DistiAttributeDictionaryAttribute(const AttributeName &name, DistiAttribDict* dict );
562 
563  virtual GLS_EXPORT bool OkToWrite() const;
564 
565  virtual void Add(DistiAttributeBase* attr) { _dict->Add(attr); }
566  virtual GLS_EXPORT std::ostream& WriteValue(std::ostream &outstr);
567  virtual GLS_EXPORT std::istream& ReadValue(std::istream &instr);
568 };
569 
570 /** Attribute for a dictionary of attributes that cares for its siblings */
572 {
573 protected:
574  DistiAttribDict *_dict;
575  DistiAttributeBase* _sibling;
576  bool _hasRead;
577 public:
579 
580  virtual GLS_EXPORT bool OkToWrite() const;
581 
582  virtual void Add(DistiAttributeBase* attr) { _dict->Add(attr); }
583  virtual GLS_EXPORT std::ostream& WriteValue(std::ostream &outstr);
584  virtual GLS_EXPORT std::istream& ReadValue(std::istream &instr);
585 };
586 
587 //----------------------------------------------------------------------------
588 //----------------------------------------------------------------------------
589 /** \class DistiAttributeStdMap
590  * An attribute for a std::map
591  */
592 template<class Map_t>
594 {
595  Map_t* _attribPtr;
596 
597 public:
598  //------------------------------------------------------------------------
600  CallbackMethodCallerBase* callback, const AttributeName &name, Map_t* attribPtr) :
601  DistiAttributeBase(callback, name, false),
602  _attribPtr(attribPtr)
603  {
604  }
605  //------------------------------------------------------------------------
607  DistiAttributeBase(callback, name, true),
608  _attribPtr( new Map_t() )
609  {
610  }
611  //------------------------------------------------------------------------
612  virtual ~DistiAttributeStdMap()
613  {
614  if (_localStorage)
615  delete _attribPtr;
616  _attribPtr = NULL;
617  }
618  //------------------------------------------------------------------------
619  virtual bool OkToWrite() const
620  {
621  return _attribPtr != 0 && _attribPtr->size();
622  }
623  //------------------------------------------------------------------------
624  virtual std::ostream& WriteValue(std::ostream& outstr)
625  {
626  outstr << "\n" << DistiAttribDict::SpacingString() << "{\n";
627  DistiAttribDict::SpacingInc();
628 
629  if (_attribPtr)
630  {
631  typename Map_t::iterator i;
632  for (i = _attribPtr->begin(); i != _attribPtr->end(); ++i)
633  {
634  outstr << DistiAttribDict::SpacingString()
635  << i->first << " " << i->second << std::endl;
636  }
637  }
638 
639  DistiAttribDict::SpacingDec();
640  outstr << DistiAttribDict::SpacingString() << "}\n";
641 
642  return outstr;
643  }
644  //------------------------------------------------------------------------
645  virtual std::istream& ReadValue(std::istream& instr)
646  {
647  instr.ignore(INT_MAX, '{');
648 
649  if (instr.good())
650  {
651  std::stringstream fontStream;
652  instr.get(*fontStream.rdbuf(), '}');
653  if (instr.good())
654  {
655  instr.ignore(1);
656  while (fontStream.good())
657  {
658  // Get rid of all the leading white space before reading the key
659 #ifdef _WIN32
660  std::stringstream::char_type c;
661 #else
662  // std::stringstream::char_type c; causes a parse error before `;' on Linux
663  char c;
664 #endif
665  do
666  {
667  c = fontStream.get();
668  } while (fontStream.good() && isspace(c));
669 
670  if (fontStream.good())
671  {
672  fontStream.putback(c);
673 
674 #if _WIN32 && _MSC_VER < 1300 // if _MSC_VER < vc70
675  Map_t::key_type key;
676  Map_t::referent_type value;
677 #else
678  typename Map_t::key_type key;
679  typename Map_t::mapped_type value;
680 #endif
681 
682  fontStream >> key >> value;
683  (*_attribPtr)[key] = value;
684  }
685  }
686  }
687  }
688  return instr;
689  }
690 }; // end DistiAttributeStdMap
691 
692 
693 /** \class DistiAttributeVertexArray
694  * An attribute for either a Vector or Vertex
695  */
696 template< class T > // Either Vector or Vertex
698 {
699 protected:
700  T** _attribPtr;
701  typedef T* Tptr;
702  unsigned int *_numVertices;
703  unsigned int _numElements;
704  bool _fixedArray;
705  bool _compatabilityMode;
706 public:
707  void SetCompatabilityMode(bool mode) { _compatabilityMode = mode; }
708  // For variable length arrays
709  DistiAttributeVertexArray(CallbackMethodCallerBase* callback, const AttributeName &name, T **attribPtr, unsigned int *numVertices ) :
710  DistiAttributeBase(callback,name,false),
711  _attribPtr(attribPtr),
712  _numVertices(numVertices),
713  _numElements(0),
714  _fixedArray(false)
715  {
716  _compatabilityMode = true;
717  }
718  // For fixed arrays
719  DistiAttributeVertexArray(CallbackMethodCallerBase* callback, const AttributeName &name, T* attribPtr, unsigned int numElements) :
720  DistiAttributeBase(callback,name,true),
721  _attribPtr( new Tptr(attribPtr) ),
722  _numVertices(NULL),
723  _numElements(numElements),
724  _fixedArray(true)
725  {
726  _compatabilityMode = true;
727  }
728 
729 
730  virtual ~DistiAttributeVertexArray()
731  {
732  if ((_fixedArray || _localStorage) &&
733  _attribPtr)
734  delete _attribPtr;
735  _attribPtr = NULL;
736  }
737 
738  virtual bool OkToWrite() const
739  {
740  return (*_attribPtr != NULL);
741  }
742 
743  virtual std::ostream & WriteValue(std::ostream &outstr)
744  {
745  if (*_attribPtr != NULL)
746  {
747  unsigned int numVerts = _numElements;
748  if (!_fixedArray)
749  {
750  outstr << *_numVertices;
751  numVerts = *_numVertices;
752  }
753  DistiAttribDict::SpacingInc();
754  for (unsigned int i = 0 ; i < numVerts; i++ )
755  {
756  outstr << std::endl;
757  outstr << (*_attribPtr)[i];
758  }
759  DistiAttribDict::SpacingDec();
760 
761  }
762  return outstr;
763  }
764  virtual std::istream & ReadValue(std::istream &instr)
765  {
766  unsigned int numVerts = _numElements;
767 
768  if (!_fixedArray)
769  {
770  instr >> numVerts;
771  *_numVertices = numVerts;
772 
773  // Remove old storage if any
774  if (*_attribPtr != NULL)
775  delete [] *_attribPtr;
776 
777  // Create new storage
778  if(numVerts>0)
779  *_attribPtr = new T[numVerts];
780  else
781  *_attribPtr = NULL;
782  }
783 
784  if (!_compatabilityMode)
785  {
786  char buf[1024];
787  // Get newline character
788  instr.getline(buf,1024);
789  }
790 
791  for (unsigned int i = 0 ; i < numVerts; i++ )
792  {
793  if (!_compatabilityMode)
794  {
795  char buf[1024];
796  instr.getline(buf,1024);
797 #ifdef GLS_DEBUG
798  int count =
799 #endif
800  sscanf(buf,"%f %f %f",
801  &((*_attribPtr)[i].x),
802  &((*_attribPtr)[i].y),
803  &((*_attribPtr)[i].z));
804 #ifdef GLS_DEBUG
805  assert (3 == count);
806 #endif
807  }
808  else
809  {
810  instr >> (*_attribPtr)[i];
811  }
812  }
813  CallCallback();
814  return instr;
815  }
816 
817  virtual bool operator==(const DistiAttributeBase& rArg)
818  {
819  DistiAttributeVertexArray< T >* r = dynamic_cast< DistiAttributeVertexArray< T >* >( const_cast<DistiAttributeBase*>(&rArg) );
820  if( !r )
821  {
822  return DistiAttributeBase::operator==( rArg );
823  }
824 
825  if (!(_name == r->_name) || _numElements != r->_numElements )
826  return false;
827 
828  for( unsigned int i = 0u; i < _numElements; ++i )
829  {
830  T leftVert = (*_attribPtr)[i];
831  T rightVert = (*r->_attribPtr)[i];
832  if( !disti::Equal( leftVert.x, rightVert.x ) || !disti::Equal( leftVert.y, rightVert.y ) || !disti::Equal( leftVert.z, rightVert.z ) )
833  {
834  return false;
835  }
836  }
837 
838  return true;
839  }
840 };
841 
842 /** An attribute for either a Vector or Vertex */
843 template<>
845 {
846 protected:
847  Vertex** _attribPtr;
848  typedef Vertex* Tptr;
849  unsigned int *_numVertices;
850  unsigned int _numElements;
851  bool _fixedArray;
852  bool _compatabilityMode;
853 public:
854  void SetCompatabilityMode(bool mode) { _compatabilityMode = mode; }
855  // For variable length arrays
856  DistiAttributeVertexArray(CallbackMethodCallerBase* callback, const AttributeName &name, Vertex **attribPtr, unsigned int *numVertices ) :
857  DistiAttributeBase(callback,name,false),
858  _attribPtr(attribPtr),
859  _numVertices(numVertices),
860  _numElements(0),
861  _fixedArray(false)
862  {
863  _compatabilityMode = true;
864  }
865  // For fixed arrays
866  DistiAttributeVertexArray(CallbackMethodCallerBase* callback, const AttributeName &name, Vertex* attribPtr, unsigned int numElements) :
867  DistiAttributeBase(callback,name,true),
868  _attribPtr( new Tptr(attribPtr) ),
869  _numVertices(NULL),
870  _numElements(numElements),
871  _fixedArray(true)
872  {
873  _compatabilityMode = true;
874  }
875 
876 
877  virtual ~DistiAttributeVertexArray()
878  {
879  if ((_fixedArray || _localStorage) &&
880  _attribPtr)
881  delete _attribPtr;
882  _attribPtr = NULL;
883  }
884 
885  virtual bool OkToWrite() const
886  {
887  return (*_attribPtr != NULL);
888  }
889 
890  virtual std::ostream & WriteValue(std::ostream &outstr)
891  {
892  if (*_attribPtr != NULL)
893  {
894  unsigned int numVerts = _numElements;
895  if (!_fixedArray)
896  {
897  outstr << *_numVertices;
898  numVerts = *_numVertices;
899  }
900  DistiAttribDict::SpacingInc();
901  for (unsigned int i = 0 ; i < numVerts; i++ )
902  {
903  outstr << std::endl;
904  outstr << (*_attribPtr)[i];
905  }
906  DistiAttribDict::SpacingDec();
907 
908  }
909  return outstr;
910  }
911  virtual std::istream & ReadValue(std::istream &instr)
912  {
913  unsigned int numVerts = _numElements;
914 
915  if (!_fixedArray)
916  {
917  instr >> numVerts;
918  *_numVertices = numVerts;
919 
920  // Remove old storage if any
921  if (*_attribPtr != NULL)
922  delete [] *_attribPtr;
923 
924  // Create new storage
925  *_attribPtr = new Vertex[numVerts];
926  }
927 
928  if (!_compatabilityMode)
929  {
930  char buf[1024];
931  // Get newline character
932  instr.getline(buf,1024);
933  }
934 
935  for (unsigned int i = 0 ; i < numVerts; i++ )
936  {
937  if (!_compatabilityMode)
938  {
939  char buf[1024];
940  instr.getline(buf,1024);
941  int r,g,b,a;
942 #ifdef GLS_DEBUG
943  int count =
944 #endif
945  sscanf(buf,"%f %f %f %d %d %d %d",
946  &((*_attribPtr)[i].x),
947  &((*_attribPtr)[i].y),
948  &((*_attribPtr)[i].z),
949  &r,&g,&b,&a);
950 #ifdef GLS_DEBUG
951  assert (7 == count);
952 #endif
953 
954  (*_attribPtr)[i].color.RGBA((unsigned char)r,(unsigned char)g,(unsigned char)b,(unsigned char)a);
955  }
956  else
957  {
958  instr >> (*_attribPtr)[i];
959  }
960  }
961  CallCallback();
962  return instr;
963  }
964 
965  virtual bool operator==(const DistiAttributeBase& rArg)
966  {
968  if( !r )
969  {
970  return DistiAttributeBase::operator==( rArg );
971  }
972 
973  if (!(_name == r->_name) || _numElements != r->_numElements )
974  return false;
975 
976  for( unsigned int i = 0u; i < _numElements; ++i )
977  {
978  Vertex leftVert = (*_attribPtr)[i];
979  Vertex rightVert = (*r->_attribPtr)[i];
980  if( !disti::Equal( leftVert.x, rightVert.x ) || !disti::Equal( leftVert.y, rightVert.y ) || !disti::Equal( leftVert.z, rightVert.z ) || leftVert.color != rightVert.color )
981  {
982  return false;
983  }
984  }
985 
986  return true;
987  }
988 };
989 
990 /** This is used specifically for changing from TexturePoints as Vertexs to TexturePoints as Vectors.
991  * It uses file version information to decide when expect what.
992  */
994 {
995 public:
996  // For fixed arrays
997  DistiAttributeTexturePointArray(CallbackMethodCallerBase* callback, const AttributeName &name, Vector* attribPtr, unsigned int numElements) :
998  DistiAttributeVertexArray<Vector>(callback, name, attribPtr, numElements)
999  {
1000  }
1001 
1002  virtual std::ostream & WriteValue(std::ostream &outstr)
1003  {
1004  unsigned int numVerts = _numElements;
1005 
1006  for (unsigned int i = 0 ; i < numVerts; i++ )
1007  {
1008  outstr << std::endl;
1009  outstr << (*_attribPtr)[i];
1010  }
1011  return outstr;
1012  }
1013 
1014  virtual std::istream & ReadValue(std::istream &instr)
1015  {
1016  unsigned int numVerts = _numElements;
1017 
1018  for (unsigned int i = 0 ; i < numVerts; i++ )
1019  {
1020  // Get the whole line and then stream it into the Vector.
1021  // Before version 3.0, GL Studio files had full Vertex data
1022  // including color information stored after the location.
1023  // Reading whole lines comsumes this color information which is
1024  // then discarded.
1025  std::string line;
1026  std::getline(instr, line);
1027  // There must have been a leading newline, so read the first line again
1028  if (i == 0 && line.length()==0)
1029  std::getline(instr, line);
1030 
1031  std::stringstream strm(line);
1032  strm >> (*_attribPtr)[i];
1033  }
1034  CallCallback();
1035  return instr;
1036  }
1037 
1038 };
1039 
1040 /** \class DistiAttributeNeverWrite
1041  * Allows for the normal template to be used to load a value but never write it out
1042  * This is used for compatability mostly.
1043  */
1044 template <class T>
1046 {
1047 public:
1048  DistiAttributeNeverWrite(CallbackMethodCallerBase* callback, const AttributeName &name, T *attribPtr):
1049  DistiAttribute<T>(callback, name, attribPtr)
1050  {
1051  }
1052  DistiAttributeNeverWrite(CallbackMethodCallerBase* callback, const AttributeName &name, const T& initialValue):
1053  DistiAttribute<T>(callback, name, initialValue)
1054  {
1055  }
1056 
1057  virtual bool OkToWrite() const { return false; }
1058 };
1059 
1060 /** \class DistiAttributeAlias
1061  * Give an alternate name to an existing attribute.
1062  * This is used for compatability mostly. i.e. GlsTextBox "String" as an alias of "Text".
1063  */
1065 {
1066 public:
1067  DistiAttributeAlias(CallbackMethodCallerBase* callback, const AttributeName &name, const AttributeName &originalName, DistiAttribDict *dict):
1068  DistiAttributeBase(callback, name, false),
1069  _originalAttribName(originalName),
1070  _dictionary(dict)
1071  {
1072  }
1073 
1074  /** \see DistiAttributeBase */
1075  virtual DISTI_EXPORT bool OkToWrite() const DISTI_METHOD_OVERRIDE;
1076 
1077  /** \see DistiAttributeBase */
1078  virtual DISTI_EXPORT bool ValueChanged() DISTI_METHOD_OVERRIDE;
1079 
1080  /** \see DistiAttributeBase */
1081  virtual DISTI_EXPORT void ResetValueChanged() DISTI_METHOD_OVERRIDE;
1082 
1083  /** \see DistiAttributeBase */
1084  virtual DISTI_EXPORT std::string ValueString() DISTI_METHOD_OVERRIDE;
1085 
1086  /** \see DistiAttributeBase */
1087  virtual DISTI_EXPORT void ValueString(const std::string& s) DISTI_METHOD_OVERRIDE;
1088 
1089  /** \see DistiAttributeBase */
1090  virtual DISTI_EXPORT long ValueInt() DISTI_METHOD_OVERRIDE;
1091 
1092  /** \see DistiAttributeBase */
1093  virtual DISTI_EXPORT void ValueInt(long val) DISTI_METHOD_OVERRIDE;
1094 
1095  /** \see DistiAttributeBase */
1096  virtual DISTI_EXPORT double ValueFloat() DISTI_METHOD_OVERRIDE;
1097 
1098  /** \see DistiAttributeBase */
1099  virtual DISTI_EXPORT void ValueFloat(double val) DISTI_METHOD_OVERRIDE;
1100 
1101  /** \see DistiAttributeBase */
1102  virtual DISTI_EXPORT std::ostream & WriteValue(std::ostream &outstr) DISTI_METHOD_OVERRIDE;
1103 
1104  /** \see DistiAttributeBase */
1105  virtual DISTI_EXPORT std::istream & ReadValue(std::istream &instr) DISTI_METHOD_OVERRIDE;
1106 
1107  /** \see DistiAttributeBase */
1108  virtual DISTI_EXPORT bool operator==(const DistiAttributeBase& r) DISTI_METHOD_OVERRIDE;
1109 
1110  /** \see DistiAttributeBase */
1111  virtual DISTI_EXPORT CallbackID RegisterObserver( AttributeObserver* callback ) DISTI_METHOD_OVERRIDE;
1112  /** \see DistiAttributeBase */
1113  virtual DISTI_EXPORT void UnregisterObserver( CallbackID id ) DISTI_METHOD_OVERRIDE;
1114  /** \see DistiAttributeBase */
1115  virtual DISTI_EXPORT void NotifyObservers() DISTI_METHOD_OVERRIDE;
1116 
1117 protected:
1118  AttributeName _originalAttribName;
1119  DistiAttribDict *_dictionary;
1120 };
1121 
1122 /** \class DistiAttributeDynamicArray
1123  * An attribute for a dynamic array
1124  * T must be related to DynamicArray
1125  */
1126 template <class T, bool showIndex /* In the output */>
1128 {
1129  T* _attribPtr;
1130 
1131 public:
1132  DistiAttributeDynamicArray(CallbackMethodCallerBase* callback, const AttributeName &name, T* attribPtr) :
1133  DistiAttributeBase(callback,name,false),
1134  _attribPtr(attribPtr)
1135  {
1136  }
1137  // Create a new DynamicArray
1139  DistiAttributeBase(callback,name,true),
1140  _attribPtr( new T() )
1141  {
1142  }
1143  virtual ~DistiAttributeDynamicArray()
1144  {
1145  if (_localStorage)
1146  delete _attribPtr;
1147  _attribPtr = NULL;
1148  }
1149 
1150  virtual bool OkToWrite() const
1151  {
1152  return ( _attribPtr != NULL &&
1153  _attribPtr->Size());
1154  }
1155 
1156  virtual std::ostream & WriteValue(std::ostream &outstr)
1157  {
1158  if (_attribPtr != NULL)
1159  {
1160  int numEntries = _attribPtr->Count();
1161  outstr << numEntries;
1162 
1163  DistiAttribDict::SpacingInc();
1164 
1165  for (int i = 0 ; i < numEntries; i++ )
1166  {
1167  outstr << std::endl;
1168 
1169  if (showIndex)
1170  {
1171  outstr << DistiAttribDict::SpacingString() <<i<<" ";
1172  }
1173  outstr.width(1);
1174  outstr << DistiAttribDict::SpacingString() <<(*_attribPtr)[i]<<" ";
1175 
1176  }
1177  DistiAttribDict::SpacingDec();
1178 
1179  }
1180  return outstr;
1181  }
1182  virtual std::istream & ReadValue(std::istream &instr)
1183  {
1184  int numEntries = 0;
1185  instr >> numEntries;
1186 
1187  _attribPtr->Count(numEntries); // Set count of objects in
1188  int entry;
1189  for (int i = 0 ; i < numEntries; i++ )
1190  {
1191  entry = i;
1192  if (showIndex)
1193  {
1194  instr >>entry;
1195  }
1196  instr >> (*_attribPtr)[entry];
1197  }
1198  CallCallback();
1199  return instr;
1200  }
1201 };
1202 
1203 
1204 
1205 /** \class DistiAttributeStdVector
1206  * An attribute for a std::vector
1207  * T must be related to std::vector
1208  */
1209 template <class T, bool showIndex /* In the output */>
1211 {
1212 private:
1213  T* _attribPtr;
1214 
1216 
1217 public:
1218 
1219  DistiAttributeStdVector(CallbackMethodCallerBase* callback, const AttributeName &name, T* attribPtr) :
1220  DistiAttributeBase(callback,name,false),
1221  _attribPtr(attribPtr)
1222  {
1223  }
1224 
1225  // Create a new std::vector
1227  DistiAttributeBase(callback,name,true),
1228  _attribPtr( new T() )
1229  {
1230  }
1231 
1232  virtual ~DistiAttributeStdVector()
1233  {
1234  if (_localStorage)
1235  {
1236  delete _attribPtr;
1237  }
1238  _attribPtr = NULL;
1239  }
1240 
1241  virtual bool OkToWrite() const
1242  {
1243  return ( _attribPtr != NULL && _attribPtr->size() );
1244  }
1245 
1246  virtual std::ostream & WriteValue(std::ostream &outstr)
1247  {
1248  if (_attribPtr != NULL)
1249  {
1250  int numEntries = _attribPtr->size();
1251  outstr << numEntries;
1252 
1253  DistiAttribDict::SpacingInc();
1254 
1255  for (int i = 0 ; i < numEntries; i++ )
1256  {
1257  outstr << std::endl;
1258 
1259  if (showIndex)
1260  {
1261  outstr << DistiAttribDict::SpacingString() <<i<<" ";
1262  }
1263  outstr.width(1);
1264  outstr << DistiAttribDict::SpacingString() <<(*_attribPtr)[i]<<" ";
1265 
1266  }
1267  DistiAttribDict::SpacingDec();
1268 
1269  }
1270  return outstr;
1271  }
1272 
1273  virtual std::istream & ReadValue(std::istream &instr)
1274  {
1275  if( _attribPtr != NULL )
1276  {
1277  int numEntries;
1278  instr >> numEntries;
1279 
1280  _attribPtr->resize(numEntries); // Set count of objects in
1281  int entry;
1282  for (int i = 0 ; i < numEntries; i++ )
1283  {
1284  entry = i;
1285  if (showIndex)
1286  {
1287  instr >>entry;
1288  }
1289  instr >> (*_attribPtr)[entry];
1290  }
1291  CallCallback();
1292  }
1293 
1294  return instr;
1295  }
1296 };
1297 
1298 /** An attribute for a DynamicArray of homogeneous items
1299  * T must have ReadValue and WriteValue methods
1300  * Replacement for DistiAttributeHomogeneousAttributeArray
1301  */
1302 template <class T>
1304 {
1305 public:
1306  typedef T* (*CreateItemCb)();
1307 
1308 protected:
1309  DynamicArray<T*> *_array;
1310  CreateItemCb _createCb;
1311 public:
1312  // Constructor requires a dynamic array of T*.
1314  (const AttributeName &name, DynamicArray<T*> *array, CreateItemCb createCb) :
1315  DistiAttributeBase(NULL,name,false),
1316  _array(array),
1317  _createCb(createCb)
1318  {
1319  }
1321 
1322  virtual bool OkToWrite() const { return _array && _array->Size(); }
1323 
1324  virtual std::ostream & WriteValue(std::ostream &outstr)
1325  {
1326  outstr << "\n" <<
1327  DistiAttribDict::SpacingString() << "{\n";
1328  DistiAttribDict::SpacingInc();
1329  for (unsigned int i = 0; i < _array->Count(); i++)
1330  {
1331  if ((*_array)[i])
1332  {
1333  outstr << DistiAttribDict::SpacingString();
1334  outstr <<"Item: "; // Everything in the list is called Item
1335  ((*_array)[i])->WriteValue(outstr);
1336  outstr << "\n";
1337  }
1338  }
1339  DistiAttribDict::SpacingDec();
1340  outstr << DistiAttribDict::SpacingString() << "}\n";
1341  return outstr;
1342  }
1343  virtual std::istream & ReadValue(std::istream &instr)
1344  {
1345  // Scan through the token including the ':'
1346  std::string buf;
1347 
1348  while (DistiAttribDict::ScanToken(instr, buf))
1349  {
1350  if (!buf.length())
1351  continue;
1352 
1353  if (buf == "Item")
1354  {
1355  // Eat the space between the : and the data
1356  instr.get();
1357  // Dynamically create it, and add it to the end of the list
1358  T* temp = dynamic_cast<T*>(_createCb());
1359  if (temp)
1360  {
1361  _array->InsertObject( temp );
1362  (*_array)[_array->Count()-1]->ReadValue(instr);
1363  }
1364  }
1365 
1366  }
1367  return instr;
1368  }
1369 
1370 };
1371 /** The attribute used in generated code for accessing class properties
1372  * It can have a get method, set method, and an attribute pointer, or almost
1373  * any combination of the three.
1374  * T must have a default constructor, even if it doesn't initialize.
1375  * SetArgT is the argument type for the SetMethodType.
1376  * Specify this if the argument for the Set call is not "const &T".
1377  * The get and set methods are called when the attribute interface is used for access.
1378  * If the methods are not provided, the attribute stream operators are used instead.
1379  * If the property does not have a method or attribute pointer, it will not be able to read/write its value.
1380  */
1381 template <class containerT, class T, class SetArgT = const T&>
1383 {
1384 public:
1385  typedef DistiAttribute<T> _BaseClass;
1386  typedef void (containerT::*SetMethodType)(SetArgT);
1387  typedef T (containerT::*GetMethodType)();
1388  typedef T (containerT::*GetMethodConstType)() const;
1389 
1390  float _precision;
1391  //T* _attribPtr;
1392  containerT* _container;
1393  SetMethodType _setMethod;
1394  GetMethodType _getMethod;
1395 
1396  // NULLs are OK
1397  DistiAttributeProperty(const AttributeName &name, containerT* frame, T* attribPtr, SetMethodType setMethod, GetMethodType getMethod) :
1398  _BaseClass(NULL,name,attribPtr),
1399  _precision(0),
1400  _container(frame),
1401  _setMethod(setMethod),
1402  _getMethod(getMethod)
1403  {
1404  // Automatically use some precision for floats
1405  if ( typeid( T ) == typeid( float ) ||
1406  typeid( T ) == typeid( double )||
1407  typeid( T ) == typeid( long double ))
1408  {
1409  _precision = 10;
1410  }
1411  }
1412 
1413  virtual bool OkToWrite() const DISTI_METHOD_OVERRIDE
1414  {
1415  return (this->_attribPtr || _getMethod);
1416  }
1417 
1418  // The DistiAttribute<> classes override the DistiAttributeBase implementation for these methods. Here, we revert back to the DistiAttributeBase implementation
1419 
1420  virtual std::string ValueString() DISTI_METHOD_OVERRIDE { return DistiAttributeBase::ValueString(); }
1421  virtual void ValueString(const std::string& s) DISTI_METHOD_OVERRIDE { DistiAttributeBase::ValueString( s ); }
1422 
1423  virtual long ValueInt() DISTI_METHOD_OVERRIDE { return DistiAttributeBase::ValueInt(); }
1424  virtual void ValueInt(long val) DISTI_METHOD_OVERRIDE { DistiAttributeBase::ValueInt( val ); }
1425 
1426  virtual double ValueFloat() DISTI_METHOD_OVERRIDE { return DistiAttributeBase::ValueFloat(); }
1427  virtual void ValueFloat(double val) DISTI_METHOD_OVERRIDE { DistiAttributeBase::ValueFloat( val ); }
1428 
1429  virtual std::ostream & WriteValue(std::ostream &outstr) DISTI_METHOD_OVERRIDE
1430  {
1431 
1432  if (_precision > 0)
1433  outstr.precision(int(_precision));
1434 
1435  if (_getMethod && _container)
1436  {
1437  // Save the current _attribPtr
1438  T* tempAttribPtr = this->_attribPtr;
1439 
1440  // Get the value from the method
1441  T temp( (_container->*_getMethod)() );
1442 
1443  // Temporarily change the _attribPtr
1444  this->_attribPtr = &temp;
1445 
1446  // Call the base class to format the _attribPtr
1447  _BaseClass::WriteValue(outstr);
1448 
1449  // Put the _attribPtr back to where it belongs
1450  this->_attribPtr = tempAttribPtr;
1451  }
1452  else if (this->_attribPtr)
1453  {
1454  _BaseClass::WriteValue(outstr);
1455  }
1456 
1457  return outstr;
1458  }
1459 
1460  virtual std::istream & ReadValue(std::istream &instr) DISTI_METHOD_OVERRIDE
1461  {
1462  if (_setMethod && _container)
1463  {
1464  // Save the current _attribPtr
1465  T* tempAttribPtr = this->_attribPtr;
1466  T temp;
1467 
1468  // Set _attribPtr to the temp variable;
1469  this->_attribPtr = &temp;
1470 
1471  // Call the base class to format the input
1472  _BaseClass::ReadValue(instr);
1473 
1474  // Call the method
1475  (_container->*_setMethod)( temp );
1476 
1477  this->_attribPtr = tempAttribPtr;
1478  }
1479  else if (this->_attribPtr)
1480  {
1481  _BaseClass::ReadValue(instr);
1482  }
1483 
1484  return instr;
1485  }
1486 
1487  virtual T Value() DISTI_METHOD_OVERRIDE
1488  {
1489  if (_getMethod && _container)
1490  {
1491  // Get the value from the method
1492  return (_container->*_getMethod)();
1493 
1494  }
1495  else if (this->_attribPtr)
1496  {
1497  return _BaseClass::Value();
1498  }
1499  else
1500  {
1501  return T();
1502  }
1503  }
1504 
1505  virtual void Value( const T& val ) DISTI_METHOD_OVERRIDE // this has to match the base class's prototype so we override it, ie can't use SetArgT here
1506  {
1507  if( _setMethod && _container )
1508  {
1509  ( _container->*_setMethod )( val );
1510  }
1511  else if( this->_attribPtr )
1512  {
1513  _BaseClass::Value( val );
1514  }
1515  }
1516 };
1517 
1518 /** Overloaded helper function to create a DistiAttributeProperty where the setter param is of type Type and the getter is non-const. (See other varians below.)
1519  * \tparam Type The type of the property (int, float, glsColor, etc.)
1520  * \tparam Class The class of the object that owns this parameter (typically a subclass of DisplayObject)
1521  * \param attrName The attribute name for this property.
1522  * \param obj The display object instance associated with this property.
1523  * \param setMethod The setter method for the property (can be NULL)
1524  * \param getMethod The getter method for the property (can be NULL)
1525  * \return The DistiAttributeProperty instance, which is owned by the caller.
1526  * \code
1527  * Attributes().Add( CreateDistiAttributeProperty<int>( MetaTextureIndex, this, &DisplayObject::TextureIndex, &DisplayObject::TextureIndex ) );
1528  * \endcode
1529  */
1530 template <typename Type, class Class>
1532  const AttributeName& attrName,
1533  Class* const obj,
1535  const typename DistiAttributeProperty<Class, Type, Type>::GetMethodType getMethod = NULL )
1536 {
1537  return new DistiAttributeProperty<Class, Type, Type>( attrName, obj, NULL, setMethod, getMethod );
1538 }
1539 
1540 /** Overloaded helper function to create a DistiAttributeProperty where the getter is const. */
1541 template <typename Type, class Class>
1543  const AttributeName& attrName,
1544  Class* const obj,
1547 {
1548  return new DistiAttributeProperty<Class, Type, Type>( attrName, obj, NULL, setMethod,
1549  reinterpret_cast<typename DistiAttributeProperty<Class, Type>::GetMethodType>( getMethod ) );
1550 }
1551 
1552 /** Overloaded helper function to create a DistiAttributeProperty where there is no setter method and the getter is const. */
1553 template <typename Type, class Class>
1555  const AttributeName& attrName,
1556  Class* const obj,
1558 {
1559  return new DistiAttributeProperty<Class, Type>( attrName, obj, NULL, NULL,
1560  reinterpret_cast<typename DistiAttributeProperty<Class, Type>::GetMethodType>( getMethod ) );
1561 }
1562 
1563 /** Overloaded helper function to create a DistiAttributeProperty where there is no setter method and the getter is non-const. */
1564 template <typename Type, class Class>
1566  const AttributeName& attrName,
1567  Class* const obj,
1568  const typename DistiAttributeProperty<Class, Type>::GetMethodType getMethod )
1569 {
1570  return new DistiAttributeProperty<Class, Type>( attrName, obj, NULL, NULL, getMethod );
1571 }
1572 
1573 /** Overloaded helper function to create a DistiAttributeProperty where the setter param is of type const Type& and the getter is non-const. */
1574 template <typename Type, class Class>
1576  const AttributeName& attrName,
1577  Class* const obj,
1579  const typename DistiAttributeProperty<Class, Type, const Type&>::GetMethodType getMethod = NULL )
1580 {
1581  return new DistiAttributeProperty<Class, Type, const Type&>( attrName, obj, NULL, setMethod, getMethod );
1582 }
1583 
1584 /** Overloaded helper function to create a DistiAttributeProperty where the setter param is of type const Type& and the getter is const. */
1585 template <typename Type, class Class>
1587  const AttributeName& attrName,
1588  Class* const obj,
1591 {
1592  return new DistiAttributeProperty<Class, Type, const Type&>( attrName, obj, NULL, setMethod,
1593  reinterpret_cast<typename DistiAttributeProperty<Class, Type, const Type&>::GetMethodType>( getMethod ) );
1594 }
1595 
1596 /** An empty attribute used where a reference to an attribute
1597  * must be returned, but needs to be blank
1598  */
1600 {
1601 public:
1603  DistiAttributeBase(NULL, AttributeName("EmptyAttribute"), false)
1604  {
1605  }
1606 
1607  /** Write nothing */
1608  virtual std::ostream & WriteValue(std::ostream &outstr)
1609  {
1610  return outstr;
1611  }
1612  /** Read nothing */
1613  virtual std::istream & ReadValue(std::istream &instr)
1614  {
1615  return instr;
1616  }
1617 
1618 };
1619 
1620 
1621 /** \class DistiAttributeEnumDirect
1622  * A Disti Attribute which reads and writes enumerations directly, bypassing method calls.
1623  */
1624 template<class enumType>
1626 {
1627 protected:
1628  enumType *_attribPtr;
1629 public:
1630 
1631  DistiAttributeEnumDefList *_pairList;
1632 
1633  DistiAttributeEnumDirect(CallbackMethodCallerBase* callback, const AttributeName &name, enumType *attribPtr, DistiAttributeEnumDefList *pairList) :
1634  DistiAttributeBase(callback,name,false),
1635  _attribPtr(attribPtr),
1636  _pairList(pairList)
1637  {
1638 
1639  }
1640  DistiAttributeEnumDirect(CallbackMethodCallerBase* callback, const AttributeName &name, const enumType& value, DistiAttributeEnumDefList *pairList) :
1641  DistiAttributeBase(callback,name,true),
1642  _attribPtr(new enumType(value)),
1643  _pairList(pairList)
1644  {
1645  }
1646 
1647  virtual ~DistiAttributeEnumDirect()
1648  {
1649  if (_localStorage && _attribPtr)
1650  delete _attribPtr;
1651  //delete _pairList; // This must point to persistant
1652  }
1653 
1654  virtual long ValueInt() { return (long)*_attribPtr; };
1655  virtual void ValueInt(long val) { *_attribPtr = (enumType)val; };
1656 
1657  virtual DistiAttributeBase& operator = (const DistiAttributeBase & oldClass)
1658  {
1659  DistiAttributeEnumDirect* ptr=dynamic_cast<DistiAttributeEnumDirect*>(const_cast<DistiAttributeBase*>(&oldClass));
1660  if (ptr)
1661  {
1662  *_attribPtr = (enumType)*(ptr->_attribPtr);
1663  CallCallback();
1664  }
1665  else
1666  {
1667  return DistiAttributeBase::operator = (oldClass);
1668  }
1669  return *this;
1670  }
1671  virtual std::ostream & WriteValue(std::ostream &outstr)
1672  {
1673  bool foundIt = false;
1674 #ifndef __VXWORKS__
1675  typename DistiAttributeEnumDefList::iterator item = _pairList->begin();
1676  while (item != _pairList->end())
1677  {
1678  if ((*item)->_enum == *_attribPtr)
1679  {
1680  outstr << (*item)->_string;
1681  foundIt = true;
1682  break;
1683  }
1684  ++item;
1685  }
1686  if (!foundIt)
1687  {
1688  //Didn't find it so just write the number
1689  outstr << (int)*_attribPtr;
1690  }
1691 #endif
1692 
1693  return outstr;
1694  }
1695  virtual std::istream & ReadValue(std::istream &instr)
1696  {
1697 #ifndef __VXWORKS__
1698  char value[64];
1699  instr >> value;
1700 
1701  bool foundIt = false;
1702  typename DistiAttributeEnumDefList::iterator item = _pairList->begin();
1703 
1704  // First look by enumeration
1705  while (item != _pairList->end())
1706  {
1707  if (strcmp((*item)->_string, value) == 0)
1708  {
1709  *_attribPtr = (enumType)(*item)->_enum;
1710  CallCallback();
1711 
1712  foundIt = true;
1713  break;
1714  }
1715  ++item;
1716  }
1717 
1718  // If not found, assume that the numerical value is specified.
1719  if (!foundIt)
1720  {
1721  *_attribPtr = (enumType) atoi(value);
1722  CallCallback();
1723  }
1724 #endif
1725 
1726  return instr;
1727  }
1728 };
1729 
1730 
1731 
1732 ////////////////////////////////////////////////////////////////////////////////
1733 /// A macro for boilerplate code to setup a DisplayObject callback.
1734 /// \param instance The DisplayObject instance.
1735 /// \param Class The current class name, derived from DisplayObject.
1736 /// \param Method The class's method name for the callback.
1737 /// \code{.cpp}
1738 /// // Given a class ScrollList that inherits from DisplayObject...
1739 /// ScrollList::ScrollList()
1740 /// {
1741 /// DISTI_REGISTER_METHOD_CALLBACK( this, &ScrollList::EventCallback );
1742 /// }
1743 ///
1744 /// int ScrollList::EventCallback( Group* self, DisplayEvent* ev )
1745 /// {
1746 /// // ... event handler code ...
1747 /// }
1748 /// \endcode
1749 ////////////////////////////////////////////////////////////////////////////////
1750 #define DISTI_REGISTER_METHOD_CALLBACK( instance, Class, Method ) \
1751  { \
1752  typedef CallbackMethodCallerTemplate< Class, Class > Caller; \
1753  typedef typename Caller::MethodType1 MethodType; \
1754  const MethodType callback = reinterpret_cast<MethodType>( Method ); \
1755  ThisClass::CallbackCaller( new Caller( callback, instance ) ); \
1756  }
1757 
1758 ////////////////////////////////////////////////////////////////////////////////
1759 /// A macro for boilerplate code to setup a DisplayObject method caller for
1760 /// MethodType 1.
1761 /// \param object The DisplayObject instance.
1762 /// \param method The method that should be called.
1763 /// \param parent The parent to the object
1764 ////////////////////////////////////////////////////////////////////////////////
1765 #define DISTI_SET_OBJECT_CALLBACK1( object, method, parent ) \
1766  (object)->CallbackCaller( \
1767  new CallbackMethodCallerTemplate< DisplayObject, DisplayObject >( \
1768  ( disti::CallbackMethodCallerTemplate<DisplayObject, DisplayObject>::MethodType1 ) \
1769  (method), (parent) ) );
1770 
1771 ////////////////////////////////////////////////////////////////////////////////
1772 /// A macro for boilerplate code to setup a DisplayObject attribute.
1773 /// \param Type The type of the attribute.
1774 /// \param name The unique string name identifying the attribute.
1775 /// \param memberVarAddr A pointer to the member variable of type \a Type.
1776 /// Can be NULL if no member variable is desired.
1777 /// \sa DISTI_ADD_ATTRIBUTE_CALLBACK
1778 /// \sa DISTI_ADD_ATTRIBUTE_SET_GET
1779 ////////////////////////////////////////////////////////////////////////////////
1780 #define DISTI_ADD_ATTRIBUTE( Type, name, memberVarAddr ) \
1781  { \
1782  static const AttributeName attr( name ); \
1783  CallbackAttributeNotifier< ThisClass > cb( this, attr ); \
1784  this->Attributes().Add( new DistiAttribute<Type>(&cb, (attr), (memberVarAddr) ) ); \
1785  }
1786 
1787 ////////////////////////////////////////////////////////////////////////////////
1788 /// A macro for boilerplate code to setup a DisplayObject attribute that has a
1789 /// callback function.
1790 /// \param Type The type of the attribute.
1791 /// \param name The unique string name identifying the attribute.
1792 /// \param memberVarAddr A pointer to the member variable of type \a Type.
1793 /// Can be NULL if no member variable is desired.
1794 /// \param callbackFunction A member function pointer to the function called when this
1795 /// attribute is changed.
1796 /// \sa DISTI_ADD_ATTRIBUTE
1797 /// \sa DISTI_ADD_ATTRIBUTE_SET_GET
1798 ////////////////////////////////////////////////////////////////////////////////
1799 #define DISTI_ADD_ATTRIBUTE_CALLBACK( Type, name, memberVarAddr, callbackFunction ) \
1800  { \
1801  typedef void (ThisClass::*Method)(); /* Member function pointer */ \
1802  static const AttributeName attr( name ); \
1803  CallbackAttributeNotifier< ThisClass > cb( this, attr, reinterpret_cast<Method>( callbackFunction ) ); \
1804  this->Attributes().Add( new DistiAttribute<Type>( &cb, (attr), (memberVarAddr) ) ); \
1805  }
1806 
1807 ////////////////////////////////////////////////////////////////////////////////
1808 /// A macro for boilerplate code to setup a DisplayObject attribute that has a
1809 /// setter and a getter function.
1810 /// \param Type The type of the attribute.
1811 /// \param name The unique string name identifying the attribute.
1812 /// \param setter A member function pointer to the setter function (can be NULL)
1813 /// \param getter A member function pointer to the getter function (can be NULL)
1814 /// \sa DISTI_ADD_ATTRIBUTE
1815 /// \sa DISTI_ADD_ATTRIBUTE_CALLBACK
1816 ////////////////////////////////////////////////////////////////////////////////
1817 #define DISTI_ADD_ATTRIBUTE_SET_GET( Type, name, setter, getter) \
1818  { \
1819  static const AttributeName attr( name ); \
1820  this->Attributes().Add( CreateDistiAttributeProperty<Type>( attr, this, setter, getter ) ); \
1821  }
1822 
1823 ////////////////////////////////////////////////////////////////////////////////
1824 /// A macro for boilerplate code to setup a string as a DisplayObject attribute.
1825 /// \param name The unique string name identifying the attribute.
1826 /// \param memberVarAddr A pointer to the member variable of type std::string.
1827 /// Can be NULL if no member variable is desired.
1828 /// \sa DISTI_ADD_ATTRIBUTE_STRING_CALLBACK
1829 ////////////////////////////////////////////////////////////////////////////////
1830 #define DISTI_ADD_ATTRIBUTE_STRING( name, memberVarAddr ) \
1831  { \
1832  static const AttributeName attr( name ); \
1833  CallbackAttributeNotifier< ThisClass > cb( this, attr ); \
1834  this->Attributes().Add( new DistiAttributeEncodedStdString( &cb, attr, memberVarAddr ) ); \
1835  }
1836 
1837 ////////////////////////////////////////////////////////////////////////////////
1838 /// A macro for boilerplate code to setup a string as a DisplayObject attribute
1839 /// with a callback
1840 /// \param name The unique string name identifying the attribute.
1841 /// \param memberVarAddr A pointer to the member variable of type std::string.
1842 /// Can be NULL if no member variable is desired.
1843 /// \param callbackFunction The function that gets called when the attribute changes.
1844 /// \sa DISTI_ADD_ATTRIBUTE_STRING
1845 ////////////////////////////////////////////////////////////////////////////////
1846 #define DISTI_ADD_ATTRIBUTE_STRING_CALLBACK( name, memberVarAddr, callbackFunction ) \
1847  { \
1848  typedef void (ThisClass::*Method)(); /* Member function pointer */ \
1849  static const AttributeName attr( name ); \
1850  CallbackAttributeNotifier< ThisClass > cb( this, attr, reinterpret_cast<Method>( callbackFunction ) ); \
1851  this->Attributes().Add( new DistiAttributeEncodedStdString( &cb, attr, memberVarAddr ) ); \
1852  }
1853 
1854 } // namespace disti
1855 
1856 #endif
1857 
Definition: display_types.h:76
Definition: gls_metadata_attributes.h:215
Definition: gls_metadata_attributes.h:545
Definition: gls_metadata_attributes.h:231
Definition: display_types.h:101
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: gls_metadata_attributes.h:1324
Definition: display_types.h:74
virtual std::istream & ReadValue(std::istream &instr)
Definition: gls_metadata_attributes.h:1182
Definition: gls_metadata_attributes.h:1599
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: gls_metadata_attributes.h:743
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: gls_metadata_attributes.h:1002
Definition: vertex.h:365
The disti metadata.
The disti::Material class.
Definition: gls_metadata_attributes.h:524
virtual std::istream & ReadValue(std::istream &instr)
Definition: gls_metadata_attributes.h:764
Definition: gls_metadata_attributes.h:254
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: gls_metadata_attributes.h:890
virtual std::istream & ReadValue(std::istream &instr)
Definition: gls_metadata_attributes.h:1014
DistiAttributeProperty< Class, Type, const Type & > * CreateDistiAttributeProperty(const AttributeName &attrName, Class *const obj, const typename DistiAttributeProperty< Class, Type, const Type & >::SetMethodType setMethod, const typename DistiAttributeProperty< Class, Type, const Type & >::GetMethodConstType getMethod)
Definition: gls_metadata_attributes.h:1586
The disti::DynamicArray class. A templated array of objects capable of dynamically growing...
Definition: gls_metadata_attributes.h:1210
Definition: gls_metadata_attributes.h:198
Definition: gls_metadata_attributes.h:428
Definition: gls_metadata_attributes.h:353
Definition: display_types.h:153
Definition: gls_metadata_attributes.h:472
Definition: gls_metadata_attributes.h:593
virtual long ValueInt()
Definition: gls_metadata_attributes.h:1654
Definition: display_types.h:151
Definition: display_types.h:92
virtual bool OkToWrite() const
Definition: gls_metadata_attributes.h:619
virtual bool OkToWrite() const
Definition: gls_metadata_attributes.h:1150
Definition: display_types.h:104
Definition: gls_metadata_attributes.h:1625
Definition: display_types.h:93
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: disti_metadata.h:584
virtual bool operator==(const DistiAttributeBase &rArg)
Definition: gls_metadata_attributes.h:965
virtual T Value()
Definition: gls_metadata_attributes.h:1487
Definition: gls_metadata_attributes.h:993
virtual std::istream & ReadValue(std::istream &instr)
Definition: disti_metadata.h:598
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: gls_metadata_attributes.h:624
virtual std::istream & ReadValue(std::istream &instr)
Definition: gls_metadata_attributes.h:1273
Definition: display_types.h:103
virtual std::string ValueString()
Definition: gls_metadata_attributes.h:1420
void InsertObject(const T &obj, unsigned int loc)
Definition: dynamic_array.h:231
Definition: display_types.h:111
A file for all GL Studio files to include.
Definition: display_types.h:64
Definition: display_types.h:117
The disti::DisplayObject class and global enumerations.
Definition: gls_metadata_attributes.h:844
virtual void ValueString(const std::string &s)
Definition: gls_metadata_attributes.h:1421
unsigned int CallbackID
Type for unique identifiers.
Definition: disti_metadata.h:334
Definition: display_types.h:91
Definition: gls_metadata_attributes.h:1127
Definition: gls_metadata_attributes.h:1303
virtual std::istream & ReadValue(std::istream &instr)
Definition: gls_metadata_attributes.h:1343
Definition: gls_metadata_attributes.h:281
virtual bool OkToWrite() const
Definition: gls_metadata_attributes.h:394
Definition: gls_metadata_attributes.h:1064
Definition: display_types.h:102
Definition: disti_metadata.h:902
Definition: display_types.h:124
virtual void ValueInt(long val)
Definition: gls_metadata_attributes.h:1655
The List_c class. Generic linked list.
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: gls_metadata_attributes.h:1608
void Count(const unsigned int count)
Definition: dynamic_array.h:120
virtual void Add(DistiAttributeBase *attr)
Definition: display_types.h:152
Definition: display_types.h:65
Definition: display_types.h:63
Definition: gls_metadata_attributes.h:1045
Definition: disti_metadata.h:481
The disti::Vertex class. A class for manipulating 3D vertices.
Generally useful defines, macros, enumerations and function prototypes.
Definition: gls_metadata_attributes.h:1382
Definition: gls_metadata_attributes.h:398
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: gls_metadata_attributes.h:1671
Definition: disti_metadata.h:179
virtual long ValueInt()
Definition: disti_metadata.h:539
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: gls_metadata_attributes.h:1429
virtual std::istream & ReadValue(std::istream &instr)
Definition: gls_metadata_attributes.h:911
Definition: disti_metadata.h:162
Definition: display_types.h:62
Definition: gls_metadata_attributes.h:446
virtual double ValueFloat()
Definition: gls_metadata_attributes.h:1426
Definition: disti_metadata.h:676
Definition: disti_metadata.h:890
Definition: callback_caller_base.h:56
virtual bool OkToWrite() const
Definition: gls_metadata_attributes.h:1322
virtual std::istream & ReadValue(std::istream &instr)
Definition: gls_metadata_attributes.h:1613
Definition: display_types.h:95
virtual std::istream & ReadValue(std::istream &instr)
Definition: gls_metadata_attributes.h:1460
bool Equal(T1 x, T2 y, float precision=0.001f)
Definition: util.h:231
Definition: display_types.h:72
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: gls_metadata_attributes.h:1156
virtual bool OkToWrite() const
Definition: gls_metadata_attributes.h:1413
Definition: display_types.h:150
Definition: gls_metadata_attributes.h:556
AttributeName _name
Definition: disti_metadata.h:185
virtual long ValueInt()
Definition: gls_metadata_attributes.h:1423
virtual bool OkToWrite() const
Definition: gls_metadata_attributes.h:885
Definition: display_types.h:118
Definition: vertex.h:84
virtual void ValueFloat(double val)
Definition: gls_metadata_attributes.h:1427
virtual std::istream & ReadValue(std::istream &instr)
Definition: gls_metadata_attributes.h:645
virtual std::ostream & WriteValue(std::ostream &outstr)
Definition: gls_metadata_attributes.h:1246
Definition: display_types.h:94
Definition: gls_metadata_attributes.h:511
Definition: gls_metadata_attributes.h:697
Definition: display_types.h:75
Definition: display_types.h:71
virtual void Value(const T &val)
Definition: gls_metadata_attributes.h:1505
Definition: display_types.h:73
virtual bool OkToWrite() const
Definition: gls_metadata_attributes.h:1057
virtual std::istream & ReadValue(std::istream &instr)
Definition: gls_metadata_attributes.h:1695
Definition: gls_metadata_attributes.h:571
Definition: gls_metadata_attributes.h:370
Definition: gls_metadata_attributes.h:492
Definition: display_types.h:154
Definition: gls_metadata_attributes.h:307
Definition: disti_metadata.h:83
Definition: display_types.h:126
Definition: display_types.h:125
Definition: gls_metadata_attributes.h:330
unsigned int Size() const
Definition: dynamic_array.h:138
Definition: bmpimage.h:46
Definition: display_types.h:149
virtual void ValueInt(long val)
Definition: gls_metadata_attributes.h:1424
virtual bool OkToWrite() const
Definition: gls_metadata_attributes.h:1241
virtual bool operator==(const DistiAttributeBase &rArg)
Definition: gls_metadata_attributes.h:817
Definition: display_types.h:110
virtual bool OkToWrite() const
Definition: gls_metadata_attributes.h:738