glc_bsrep.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  http://glc-lib.sourceforge.net
00006 
00007  GLC-lib is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU Lesser General Public License as published by
00009  the Free Software Foundation; either version 3 of the License, or
00010  (at your option) any later version.
00011 
00012  GLC-lib is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU Lesser General Public License for more details.
00016 
00017  You should have received a copy of the GNU Lesser General Public License
00018  along with GLC-lib; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021  *****************************************************************************/
00023 
00024 #ifndef GLC_BSREP_H_
00025 #define GLC_BSREP_H_
00026 
00027 #include <QString>
00028 #include <QFileInfo>
00029 #include <QDataStream>
00030 #include <QUuid>
00031 #include <QDateTime>
00032 #include <QMutex>
00033 
00034 #include "../glc_config.h"
00035 #include "glc_3drep.h"
00036 
00039 
00040 
00041 class GLC_LIB_EXPORT GLC_BSRep
00042 {
00044 
00046 
00047 public:
00049         GLC_BSRep(const QString& absoluteFileName= QString(), bool useCompression= true);
00050 
00052         GLC_BSRep(const GLC_BSRep&);
00053 
00055         virtual ~GLC_BSRep();
00057 
00058 
00060 
00061 public:
00062 
00064         inline QString absoluteFileName() const
00065         {return m_FileInfo.fileName();}
00066 
00068         bool isUsable(const QDateTime&);
00069 
00071         GLC_3DRep loadRep();
00072 
00074         GLC_BoundingBox boundingBox();
00075 
00077         static QString suffix();
00078 
00080         static quint32 version();
00082 
00084 
00086 
00087 public:
00089         void setAbsoluteFileName(const QString&);
00090 
00092         bool save(const GLC_3DRep&);
00093 
00095         inline void setCompressionUsage(bool usage)
00096         {m_UseCompression= usage;}
00097 
00099         inline void setCompressionLevel(int level)
00100         {m_CompressionLevel= level;}
00101 
00103 
00104 private:
00106 // Private services function
00108 
00110         bool open(QIODevice::OpenMode);
00111 
00113         bool close();
00114 
00116         void writeHeader(const QDateTime&);
00117 
00119         bool headerIsOk();
00120 
00122         bool timeStampOk(const QDateTime&);
00123 
00125 // Private members
00127 private:
00129         static const QString m_Suffix;
00130 
00132         static const QUuid m_Uuid;
00133 
00135         static const quint32 m_Version;
00136 
00138         QFileInfo m_FileInfo;
00139 
00141         QFile* m_pFile;
00142 
00144         QDataStream m_DataStream;
00145 
00147         bool m_UseCompression;
00148 
00150         int m_CompressionLevel;
00151 
00153         static QMutex m_CompressionMutex;
00154 
00155 };
00156 
00157 #endif /* GLC_BSREP_H_ */

SourceForge.net Logo

©2005-2011 Laurent Ribon