HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PI_PropertyMap.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: PI_PropertyMap.h ( OP Library, C++)
7  *
8  * COMMENTS: When loading in old .hip files, there are some operators which
9  * want to handle obsolete parameters by creating spare
10  * properties. This class helps manage that process.
11  */
12 
13 #ifndef __PI_PropertyMap__
14 #define __PI_PropertyMap__
15 
16 #include "PI_API.h"
17 #include <UT/UT_SymbolTable.h>
18 
19 class PRM_ParmNameMap;
21 
23 public:
24  PI_PropertyMapDef(const char *parmname,
25  const char *propertyfile,
26  const char *propertyname,
27  const char *ch0=0, const char *ch1=0,
28  const char *ch2=0, const char *ch3=0)
29  {
30  myParm = parmname;
31  myPropFile = propertyfile;
32  myProperty = propertyname;
33  if (!ch0)
34  ch0 = myParm;
35  myChannels[0] = ch0;
36  myChannels[1] = ch1;
37  myChannels[2] = ch2;
38  myChannels[3] = ch3;
39  setRename(parmname, ch0, ch1, ch2, ch3);
40  }
41 
42  // If the parameter is re-named during loading, you can specify the NEW
43  // name (and channel names) here.
44  void setRename(const char *r, const char *ch0=0, const char *ch1=0,
45  const char *ch2=0, const char *ch3=0)
46  {
47  myRename = r;
48  myChRename[0] = ch0;
49  myChRename[1] = ch1;
50  myChRename[2] = ch2;
51  myChRename[3] = ch3;
52  }
53 
54  const char *getParm() const { return myParm; }
55  const char *getRename() const { return myRename; }
56  const char *getPropFile() const { return myPropFile; }
57  const char *getProperty() const { return myProperty; }
58  const char *getCh(int i) const { return myChannels[i]; }
59  const char *getChRename(int i) const { return myChRename[i]; }
60 private:
61  const char *myParm;
62  const char *myPropFile;
63  const char *myProperty;
64  const char *myRename;
65  const char *myChannels[4];
66  const char *myChRename[4];
67 };
68 
70 public:
72  virtual ~PI_PropertyMap();
73 
74  void setMap(int n, const PI_PropertyMapDef map[])
75  {
76  myMap = map;
77  myEntries = n;
78  createTokenMap();
79  }
80 
81  bool renameParameter(const char *oldname, const char *newname,
82  const char *newch0=0, const char *newch1=0,
83  const char *newch2=0, const char *newch3=0);
84  bool createFromChannel(PI_EditScriptedParms &editparms,
85  PRM_ParmNameMap *nmap,
86  const char *chname);
87 
88 private:
89  void createTokenMap();
90 
92  const PI_PropertyMapDef *myMap;
93  int myEntries;
94 };
95 
96 #endif
const char * getParm() const
void setRename(const char *r, const char *ch0=0, const char *ch1=0, const char *ch2=0, const char *ch3=0)
const char * getRename() const
#define PI_API
Definition: PI_API.h:10
GLdouble n
Definition: glcorearb.h:2008
const char * getPropFile() const
const char * getCh(int i) const
void setMap(int n, const PI_PropertyMapDef map[])
const char * getProperty() const
GLboolean r
Definition: glcorearb.h:1222
const char * getChRename(int i) const
PI_PropertyMapDef(const char *parmname, const char *propertyfile, const char *propertyname, const char *ch0=0, const char *ch1=0, const char *ch2=0, const char *ch3=0)