GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Private Member Functions | Private Attributes | Static Private Attributes | List of all members
GLC_BSRep Class Reference

GLC_BSRep : The 3D Binary serialised representation. More...

#include <glc_bsrep.h>

Public Member Functions

Constructor
 GLC_BSRep (const QString &absoluteFileName=QString(), bool useCompression=true)
 Default constructor.
 
 GLC_BSRep (const GLC_BSRep &)
 Copy constructor.
 
virtual ~GLC_BSRep ()
 Destructor.
 
Set Functions
void setAbsoluteFileName (const QString &)
 Set the binary representation file name.
 
bool save (const GLC_3DRep &)
 Save the GLC_3DRep in serialised binary.
 
void setCompressionUsage (bool usage)
 Set the compression usage for saving a 3DREP in binary format.
 
void setCompressionLevel (int level)
 Set the compression level if compression is used when saving in binary format.
 

Private Member Functions

bool open (QIODevice::OpenMode, QFile *pFile)
 Open the file.
 
bool close ()
 Close the file.
 
void writeHeader (const QDateTime &)
 Write the header.
 
bool headerIsOk ()
 Check the header.
 
bool timeStampOk (const QDateTime &)
 Check the time Stamp.
 

Private Attributes

QFileInfo m_FileInfo
 the Binary representation file informations
 
QFile * m_pFile
 The brep file.
 
QDataStream m_DataStream
 The Data stream.
 
bool m_UseCompression
 Compress Data.
 
int m_CompressionLevel
 The compression level.
 

Static Private Attributes

static const QString m_Suffix
 The binary rep suffix.
 
static const QUuid m_Uuid
 The binary rep magic number.
 
static const quint32 m_Version = 103
 The binary rep version.
 
static QMutex m_CompressionMutex
 Compression Mutex.
 

Get Functions

QString absoluteFileName () const
 Return the binary representation file name.
 
bool isUsable (const QDateTime &)
 Return true if the binary rep is usable.
 
GLC_3DRep loadRep (QFile *pFile=NULL)
 Load the binary rep, if the file is not NULL the rep take ownership of the file.
 
GLC_BoundingBox boundingBox ()
 Return the bounding box of the binary representation.
 
static QString suffix ()
 Return bsrep suffix.
 
static quint32 version ()
 Return bsrep version.
 

Detailed Description

GLC_BSRep : The 3D Binary serialised representation.

Definition at line 41 of file glc_bsrep.h.

Constructor & Destructor Documentation

GLC_BSRep::GLC_BSRep ( const QString &  absoluteFileName = QString(),
bool  useCompression = true 
)

Default constructor.

Definition at line 41 of file glc_bsrep.cpp.

References m_DataStream, and setAbsoluteFileName().

GLC_BSRep::GLC_BSRep ( const GLC_BSRep binaryRep)

Copy constructor.

Definition at line 54 of file glc_bsrep.cpp.

References m_DataStream.

GLC_BSRep::~GLC_BSRep ( )
virtual

Destructor.

Definition at line 65 of file glc_bsrep.cpp.

References m_pFile.

Member Function Documentation

QString GLC_BSRep::absoluteFileName ( ) const
inline

Return the binary representation file name.

Definition at line 64 of file glc_bsrep.h.

GLC_BoundingBox GLC_BSRep::boundingBox ( void  )

Return the bounding box of the binary representation.

Definition at line 161 of file glc_bsrep.cpp.

References close(), headerIsOk(), m_DataStream, open(), and timeStampOk().

Referenced by loadRep().

bool GLC_BSRep::close ( )
private

Close the file.

Definition at line 285 of file glc_bsrep.cpp.

References m_DataStream, and m_pFile.

Referenced by boundingBox(), isUsable(), loadRep(), and save().

bool GLC_BSRep::headerIsOk ( )
private

Check the header.

Definition at line 320 of file glc_bsrep.cpp.

References m_DataStream, m_pFile, m_Uuid, m_Version, and version().

Referenced by boundingBox(), isUsable(), and loadRep().

bool GLC_BSRep::isUsable ( const QDateTime &  timeStamp)

Return true if the binary rep is usable.

Definition at line 71 of file glc_bsrep.cpp.

References GLC_TraceLog::addTrace(), close(), GLC_FileFormatException::FileNotFound, headerIsOk(), GLC_TraceLog::isEnable(), m_FileInfo, open(), and timeStampOk().

Referenced by GLC_CacheManager::isUsable().

