BufferSource.h
Go to the documentation of this file.00001
00002 #ifndef INCLUDED_BufferSource_h_
00003 #define INCLUDED_BufferSource_h_
00004
00005 #include "local/DataSource.h"
00006 #include "IPC/Thread.h"
00007 #include <vector>
00008 #include <string>
00009
00010
00011 class BufferSource : public virtual DataSource {
00012 public:
00013
00014 BufferSource()
00015 : DataSource(), timestamp(-1U), name("BufferSource"), buffer(), reqTime(-1U),
00016 swapLock(), readySignal(), readyTimestamp(-1U), readyName(), readyBuffer(), isReady(false),
00017 frame(0)
00018 {}
00019
00020 unsigned int timestamp;
00021 std::string name;
00022 std::vector<char> buffer;
00023 unsigned int reqTime;
00024
00025 virtual unsigned int nextTimestamp() { return timestamp; }
00026 virtual const std::string& nextName() { return name; }
00027 virtual unsigned int getData(const char *& payload, unsigned int& payloadSize, unsigned int& t, std::string& n);
00028
00029 virtual void signalReady();
00030
00031 virtual void setDataSourceThread(LoadDataThread* th) {
00032 if(th==NULL)
00033 reqTime=-1U;
00034 DataSource::setDataSourceThread(th);
00035 }
00036
00037 protected:
00038 Thread::Lock swapLock;
00039 Thread::Condition readySignal;
00040 unsigned int readyTimestamp;
00041 std::string readyName;
00042 std::vector<char> readyBuffer;
00043 bool isReady;
00044 unsigned int frame;
00045 };
00046
00047
00048
00049
00050
00051
00052 #endif