qtms/inc/qtmsmembuffer.h
changeset 44 d141fc1ad77b
parent 32 edd273b3192a
child 50 762d760dcfdf
equal deleted inserted replaced
43:7b58e65d61ee 44:d141fc1ad77b
    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 // FORWARD DECLARATION
    23 namespace TMS {
    24 namespace TMS {
    24 class TMSBuffer;
    25 class TMSBuffer;
    25 }
    26 }
    26 
    27 
    27 namespace QTMS {
    28 namespace QTMS {
    31     {
    32     {
    32 public:
    33 public:
    33     virtual ~QTMSMemBuffer();
    34     virtual ~QTMSMemBuffer();
    34 
    35 
    35     /**
    36     /**
    36      * Creates Memory Buffer object of the given size.
    37      * Factory methods
    37      * The memory is allocated on the heap.
       
    38      *
       
    39      * @param  size
       
    40      *      Size of the buffer to be created.
       
    41      *
       
    42      * @param  qbuffer
       
    43      *      Created QTMSBuffer object.
       
    44      *
       
    45      * @param  buffer
       
    46      *      TMS::TMSBuffer buffer object.
       
    47      *
       
    48      * @return
       
    49      *      TMS_RESULT_SUCCESS if buffer is created successfully.
       
    50      *      TMS_RESULT_INSUFFICIENT_MEMORY if buffer creation failed due to
       
    51      *      insufficient memory.
       
    52      *      TMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED if the buffer type is not
       
    53      *      supported.
       
    54      *
       
    55      */
    38      */
    56     static gint Create(guint size, QTMSBuffer*& qbuffer,
    39     static gint Create(QTMSBuffer*& buffer, TMS::TMSBuffer*& tmsbuffer);
    57             TMS::TMSBuffer*& tmsbuffer);
       
    58 
    40 
    59     /**
    41     /**
    60      * Return buffer type.
    42      * Return buffer type.
    61      *
    43      *
    62      * @param  buftype
    44      * @param  buftype
   114      */
    96      */
   115     virtual gint GetDataPtr(guint8*& bufptr);
    97     virtual gint GetDataPtr(guint8*& bufptr);
   116 
    98 
   117 private:
    99 private:
   118     QTMSMemBuffer();
   100     QTMSMemBuffer();
   119     gint PostConstruct();
   101     gint PostConstruct(guint size, TMS::TMSBuffer*& tmsbuffer);
   120 
   102 
   121 protected:
   103 protected:
   122     TMS::TMSBuffer* iBuffer;
   104     TMS::TMSBuffer* iTmsBuffer;
       
   105 
       
   106 private:
       
   107     guint iBufferSize;
       
   108     guint64 iTimeStamp;
       
   109     guint8* iDataPtr;
       
   110     gboolean iOwnsBuffer;
   123     };
   111     };
   124 
   112 
   125 } //namespace QTMS
   113 } //namespace QTMS
   126 
   114 
   127 #endif //QTMS_MEM_BUFFER_H
   115 #endif //QTMS_MEM_BUFFER_H