Include :
- aggiornamento prototipi - aggiunte per ObjUser.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "/EgtDev/Include/EGkGeoFrame3d.h"
|
||||
#include "/EgtDev/Include/EGkGeoObj.h"
|
||||
#include "/EgtDev/Include/EGkMaterial.h"
|
||||
#include "/EgtDev/Include/EGkObjUser.h"
|
||||
#include "/EgtDev/Include/EgtNumCollection.h"
|
||||
#include "/EgtDev/Include/EgtStringBase.h"
|
||||
#include "/EgtDev/Include/EgtILogger.h"
|
||||
@@ -169,6 +170,12 @@ class __declspec( novtable) IGeomDB
|
||||
virtual bool GetInfo( int nId, const std::string& sKey, STRVECTOR& vsInfo) const = 0 ;
|
||||
virtual bool ExistsInfo( int nId, const std::string& sKey) const = 0 ;
|
||||
virtual bool RemoveInfo( int nId, const std::string& sKey) = 0 ;
|
||||
// ObjUser
|
||||
virtual bool SetObjUser( int nId, IObjUser* pObjUser) = 0 ;
|
||||
virtual IObjUser* GetObjUser( int nId) = 0 ;
|
||||
virtual const IObjUser* GetObjUser( int nId) const = 0 ;
|
||||
virtual bool DumpObjUser( int nId, std::string& sOut, const char* szNewLine) const = 0 ;
|
||||
virtual bool CopyObjUser( int nIdSou, int nIdDest) = 0 ;
|
||||
// Material library
|
||||
virtual int AddMaterial( const std::string& sName, const Material& matM) = 0 ;
|
||||
virtual int FindMaterial( const std::string& sName) const = 0 ;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EGkObjUser.h Data : 22.05.15 Versione : 1.6e3
|
||||
// Contenuto : Dichiarazione della interfaccia IObjUser.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.05.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EgtStringBase.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class __declspec( novtable) IObjUser
|
||||
{
|
||||
public :
|
||||
virtual ~IObjUser( void) {}
|
||||
virtual IObjUser* Clone( void) const = 0 ;
|
||||
virtual bool IsDefault(void) const { return false ; }
|
||||
virtual const std::string& GetClassName( void) const = 0 ;
|
||||
virtual bool Dump( std::string& sOut, const char* szNewLine = "\n") const = 0 ;
|
||||
virtual bool ToSave( void) const { return false ; }
|
||||
virtual bool Save( STRVECTOR& vString) const { return false ; }
|
||||
virtual bool Load( const STRVECTOR& vString) { return false ; }
|
||||
virtual bool SetOwner( int nId) = 0 ;
|
||||
virtual int GetOwner( void) const = 0 ;
|
||||
} ;
|
||||
@@ -0,0 +1,75 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EGkObjUserFactory.h Data : 22.05.15 Versione : 1.6e3
|
||||
// Contenuto : Factory della classe IObjUser.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 22.05.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EGkObjUser.h"
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
//----------------------- Macro per import/export ----------------------------
|
||||
#undef EGK_EXPORT
|
||||
#if defined( I_AM_EGK) // da definirsi solo nella DLL
|
||||
#define EGK_EXPORT __declspec( dllexport)
|
||||
#else
|
||||
#define EGK_EXPORT __declspec( dllimport)
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
#define OBJUSER_REGISTER( sName, T) static const bool bReg_##T = \
|
||||
ObjUserRegister<class T>::DoRegister( sName)
|
||||
#define OBJUSER_GETNAME( T) ObjUserRegister<class T>::GetName()
|
||||
#define OBJUSER_CREATE( sName) ObjUserFactory::Create( sName)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <class T>
|
||||
class ObjUserRegister
|
||||
{
|
||||
public :
|
||||
static bool DoRegister( const std::string& sName)
|
||||
{ if ( ! ObjUserFactory::Register( sName, Create))
|
||||
return false ;
|
||||
GetNamePrivate() = sName ;
|
||||
return true ; }
|
||||
static IObjUser* Create( void)
|
||||
{ return new(nothrow) T ; }
|
||||
static const std::string& GetName( void)
|
||||
{ return GetNamePrivate() ; }
|
||||
|
||||
private :
|
||||
ObjUserRegister( void) {}
|
||||
~ObjUserRegister( void) {}
|
||||
static std::string& GetNamePrivate( void)
|
||||
{ static std::string s_sName ;
|
||||
return s_sName ; }
|
||||
} ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
class ObjUserFactory
|
||||
{
|
||||
public :
|
||||
// definizione del tipo funzione di creazione
|
||||
typedef IObjUser* ( *ObjUserCreator) ( void) ;
|
||||
// per registrare le funzioni di creazione
|
||||
EGK_EXPORT static bool Register( const std::string& sName, ObjUserCreator Creator) ;
|
||||
// per creare l'oggetto richiesto
|
||||
EGK_EXPORT static IObjUser* Create( const std::string& sName) ;
|
||||
|
||||
private :
|
||||
ObjUserFactory( void) {}
|
||||
~ObjUserFactory( void) {}
|
||||
// definizione del tipo mappa con coppie nome, funzione di creazione
|
||||
typedef std::unordered_map<std::string, ObjUserCreator> CreatorMap ;
|
||||
// metodo di accesso alla mappa statica
|
||||
static CreatorMap& GetCreatorMap( void) ;
|
||||
} ;
|
||||
@@ -0,0 +1,85 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EgnStringKeyVal.h Data : 23.05.15 Versione : 1.6e3
|
||||
// Contenuto : Funzioni per gestione coppie chiave-valore in stringhe.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 23.05.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "/EgtDev/Include/EgnStringUtils.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const char EQUAL = '=' ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
FindKey( const std::string& sString, const std::string& sKey)
|
||||
{
|
||||
return ( sString.compare( 0, sKey.length(), sKey) == 0 &&
|
||||
sString.length() > sKey.length() &&
|
||||
sString[sKey.length()] == EQUAL) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
IsValidKey( const std::string& sString)
|
||||
{
|
||||
return ( ! sString.empty() &&
|
||||
sString.find( '\n') == std::string::npos &&
|
||||
sString.find_first_not_of( " \t\r\n") != std::string::npos) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
IsValidVal( const std::string& sString)
|
||||
{
|
||||
return ( sString.empty() ||
|
||||
( sString.find( '\n') == std::string::npos &&
|
||||
sString.find_first_not_of( " \t\r\n") != std::string::npos)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
SetVal( const std::string& sKey, const std::string& sVal, std::string& sString)
|
||||
{
|
||||
if ( ! IsValidKey( sKey) || ! IsValidVal( sVal))
|
||||
return false ;
|
||||
sString = sKey + EQUAL + sVal ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <class T>
|
||||
inline bool
|
||||
SetVal( const std::string& sKey, T& Val, std::string& sString)
|
||||
{
|
||||
return SetVal( sKey, ToString( Val), sString) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
inline bool
|
||||
GetVal( const std::string& sString, const std::string& sKey, std::string& sVal)
|
||||
{
|
||||
if ( ! IsValidKey( sKey))
|
||||
return false ;
|
||||
if ( ! FindKey( sString, sKey))
|
||||
return false ;
|
||||
sVal = sString.substr( sKey.length() + 1) ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
template <class T>
|
||||
inline bool
|
||||
GetVal( const std::string& sString, const std::string& sKey, T& Val)
|
||||
{
|
||||
std::string sVal ;
|
||||
return ( GetVal( sString, sKey, sVal) && FromString( sVal, Val)) ;
|
||||
}
|
||||
+1
-1
@@ -61,7 +61,7 @@ ToLower( std::string& sString)
|
||||
{ std::transform( sString.begin(), sString.end(), sString.begin(), ::tolower) ;
|
||||
return sString ; }
|
||||
inline bool
|
||||
CompareNoCase( const std::string& sL, const std::string& sR)
|
||||
EqualNoCase( const std::string& sL, const std::string& sR)
|
||||
{ return ( sL.size() == sR.size() &&
|
||||
std::equal( sL.cbegin(), sL.cend(), sR.cbegin(),
|
||||
[]( std::string::value_type cL, std::string::value_type cR)
|
||||
|
||||
+3
-1
@@ -76,11 +76,13 @@ class __declspec( novtable) IMachMgr
|
||||
virtual bool ResetHeadSet( const std::string& sHead) = 0 ;
|
||||
virtual bool SetCalcTable( const std::string& sTable) = 0 ;
|
||||
virtual bool SetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) = 0 ;
|
||||
virtual bool GetCalcAngles( const Vector3d& vtDirT,
|
||||
virtual bool GetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) = 0 ;
|
||||
virtual bool GetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
|
||||
int& nStat, double& dX, double& dY, double& dZ) = 0 ;
|
||||
virtual bool VerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) = 0 ;
|
||||
// Operations
|
||||
virtual int AddDrilling( const std::string& sName) = 0 ;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
+2
-1
@@ -423,11 +423,12 @@ EXE_EXPORT bool ExeLoadTool( const std::string& sHead, int nExit, const std::str
|
||||
EXE_EXPORT bool ExeResetHeadSet( const std::string& sHead) ;
|
||||
EXE_EXPORT bool ExeSetCalcTable( const std::string& sTable) ;
|
||||
EXE_EXPORT bool ExeSetCalcTool( const std::string& sTool, const std::string& sHead, int nExit) ;
|
||||
EXE_EXPORT bool ExeGetCalcAngles( const Vector3d& vtDirT,
|
||||
EXE_EXPORT bool ExeGetCalcAngles( const Vector3d& vtDirT, const Vector3d& vtDirA,
|
||||
int& nStat, double& dAngA1, double& dAngB1, double& dAngA2, double& dAngB2) ;
|
||||
EXE_EXPORT bool ExeGetCalcPositions( const Point3d& ptP, double dAngA, double dAngB,
|
||||
int& nStat, double& dX, double& dY, double& dZ) ;
|
||||
EXE_EXPORT bool ExeVerifyOutOfStroke( double dX, double dY, double dZ, double dAngA, double dAngB, int& nStat) ;
|
||||
EXE_EXPORT int ExeAddDrilling( const std::string& sName) ;
|
||||
|
||||
// Scene
|
||||
EXE_EXPORT bool ExeInitScene( HWND hWnd, int nDriver, bool b2Buff, int nColorBits, int nDepthBits) ;
|
||||
|
||||
Reference in New Issue
Block a user