00001
00019 #ifndef _ONV_LBUFFER_H
00020 #define _ONV_LBUFFER_H
00021
00022 #include <cc++2/cc++/thread.h>
00023 #include <cc++2/cc++/config.h>
00024 #include <cc++2/cc++/exception.h>
00025 #include <pthread.h>
00026 #include <semaphore.h>
00027 #include <time.h>
00028 #include <signal.h>
00029 #include <unistd.h>
00030
00031 using namespace ost;
00038 class LBuffer : public Mutex {
00039 private:
00040 int Width, Height, ElementSz;
00041 void *Ptr;
00042 public:
00043
00045 LBuffer( int W,
00046 int H,
00047 int sz )
00048 {
00049 Ptr = malloc(sz*W*H);
00050 Width = (size_t)W;
00051 Height = (size_t)H;
00052 ElementSz = (size_t)sz ;
00053 };
00054
00056 ~LBuffer() {
00057 free(Ptr);
00058 };
00061 void lock() { ENTER_CRITICAL; }
00062
00064 void unlock() { LEAVE_CRITICAL; }
00065
00067 size_t width() { return (size_t)Width; }
00068
00070 size_t height() { return (size_t)Height; }
00071
00073 size_t elmentsz() { return (size_t)ElementSz; }
00074
00076 size_t size() { return (size_t)(ElementSz*Width*Height); }
00077
00079 void *ptr() { return Ptr; }
00080 };
00081
00082 #endif