source: trunk/src/objects/RpArray1D.h @ 1389

Last change on this file since 1389 was 1386, checked in by dkearney, 15 years ago

adding a few object prototypes we can play with for future developement. the plot object is probably the most interesting. examples are located in examples/objects dirs

File size: 2.4 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_ARRAY1D_H
12#define RAPPTURE_ARRAY1D_H
13
14#include "RpAccessor.h"
15#include "RpSimpleBuffer.h"
16
17namespace Rappture {
18
19class Array1D
20{
21public:
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);
31    Array1D (const Array1D &o);
32    ~Array1D();
33
34    Accessor<const char *> path;
35    Accessor<const char *> label;
36    Accessor<const char *> desc;
37    Accessor<const char *> units;
38    Accessor<const char *> scale;
39
40    virtual Array1D& append(double *val, size_t nmemb);
41    virtual size_t read(double *val, size_t nmemb);
42    virtual size_t nmemb() const;
43    virtual double min() const;
44    virtual double max() const;
45    virtual const double *data() const;
46
47    static const char type[];
48
49private:
50
51    SimpleDoubleBuffer _val;
52    double _min;
53    double _max;
54};
55
56class Array1DUniform
57{
58public:
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    ~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
86private:
87    SimpleDoubleBuffer _val;
88
89};
90} // namespace Rappture
91
92#endif // RAPPTURE_ARRAY1D_H
Note: See TracBrowser for help on using the repository browser.