Changeset 1065


Ignore:
Timestamp:
Jun 25, 2008 11:46:17 AM (12 years ago)
Author:
dkearney
Message:

changed float buffer example to really buffer floats.
changed dxWrite to demo functions for changing properties of the positions grid we create.
added character version of show to simple buffer objects.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/objects/dxWriter/Makefile

    r1064 r1065  
    55
    66clean:
    7         rm -rf dxWrite
     7        rm -rf dxWrite myDXFile.dx
  • trunk/examples/objects/dxWriter/dxWrite.cc

    r1064 r1065  
    77    Rappture::DXWriter d;
    88    float i = 0.0;
    9 //    int rank = 3;
     9    int rank = 3;
    1010    size_t p[] = {3,5,5};
    11 //    float origin[] = {0.0,0.0,0.0};
    12 //    float delta[] = {1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0};
     11    float origin[] = {0.0,0.0,0.0};
     12    float delta[] = {1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0};
    1313
    14 //    d.rank(rank);
    15 //    d.origin(origin);
    16 //    d.delta(delta);
     14    d.rank(rank);
     15    d.origin(origin);
     16    d.delta(delta);
    1717    d.counts(p);
    1818
  • trunk/examples/objects/floatBuffer/Makefile

    r1064 r1065  
     1all: floatBuffer
     2
    13floatBuffer: floatBuffer.cc
    24        g++ -g -Wall -o $@ $< -lrappture
  • trunk/examples/objects/floatBuffer/floatBuffer.cc

    r1064 r1065  
    44int main()
    55{
    6     Rappture::SimpleBuffer<int> fbuf;
     6    Rappture::SimpleBuffer<float> fbuf;
    77    float val = 0;
    88
     
    1212        std::cout << "storing " << val << std::endl;
    1313        fbuf.append(&val,1);
    14         // fbuf.show();
    1514        val += 1.1;
    1615    }
     
    3332    std::cout << "SEEK_END -20 pos = " << fbuf.tell() << std::endl;;
    3433
    35     Rappture::SimpleBuffer<int> cbuf;
     34    Rappture::SimpleBuffer<float> cbuf;
    3635    cbuf.move(fbuf);
    3736    cbuf.show();
  • trunk/src/core/RpSimpleBuffer.h

    r1055 r1065  
    423423
    424424
     425template<> inline
     426SimpleBuffer<char>&
     427SimpleBuffer<char>::show()
     428{
     429    size_t curMemb = 0;
     430
     431    while (curMemb != _nMembStored) {
     432        fprintf(stdout,"_buf[%d] = :%c:\n",curMemb,_buf[curMemb]);
     433        curMemb += 1;
     434    }
     435    fprintf(stdout,"_nMembAvl = :%d:\n",_nMembAvl);
     436
     437    return *this;
     438}
     439
     440
    425441template<class T>
    426442SimpleBuffer<T>&
     
    430446
    431447    while (curMemb != _nMembStored) {
    432         fprintf(stdout,"_buf[%d] = :%#x:\n",curMemb,_buf[curMemb]);
     448        fprintf(stdout,"_buf[%d] = :%g:\n",curMemb,(double)_buf[curMemb]);
    433449        curMemb += 1;
    434450    }
Note: See TracChangeset for help on using the changeset viewer.