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  Version 2.0.0 Beta 1, packaged on April 2010.
00006 
00007  http://glc-lib.sourceforge.net
00008 
00009  GLC-lib is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  GLC-lib is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with GLC-lib; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023  *****************************************************************************/
00025 
00026 #ifndef GLC_BSREP_H_
00027 #define GLC_BSREP_H_
00028 
00029 #include <QString>
00030 #include <QFileInfo>
00031 #include <QDataStream>
00032 #include <QUuid>
00033 #include <QDateTime>
00034 
00035 #include "../glc_config.h"
00036 #include "glc_3drep.h"
00037 
00040 
00041 
00042 class GLC_LIB_EXPORT GLC_BSRep
00043 {
00045 
00047 
00048 public:
00050         GLC_BSRep(const QString& absoluteFileName= QString(), bool useCompression= true);
00051 
00053         GLC_BSRep(const GLC_BSRep&);
00054 
00056         virtual ~GLC_BSRep();
00058 
00059 
00061 
00062 public:
00063 
00065         inline QString absoluteFileName() const
00066         {return m_FileInfo.fileName();}
00067 
00069         bool repIsUpToDate(const QDateTime&);
00070 
00072         GLC_3DRep loadRep();
00073 
00075         GLC_BoundingBox boundingBox();
00076 
00078         static QString suffix();
00080 
00082 
00084 
00085 public:
00087         void setAbsoluteFileName(const QString&);
00088 
00090         bool save(const GLC_3DRep&);
00091 
00093         inline void setCompressionUsage(bool usage)
00094         {m_UseCompression= usage;}
00095 
00097         inline void setCompressionLevel(int level)
00098         {m_CompressionLevel= level;}
00099 
00101 
00102 private:
00104 // Private services function
00106 
00108         bool open(QIODevice::OpenMode);
00109 
00111         bool close();
00112 
00114         void writeHeader(const QDateTime&);
00115 
00117         bool headerIsOk();
00118 
00120         bool timeStampOk(const QDateTime&);
00121 
00123 // Private members
00125 private:
00127         static const QString m_Suffix;
00128 
00130         static const QUuid m_Uuid;
00131 
00133         static const quint32 m_Version;
00134 
00136         QFileInfo m_FileInfo;
00137 
00139         QFile* m_pFile;
00140 
00142         QDataStream m_DataStream;
00143 
00145         bool m_UseCompression;
00146 
00148         int m_CompressionLevel;
00149 
00150 };
00151 
00152 #endif /* GLC_BSREP_H_ */

SourceForge.net Logo

©2005 Laurent Ribon