Files
EgtMachKernel/ToolsMgr.h
T
Dario Sassi 0cbd07fe4a EgtMachKernel 2.1j1 :
- aggiunta gestione richiesta diametro portautensile.
2019-10-07 06:43:26 +00:00

86 lines
3.5 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& sToolsDir, const std::string& sToolsFile) ;
bool Reload( void) ;
bool GetModified( void) const
{ return m_bModified ; }
const UUIDVECTOR& GetUtModified( void) const
{ return m_utModified ; }
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 ;
bool GetCurrToolMaxDepth( double dSafe, double& dMaxDepth) const ;
bool GetCurrToolThDiam( double& dThDiam) const ;
const ToolData* GetCurrTool( void) const
{ if ( m_bCurrTool)
return &m_tdCurrTool ;
else
return nullptr ; }
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 ;
bool UpdateCurrToolHolderData( void) ;
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_sToolsDir ;
std::string m_sToolsPath ;
UUIDTDATA_UMAP m_utData ;
STRUUID_MAP m_suData ;
mutable STRUUID_CITER m_suCIter ;
bool m_bCurrTool ;
ToolData m_tdCurrTool ;
mutable bool m_bModified ;
mutable UUIDVECTOR m_utModified ;
} ;