HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PRM_Data.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_Data.h (Parameter Library)
7  *
8  * COMMENTS:
9  * PRM_Data contains the variable part of a Data
10  * parameter.
11  *
12  */
13 
14 #ifndef __PRM_Data__
15 #define __PRM_Data__
16 
17 #include "PRM_API.h"
18 #include "PRM_Instance.h"
19 
20 class PRM_ParmList;
21 class PRM_Template;
22 class CH_Channel;
23 class CH_Collection;
24 class CH_Manager;
25 class UT_JSONValueMap;
26 class UT_StringWrap;
27 
29 {
30 public:
31  PRM_Data(PRM_Template *thetemplateptr,
32  PRM_Parm *parm);
33  PRM_Data(PRM_Data *thesrcptr,
34  PRM_Parm *parm);
35  virtual ~PRM_Data();
36  virtual void adopt(PRM_Instance &thesrc);
37  virtual PRM_Instance *duplicateSelf(PRM_Parm *parm);
38 
39  virtual void setValueToDefault(fpreal time, int index,
40  PRM_AddKeyType add_key);
41  virtual void revertToDefault(int index);
42  virtual void revertToDefaults(bool clear_channels = true);
43  virtual void restoreFactoryDefault(int index);
44  virtual void overwriteDefault(fpreal time, int index);
45  virtual void overwriteDefaults(fpreal time);
46  virtual int isDefault(int index, enum PRM_DefaultType deftype,
47  bool basiccheck = true) const;
48  virtual void save(std::ostream &os, int binary, bool compiled) const;
49  virtual bool load(UT_IStream &is);
50 
51  virtual void saveUndoData(PRM_UndoDataHandle &data) const;
52  virtual bool loadUndoData(const PRM_UndoDataHandle &data);
53 
54  virtual void saveCommand(std::ostream &os, int values,
55  int index=-1) const;
56  virtual int loadCommand(int argc, const char *const argv[],
57  int index, bool values_only,
58  PRM_AddKeyType add_key,
59  PRM_KeySetType set_type);
60 
61  virtual void getValue(PRM_ParmList *thelist, fpreal thetime,
62  int32 &theintref, int theindex,
63  int thread) const;
64  virtual void getValue(PRM_ParmList *thelist, fpreal thetime,
65  int64 &theintref, int theindex,
66  int thread) const;
67  virtual void getValue(PRM_ParmList *thelist, fpreal thetime,
68  fpreal &thefloatref, int theindex,
69  int thread) const;
70  virtual void getValue(PRM_ParmList *thelist, fpreal thetime,
71  UT_String &thestrref, int theindex,
72  bool expand, int thread) const;
73  virtual void getValue(PRM_ParmList *thelist, fpreal thetime,
74  PRM_DataItemHandle &thedataref, int theindex,
75  int thread) const;
76  virtual void getValue(PRM_ParmList *thelist, fpreal time,
77  UT_JSONValueMap &themap, int index,
78  bool expand, int thread) const;
79 
80  // set value of a parameter
81  // setkey - determines how the value is set at keyframes. Whether the
82  // preference is used or always set as pending.
83  virtual void setValue(fpreal time,
84  const char *value,
85  CH_StringMeaning meaning,
86  bool kill_expr = false,
87  int index = 0,
90 
91  virtual void setValue(fpreal time,
92  fpreal value,
93  bool kill_expr = false,
94  int index = 0,
97 
98  virtual void setValue(fpreal time,
99  int32 value,
100  bool kill_expr = false,
101  int index = 0,
104 
105  virtual void setValue(fpreal time,
106  int64 value,
107  bool kill_expr = false,
108  int index = 0,
111 
112  virtual void setValue(fpreal time,
113  const PRM_DataItemHandle &value,
114  bool kill_expr = false,
115  const int index = 0,
118 
119  virtual void getExpressionStringForUI(fpreal thetime,
120  UT_String &thestrref,
121  int theindex,
122  int thread) const;
123  virtual void getExpression(fpreal thetime, UT_String &expr,
124  int theindex, bool allow_value,
125  int thread) const;
126  virtual void setExpression(fpreal time,
127  const char *expr,
128  CH_ExprLanguage language,
129  int index, bool evaluate = true,
130  bool rmchannel = false);
131  virtual void setDefaultChannelValue(CH_Channel *channelptr,
132  int theindex = 0);
133  virtual bool getMagicString(UT_TokenString &magic,
134  PRM_ParmList *list, int size,
135  fpreal t, bool add_if_default /*=true*/,
136  int thread);
137  //
138  // adds a keyframe if a change is pending
139  //
140  virtual void hardenChanges(fpreal thetime,
141  int theindex,
142  bool theforceflag,
143  const char *patt = 0,
144  CH_ChannelRefList *list = 0);
145 
146  virtual int64 getMemoryUsage(bool inclusive) const;
147 
148  bool setData(const PRM_DataItemHandle &b, fpreal time, int index);
149  PRM_DataItemHandle getData(fpreal time, int index) const;
150 
151 private:
152  void revertToDefaultWithoutRemovingChannel(
153  fpreal time, int index);
154 
155  /// @{
156  /// Helper methods for returning key-value dictionary (JSON map) values.
157  void expandJSONMap(
158  PRM_ParmList *thelist, fpreal time, int index,
159  int thread, const UT_JSONValueMap &src_map,
160  UT_JSONValueMap &expanded_map)
161  const;
162  bool expandJSONString(
163  CH_Manager *cman, CH_Collection *collection,
164  const PRM_ParmList *thelist, fpreal time,
165  int index, int thread, const char *str,
166  UT_StringWrap &expanded_str,
167  bool &is_time_dependent) const;
168  void copyJSONMap(
169  const UT_JSONValueMap &src_map,
170  UT_JSONValueMap &dest_map) const;
171 
172  mutable PRM_SpinLock myLock;
174 };
175 
176 #endif
virtual void setValueToDefault(fpreal time, int index, PRM_AddKeyType add_key)=0
PRM_AddKeyType
Definition: PRM_Parm.h:56
virtual void overwriteDefault(fpreal time, int index)=0
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
virtual void setDefaultChannelValue(CH_Channel *channelptr, int index=0)=0
CH_ExprLanguage
CH_StringMeaning
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
virtual void getExpression(fpreal time, UT_String &value, int index, bool allow_value, int thread) const =0
PRM_DefaultType
Definition: PRM_Default.h:19
PRM_KeySetType
virtual void setExpression(fpreal time, const char *value, CH_ExprLanguage language, int index, bool evaluate=true, bool rmchannel=false)
virtual void saveUndoData(PRM_UndoDataHandle &data) const
virtual void getValue(PRM_ParmList *parm_list, fpreal time, int32 &value, int index, int thread) const =0
Wrapper around hboost::shared_ptr.
Definition: UT_SharedPtr.h:27
virtual PRM_Instance * duplicateSelf(PRM_Parm *node)=0
GLsizeiptr size
Definition: glcorearb.h:663
virtual bool getMagicString(UT_TokenString &magic, PRM_ParmList *list, int size, fpreal t, bool add_if_default, int thread)=0
long long int64
Definition: SYS_Types.h:100
tbb::spin_rw_mutex PRM_SpinLock
Definition: PRM_Lock.h:22
virtual void saveCommand(std::ostream &os, int values=0, int index=-1) const =0
virtual void overwriteDefaults(fpreal time)=0
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:28
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
virtual bool load(UT_IStream &is)=0
virtual void hardenChanges(fpreal time, int index, bool theforceflag, const char *patt=0, CH_ChannelRefList *list=0)=0
virtual bool loadUndoData(const PRM_UndoDataHandle &data)
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:263
virtual int loadCommand(int argc, const char *const argv[], int index, bool values_only, PRM_AddKeyType add_key, PRM_KeySetType set_type)=0
virtual int isDefault(int index, enum PRM_DefaultType deftype, bool basiccheck=true) const
virtual void revertToDefault(int index)=0
GLuint index
Definition: glcorearb.h:785
virtual int64 getMemoryUsage(bool inclusive) const
virtual void getExpressionStringForUI(fpreal time, UT_String &value, int index, int thread) const =0
virtual void revertToDefaults(bool clear_channels=true)=0
#define PRM_API
Definition: PRM_API.h:10
virtual void restoreFactoryDefault(int index)=0
virtual void adopt(PRM_Instance &thesrcinstance)
virtual void setValue(fpreal time, const char *value, CH_StringMeaning meaning, bool kill_expr=false, int index=0, PRM_AddKeyType add_key=PRM_AK_MARK_PENDING, PRM_KeySetType setkey=PRM_USE_PREFERENCES)
virtual void save(std::ostream &os, int binary, bool compiled) const =0