64ed8babd1
- aggiunta gestione DB utensili - aggiunta gestione DB lavorazioni.
54 lines
1.8 KiB
C++
54 lines
1.8 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : ToolsMgr.h Data : 01.06.15 Versione : 1.6f1
|
|
// Contenuto : Dichiarazione della classe ToolsMgr.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 01.06.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "ToolData.h"
|
|
#include <unordered_map>
|
|
#include <map>
|
|
|
|
class Scanner ;
|
|
class Writer ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
class ToolsMgr
|
|
{
|
|
public :
|
|
ToolsMgr( void) ;
|
|
bool Init( const std::string& sToolsFile) ;
|
|
bool Load( void) ;
|
|
bool Save( bool bCompressed = true) const ;
|
|
const ToolData* GetTool( const EgtUUID& Uuid) const ;
|
|
const ToolData* GetTool( const std::string& sName) const ;
|
|
bool GetFirstTool( int nFamily, std::string& sName, int& nType) const ;
|
|
bool GetNextTool( int nFamily, std::string& sName, int& nType) const ;
|
|
|
|
private :
|
|
bool LoadHeader( Scanner& TheScanner, int& nTotal, bool& bEnd) ;
|
|
bool LoadOneTool( Scanner& TheScanner, bool& bEnd) ;
|
|
bool SaveHeader( Writer& TheWriter) const ;
|
|
bool SaveOneTool( const EgtUUID& Uuid, Writer& TheWriter) const ;
|
|
bool VerifyCurrTool( int nFamily, std::string& sName, int& nType) const ;
|
|
|
|
private :
|
|
typedef std::unordered_map< EgtUUID, ToolData> UUIDTDATA_UMAP ;
|
|
typedef std::map< std::string, EgtUUID> STRUUID_MAP ;
|
|
typedef STRUUID_MAP::const_iterator STRUUID_CITER ;
|
|
|
|
private :
|
|
std::string m_sToolsFile ;
|
|
UUIDTDATA_UMAP m_utData ;
|
|
STRUUID_MAP m_suData ;
|
|
mutable STRUUID_CITER m_suCIter ;
|
|
mutable int m_nCounter ;
|
|
} ; |