HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PRM_Default.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: PRM_Default.h (Parameter Library)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __PRM_Default__
12 #define __PRM_Default__
13 
14 #include "PRM_API.h"
15 #include <SYS/SYS_Types.h>
16 #include <CH/CH_ExprLanguage.h>
17 
18 // These options can be OR'd and are processed in order from top to bottom.
20  PRM_DEFAULT_LOCK = 0x00000001,
21  PRM_DEFAULT_USER = 0x00000002,
22  PRM_DEFAULT_EXPR = 0x00000004,
23  PRM_DEFAULT_FCTY = 0x00000008,
24  PRM_DEFAULT_MASK = 0x0000000F
25 };
26 
27 #define PRM_FACTORY_DEF PRM_DefaultType( \
28  PRM_DEFAULT_LOCK | PRM_DEFAULT_FCTY)
29 #define PRM_USER_DEF PRM_DefaultType( \
30  PRM_FACTORY_DEF | PRM_DEFAULT_USER)
31 #define PRM_TRUE_FACTORY_DEF PRM_DefaultType( \
32  PRM_FACTORY_DEF | PRM_DEFAULT_EXPR)
33 #define PRM_FACTORY_UI_DEF PRM_DefaultType( \
34  PRM_TRUE_FACTORY_DEF & ~PRM_DEFAULT_LOCK)
35 
36 //
37 // For now, ordinal and animated parameters are both stored in a floating
38 // point number.
39 //
40 
42 {
43 public:
44  /// PRM_Default has two parts: a float and a string. For floating point
45  /// parameters, if the default string is defined, then the parameter will
46  /// start off being animated and have the channel expression defined by the
47  /// string. Otherwise, the floating point default is used for float and
48  /// integer types, while the string is used to initialize string types.
49  PRM_Default(fpreal thefloat=0,
50  const char *thestring = 0,
51  CH_StringMeaning string_meaning =
53 
54  fpreal getFloat() const { return myFloat; }
55  int getOrdinal() const { return (int)myFloat; }
56  bool gotString() const { return (myString) ? true : false; }
57  const char *getString() const { return (myString) ? myString : ""; }
59  { return myStringMeaning; }
60 
61  PRM_Default &operator=(const PRM_Default &dft);
62 
63  void set(fpreal thefloat, const char *thestring,
64  CH_StringMeaning string_meaning);
65 
66  void setFloat(fpreal v) { myFloat = v; }
67  void setOrdinal(int v) { myFloat = (fpreal)v; }
68  void setString(const char *v, bool free_existing = false);
69  void setStringMeaning(CH_StringMeaning string_meaning);
70 
71  /// NOTE: Based on the lack of destructor, PRM_Default does NOT
72  /// own *myString, but ownership semantics are bonkers in
73  /// these mysterious lands of PRM.
74  int64 getMemoryUsage(bool inclusive) const
75  { return inclusive ? sizeof(*this) : 0; }
76 
77 private:
78  fpreal myFloat;
79  const char *myString;
80  CH_StringMeaning myStringMeaning;
81 };
82 #endif
int getOrdinal() const
Definition: PRM_Default.h:55
CH_StringMeaning
const GLdouble * v
Definition: glcorearb.h:836
PRM_DefaultType
Definition: PRM_Default.h:19
void setFloat(fpreal v)
Definition: PRM_Default.h:66
CH_StringMeaning getStringMeaning() const
Definition: PRM_Default.h:58
fpreal getFloat() const
Definition: PRM_Default.h:54
long long int64
Definition: SYS_Types.h:106
const char * getString() const
Definition: PRM_Default.h:57
void setOrdinal(int v)
Definition: PRM_Default.h:67
double fpreal
Definition: SYS_Types.h:269
int64 getMemoryUsage(bool inclusive) const
Definition: PRM_Default.h:74
bool gotString() const
Definition: PRM_Default.h:56
#define PRM_API
Definition: PRM_API.h:10