source: trunk/examples/objects/floatBuffer/floatBuffer.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: 838 bytes
Line 
1#include <iostream>
2#include "RpSimpleBuffer.h"
3
4int main()
5{
6    Rappture::SimpleBuffer<float> fbuf;
7    float val = 0;
8
9    fbuf.set(10);
10
11    for (int i=0; i < 100; i++) {
12        std::cout << "storing " << val << std::endl;
13        fbuf.append(&val,1);
14        val += 1.1;
15    }
16
17    fbuf.rewind();
18    val = -1;
19
20    while (!fbuf.eof()) {
21        fbuf.read(&val,1);
22        std::cout << "retrieving " << val << std::endl;
23    }
24
25    fbuf.seek(0,SEEK_SET);
26    std::cout << "SEEK_SET 0 pos = " << fbuf.tell() << std::endl;;
27
28    fbuf.seek(40,SEEK_CUR);
29    std::cout << "SEEK_CUR 40 pos = " << fbuf.tell() << std::endl;;
30
31    fbuf.seek(-20,SEEK_END);
32    std::cout << "SEEK_END -20 pos = " << fbuf.tell() << std::endl;;
33
34    Rappture::SimpleBuffer<float> cbuf;
35    cbuf.move(fbuf);
36    cbuf.show();
37
38    fbuf.clear();
39    return 0;
40}
Note: See TracBrowser for help on using the repository browser.