EgtGeomKernel 1.6f2 :
- ObjUser rinominati UserObj - aggiunta RemoveUserObj - aggiunte a GdbIterator le funzioni di trsformazione.
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : UserObjFactory.h Data : 22.05.15 Versione : 1.6e3
|
||||
// Contenuto : Factory della classe IUserObj.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.05.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "/EgtDev/Include/EGkUserObjFactory.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
UserObjFactory::Register( const string& sName, UserObjCreator Creator)
|
||||
{
|
||||
return GetCreatorMap().emplace( sName, Creator).second ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
IUserObj*
|
||||
UserObjFactory::Create( const string& sName)
|
||||
{
|
||||
auto Iter = GetCreatorMap().find( sName) ;
|
||||
if ( Iter != GetCreatorMap().end()) {
|
||||
if ( Iter->second != nullptr)
|
||||
return Iter->second() ;
|
||||
}
|
||||
return nullptr ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
UserObjFactory::GetList( STRVECTOR& vsList)
|
||||
{
|
||||
// verifico parametro di ritorno
|
||||
if ( &vsList == nullptr)
|
||||
return false ;
|
||||
// ciclo sugli oggetti registrati
|
||||
for ( auto Iter = GetCreatorMap().cbegin() ; Iter != GetCreatorMap().cend() ; ++ Iter)
|
||||
vsList.emplace_back( Iter->first) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
UserObjFactory::CreatorMap&
|
||||
UserObjFactory::GetCreatorMap( void)
|
||||
{
|
||||
static CreatorMap s_CreatorMap ;
|
||||
return s_CreatorMap ;
|
||||
}
|
||||
Reference in New Issue
Block a user