Changeset 1528 for trunk/src/objects
- Timestamp:
- Jun 22, 2009, 3:16:39 PM (15 years ago)
- Location:
- trunk/src/objects
- Files:
-
- 12 added
- 18 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/objects/Makefile.in
r1389 r1528 51 51 RpAccessor.h \ 52 52 RpArray1D.h \ 53 RpArray1DUniform.h \ 54 RpAxisMarker.h \ 53 55 RpBoolean.h \ 54 56 RpChain.h \ … … 58 60 RpInt.h \ 59 61 RpHashHelper.h \ 62 RpHistogram.h \ 60 63 RpNumber.h \ 64 RpPath.h \ 61 65 RpPlot.h \ 62 66 RpPool.h \ 67 RpScatter.h \ 63 68 RpString.h \ 64 RpVariable.h 69 RpTree.h \ 70 RpObject.h 65 71 66 72 LOCAL_HEADERS = \ … … 69 75 OBJS = \ 70 76 RpArray1D.o \ 77 RpArray1DUniform.o \ 78 RpAxisMarker.o \ 71 79 RpBoolean.o \ 72 80 RpChain.o \ … … 76 84 RpHash.o \ 77 85 RpHashHelper.o \ 86 RpHistogram.o \ 78 87 RpNumber.o \ 88 RpPath.o \ 79 89 RpPlot.o \ 80 90 RpPool.o \ 91 RpScatter.o \ 81 92 RpString.o \ 93 RpTree.o \ 82 94 RpUtils2.o \ 83 Rp Variable.o95 RpObject.o 84 96 85 97 -
trunk/src/objects/RpAccessor.h
r1386 r1528 76 76 // raise error and exit 77 77 } 78 strncpy(tmp,val,len); 79 tmp[len] = '\0'; 78 strncpy(tmp,val,len+1); 80 79 81 80 if (_val) { -
trunk/src/objects/RpArray1D.cc
r1386 r1528 17 17 using namespace Rappture; 18 18 19 const char Array1D::type[] = "RAPPTURE_AXIS_TYPE_IRREGULAR"; 20 const char Array1DUniform::type[] = "RAPPTURE_AXIS_TYPE_UNIFORM"; 21 22 Array1D::Array1D (const char *path) 23 : _val(SimpleDoubleBuffer()), 19 const char Array1D::type[] = "RAPPTURE_AXIS_TYPE_IRREGULAR"; 20 21 Array1D::Array1D() 22 : Object(), 24 23 _min(std::numeric_limits<double>::max()), 25 24 _max(std::numeric_limits<double>::min()) 26 25 { 27 this->path(path); 28 this->label(""); 29 this->desc(""); 30 this->units(""); 31 this->scale("linear"); 32 } 33 34 Array1D::Array1D ( 35 const char *path, 36 double *val, 37 size_t size 38 ) 39 : _val(SimpleDoubleBuffer()), 26 name(""); 27 label(""); 28 desc(""); 29 units(""); 30 scale("linear"); 31 } 32 33 Array1D::Array1D(const double *val, size_t size) 34 : Object(), 40 35 _min(std::numeric_limits<double>::max()), 41 36 _max(std::numeric_limits<double>::min()) 42 37 { 43 this->path(path);44 this->label("");45 this->desc("");46 this->units("");47 this->scale("linear");38 name(""); 39 label(""); 40 desc(""); 41 units(""); 42 scale("linear"); 48 43 append(val,size); 49 44 } 50 45 51 Array1D::Array1D (52 const char *path,53 double *val,54 size_t size,55 const char *label,56 const char *desc,57 const char *units,58 const char *scale59 )60 : _val(SimpleDoubleBuffer()),61 _min(std::numeric_limits<double>::max()),62 _max(std::numeric_limits<double>::min())63 {64 this->path(path);65 this->label(label);66 this->desc(desc);67 this->units(units);68 this->scale(scale);69 append(val,size);70 }71 72 46 // copy constructor 73 Array1D::Array1D ( const Array1D& o)47 Array1D::Array1D(const Array1D& o) 74 48 : _val(o._val), 75 49 _min(o._min), 76 50 _max(o._max) 77 51 { 78 this->path(o.path());79 this->label(o.label());80 this->desc(o.desc());81 this->units(o.units());82 this->scale(o.scale());52 name(o.name()); 53 label(o.label()); 54 desc(o.desc()); 55 units(o.units()); 56 scale(o.scale()); 83 57 } 84 58 … … 97 71 98 72 Array1D& 99 Array1D::append( 100 double *val, 101 size_t nmemb) 73 Array1D::append(const double *val, size_t nmemb) 102 74 { 103 75 double nmin = _min; … … 122 94 123 95 /**********************************************************************/ 96 // METHOD: clear() 97 /// clear data values from the object 98 /** 99 * Clear data values from the object 100 */ 101 102 Array1D& 103 Array1D::clear() 104 { 105 _val.clear(); 106 return *this; 107 } 108 109 /**********************************************************************/ 124 110 // METHOD: read() 125 111 /// Read values from the axis object into a memory location … … 129 115 130 116 size_t 131 Array1D::read( 132 double *val, 133 size_t nmemb) 117 Array1D::read(double *val, size_t nmemb) 134 118 { 135 119 return _val.read(val,nmemb); … … 188 172 } 189 173 174 /**********************************************************************/ 175 // METHOD: xml() 176 /// Return the xml text representation of this object 177 /** 178 * Return the xml text representation of this object 179 */ 180 181 const char * 182 Array1D::xml() 183 { 184 return ""; 185 } 186 187 /**********************************************************************/ 188 // METHOD: xml() 189 /// Return the xml text representation of this object 190 /** 191 * Return the xml text representation of this object 192 */ 193 194 const int 195 Array1D::is() const 196 { 197 // return "ar1d" in hex 198 return 0x61723164; 199 } 200 190 201 // -------------------------------------------------------------------- // 191 202 -
trunk/src/objects/RpArray1D.h
r1397 r1528 14 14 #include "RpAccessor.h" 15 15 #include "RpSimpleBuffer.h" 16 #include "RpObject.h" 16 17 17 18 namespace Rappture { 18 19 19 class Array1D 20 class Array1D : public Object 20 21 { 21 22 public: 22 Array1D (const char *path); 23 Array1D (const char *path, double *val, size_t size); 24 Array1D (const char *path, 25 double *val, 26 size_t size, 27 const char *label, 28 const char *desc, 29 const char *units, 30 const char *scale); 23 24 Array1D(); 25 Array1D (const double *val, size_t size); 31 26 Array1D (const Array1D &o); 32 27 virtual ~Array1D(); 33 28 34 Accessor<const char *> path; 35 Accessor<const char *> label; 36 Accessor<const char *> desc; 29 Accessor<const char *> name; 37 30 Accessor<const char *> units; 38 31 Accessor<const char *> scale; 39 32 40 virtual Array1D& append(double *val, size_t nmemb); 33 virtual Array1D& append(const double *val, size_t nmemb); 34 virtual Array1D& clear(); 41 35 virtual size_t read(double *val, size_t nmemb); 42 36 virtual size_t nmemb() const; … … 47 41 static const char type[]; 48 42 49 private: 43 const char *xml(void); 44 const int is(void) const; 45 46 protected: 50 47 51 48 SimpleDoubleBuffer _val; … … 54 51 }; 55 52 56 class Array1DUniform57 {58 public:59 Array1DUniform (const char *path);60 Array1DUniform (const char *path, double begin, double end, size_t step);61 Array1DUniform (const char *path,62 double begin,63 double end,64 size_t step,65 const char *label,66 const char *desc,67 const char *units,68 const char *scale);69 Array1DUniform (const Array1DUniform &o);70 virtual ~Array1DUniform ();71 72 Accessor<const char *> path;73 Accessor<const char *> label;74 Accessor<const char *> desc;75 Accessor<const char *> units;76 Accessor<const char *> scale;77 Accessor<double> begin;78 Accessor<double> end;79 Accessor<size_t> step;80 81 size_t read(double *val, size_t nmemb);82 const double *data() const;83 virtual size_t nmemb() const;84 static const char type[];85 86 private:87 SimpleDoubleBuffer _val;88 89 };90 53 } // namespace Rappture 91 54 -
trunk/src/objects/RpBoolean.cc
r1386 r1528 21 21 int val 22 22 ) 23 : Variable()23 : Object () 24 24 { 25 25 this->path(path); … … 34 34 const char *desc 35 35 ) 36 : Variable()36 : Object () 37 37 { 38 38 this->path(path); … … 45 45 // copy constructor 46 46 Boolean::Boolean ( const Boolean& o ) 47 : Variable(o)47 : Object(o) 48 48 { 49 49 this->def(o.def()); … … 57 57 } 58 58 59 /**********************************************************************/ 60 // METHOD: xml() 61 /// view this object's xml 62 /** 63 * View this object as an xml element returned as text. 64 */ 65 66 const char * 67 Boolean::xml() 68 { 69 Path p(path()); 70 _tmpBuf.clear(); 71 72 // FIXME: boolean should print yes/no 73 74 _tmpBuf.appendf( 75 "<boolean id=\"%s\">\n\ 76 <about>\n\ 77 <label>%s</label>\n\ 78 <description>%s</description>\n\ 79 </about>\n\ 80 <default>%i</default>\n\ 81 <current>%i</current>\n\ 82 </boolean>", 83 p.id(),label(),desc(),def(),cur()); 84 85 return _tmpBuf.bytes(); 86 } 87 88 /**********************************************************************/ 89 // METHOD: is() 90 /// what kind of object is this 91 /** 92 * return hex value telling what kind of object this is. 93 */ 94 95 const int 96 Boolean::is() const 97 { 98 // return "bool" in hex 99 return 0x626F6F6C; 100 } 101 59 102 // -------------------------------------------------------------------- // -
trunk/src/objects/RpBoolean.h
r1386 r1528 9 9 */ 10 10 11 #include "Rp Variable.h"11 #include "RpObject.h" 12 12 13 13 #ifndef RAPPTURE_BOOLEAN_H … … 16 16 namespace Rappture { 17 17 18 class Boolean : public Variable18 class Boolean : public Object 19 19 { 20 20 public: … … 34 34 Accessor<int> cur; 35 35 36 const char *xml(); 37 const int is() const; 36 38 }; 37 39 … … 39 41 40 42 /*--------------------------------------------------------------------------*/ 41 /*--------------------------------------------------------------------------*/42 43 43 44 #endif -
trunk/src/objects/RpChainHelper.c
r1386 r1528 110 110 111 111 len = strlen((char*)from); 112 *to = (void*) malloc(len*sizeof(char) );113 str cpy((char*)(*to),(char*)from);112 *to = (void*) malloc(len*sizeof(char)+1); 113 strncpy((char*)(*to),(char*)from,len+1); 114 114 return 0; 115 115 } -
trunk/src/objects/RpChainHelper.h
r1386 r1528 22 22 int (*cpyFxn)(void **to,void *from)); 23 23 24 int Rp_ChainCharCpyFxn (void **to, void *from); 25 int Rp_ChainCharCmpFxn (void *to, void *from); 26 27 24 28 #ifdef __cplusplus 25 29 } -
trunk/src/objects/RpChoice.cc
r1386 r1528 20 20 const char *val 21 21 ) 22 : Variable(),22 : Object (), 23 23 _options (NULL) 24 24 { … … 36 36 const char *desc 37 37 ) 38 : Variable(),38 : Object (), 39 39 _options (NULL) 40 40 { … … 48 48 // copy constructor 49 49 Choice::Choice ( const Choice& o ) 50 : Variable(o)50 : Object(o) 51 51 { 52 52 this->def(o.def()); … … 142 142 } 143 143 144 /**********************************************************************/ 145 // METHOD: xml() 146 /// view this object's xml 147 /** 148 * View this object as an xml element returned as text. 149 */ 150 151 const char * 152 Choice::xml() 153 { 154 Path p(path()); 155 _tmpBuf.clear(); 156 157 _tmpBuf.appendf( 158 "<choice id='%s'>\n\ 159 <about>\n\ 160 <label>%s</label>\n\ 161 <description>%s</description>\n\ 162 </about>\n", 163 p.id(),label(),desc()); 164 165 Rp_ChainLink *l = NULL; 166 l = Rp_ChainFirstLink(_options); 167 while (l != NULL) { 168 option *op = (option *)Rp_ChainGetValue(l); 169 _tmpBuf.appendf( 170 " <option>\n\ 171 <about>\n\ 172 <label>%s</label>\n\ 173 <description>%s</description>\n\ 174 </about>\n\ 175 <value>%s</value>\n\ 176 </option>\n", 177 op->label(),op->desc(),op->val()); 178 l = Rp_ChainNextLink(l); 179 } 180 181 _tmpBuf.appendf( 182 " <default>%s</default>\n\ 183 <current>%s</current>\n\ 184 </choice>", 185 def(),cur()); 186 187 return _tmpBuf.bytes(); 188 } 189 190 /**********************************************************************/ 191 // METHOD: is() 192 /// what kind of object is this 193 /** 194 * return hex value telling what kind of object this is. 195 */ 196 197 const int 198 Choice::is() const 199 { 200 // return "choi" in hex 201 return 0x63686F69; 202 } 203 144 204 // -------------------------------------------------------------------- // 145 205 -
trunk/src/objects/RpChoice.h
r1386 r1528 9 9 */ 10 10 #include <errno.h> 11 #include "Rp Variable.h"11 #include "RpObject.h" 12 12 #include "RpChain.h" 13 13 … … 17 17 namespace Rappture { 18 18 19 class Choice : public Variable19 class Choice : public Object 20 20 { 21 21 public: … … 41 41 Choice& delOption ( const char *label); 42 42 43 const char *xml(); 44 const int is() const; 45 43 46 private: 44 47 … … 46 49 Rp_Chain *_options; 47 50 48 struct option{51 typedef struct { 49 52 Accessor<const char *> label; 50 53 Accessor<const char *> desc; 51 54 Accessor<const char *> val; 52 } ;55 } option; 53 56 }; 54 57 -
trunk/src/objects/RpCurve.cc
r1386 r1528 16 16 using namespace Rappture; 17 17 18 /* 19 const char Curve::format[] = "RAPPTURE::CURVE::FORMAT"; 20 const char Curve::id[] = "RAPPTURE::CURVE::ID"; 21 const char Curve::creator[] = "RAPPTURE::CURVE::CREATOR"; 22 */ 23 const char Curve::x[] = "xaxis"; 24 const char Curve::y[] = "yaxis"; 25 26 Curve::Curve () 27 : Object (), 28 _axisList (NULL) 29 { 30 this->path(""); 31 this->label(""); 32 this->desc(""); 33 this->group(""); 34 } 35 18 36 Curve::Curve (const char *path) 19 : Variable(),20 _axisList(NULL)37 : Object (), 38 _axisList (NULL) 21 39 { 22 40 this->path(path); … … 26 44 } 27 45 28 Curve::Curve ( 29 const char *path, 30 const char *label, 31 const char *desc, 32 const char *group 33 ) 34 : Variable (), 35 _axisList (NULL) 46 Curve::Curve (const char *path, const char *label, const char *desc, 47 const char *group) 48 : Object (), 49 _axisList (NULL) 36 50 { 37 51 this->path(path); … … 43 57 // copy constructor 44 58 Curve::Curve ( const Curve& o ) 45 : Variable(o)59 : Object(o) 46 60 { 47 61 this->path(o.path()); … … 69 83 */ 70 84 71 Curve& 85 Array1D * 72 86 Curve::axis( 87 const char *name, 73 88 const char *label, 74 89 const char *desc, 75 90 const char *units, 76 91 const char *scale, 77 double *val,92 const double *val, 78 93 size_t size) 79 94 { 80 95 Array1D *a = NULL; 81 SimpleCharBuffer apath(path()); 82 83 apath.append("."); 84 apath.append(label); 85 86 a = new Array1D(apath.bytes(),val,size,label,desc,units,scale); 87 if (!a) { 96 97 a = new Array1D(val,size); 98 if (a == NULL) { 88 99 // raise error and exit 89 } 100 return NULL; 101 } 102 a->name(name); 103 a->label(label); 104 a->desc(desc); 105 a->units(units); 106 a->scale(scale); 90 107 91 108 if (_axisList == NULL) { … … 93 110 if (_axisList == NULL) { 94 111 // raise error and exit 112 delete a; 113 return NULL; 95 114 } 96 115 } … … 98 117 Rp_ChainAppend(_axisList,a); 99 118 100 return *this; 101 } 102 103 /* 104 Curve& 105 Curve::addAxis( 106 const char *path) 107 { 108 return *this; 109 } 110 */ 119 return a; 120 } 111 121 112 122 /**********************************************************************/ … … 118 128 119 129 Curve& 120 Curve::delAxis(const char * label)130 Curve::delAxis(const char *name) 121 131 { 122 132 Array1D *a = NULL; 123 133 Rp_ChainLink *l = NULL; 124 l = __searchAxisList(label); 125 126 if (l == NULL) { 127 return *this; 128 } 129 130 a = (Array1D *) Rp_ChainGetValue(l); 131 delete a; 132 Rp_ChainDeleteLink(_axisList,l); 134 l = __searchAxisList(name); 135 136 if (l != NULL) { 137 a = (Array1D *) Rp_ChainGetValue(l); 138 delete a; 139 Rp_ChainDeleteLink(_axisList,l); 140 } 133 141 134 142 return *this; … … 153 161 154 162 size_t ret = 0; 155 Rappture::Array1D *a = getAxis(label);163 Array1D *a = getAxis(label); 156 164 if (a != NULL) { 157 165 *arr = a->data(); … … 169 177 170 178 Array1D * 171 Curve::getAxis(const char * label) const179 Curve::getAxis(const char *name) const 172 180 { 173 181 Rp_ChainLink *l = NULL; 174 l = __searchAxisList( label);182 l = __searchAxisList(name); 175 183 176 184 if (l == NULL) { … … 182 190 183 191 Rp_ChainLink * 184 Curve::__searchAxisList(const char * label) const185 { 186 if ( label== NULL) {192 Curve::__searchAxisList(const char *name) const 193 { 194 if (name == NULL) { 187 195 return NULL; 188 196 } … … 193 201 194 202 Rp_ChainLink *l = NULL; 195 Rp_ChainLink *retval = NULL;203 Path p; 196 204 197 205 // traverse the list looking for the match … … 199 207 while (l != NULL) { 200 208 Array1D *a = (Array1D *) Rp_ChainGetValue(l); 201 const char *a label = a->label();202 if ((* label == *alabel) && (strcmp(alabel,label) == 0)) {209 const char *aname = a->name(); 210 if ((*name == *aname) && (strcmp(name,aname) == 0)) { 203 211 // we found matching entry, return it 204 retval = l;205 212 break; 206 213 } … … 208 215 } 209 216 210 return retval;217 return l; 211 218 } 212 219 … … 244 251 } 245 252 253 /**********************************************************************/ 254 // METHOD: xml() 255 /// Return the xml of the object 256 /** 257 * Return the xml of the object 258 */ 259 260 const char * 261 Curve::xml() 262 { 263 Path p(path()); 264 265 Array1D *tmpAxis = NULL; 266 size_t nmemb = 0; 267 268 const double *dataArr[dims()]; 269 270 _tmpBuf.clear(); 271 272 _tmpBuf.appendf( 273 "<curve id=\"%s\">\n\ 274 <about>\n\ 275 <group>%s</group>\n\ 276 <label>%s</label>\n\ 277 <description>%s</description>\n\ 278 </about>\n", p.id(),group(),label(),desc()); 279 280 for (size_t dim=0; dim < dims(); dim++) { 281 tmpAxis = getNthAxis(dim); 282 nmemb = tmpAxis->nmemb(); 283 dataArr[dim] = tmpAxis->data(); 284 _tmpBuf.appendf( 285 " <%s>\n\ 286 <label>%s</label>\n\ 287 <description>%s</description>\n\ 288 <units>%s</units>\n\ 289 <scale>%s</scale>\n\ 290 </%s>\n", 291 tmpAxis->name(), tmpAxis->label(), tmpAxis->desc(), 292 tmpAxis->units(), tmpAxis->scale(), tmpAxis->name()); 293 } 294 295 _tmpBuf.append(" <component>\n <xy>\n"); 296 for (size_t idx=0; idx < nmemb; idx++) { 297 for(size_t dim=0; dim < dims(); dim++) { 298 _tmpBuf.appendf("%10g",dataArr[dim][idx]); 299 } 300 _tmpBuf.append("\n",1); 301 } 302 _tmpBuf.append(" </xy>\n </component>\n</curve>"); 303 _tmpBuf.append("\0",1); 304 305 return _tmpBuf.bytes(); 306 } 307 308 /**********************************************************************/ 309 // METHOD: is() 310 /// what kind of object is this 311 /** 312 * return hex value telling what kind of object this is. 313 */ 314 315 const int 316 Curve::is() const 317 { 318 // return "curv" in hex 319 return 0x63757276; 320 } 321 322 246 323 // -------------------------------------------------------------------- // 247 324 -
trunk/src/objects/RpCurve.h
r1386 r1528 9 9 */ 10 10 #include <errno.h> 11 #include "Rp Variable.h"11 #include "RpObject.h" 12 12 #include "RpChain.h" 13 13 #include "RpArray1D.h" … … 18 18 namespace Rappture { 19 19 20 class Curve : public Variable20 class Curve : public Object 21 21 { 22 22 public: 23 23 24 Curve (const char *path);24 Curve(); 25 25 26 Curve (const char *path, 27 const char *label, 28 const char *desc, 29 const char *group); 26 Curve(const char *path); 30 27 31 Curve (const Curve& o); 28 Curve(const char *path, const char *label, const char *desc, 29 const char *group); 32 30 33 virtual ~Curve ();31 Curve(const Curve& o); 34 32 35 Curve& axis (const char *label, 36 const char *desc, 37 const char *units, 38 const char *scale, 39 double *val, 40 size_t size); 33 virtual ~Curve(); 41 34 42 Curve& delAxis (const char *label); 35 Array1D *axis(const char *name, const char *label, const char *desc, 36 const char *units, const char *scale, const double *val, 37 size_t size); 43 38 44 size_t data (const char *label, 45 const double **arr) const; 39 Curve& delAxis(const char *name); 46 40 47 Array1D *getAxis ( const char *label) const; 48 Array1D *getNthAxis ( size_t n) const; 41 size_t data(const char *label, const double **arr) const; 49 42 50 /* 51 Array1D *firstAxis (); 52 Array1D *lastAxis (); 53 Array1D *nextAxis ( const char *prevLabel); 54 Array1D *prevAxis ( const char *prevLabel); 55 */ 43 Array1D *getAxis(const char *name) const; 44 Array1D *getNthAxis(size_t n) const; 56 45 46 // should be a list of groups to add this curve to? 57 47 Accessor <const char *> group; 58 48 size_t dims() const; 59 49 50 const char *xml(); 51 const int is() const; 52 53 static const char x[]; 54 static const char y[]; 55 60 56 private: 61 57 62 // hash or linked list of preset values58 // hash or linked list of axis 63 59 Rp_Chain *_axisList; 64 60 65 Rp_ChainLink *__searchAxisList(const char * label) const;61 Rp_ChainLink *__searchAxisList(const char * name) const; 66 62 }; 63 67 64 68 65 } // namespace Rappture 69 66 70 67 /*--------------------------------------------------------------------------*/ 71 /*--------------------------------------------------------------------------*/72 68 73 69 #endif // RAPPTURE_CURVE_H -
trunk/src/objects/RpNumber.cc
r1386 r1528 14 14 #include "RpNumber.h" 15 15 #include "RpUnits.h" 16 #include "RpSimpleBuffer.h" 16 17 17 18 using namespace Rappture; 18 19 19 Number::Number ( 20 const char *path, 21 const char *units, 22 double val 23 ) 24 : Variable (), 25 _minmaxSet (0), 26 _presets (NULL) 20 Number::Number() 21 : Object (), 22 _minSet (0), 23 _maxSet (0), 24 _presets (NULL) 25 { 26 this->path(""); 27 this->label(""); 28 this->desc(""); 29 this->def(0.0); 30 this->cur(0.0); 31 this->min(0.0); 32 this->max(0.0); 33 // need to set this to the None unit 34 // this->units(units); 35 } 36 37 Number::Number(const char *path, const char *units, double val) 38 : Object (), 39 _minSet (0), 40 _maxSet (0), 41 _presets (NULL) 27 42 { 28 43 const RpUnits *u = NULL; … … 43 58 } 44 59 45 Number::Number ( 46 const char *path, 47 const char *units, 48 double val, 49 double min, 50 double max, 51 const char *label, 52 const char *desc 53 ) 54 : Variable (), 55 _minmaxSet (0), 56 _presets (NULL) 60 Number::Number(const char *path, const char *units, double val, 61 double min, double max, const char *label, 62 const char *desc) 63 : Object (), 64 _minSet (0), 65 _maxSet (0), 66 _presets (NULL) 57 67 { 58 68 const RpUnits *u = NULL; … … 73 83 74 84 if ((min == 0) && (max == 0)) { 75 _minmaxSet = 0; 85 _minSet = 0; 86 _maxSet = 0; 76 87 } 77 88 else { 78 89 90 _minSet = 1; 79 91 if (min > val) { 80 92 this->min(val); 81 93 } 82 94 95 _maxSet = 1; 83 96 if (max < val) { 84 97 this->max(val); … … 89 102 // copy constructor 90 103 Number::Number ( const Number& o ) 91 : Variable(o), 92 _minmaxSet (o._minmaxSet) 104 : Object (o), 105 _minSet (o._minSet), 106 _maxSet (o._maxSet) 93 107 { 94 108 this->def(o.def()); … … 105 119 { 106 120 // clean up dynamic memory 107 121 } 122 123 const char * 124 Number::units(void) const 125 { 126 return propstr("units"); 127 } 128 129 void 130 Number::units(const char *p) 131 { 132 propstr("units",p); 108 133 } 109 134 … … 115 140 */ 116 141 117 double 118 Number::convert(const char *to) {119 142 int 143 Number::convert(const char *to) 144 { 120 145 const RpUnits* toUnit = NULL; 121 146 const RpUnits* fromUnit = NULL; … … 149 174 } 150 175 151 if (err) { 152 convertedVal = cur(); 153 } 154 155 return convertedVal; 176 return err; 177 } 178 179 /**********************************************************************/ 180 // METHOD: value() 181 /// Get the value of this object converted to specified units 182 /** 183 * does not change the value of the object 184 * error code is returned 185 */ 186 187 int 188 Number::value(const char *to, double *value) const 189 { 190 return 1; 156 191 } 157 192 … … 165 200 166 201 Number& 167 Number::addPreset( 168 const char *label, 169 const char *desc, 170 double val, 171 const char *units) 202 Number::addPreset(const char *label, const char *desc, double val, 203 const char *units) 172 204 { 173 205 preset *p = NULL; … … 236 268 } 237 269 270 /**********************************************************************/ 271 // METHOD: xml() 272 /// view this object's xml 273 /** 274 * View this object as an xml element returned as text. 275 */ 276 277 const char * 278 Number::xml() 279 { 280 Path p(path()); 281 _tmpBuf.clear(); 282 283 _tmpBuf.appendf( 284 "<number id='%s'>\n\ 285 <about>\n\ 286 <label>%s</label>\n\ 287 <description>%s</description>\n\ 288 </about>\n\ 289 <units>%s</units>\n", 290 p.id(),label(),desc(),units()); 291 292 if (_minSet) { 293 _tmpBuf.appendf(" <min>%g%s</min>\n", min(),units()); 294 } 295 if (_maxSet) { 296 _tmpBuf.appendf(" <max>%g%s</max>\n", max(),units()); 297 } 298 299 _tmpBuf.appendf( 300 " <default>%g%s</default>\n\ 301 <current>%g%s</current>\n\ 302 </number>", 303 def(),units(),cur(),units()); 304 305 return _tmpBuf.bytes(); 306 } 307 308 /**********************************************************************/ 309 // METHOD: is() 310 /// what kind of object is this 311 /** 312 * return hex value telling what kind of object this is. 313 */ 314 315 const int 316 Number::is() const 317 { 318 // return "numb" in hex 319 return 0x6E756D62; 320 } 321 322 238 323 // -------------------------------------------------------------------- // 239 324 -
trunk/src/objects/RpNumber.h
r1386 r1528 9 9 */ 10 10 #include <errno.h> 11 #include "Rp Variable.h"11 #include "RpObject.h" 12 12 #include "RpChain.h" 13 13 … … 17 17 namespace Rappture { 18 18 19 class Number : public Variable19 class Number : public Object 20 20 { 21 21 public: 22 22 23 Number ( const char *path, 24 const char *units, 25 double val); 23 Number(); 24 Number(const char *path, const char *units, double val); 26 25 27 Number ( const char *path, 28 const char *units, 29 double val, 30 double min, 31 double max, 32 const char *label, 33 const char *desc); 26 Number(const char *path, const char *units, double val, 27 double min, double max, const char *label, 28 const char *desc); 34 29 35 Number 30 Number( const Number& o ); 36 31 virtual ~Number (); 37 32 … … 40 35 Accessor<double> min; 41 36 Accessor<double> max; 42 Accessor<const char *> units;43 37 44 // need to add a way to tell user conversion failed45 v irtual double convert (const char *to);38 const char *units(void) const; 39 void units(const char *p); 46 40 47 Number& addPreset( const char *label, 48 const char *desc, 49 double val, 50 const char *units ); 41 // convert the value stored in this object to specified units 42 // does not return the converted value 43 // error code is returned 44 int convert(const char *to); 45 46 // get the value of this object converted to specified units 47 // does not change the value of the object 48 // error code is returned 49 int value(const char *units, double *value) const; 50 51 Number& addPreset(const char *label, const char *desc, 52 double val, const char *units); 51 53 52 54 Number& delPreset(const char *label); 55 56 const char* xml(); 57 const int is() const; 53 58 54 59 private: 55 60 56 61 // flag tells if user specified min and max values 57 int _minmaxSet; 62 int _minSet; 63 int _maxSet; 58 64 59 65 // hash or linked list of preset values … … 63 69 Accessor<const char *> label; 64 70 Accessor<const char *> desc; 71 Accessor<const char *> units; 65 72 Accessor<double> val; 66 Accessor<const char *> units;67 73 }; 74 68 75 }; 69 76 -
trunk/src/objects/RpObject.cc
r1428 r1528 1 1 /* 2 2 * ---------------------------------------------------------------------- 3 * Rp Variable.cc3 * RpObject.cc 4 4 * 5 * Rappture 2.0 Variablemember functions5 * Rappture 2.0 Object member functions 6 6 * 7 7 * ====================================================================== … … 14 14 */ 15 15 16 #include "Rp Variable.h"16 #include "RpObject.h" 17 17 #include "RpHashHelper.h" 18 18 19 19 using namespace Rappture; 20 20 21 Variable::Variable()21 Object::Object() 22 22 { 23 23 __init(); 24 24 } 25 25 26 Variable::Variable(26 Object::Object ( 27 27 const char *path, 28 28 const char *label, … … 38 38 } 39 39 40 Variable::Variable(const Variable& o)40 Object::Object(const Object& o) 41 41 { 42 42 path(o.path()); … … 45 45 hints(o.hints()); 46 46 color(o.color()); 47 icon(o.icon());47 // icon(o.icon()); 48 48 49 49 if (o._h != NULL) { … … 52 52 } 53 53 54 Variable::~Variable()54 Object::~Object() 55 55 { 56 56 __clear(); 57 57 } 58 58 59 const char* 60 Object::path() const 61 { 62 return propstr("path"); 63 } 64 65 void 66 Object::path(const char *p) 67 { 68 propstr("path",p); 69 } 70 71 const char* 72 Object::label() const 73 { 74 return propstr("label"); 75 } 76 77 void 78 Object::label( 79 const char *p) 80 { 81 propstr("label",p); 82 } 83 84 const char* 85 Object::desc() const 86 { 87 return propstr("desc"); 88 } 89 90 void 91 Object::desc(const char *p) 92 { 93 propstr("desc",p); 94 } 95 96 const char* 97 Object::hints() const 98 { 99 return propstr("hints"); 100 } 101 102 void 103 Object::hints(const char *p) 104 { 105 propstr("hints",p); 106 } 107 108 const char* 109 Object::color() const 110 { 111 return propstr("color"); 112 } 113 114 void 115 Object::color(const char *p) 116 { 117 propstr("color",p); 118 } 119 120 // get a general property 59 121 const void * 60 Variable::property( 61 const char *key, 62 const void *val) 63 { 64 const void *r = NULL; 122 Object::property(const char *key) const 123 { 124 if (key == NULL) { 125 // no key to search for 126 return NULL; 127 } 128 129 if (_h == NULL) { 130 // hash table does not exist, value is not in table 131 return NULL; 132 } 133 134 // get the value 135 return Rp_HashSearchNode(_h,key); 136 } 137 138 // set a general property 139 void 140 Object::property(const char *key, const void *val, size_t nbytes) 141 { 142 if (key == NULL) { 143 // no key for value 144 return; 145 } 146 65 147 if (_h == NULL) { 66 148 // hash table does not exist, create it … … 69 151 } 70 152 71 if (val == NULL) { 72 // get the value 73 r = Rp_HashSearchNode(_h,key); 74 } else { 75 // set the value 76 Rp_HashRemoveNode(_h,key); 77 Rp_HashAddNode(_h,key,val); 78 r = val; 79 } 80 81 return r; 82 } 83 153 // FIXME: this is suspect, 154 // want to use void's and void*'s but c++ wont let me 155 // g++ says there is no delete[] for void* 156 void *tmp = new char[nbytes]; 157 memcpy(tmp,val,nbytes); 158 159 // set the value 160 char *old = (char *) Rp_HashRemoveNode(_h,key); 161 delete[] old; 162 old = NULL; 163 Rp_HashAddNode(_h,key,tmp); 164 165 return; 166 } 167 168 // get a const char* property 84 169 const char * 85 Variable::propstr( 86 const char *key, 87 const char *val) 88 { 89 const char *r = NULL; 170 Object::propstr(const char *key) const 171 { 172 if (key == NULL) { 173 // no key for value 174 return NULL; 175 } 176 177 if (_h == NULL) { 178 // hash table does not exist, value does not exist in table 179 return NULL; 180 } 181 182 // get the value 183 return (const char *) Rp_HashSearchNode(_h,key); 184 } 185 186 // set a const char* property 187 void 188 Object::propstr(const char *key, const char *val) 189 { 90 190 char *str = NULL; 191 192 if (key == NULL) { 193 // no key for value 194 return; 195 } 196 91 197 if (_h == NULL) { 92 198 // hash table does not exist, create it … … 95 201 } 96 202 97 if (val == NULL) { 98 // get the value 99 r = (const char *) Rp_HashSearchNode(_h,key); 100 } else { 101 // set the value 102 //FIXME: users responsibility to free value with propremove() 103 size_t l = strlen(val); 104 str = new char[l+1]; 105 strcpy(str,val); 106 107 // FIXME: possible memory leak here 108 // we dont free the removed item, 109 // it is user's responsibility to use propremove() to free it 110 // we don't know whether to use delete or delete[]. 111 Rp_HashRemoveNode(_h,key); 112 Rp_HashAddNode(_h,key,str); 113 r = val; 114 } 115 116 return r; 117 } 118 119 void * 120 Variable::propremove( 121 const char *key) 203 // set the value 204 // FIXME: this is suspect, 205 // want to use void's and void*'s but c++ wont let me 206 // g++ says there is no delete[] for void* 207 size_t l = strlen(val); 208 str = new char[l+1]; 209 strcpy(str,val); 210 211 char *old = (char *) Rp_HashRemoveNode(_h,key); 212 delete[] old; 213 old = NULL; 214 Rp_HashAddNode(_h,key,str); 215 216 return; 217 } 218 219 // remove a property from the hash table 220 void 221 Object::propremove(const char *key) 122 222 { 123 223 if ((key == NULL) || (_h == NULL)) { 124 224 // key or hash table does not exist 125 return NULL; 126 } 127 128 return Rp_HashRemoveNode(_h,key); 129 } 130 131 void 132 Variable::__init() 225 return; 226 } 227 228 char *tmp = (char *) Rp_HashRemoveNode(_h,key); 229 delete[] tmp; 230 tmp = NULL; 231 return; 232 } 233 234 void 235 Object::__init() 133 236 { 134 237 _h = NULL; … … 139 242 // icon(NULL); 140 243 path(""); 141 } 142 143 void 144 Variable::__clear() 145 { 146 // who frees the Accessors? 147 244 245 _tmpBuf.clear(); 246 247 _h = (Rp_HashTable*) malloc(sizeof(Rp_HashTable)); 248 Rp_InitHashTable(_h,RP_STRING_KEYS); 249 } 250 251 void 252 Object::__clear() 253 { 254 _tmpBuf.clear(); 255 256 // traverse the hash table to delete values, then delete hash table 148 257 if (_h != NULL) { 258 Rp_HashEntry *hEntry = NULL; 259 Rp_HashSearch hSearch; 260 261 hEntry = Rp_FirstHashEntry(_h,&hSearch); 262 while (hEntry != NULL) { 263 // FIXME: this is suspect, 264 // want to use void's and void*'s but c++ wont let me 265 // g++ says there is no delete[] for void* 266 char *v = (char *) Rp_GetHashValue(hEntry); 267 delete[] v; 268 v = NULL; 269 hEntry = Rp_NextHashEntry(&hSearch); 270 } 271 149 272 Rp_DeleteHashTable(_h); 150 } 151 152 __init(); 153 } 154 273 _h = NULL; 274 } 275 } 276 277 const char * 278 Object::xml() const 279 { 280 return NULL; 281 } 282 283 void 284 Object::xml(const char *xmltext) 285 { 286 return; 287 } 288 289 const int 290 Object::is() const 291 { 292 // return "var" in hex 293 return 0x766172; 294 } 155 295 156 296 // -------------------------------------------------------------------- // -
trunk/src/objects/RpObject.h
r1428 r1528 9 9 */ 10 10 11 #ifndef RAPPTURE_ VARIABLE_H12 #define RAPPTURE_ VARIABLE_H11 #ifndef RAPPTURE_OBJECT_H 12 #define RAPPTURE_OBJECT_H 13 13 14 14 #include "RpInt.h" … … 16 16 #include "RpAccessor.h" 17 17 #include "RpBuffer.h" 18 #include "RpPath.h" 18 19 19 20 namespace Rappture { 20 21 21 class Variable22 class Object 22 23 { 23 24 public: 24 Variable();25 Variable (const char *path,26 27 28 29 const char *color);30 Variable (const Variable& o);31 virtual ~ Variable();25 Object (); 26 Object (const char *path, 27 const char *label, 28 const char *desc, 29 const char *hints, 30 const char *color); 31 Object (const Object& o); 32 virtual ~Object(); 32 33 33 Accessor<const char *> path; 34 Accessor<const char *> label; 35 Accessor<const char *> desc; 36 Accessor<const char *> hints; 37 Accessor<const char *> color; 38 Accessor<Buffer> icon; 34 const char *path(void) const; 35 void path(const char *p); 36 37 const char *label(void) const; 38 void label(const char *p); 39 40 const char *desc(void) const; 41 void desc(const char *p); 42 43 const char *hints(void) const; 44 void hints(const char *p); 45 46 const char *color(void) const; 47 void color(const char *); 48 49 // void *icon(void) const; 50 // void icon(void *p, size_t nbytes); 39 51 40 52 // these functions are not completely improper use proof 41 53 // user is responsible for calling propremove() on any item 42 54 // they put into the hash table. 43 const void *property (const char *key, const void *val); 44 const char *propstr (const char *key, const char *val); 45 void *propremove (const char *key); 55 56 // get/set void* property 57 const void *property (const char *key) const; 58 void property (const char *key, const void *val, size_t nbytes); 59 60 // get/set const char * property 61 const char *propstr (const char *key) const; 62 void propstr (const char *key, const char *val); 63 64 // remove property from hash table 65 void propremove (const char *key); 66 67 // get the Rappture1.1 xml text for this object 68 virtual const char *xml() const; 69 70 // set the object properties based on Rappture1.1 xml text 71 virtual void xml(const char *xmltext); 72 73 virtual const int is() const; 74 75 protected: 76 77 /// temprorary buffer for returning text to the user 78 SimpleCharBuffer _tmpBuf; 46 79 47 80 private: … … 55 88 /// close out the object, freeing its memory 56 89 void __clear(); 90 57 91 }; 58 92 59 } // RAPPTURE_ VARIABLE_H93 } // RAPPTURE_OBJECT_H 60 94 61 95 /*--------------------------------------------------------------------------*/ -
trunk/src/objects/RpPlot.cc
r1386 r1528 16 16 using namespace Rappture; 17 17 18 const char Plot::format[] = "RAPPTURE::PLOT::FORMAT"; 19 const char Plot::id[] = "RAPPTURE::PLOT::ID"; 20 const char Plot::xaxis[] = "RAPPTURE::PLOT::XAXIS"; 21 const char Plot::yaxis[] = "RAPPTURE::PLOT::YAXIS"; 18 const char Plot::format[] = "RAPPTURE::PLOT::FORMAT"; 19 const char Plot::id[] = "RAPPTURE::PLOT::ID"; 20 const char Plot::xaxis[] = "xaxis"; 21 const char Plot::yaxis[] = "yaxis"; 22 const char Plot::creator[] = "RAPPTURE::PLOT::CREATOR"; 23 24 /* 25 const char *Plot::creator[] = { 26 "plot", 27 "user" 28 }; 29 */ 22 30 23 31 Plot::Plot () 24 : Variable(),32 : Object (), 25 33 _curveList (NULL) 26 34 { … … 33 41 // copy constructor 34 42 Plot::Plot ( const Plot& o ) 35 : Variable(o)43 : Object(o) 36 44 { 37 45 _curveList = Rp_ChainCreate(); … … 48 56 Rp_ChainLink *l = Rp_ChainFirstLink(_curveList); 49 57 while (l != NULL) { 50 char *str = NULL;51 58 Curve * c = (Curve *) Rp_ChainGetValue(l); 52 53 str = (char *) c->propremove(Plot::format); 54 delete str; 55 56 str = (char *) c->propremove(Plot::id); 57 delete str; 58 59 c->propremove(Plot::format); 60 c->propremove(Plot::id); 59 61 delete c; 60 62 c = NULL; … … 89 91 } 90 92 93 Path cpath; 94 cpath.id(name); 95 c->path(cpath.path()); 96 91 97 // can't use "xaxis" kinda strings here have to allocate it forreal 92 c->axis( xaxis,"xdesc","xunits","xcale",x,nPts);93 c->axis( yaxis,"ydesc","yunits","ycale",y,nPts);94 c->propstr( format,fmt);95 c->propstr( id,name);98 c->axis(Plot::xaxis,"","","","",x,nPts); 99 c->axis(Plot::yaxis,"","","","",y,nPts); 100 c->propstr(Plot::format,fmt); 101 c->propstr(Plot::creator,"plot"); 96 102 97 103 if (_curveList == NULL) { … … 109 115 110 116 /**********************************************************************/ 117 // METHOD: add() 118 /// Add an xy curve to the object 119 /** 120 * Add an xy curve to the object. 121 * returns curve id 122 */ 123 124 Plot& 125 Plot::add( 126 Curve *c, 127 const char *name) 128 { 129 if (c == NULL) { 130 // raise memory error and exit 131 return *this; 132 } 133 134 c->propstr(Plot::id,name); 135 136 if (_curveList == NULL) { 137 _curveList = Rp_ChainCreate(); 138 if (_curveList == NULL) { 139 // raise error and exit 140 } 141 } 142 143 Rp_ChainAppend(_curveList,c); 144 145 return *this; 146 } 147 148 149 /**********************************************************************/ 111 150 // METHOD: count() 112 151 /// return number of curves in this object … … 143 182 } 144 183 return c; 184 } 185 186 /**********************************************************************/ 187 // METHOD: getNthCurve() 188 /// Return the Nth Curve object 189 /** 190 * Return the Nth Curve 191 */ 192 193 Curve * 194 Plot::getNthCurve(size_t n) const 195 { 196 Rp_ChainLink *l = NULL; 197 l = Rp_ChainGetNthLink(_curveList,n); 198 199 if (l == NULL) { 200 return NULL; 201 } 202 203 return (Curve *) Rp_ChainGetValue(l); 145 204 } 146 205 … … 163 222 while (l != NULL) { 164 223 Curve *c = (Curve *) Rp_ChainGetValue(l); 165 const char *cname = (const char *) c->property(id,NULL);224 const char *cname = c->propstr(Plot::id); 166 225 if (cname != NULL) { 167 226 if((*cname == *name) && (strcmp(cname,name) == 0)) { … … 191 250 } 192 251 252 /**********************************************************************/ 253 // METHOD: xml() 254 /// Return the xml of this object 255 /** 256 * returns the xml of this object 257 */ 258 259 const char * 260 Plot::xml() 261 { 262 263 Rp_ChainLink *l = NULL; 264 265 _tmpBuf.clear(); 266 267 l = Rp_ChainFirstLink(_curveList); 268 while (l != NULL) { 269 Curve *c = (Curve *) Rp_ChainGetValue(l); 270 271 //find who created the curve 272 const char *ccreator = c->propstr(Plot::creator); 273 if ((ccreator != NULL) && 274 (*ccreator == 'p') && 275 (strcmp(ccreator,"plot") == 0)) { 276 // FIXME: check fields to see if the user specified value 277 // plot defined curve, use plot's labels in curve's xml 278 const char *xlabel = propstr("xlabel"); 279 const char *xdesc = propstr("xdesc"); 280 const char *xunits = propstr("xunits"); 281 const char *xscale = propstr("xscale"); 282 const char *ylabel = propstr("ylabel"); 283 const char *ydesc = propstr("ydesc"); 284 const char *yunits = propstr("yunits"); 285 const char *yscale = propstr("yscale"); 286 287 if (xlabel || xdesc || xunits || xscale) { 288 Array1D *cxaxis = c->getAxis(Plot::xaxis); 289 cxaxis->label(xlabel); 290 cxaxis->desc(xdesc); 291 cxaxis->units(xunits); 292 cxaxis->scale(xscale); 293 } 294 295 if (ylabel || ydesc || yunits || yscale) { 296 Array1D *cyaxis = c->getAxis(Plot::yaxis); 297 cyaxis->label(ylabel); 298 cyaxis->desc(ydesc); 299 cyaxis->units(yunits); 300 cyaxis->scale(yscale); 301 } 302 } 303 304 _tmpBuf.append(c->xml()); 305 _tmpBuf.append("\n",1); 306 l = Rp_ChainNextLink(l); 307 } 308 309 // remove trailing newline 310 _tmpBuf.remove(1); 311 // append terminating null character 312 _tmpBuf.append("\0",1); 313 314 return _tmpBuf.bytes(); 315 } 316 317 /**********************************************************************/ 318 // METHOD: is() 319 /// what kind of object is this 320 /** 321 * return hex value telling what kind of object this is. 322 */ 323 324 const int 325 Plot::is() const 326 { 327 // return "plot" in hex 328 return 0x706C6F74; 329 } 330 193 331 // -------------------------------------------------------------------- // -
trunk/src/objects/RpPlot.h
r1386 r1528 9 9 */ 10 10 #include <errno.h> 11 #include "Rp Variable.h"11 #include "RpObject.h" 12 12 #include "RpChainHelper.h" 13 13 #include "RpCurve.h" … … 18 18 namespace Rappture { 19 19 20 class Plot : public Variable20 class Plot : public Object 21 21 { 22 22 public: … … 33 33 const char *name); 34 34 35 Plot& add (Curve *c, const char *name); 36 35 37 // count the number of curves in the object 36 38 size_t count() const; … … 38 40 // retrieve a curve from the object 39 41 Curve *curve (const char* name) const; 42 Curve *getNthCurve(size_t n) const; 43 44 const char *xml(); 45 const int is() const; 46 47 private: 48 49 // hash or linked list of preset values 50 Rp_Chain *_curveList; 40 51 41 52 static const char format[]; … … 43 54 static const char xaxis[]; 44 55 static const char yaxis[]; 56 static const char creator[]; 45 57 46 private: 47 48 // hash or linked list of preset values 49 Rp_Chain *_curveList; 58 // static const char *creator[]; 50 59 51 60 Rp_ChainLink *__searchCurveList(const char *name) const; -
trunk/src/objects/RpString.cc
r1386 r1528 20 20 const char *val 21 21 ) 22 : Variable()22 : Object () 23 23 { 24 24 this->path(path); … … 41 41 size_t height 42 42 ) 43 : Variable()43 : Object () 44 44 { 45 45 this->path(path); … … 55 55 // copy constructor 56 56 String::String ( const String& o ) 57 : Variable(o)57 : Object(o) 58 58 { 59 59 this->hints(o.hints()); … … 70 70 } 71 71 72 /**********************************************************************/ 73 // METHOD: xml() 74 /// view this object's xml 75 /** 76 * View this object as an xml element returned as text. 77 */ 78 79 const char * 80 String::xml() 81 { 82 Path p(path()); 83 _tmpBuf.clear(); 84 85 _tmpBuf.appendf( 86 "<string id='%s'>\n\ 87 <about>\n\ 88 <label>%s</label>\n\ 89 <description>%s</description>\n\ 90 <hints>%s</hints>\n\ 91 </about>\n\ 92 <size>%ix%i</size>\n\ 93 <default>%s</default>\n\ 94 <current>%s</current>\n\ 95 </string>\n", 96 p.id(),label(),desc(),hints(),width(),height(),def(),cur()); 97 98 return _tmpBuf.bytes(); 99 } 100 101 /**********************************************************************/ 102 // METHOD: is() 103 /// what kind of object is this 104 /** 105 * return hex value telling what kind of object this is. 106 */ 107 108 const int 109 String::is() const 110 { 111 // return "stri" in hex 112 return 0x73747269; 113 } 114 72 115 // -------------------------------------------------------------------- // 73 116 -
trunk/src/objects/RpString.h
r1386 r1528 9 9 */ 10 10 #include <errno.h> 11 #include "Rp Variable.h"11 #include "RpObject.h" 12 12 13 13 #ifndef RAPPTURE_STRING_H … … 16 16 namespace Rappture { 17 17 18 class String : public Variable18 class String : public Object 19 19 { 20 20 public: … … 34 34 virtual ~String (); 35 35 36 Accessor<const char *> hints;37 36 Accessor<const char *> def; 38 37 Accessor<const char *> cur; 39 38 Accessor<size_t> width; 40 39 Accessor<size_t> height; 40 41 const char *xml(); 42 const int is() const; 41 43 42 44 private:
Note: See TracChangeset
for help on using the changeset viewer.