Changeset 1586


Ignore:
Timestamp:
Oct 23, 2009 7:56:25 AM (11 years ago)
Author:
dkearney
Message:

updating potential apis for c cpp and python. adding random() and diff()
functions to the rappture objects. objects should be able to generate a random
value for itself based on how it was configured. objects should be able to
compare itself with another object and tell us what the differences are.

Location:
trunk
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/objects/api/c/number

    r1581 r1586  
    5959    void Rp_NumberVValue(Rp_Number *num, void *storage, size_t numHints,
    6060                         va_list arg) const;
     61    void Rp_NumberRandom();
     62    Rp_Chain *Rp_NumberDiff(const Rp_Object *o);
    6163
    6264    void Rp_NumberAddPreset(Rp_Number *num, const char *label,
     
    368370                va_list arg. Values stored in the object are
    369371                not changed.
     372    Code Example:
     373
     374void Rp_NumberRandom();
     375    Purpose: populate the object with a random value
     376    Input Arguments: 0
     377    Return Value: None
     378    Notes: the current value of this object will be populated
     379           with a random value that fits within the min and
     380           max if they were specified.
     381    Code Example:
     382
     383Rp_Chain *Rp_NumberDiff(const Rp_Object *o);
     384    Purpose: return a linked list showing the differences between
     385             this object and Rp_Object *o
     386    Input Arguments: 1
     387        1. const Rp_Object *o - object to diff against
     388    Return Value: list of differences between objects
     389    Notes: None
    370390    Code Example:
    371391
  • trunk/examples/objects/api/c/plot

    r1581 r1586  
    4242    void Rp_PlotVValue(Rp_Plot *p, void *storage, size_t numHints,
    4343                       va_list arg) const;
     44    void Rp_PlotRandom();
     45    Rp_Chain *Rp_PlotDiff(Rp_Plot *o);
    4446
    4547    void Rp_PlotConfigure(Rp_Plot *p, size_t as, ClientData c);
     
    264266    Code Example:
    265267
     268void Rp_PlotRandom();
     269    Purpose: populate the object with a random value
     270    Input Arguments: 0
     271    Return Value: None
     272    Notes: the current value of this object will be populated
     273           with a random value that fits within the min and
     274           max if they were specified.
     275    Code Example:
     276
     277Rp_Chain *Rp_PlotDiff(const Rp_Object *o);
     278    Purpose: return a linked list showing the differences between
     279             this object and Rp_Object *o
     280    Input Arguments: 1
     281        1. const Rp_Object *o - object to diff against
     282    Return Value: list of differences between objects
     283    Notes: None
     284    Code Example:
     285
    266286void Rp_PlotConfigure(Rp_Plot *p, size_t as, ClientData c);
    267287    Purpose: configure the object based on the data in "c".
  • trunk/examples/objects/api/cpp/boolean

    r1581 r1586  
    4646
    4747    void vvalue(void *storage, size_t numHints, va_list arg) const;
     48    void random();
     49    Rp_Chain *diff(const Object& o);
    4850
    4951    void configure(size_t as, ClientData c);
     
    244246                va_list arg. Values stored in the object are
    245247                not changed.
     248    Code Example:
     249
     250void random();
     251    Purpose: populate the object with a random value
     252    Input Arguments: 0
     253    Return Value: None
     254    Notes: the current value of this object will be populated
     255           with a random value that fits within the min and
     256           max if they were specified.
     257    Code Example:
     258
     259Rp_Chain *diff(const Rp_Object &o);
     260    Purpose: return a linked list showing the differences between
     261             this object and Rp_Object &o
     262    Input Arguments: 1
     263        1. const Rp_Object &o - object to diff against
     264    Return Value: list of differences between objects
     265    Notes: None
    246266    Code Example:
    247267
  • trunk/examples/objects/api/cpp/choice

    r1581 r1586  
    4646
    4747    void vvalue(void *storage, size_t numHints, va_list arg) const;
     48    void random();
     49    Rp_Chain *diff(const Object& o);
     50
    4851
    4952    Choice& addPreset(const char *label, const char *desc,
     
    251254                va_list arg. Values stored in the object are
    252255                not changed.
     256    Code Example:
     257
     258void random();
     259    Purpose: populate the object with a random value
     260    Input Arguments: 0
     261    Return Value: None
     262    Notes: the current value of this object will be populated
     263           with a random value that fits within the min and
     264           max if they were specified.
     265    Code Example:
     266
     267Rp_Chain *diff(const Rp_Object &o);
     268    Purpose: return a linked list showing the differences between
     269             this object and Rp_Object &o
     270    Input Arguments: 1
     271        1. const Rp_Object &o - object to diff against
     272    Return Value: list of differences between objects
     273    Notes: None
    253274    Code Example:
    254275
  • trunk/examples/objects/api/cpp/curve

    r1581 r1586  
    5454
    5555    void vvalue(void *storage, size_t numHints, va_list arg) const;
     56    void random();
     57    Rp_Chain *diff(const Object& o);
    5658
    5759    void configure(size_t as, ClientData c);
     
    281283    Code Example:
    282284
     285void random();
     286    Purpose: populate the object with a random value
     287    Input Arguments: 0
     288    Return Value: None
     289    Notes: the current value of this object will be populated
     290           with a random value that fits within the min and
     291           max if they were specified.
     292    Code Example:
     293
     294Rp_Chain *diff(const Rp_Object &o);
     295    Purpose: return a linked list showing the differences between
     296             this object and Rp_Object &o
     297    Input Arguments: 1
     298        1. const Rp_Object &o - object to diff against
     299    Return Value: list of differences between objects
     300    Notes: None
     301    Code Example:
     302
    283303void configure(size_t as, ClientData c);
    284304    Purpose: configure the object based on the data in "c".
  • trunk/examples/objects/api/cpp/number

    r1581 r1586  
    5858    double value(const char *units) const;
    5959    void vvalue(void *storage, size_t numHints, va_list arg) const;
     60    void random();
     61    Rp_Chain *diff(const Object& o);
    6062
    6163    Number& addPreset(const char *label, const char *desc,
     
    334336                va_list arg. Values stored in the object are
    335337                not changed.
     338    Code Example:
     339
     340void random();
     341    Purpose: populate the object with a random value
     342    Input Arguments: 0
     343    Return Value: None
     344    Notes: the current value of this object will be populated
     345           with a random value that fits within the min and
     346           max if they were specified.
     347    Code Example:
     348
     349Rp_Chain *diff(const Rp_Object &o);
     350    Purpose: return a linked list showing the differences between
     351             this object and Rp_Object &o
     352    Input Arguments: 1
     353        1. const Rp_Object &o - object to diff against
     354    Return Value: list of differences between objects
     355    Notes: None
    336356    Code Example:
    337357
  • trunk/examples/objects/api/cpp/plot

    r1581 r1586  
    4545
    4646    void vvalue(void *storage, size_t numHints, va_list arg) const;
     47    void random();
     48    Rp_Chain *diff(const Object& o);
    4749
    4850    void configure(size_t as, ClientData c);
     
    246248    Code Example:
    247249
     250void random();
     251    Purpose: populate the object with a random value
     252    Input Arguments: 0
     253    Return Value: None
     254    Notes: the current value of this object will be populated
     255           with a random value that fits within the min and
     256           max if they were specified.
     257    Code Example:
     258
     259Rp_Chain *diff(const Rp_Object &o);
     260    Purpose: return a linked list showing the differences between
     261             this object and Rp_Object &o
     262    Input Arguments: 1
     263        1. const Rp_Object &o - object to diff against
     264    Return Value: list of differences between objects
     265    Notes: None
     266    Code Example:
     267
    248268void configure(size_t as, ClientData c);
    249269    Purpose: configure the object based on the data in "c".
  • trunk/examples/objects/app-fermi/fermi4.py

    r1581 r1586  
    11#! /usr/bin/env python
    22# ----------------------------------------------------------------------
    3 #  EXAMPLE: Fermi-Dirac function in C++.
     3#  EXAMPLE: Fermi-Dirac function in Python.
    44#
    55#  This simple example shows how to use Rappture within a simulator
    6 #  written in C++.
     6#  written in Python.
    77# ======================================================================
    88#  AUTHOR:  Derrick Kearney, Purdue University
     
    5757    lib = Rappture.Library(argv[1])
    5858
    59 #    T = Rappture.Number();
    60 #    Ef = 0.0;
    61 #    dE = 0.0;
    62 #    kT = 0.0;
    63 #    Emin = 0.0;
    64 #    Emax = 0.0;
    6559    nPts = 200;
    6660    EArr = list() # [nPts];
  • trunk/src/objects/RpObject.cc

    r1581 r1586  
    318318
    319319void
     320Object::random()
     321{
     322    // bland objects cannot make random values
     323    return;
     324}
     325
     326Rp_Chain *
     327Object::diff(const Object &o)
     328{
     329    return NULL;
     330}
     331
     332void
    320333Object::__init()
    321334{
  • trunk/src/objects/RpObject.h

    r1581 r1586  
    6363
    6464        // get/set void* property
    65         const void *property (const char *key) const;
    66         void property (const char *key, const void *val, size_t nbytes);
     65        const void *property(const char *key) const;
     66        void property(const char *key, const void *val, size_t nbytes);
    6767
    6868        // get/set const char * property
    69         const char *propstr (const char *key) const;
    70         void propstr (const char *key, const char *val);
     69        const char *propstr(const char *key) const;
     70        void propstr(const char *key, const char *val);
    7171
    7272        // remove property from hash table
     
    7474
    7575        // return the value of object based on provided hints
    76         virtual void vvalue (void *storage, size_t numHints, va_list arg) const;
     76        virtual void vvalue(void *storage, size_t numHints, va_list arg) const;
     77        // populate the object with a random value
     78        virtual void random();
     79        // return the difference between this object and o
     80        virtual Rp_Chain *diff(const Object& o);
    7781
    7882        // get the Rappture1.1 xml text for this object
Note: See TracChangeset for help on using the changeset viewer.