CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Utilities/StorageFactory/interface/IOPosBuffer.h

Go to the documentation of this file.
00001 #ifndef STORAGE_FACTORY_IO_POS_BUFFER_H
00002 # define STORAGE_FACTORY_IO_POS_BUFFER_H
00003 
00004 # include "Utilities/StorageFactory/interface/IOTypes.h"
00005 
00007 struct IOPosBuffer
00008 {
00009 public:
00010   IOPosBuffer (void);
00011   IOPosBuffer (IOOffset offset, void *data, IOSize length);
00012   IOPosBuffer (IOOffset offset, const void *data, IOSize length);
00013 
00014   IOOffset      offset (void) const;
00015   void *        data (void) const;
00016   IOSize        size (void) const;
00017 
00018   void          set_offset (IOOffset new_offset);
00019   void          set_data (void * new_buffer);
00020   void          set_size (IOSize new_size);
00021 
00022 private:
00023   IOOffset      m_offset;       //< File offset.
00024   void          *m_data;        //< Data
00025   IOSize        m_length;       //< Length of data in bytes.
00026 };
00027 
00029 inline
00030 IOPosBuffer::IOPosBuffer (void)
00031   : m_offset (0),
00032     m_data (0),
00033     m_length (0)
00034 {}
00035 
00037 inline
00038 IOPosBuffer::IOPosBuffer (IOOffset offset, void *data, IOSize length)
00039   : m_offset (offset),
00040     m_data (data),
00041     m_length (length)
00042 {}
00043 
00045 inline
00046 IOPosBuffer::IOPosBuffer (IOOffset offset, const void *data, IOSize length)
00047   : m_offset (offset),
00048     m_data (const_cast<void *> (data)),
00049     m_length (length)
00050 {}
00051 
00053 inline IOOffset
00054 IOPosBuffer::offset (void) const
00055 { return m_offset; }
00056 
00058 inline void *
00059 IOPosBuffer::data (void) const
00060 { return m_data; }
00061 
00063 inline IOSize
00064 IOPosBuffer::size (void) const
00065 { return m_length; }
00066 
00068 inline void
00069 IOPosBuffer::set_offset(IOOffset new_offset)
00070 { m_offset = new_offset; }
00071 
00073 inline void
00074 IOPosBuffer::set_data(void * new_data)
00075 { m_data = new_data; }
00076 
00078 inline void
00079 IOPosBuffer::set_size(IOSize new_length)
00080 { m_length = new_length; }
00081 
00082 #endif // STORAGE_FACTORY_IO_POS_BUFFER_H