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