Ignore:
Timestamp:
Jun 22, 2009 3:16:39 PM (12 years ago)
Author:
dkearney
Message:

updating the objects code and adding some more examples describing how i want developers to use the objects. some of the objects don't work yet, like the tree, anything with an example should work

Location:
trunk/examples/objects
Files:
18 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/objects/Makefile.in

    r1386 r1528  
    1515RM              = rm -f
    1616
    17 examples   = \
     17examples = \
    1818                axis \
    1919                curve \
    2020                dxWriter \
    2121                floatBuffer \
     22                histogram \
    2223                number \
     24                path \
    2325                plot \
    24                 string
     26                string \
     27                tree \
     28                xmlparser
    2529
    2630destdir    = $(prefix)/examples/objects
  • trunk/examples/objects/axis/Makefile.in

    r1386 r1528  
    1818CXXFLAGS        = @CFLAGS@
    1919DEFINES         = -g -Wall
    20 INCLUDES        = -I$(srcdir)/../../../src/core \
     20INCLUDES        = -I../../../src/core \
     21                  -I../../../src/objects \
     22                  -I$(srcdir)/../../../src/core \
    2123                  -I$(srcdir)/../../../src/objects \
    2224                  -I$(includedir)
  • trunk/examples/objects/axis/axis.cc

    r1386 r1528  
    11#include <iostream>
    22#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}
    322
    423int
    524printAxis(Rappture::Array1D *n)
    625{
    7     std::cout << "path: " << n->path() << std::endl;
     26    std::cout << "name: " << n->name() << std::endl;
    827    std::cout << "label: " << n->label() << std::endl;
    928    std::cout << "desc: " << n->desc() << std::endl;
     
    2241}
    2342
     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
    2455int main()
    2556{
     
    2758    double d[] = {70,400,199,502,832924};
    2859
    29     n = new Rappture::Array1D("output.axis(temperature)",d,5,"mylabel",
    30                             "mydesc","K","linear");
     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");
    3166
    3267    printAxis(n);
    3368
    34     Rappture::Array1D n1("output.axis(t)",d,5);
     69    Rappture::Array1D n1(d,5);
     70    n1.name("output.axis(t)");
    3571    printAxis(&n1);
    3672
    3773    delete n;
    3874
     75    axis_0_0();
     76
    3977    return 0;
    4078}
  • trunk/examples/objects/curve/curve.cc

    r1386 r1528  
    11#include <iostream>
    22#include "RpCurve.h"
     3
     4int test(
     5    const char *testname,
     6    const char *desc,
     7    const char *expected,
     8    const char *received)
     9{
     10    if (strcmp(expected,received) != 0) {
     11        printf("Error: %s\n", testname);
     12        printf("\t%s\n", desc);
     13        printf("\texpected \"%s\"\n",expected);
     14        printf("\treceived \"%s\"\n",received);
     15        return 1;
     16    }
     17    return 0;
     18}
    319
    420int
     
    1834    }
    1935
     36    std::cout << "xml: " << n->xml() << std::endl;
    2037    return 0;
     38}
     39
     40int curve_0_0 ()
     41{
     42    const char *desc = "test basic constructor";
     43    const char *testname = "curve_0_0";
     44
     45    const char *expected = "output.curve(myid)";
     46    const char *received = NULL;
     47
     48    Rappture::Curve c(expected);
     49    received = c.path();
     50
     51    return test(testname,desc,expected,received);
    2152}
    2253
     
    3162                            "mydesc","mygroup");
    3263
    33     n->axis("xlabel","xdesc","xunits","xscale",x,10);
    34     n->axis("ylabel","ydesc","yunits","yscale",y,10);
    35     n->axis("zlabel","zdesc","zunits","zscale",z,10);
     64    n->axis("xaxis","xlabel","xdesc","xunits","xscale",x,10);
     65    n->axis("yaxis","ylabel","ydesc","yunits","yscale",y,10);
     66    n->axis("zaxis","zlabel","zdesc","zunits","zscale",z,10);
    3667    printCurve(n);
    3768    n->delAxis("zlabel");
  • trunk/examples/objects/number/number.cc

    r1386 r1528  
    1313    std::cout << "max: " << n->max() << std::endl;
    1414    std::cout << "units: " << n->units() << std::endl;
     15    std::cout << "xml: " << n->xml() << std::endl;
    1516    return 0;
    1617}
  • trunk/examples/objects/plot/plot.cc

    r1397 r1528  
    4141    std::printf("curveCnt = %zu\n",curveCnt);
    4242
     43    std::printf("xml: %s\n",p1->xml());
     44
     45/*
    4346    // retrieve curve from curve name
    4447    // may want to add curve to another plot
     
    5154    size_t ylen = 0;
    5255
    53     xlen = c->data(Rappture::Plot::xaxis,&ax);
    54     ylen = c->data(Rappture::Plot::yaxis,&ay);
     56    xlen = c->data(Rappture::Curve::xaxis,&ax);
     57    ylen = c->data(Rappture::Curve::yaxis,&ay);
    5558
    5659    std::printf("xlen = %zu\nylen = %zu\n",xlen,ylen);
    57     std::printf("fmt = %s\n",c->propstr(Rappture::Plot::format,NULL));
     60    std::printf("fmt = %s\n",c->propstr(Rappture::Curve::format,NULL));
    5861
    5962    if (   (ax != NULL)
     
    6366        }
    6467    }
     68*/
    6569
    6670    delete p1;
Note: See TracChangeset for help on using the changeset viewer.