GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_bsrep.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
23 
24 #ifndef GLC_BSREP_H_
25 #define GLC_BSREP_H_
26 
27 #include <QString>
28 #include <QFileInfo>
29 #include <QDataStream>
30 #include <QUuid>
31 #include <QDateTime>
32 #include <QMutex>
33 
34 #include "../glc_config.h"
35 #include "glc_3drep.h"
36 
39 
40 
42 {
44 
46 
47 public:
49  GLC_BSRep(const QString& absoluteFileName= QString(), bool useCompression= true);
50 
52  GLC_BSRep(const GLC_BSRep&);
53 
55  virtual ~GLC_BSRep();
57 
58 
60 
61 public:
62 
64  inline QString absoluteFileName() const
65  {return m_FileInfo.fileName();}
66 
68  bool isUsable(const QDateTime&);
69 
71  GLC_3DRep loadRep(QFile* pFile= NULL);
72 
74  GLC_BoundingBox boundingBox();
75 
77  static QString suffix();
78 
80  static quint32 version();
82 
84 
86 
87 public:
89  void setAbsoluteFileName(const QString&);
90 
92  bool save(const GLC_3DRep&);
93 
95  inline void setCompressionUsage(bool usage)
96  {m_UseCompression= usage;}
97 
99  inline void setCompressionLevel(int level)
100  {m_CompressionLevel= level;}
101 
103 
104 private:
106 // Private services function
108 
110  bool open(QIODevice::OpenMode, QFile *pFile);
111 
113  bool close();
114 
116  void writeHeader(const QDateTime&);
117 
119  bool headerIsOk();
120 
122  bool timeStampOk(const QDateTime&);
123 
125 // Private members
127 private:
129  static const QString m_Suffix;
130 
132  static const QUuid m_Uuid;
133 
135  static const quint32 m_Version;
136 
138  QFileInfo m_FileInfo;
139 
141  QFile* m_pFile;
142 
144  QDataStream m_DataStream;
145 
148 
151 
153  static QMutex m_CompressionMutex;
154 
155 };
156 
157 #endif /* GLC_BSREP_H_ */

©2005-2013 Laurent Ribon