source: trunk/examples/objects/axis/axis.cc @ 5673

Last change on this file since 5673 was 5673, checked in by ldelgass, 9 years ago

Fix line endings, set eol-style to native on all C/C++ sources.

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1#include <iostream>
2#include "RpArray1D.h"
3
4
5int test(
6    const char *testname,
7    const char *desc,
8    const char *expected,
9    const char *received)
10{
11/*
12    if (strcmp(expected,received) != 0) {
13        printf("Error: %s\n", testname);
14        printf("\t%s\n", desc);
15        printf("\texpected \"%s\"\n",expected);
16        printf("\treceived \"%s\"\n",received);
17        return 1;
18    }
19*/
20    return 0;
21}
22
23int
24printAxis(Rappture::Array1D *n)
25{
26    std::cout << "name: " << n->name() << std::endl;
27    std::cout << "label: " << n->label() << std::endl;
28    std::cout << "desc: " << n->desc() << std::endl;
29    std::cout << "nmemb: " << n->nmemb() << std::endl;
30    std::cout << "min: " << n->min() << std::endl;
31    std::cout << "max: " << n->max() << std::endl;
32    std::cout << "units: " << n->units() << std::endl;
33
34    const double *d = n->data();
35
36    for (size_t i = 0; i < n->nmemb(); i++) {
37        std::cout << "d[" << i << "] = " << d[i] << std::endl;
38    }
39
40    return 0;
41}
42
43int axis_0_0 ()
44{
45    const char *desc = "";
46    const char *testname = "axis_0_0";
47
48
49    const char *expected = NULL;
50    const char *received = NULL;
51
52    return test(testname,desc,expected,received);
53}
54
55int main()
56{
57    Rappture::Array1D *n = NULL;
58    double d[] = {70,400,199,502,832924};
59
60    n = new Rappture::Array1D(d,5);
61    n->name("output.axis(temperature)");
62    n->label("mylabel");
63    n->desc("mydesc");
64    n->units("K");
65    n->scale("linear");
66
67    printAxis(n);
68
69    Rappture::Array1D n1(d,5);
70    n1.name("output.axis(t)");
71    printAxis(&n1);
72
73    delete n;
74
75    axis_0_0();
76
77    return 0;
78}
Note: See TracBrowser for help on using the repository browser.