49d2577328
- sistemato aggiornamento utensili attrezzati in macchina al salvatggio DB utensili.
74 lines
2.9 KiB
C++
74 lines
2.9 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 Load( const std::string& sToolsFile) ;
|
|
bool Reload( void) ;
|
|
bool GetModified( void)
|
|
{ return m_bModified ; }
|
|
bool Save( bool bCompressed = true) const ;
|
|
bool GetToolNewName( std::string& sName) const ;
|
|
bool AddTool( const std::string& sName, int nType) ;
|
|
bool CopyTool( const std::string& sSource, const std::string& sName) ;
|
|
bool RemoveTool( const std::string& sName) ;
|
|
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 ;
|
|
bool SetCurrTool( const std::string& sName) ;
|
|
bool SaveCurrTool( void) ;
|
|
bool IsCurrToolModified( void) const ;
|
|
bool SetCurrToolParam( int nType, bool bVal) ;
|
|
bool SetCurrToolParam( int nType, int nVal) ;
|
|
bool SetCurrToolParam( int nType, double dVal) ;
|
|
bool SetCurrToolParam( int nType, const std::string& sVal) ;
|
|
bool GetCurrToolParam( int nType, bool& bVal) const ;
|
|
bool GetCurrToolParam( int nType, int& nVal) const ;
|
|
bool GetCurrToolParam( int nType, double& dVal) const ;
|
|
bool GetCurrToolParam( int nType, std::string& sVal) const ;
|
|
|
|
private :
|
|
bool Clear( void) ;
|
|
bool LoadHeader( Scanner& TheScanner, int& nVersion, int& nToolSize, int& nTotal, bool& bEnd) ;
|
|
bool LoadOneTool( Scanner& TheScanner, int nToolSize, bool& bEnd) ;
|
|
bool SaveHeader( Writer& TheWriter) const ;
|
|
bool SaveOneTool( const EgtUUID& Uuid, int& nCounter, Writer& TheWriter) const ;
|
|
bool VerifyTool( 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 ;
|
|
bool m_bCurrTool ;
|
|
ToolData m_tdCurrTool ;
|
|
mutable bool m_bModified ;
|
|
} ; |