GLC_3DRep GLC_BSRep::loadRep ( QFile *  pFile = NULL)
bool GLC_BSRep::open ( QIODevice::OpenMode  mode,
QFile *  pFile 
)
private

Open the file.

Definition at line 253 of file glc_bsrep.cpp.

References GLC_TraceLog::addTrace(), GLC_TraceLog::isEnable(), m_DataStream, m_FileInfo, and m_pFile.

Referenced by boundingBox(), isUsable(), loadRep(), and save().

bool GLC_BSRep::save ( const GLC_3DRep rep)

Save the GLC_3DRep in serialised binary.

Check if the currentFileInfo is valid and writable

Definition at line 204 of file glc_bsrep.cpp.

References GLC_3DRep::boundingBox(), close(), GLC_3DRep::faceCount(), GLC_Rep::lastModified(), m_CompressionLevel, m_DataStream, m_pFile, m_UseCompression, open(), and writeHeader().

Referenced by GLC_CacheManager::addToCache().

void GLC_BSRep::setAbsoluteFileName ( const QString &  fileName)

Set the binary representation file name.

Definition at line 193 of file glc_bsrep.cpp.

References m_FileInfo, and m_Suffix.

Referenced by GLC_BSRep(), and GLC_CacheManager::isUsable().

void GLC_BSRep::setCompressionLevel ( int  level)
inline

Set the compression level if compression is used when saving in binary format.

Definition at line 99 of file glc_bsrep.h.

Referenced by GLC_CacheManager::addToCache().

void GLC_BSRep::setCompressionUsage ( bool  usage)
inline

Set the compression usage for saving a 3DREP in binary format.

Definition at line 95 of file glc_bsrep.h.

QString GLC_BSRep::suffix ( )
static

Return bsrep suffix.

Definition at line 179 of file glc_bsrep.cpp.

References m_Suffix.

Referenced by GLC_CacheManager::binary3DRep(), GLC_CacheManager::isCashed(), and GLC_CacheManager::isUsable().

bool GLC_BSRep::timeStampOk ( const QDateTime &  timeStamp)
private

Check the time Stamp.

Definition at line 343 of file glc_bsrep.cpp.

References m_DataStream, and m_pFile.

Referenced by boundingBox(), isUsable(), and loadRep().

quint32 GLC_BSRep::version ( )
static

Return bsrep version.

Definition at line 184 of file glc_bsrep.cpp.

References m_Version.

Referenced by headerIsOk().

void GLC_BSRep::writeHeader ( const QDateTime &  dateTime)
private

Write the header.

Definition at line 299 of file glc_bsrep.cpp.

References m_DataStream, m_pFile, m_Uuid, and m_Version.

Referenced by save().

Member Data Documentation

int GLC_BSRep::m_CompressionLevel
private

The compression level.

Definition at line 150 of file glc_bsrep.h.

Referenced by save().

QMutex GLC_BSRep::m_CompressionMutex
staticprivate

Compression Mutex.

Definition at line 153 of file glc_bsrep.h.

QDataStream GLC_BSRep::m_DataStream
private

The Data stream.

Definition at line 144 of file glc_bsrep.h.

Referenced by boundingBox(), close(), GLC_BSRep(), headerIsOk(), loadRep(), open(), save(), timeStampOk(), and writeHeader().

QFileInfo GLC_BSRep::m_FileInfo
private

the Binary representation file informations

Definition at line 138 of file glc_bsrep.h.

Referenced by isUsable(), loadRep(), open(), and setAbsoluteFileName().

QFile* GLC_BSRep::m_pFile
private

The brep file.

Definition at line 141 of file glc_bsrep.h.

Referenced by close(), headerIsOk(), open(), save(), timeStampOk(), writeHeader(), and ~GLC_BSRep().

const QString GLC_BSRep::m_Suffix
staticprivate

The binary rep suffix.

Definition at line 129 of file glc_bsrep.h.

Referenced by setAbsoluteFileName(), and suffix().

bool GLC_BSRep::m_UseCompression
private

Compress Data.

Definition at line 147 of file glc_bsrep.h.

Referenced by save().

const QUuid GLC_BSRep::m_Uuid
staticprivate

The binary rep magic number.

Definition at line 132 of file glc_bsrep.h.

Referenced by headerIsOk(), and writeHeader().

const quint32 GLC_BSRep::m_Version = 103
staticprivate

The binary rep version.

Definition at line 135 of file glc_bsrep.h.

Referenced by headerIsOk(), version(), and writeHeader().


The documentation for this class was generated from the following files:

©2005-2013 Laurent Ribon