source: trunk/src/objects/RpVariable.h @ 1261

Last change on this file since 1261 was 1018, checked in by gah, 16 years ago

Massive changes: New directory/file layout

File size: 3.4 KB
Line 
1/*
2 * ======================================================================
3 *  Copyright (c) 2004-2005  Purdue Research Foundation
4 *
5 *  See the file "license.terms" for information on usage and
6 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7 * ======================================================================
8 */
9#include <iostream>
10#include <string>
11#include <sstream>
12#include <stdlib.h>
13#include <errno.h>
14
15
16// #include "RpLibrary.h"
17
18#ifndef _RpABOUT_H
19    #include "RpAbout.h"
20#endif
21
22#ifndef _RpVARIABLE_H
23#define _RpVARIABLE_H
24
25class RpVariable
26{
27    public:
28       
29        // users member fxns
30
31        virtual RpVariable& setPath         (std::string newPath);
32        virtual RpVariable& setDefaultValue (void* newDefaultVal);
33        virtual RpVariable& setCurrentValue (void* newCurrentVal);
34        virtual RpVariable& setLabel        (std::string newLabel);
35        virtual RpVariable& setDesc         (std::string newDesc);
36        virtual RpVariable& setHints        (std::string newHints);
37        virtual RpVariable& setColor        (std::string newColor);
38        virtual RpVariable& setIcon         (std::string newIcon);
39
40        virtual std::string getPath         () const;
41        /* maybe we dont need 2 get functions? */
42        virtual void* getDefaultValue       () const;
43        virtual void* getCurrentValue       () const;
44        virtual std::string getLabel        () const;
45        virtual std::string getDesc         () const;
46        virtual std::string getHints        () const;
47        virtual std::string getColor        () const;
48        virtual std::string getIcon         () const;
49
50        // place the information from this object into the xml library 'lib'
51        // virtual RpNumber& put(RpLibrary lib);
52        // virtual RpVariable& put() const;
53
54        // we need a copy of defaultVal in currentVal, not the same pointer.
55        // need to fix this.
56       
57        RpVariable (
58                    std::string path,
59                    void* defaultVal
60                )
61            :   about       (RpAbout()),
62                path        (path),
63                defaultVal  (defaultVal),
64                currentVal  (defaultVal)
65        {
66            // about's default no-arg const is called
67        };
68
69        RpVariable (
70                    std::string path,
71                    void* defaultVal,
72                    std::string label,
73                    std::string desc
74                )
75            :   about       (RpAbout(label,desc)),
76                path        (path),
77                defaultVal  (defaultVal),
78                currentVal  (defaultVal)
79        {}
80       
81        // copy constructor
82        RpVariable ( const RpVariable& myRpVariable )
83                // will the RpAbout copy constructor be called here?
84            :   about       (RpAbout(myRpVariable.about)),
85                path        (myRpVariable.path),
86                defaultVal  (myRpVariable.defaultVal),
87                currentVal  (myRpVariable.currentVal)
88        {}
89
90        // default destructor
91        virtual ~RpVariable ()
92        {
93            // clean up dynamic memory
94        }
95
96    private:
97
98        RpAbout about;
99        std::string path;
100        void* defaultVal;
101        void* currentVal;
102
103
104};
105
106/*--------------------------------------------------------------------------*/
107/*--------------------------------------------------------------------------*/
108
109#endif
Note: See TracBrowser for help on using the repository browser.