Files
EgtGeomKernel/IdManager.h
T
Dario Sassi 396d53fc5d EgtGeomKernel 1.5h6 :
- migliorata trasformazioni di archi in curve di Bezier
- aggiunta funzione di esplosione di testi in più entità su interruzione di linea
- in TSC aggiunta funzione TEXT.SPLIT che fa quanto detto sopra
- in TSC aggiunta gestione colori e materiali notevoli da entità
- corretta assegnazione materiale a entità tramite Id
- piccole migliorie a PolyArc, aggiunta IsFlat.
2014-08-23 08:42:41 +00:00

62 lines
2.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : IdManager.h Data : 02.12.13 Versione : 1.4a3
// Contenuto : Dichiarazione e implementazione della classe IdManager.
//
//
//
// Modifiche : 02.12.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <unordered_map>
//----------------------------------------------------------------------------
class IdManager
{
public :
IdManager( void)
{ m_nMaxId = 0 ; }
bool Init( int nBuckets)
{ m_GdbIdMap.rehash( nBuckets) ; return true ; }
bool Clear( void)
{ m_GdbIdMap.clear() ; m_nMaxId = 0 ; return true ; }
GdbObj* FindObj( int nId)
{ INTPGDBO_UMAP::iterator Iter = m_GdbIdMap.find( nId) ;
if ( Iter != m_GdbIdMap.end())
return Iter->second ;
else
return nullptr ; }
const GdbObj* FindObj( int nId) const
{ INTPGDBO_UMAP::const_iterator Iter = m_GdbIdMap.find( nId) ;
if ( Iter != m_GdbIdMap.end())
return Iter->second ;
else
return nullptr ; }
bool AddObj( int nId, GdbObj* pGObj)
{ if ( nId > m_nMaxId)
m_nMaxId = nId ;
return m_GdbIdMap.insert( INTPGDBO_UMAP::value_type( nId, pGObj)).second ; }
bool RemoveObj( int nId)
{ m_GdbIdMap.erase( nId) ; return true ; }
int GetNewId( void)
{ return ( ++ m_nMaxId) ; }
int GetMaxId( void) const
{ return m_nMaxId ; }
void UpdateMaxId( int nId)
{ if ( nId > m_nMaxId)
m_nMaxId = nId ; }
private :
typedef std::unordered_map< int, GdbObj*> INTPGDBO_UMAP ;
private :
int m_nMaxId ;
INTPGDBO_UMAP m_GdbIdMap ; // map basato sugli identificatori
} ;