00001
00011 #ifndef TARTSHAREDMEMORYDATASOURCE_H
00012 #define TARTSHAREDMEMORYDATASOURCE_H
00013
00014 #include "TArtSharedMemory.h"
00015 #include "TArtSemaphore.h"
00016 #include "TArtDataSource.h"
00017
00018 #ifdef BABIRL
00019 #define SHM_BUFF_SIZE 0x80000 // 256 kByte
00020 #define ANSHMKEY 561000
00021 #define ANSEMKEY 561001
00022 #else
00023 #define SHM_BUFF_SIZE 0x4000 // 16 kByte
00024 #define ANSHMKEY 17001
00025 #define ANSEMKEY 18001
00026 #endif
00027
00028 class TArtSharedMemoryDataSource : public TArtDataSource {
00029 public:
00030 ~TArtSharedMemoryDataSource();
00031 static TArtDataSource* Instance();
00032 ArtFileStat_t Open(const char* sourceName = 0);
00033 void Close();
00034 ArtBlockStat_t GetNextBlock();
00035 int Read(char *buf, const int &size, const int &offset = 0);
00036 protected:
00037 TArtSharedMemoryDataSource();
00038 private:
00039 static TArtDataSource *fgInstance;
00040 TArtSharedMemory *fSharedMemory;
00041 TArtSemaphore *fSemaphore;
00042 unsigned int fNBlock;
00043 unsigned int fMemoryPos;
00044 };
00045 #endif // end of #ifdef TARTSHAREDMEMORYDATASOURCE_H