rawcontainer.h

00001 /*
00002  * libopenraw - rawcontainer.h
00003  *
00004  * Copyright (C) 2006 Hubert Figuiere
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 
00022 
00023 
00024 #ifndef _RAWCONTAINER_H_
00025 #define _RAWCONTAINER_H_
00026 
00027 #include <sys/types.h>
00028 
00029 #include <libopenraw/io.h>
00030 #include <libopenraw/types.h>
00031 
00032 
00033 namespace OpenRaw {
00034     namespace IO {
00035         class Stream;
00036     }
00037 
00038     namespace Internals {
00039 
00040         
00044         class RawContainer
00045         {
00046         public:
00048             typedef enum {
00049                 ENDIAN_NULL = 0, 
00050                 ENDIAN_BIG,      
00051                 ENDIAN_LITTLE    
00052             } EndianType;
00053 
00059             RawContainer(IO::Stream *_file, off_t offset);
00061             virtual ~RawContainer();
00062             
00063             IO::Stream *file()
00064                 {
00065                     return m_file;
00066                 }
00067             EndianType endian() const
00068                 {
00069                     return m_endian;
00070                 }
00071 
00073             bool readInt16(IO::Stream *f, int16_t & v);
00075             bool readInt32(IO::Stream *f, int32_t & v);
00077             bool readUInt16(IO::Stream *f, uint16_t & v);
00079             bool readUInt32(IO::Stream *f, uint32_t & v);
00087             size_t fetchData(void *buf, const off_t offset, const size_t buf_size);
00088 
00089         protected:
00090 
00091             RawContainer(const RawContainer&);
00092             RawContainer & operator=(const RawContainer &);
00093 
00094             void setEndian(EndianType endian)
00095                 {
00096                     m_endian = endian;
00097                 }
00098 
00100             IO::Stream *m_file;
00102             off_t m_offset;
00103             EndianType m_endian;
00104         };
00105         
00106     }
00107 }
00108 
00109 
00110 #endif

Generated on Sat Jan 27 11:36:13 2007 for libopenraw by  doxygen 1.4.7