qtms/inc/qtmsmembuffer.h
changeset 32 edd273b3192a
parent 27 cbb1bfb7ebfb
child 40 4a1905d205a2
equal deleted inserted replaced
27:cbb1bfb7ebfb 32:edd273b3192a
    18 #ifndef QTMS_MEM_BUFFER_H
    18 #ifndef QTMS_MEM_BUFFER_H
    19 #define QTMS_MEM_BUFFER_H
    19 #define QTMS_MEM_BUFFER_H
    20 
    20 
    21 #include <qtmsbuffer.h>
    21 #include <qtmsbuffer.h>
    22 
    22 
       
    23 namespace TMS {
       
    24 class TMSBuffer;
       
    25 }
       
    26 
    23 namespace QTMS {
    27 namespace QTMS {
    24 
    28 
    25 // QTMSMemBuffer class
    29 // QTMSMemBuffer class
    26 class QTMSMemBuffer : public QTMSBuffer
    30 class QTMSMemBuffer : public QTMSBuffer
    27     {
    31     {
    33      * The memory is allocated on the heap.
    37      * The memory is allocated on the heap.
    34      *
    38      *
    35      * @param  size
    39      * @param  size
    36      *      Size of the buffer to be created.
    40      *      Size of the buffer to be created.
    37      *
    41      *
       
    42      * @param  qbuffer
       
    43      *      Created QTMSBuffer object.
       
    44      *
    38      * @param  buffer
    45      * @param  buffer
    39      *      Created buffer object.
    46      *      TMS::TMSBuffer buffer object.
    40      *
    47      *
    41      * @return
    48      * @return
    42      *      TMS_RESULT_SUCCESS if buffer is created successfully.
    49      *      TMS_RESULT_SUCCESS if buffer is created successfully.
    43      *      TMS_RESULT_INSUFFICIENT_MEMORY if buffer creation failed due to
    50      *      TMS_RESULT_INSUFFICIENT_MEMORY if buffer creation failed due to
    44      *      insufficient memory.
    51      *      insufficient memory.
    45      *      TMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED if the buffer type is not
    52      *      TMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED if the buffer type is not
    46      *      supported.
    53      *      supported.
    47      *
    54      *
    48      */
    55      */
    49     static gint Create(guint size, QTMSBuffer*& buffer);
    56     static gint Create(guint size, QTMSBuffer*& qbuffer,
       
    57             TMS::TMSBuffer*& tmsbuffer);
    50 
    58 
    51     /**
    59     /**
    52      * Return buffer type.
    60      * Return buffer type.
    53      *
    61      *
    54      * @param  buftype
    62      * @param  buftype
   106      */
   114      */
   107     virtual gint GetDataPtr(guint8*& bufptr);
   115     virtual gint GetDataPtr(guint8*& bufptr);
   108 
   116 
   109 private:
   117 private:
   110     QTMSMemBuffer();
   118     QTMSMemBuffer();
   111     gint PostConstruct(guint size);
   119     gint PostConstruct();
   112 
   120 
   113 private:
   121 protected:
   114     guint iBufferSize;
   122     TMS::TMSBuffer* iBuffer;
   115     guint iTimeStamp;
       
   116     guint8* iDataPtr;
       
   117     gboolean iOwnsBuffer;
       
   118     };
   123     };
   119 
   124 
   120 } //namespace QTMS
   125 } //namespace QTMS
   121 
   126 
   122 #endif //QTMS_MEM_BUFFER_H
   127 #endif //QTMS_MEM_BUFFER_H