source: trunk/src/objects/RpObject.h @ 1581

Last change on this file since 1581 was 1581, checked in by dkearney, 11 years ago

updates for the rappture objects, object examples, and object apis. small fix for rpunits c interface to check string length. there should probably be more of these checks in the c interface, but units should also be rewritten. added folders to separate out octave2 and octave3 app-fermi examples

File size: 3.5 KB
Line 
1/*
2 * ======================================================================
3 *  AUTHOR:  Derrick S. Kearney, Purdue University
4 *  Copyright (c) 2005-2009  Purdue Research Foundation
5 *
6 *  See the file "license.terms" for information on usage and
7 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8 * ======================================================================
9 */
10
11#ifndef RAPPTURE_OBJECT_H
12#define RAPPTURE_OBJECT_H
13
14#include "RpInt.h"
15#include "RpHash.h"
16#include "RpOutcome.h"
17#include "RpAccessor.h"
18#include "RpBuffer.h"
19#include "RpPath.h"
20#include "RpParserXML.h"
21#include "RpObjConfig.h"
22#include <cstdarg>
23
24namespace Rappture {
25
26class Object
27{
28    public:
29        Object ();
30        Object (const char *name,
31                const char *path,
32                const char *label,
33                const char *desc,
34                const char *hints,
35                const char *color);
36        Object (const Object& o);
37        virtual ~Object();
38
39        const char *name(void) const;
40        void name(const char *p);
41
42        const char *path(void) const;
43        void path(const char *p);
44
45        const char *label(void) const;
46        void label(const char *p);
47
48        const char *desc(void) const;
49        void desc(const char *p);
50
51        const char *hints(void) const;
52        void hints(const char *p);
53
54        const char *color(void) const;
55        void color(const char *p);
56
57        // void *icon(void) const;
58        // void icon(void *p, size_t nbytes);
59
60        // these functions are not completely improper use proof
61        // user is responsible for calling propremove() on any item
62        // they put into the hash table.
63
64        // get/set void* property
65        const void *property (const char *key) const;
66        void property (const char *key, const void *val, size_t nbytes);
67
68        // get/set const char * property
69        const char *propstr (const char *key) const;
70        void propstr (const char *key, const char *val);
71
72        // remove property from hash table
73        void propremove (const char *key);
74
75        // return the value of object based on provided hints
76        virtual void vvalue (void *storage, size_t numHints, va_list arg) const;
77
78        // get the Rappture1.1 xml text for this object
79        // virtual const char *xml(size_t indent, size_t tabstop) const;
80
81        // configure the object properties based on Rappture1.1 xml text
82        virtual void configure(size_t as, ClientData c);
83        virtual void dump(size_t as, ClientData c);
84
85        virtual Outcome &outcome() const;
86        virtual const int is() const;
87
88    protected:
89
90        /// temprorary buffer for returning text to the user
91        SimpleCharBuffer _tmpBuf;
92
93        /// status of the object
94        mutable Rappture::Outcome _status;
95
96        virtual void __hintParser(char *hint,
97            const char **hintKey, const char **hintVal) const;
98
99        virtual void __configureFromXml(ClientData c);
100        virtual void __configureFromTree(ClientData c);
101        virtual void __dumpToXml(ClientData c);
102        virtual void __dumpToTree(ClientData c);
103    private:
104
105        /// hash table holding other object properties
106        Rp_HashTable *_h;
107
108        /// initialize the object, set the data members to 0 or null
109        void __init();
110
111        /// close out the object, freeing its memory
112        void __clear();
113};
114
115} // RAPPTURE_OBJECT_H
116
117/*--------------------------------------------------------------------------*/
118/*--------------------------------------------------------------------------*/
119
120#endif
Note: See TracBrowser for help on using the repository browser.