Include : aggiunto oggetto ReleasePointer e interfacce varie.

This commit is contained in:
Dario Sassi
2013-11-26 15:02:45 +00:00
parent c8b31a1eb3
commit fd3238f092
7 changed files with 227 additions and 2 deletions
+50
View File
@@ -0,0 +1,50 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EGkGeomDB.h Data : 24.11.13 Versione : 1.3a1
// Contenuto : Dichiarazione della interfaccia IGeomDB.
//
//
//
// Modifiche : 24.11.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
#include "/EgtDev/Include/EGkGeoObj.h"
//----------------------- 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
//-----------------------------------------------------------------------------
class _declspec( novtable) IGeomDB
{
public :
virtual ~IGeomDB( void) {}
virtual bool Init( void) = 0 ;
virtual bool Clear( void) = 0 ;
virtual bool Load( std::ifstream& osIn) = 0 ;
virtual bool Save( std::ofstream& osOut) = 0 ;
virtual bool ExistsObj( const std::string& sName) = 0 ;
virtual bool AddGeoObj( const std::string& sName, IGeoObj* pGeoObj) = 0 ;
virtual GeoObjType GetObjType( const std::string& sName) = 0 ;
virtual IGeoObj* GetGeoObj( const std::string& sName) = 0 ;
virtual bool Copy( const std::string& sNameSou, const std::string& sNameDest) = 0 ;
virtual bool Erase( const std::string& sName) = 0 ;
virtual bool Translate( const std::string& sName, const Vector3d& vtMove) = 0 ;
virtual bool Rotate( const std::string& sName, const Point3d& ptAx, const Vector3d& vtAx, double dCosAng, double dSinAng) = 0 ;
virtual bool Rotate( const std::string& sName, const Point3d& ptAx, const Vector3d& vtAx, double dAngDeg) = 0 ;
virtual bool Scale( const std::string& sName, const Point3d& ptCen, double dCoeffX, double dCoeffY, double dCoeffZ) = 0 ;
virtual bool Mirror( const std::string& sName, const Point3d& ptOn, const Vector3d& vtNorm) = 0 ;
} ;
//-----------------------------------------------------------------------------
EGK_EXPORT IGeomDB* CreateGeomDB( void) ;
+20
View File
@@ -0,0 +1,20 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EgnStringBase.h Data : 25.11.13 Versione : 1.3a1
// Contenuto : Dichiarazioni di base (costanti, tipi, ...) per le stringhe.
//
//
//
// Modifiche : 25.11.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <string>
#include <vector>
//----------------------------------------------------------------------------
typedef std::vector<std::string> STRVECTOR ;
+1 -2
View File
@@ -13,9 +13,8 @@
#pragma once
#include <string>
#include <vector>
#include <algorithm>
#include "/EgtDev/Include/EgnStringBase.h"
#include "/EgtDEv/Include/EGkPoint3d.h"
//----------------------- Macro per import/export -----------------------------
+36
View File
@@ -0,0 +1,36 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EgkGdbExecutor.h Data : 25.11.13 Versione : 1.3a1
// Contenuto : Dichiarazione della interfaccia IGdbExecutor.
//
//
//
// Modifiche : 25.11.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EgnCmdExecutor.h"
#include "/EgtDev/Include/EgkGeomDB.h"
//----------------------- 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
//----------------------------------------------------------------------------
class _declspec( novtable) IGdbExecutor : public ICmdExecutor
{
public :
virtual ~IGdbExecutor( void) {}
virtual bool Set( IGeomDB* pGdb) = 0 ;
} ;
//----------------------------------------------------------------------------
EGK_EXPORT IGdbExecutor* CreateGdbExecutor( void) ;
+23
View File
@@ -0,0 +1,23 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EgnCmdExecutor.h Data : 25.11.13 Versione : 1.3a1
// Contenuto : Dichiarazione della interfaccia ICmdExecutor.
//
//
//
// Modifiche : 25.11.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EgnStringBase.h"
//----------------------------------------------------------------------------
class _declspec( novtable) ICmdExecutor
{
public :
virtual bool Execute( const std::string& sCmd1, const std::string& sCmd2, const STRVECTOR& vsParams) = 0 ;
} ;
+37
View File
@@ -0,0 +1,37 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EgnCmdParser.h Data : 25.11.13 Versione : 1.3a1
// Contenuto : Dichiarazione della interfaccia ICmdParser.
//
//
//
// Modifiche : 25.11.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include "/EgtDev/Include/EgnStringBase.h"
#include "/EgtDev/Include/EgnCmdExecutor.h"
//----------------------- Macro per import/export -----------------------------
#undef EGN_EXPORT
#if defined( I_AM_EGN) // da definirsi solo nella DLL
#define EGN_EXPORT __declspec( dllexport)
#else
#define EGN_EXPORT __declspec( dllimport)
#endif
//----------------------------------------------------------------------------
class _declspec( novtable) ICmdParser
{
public :
virtual ~ICmdParser( void) {}
virtual bool Initialize( std::wstring sCmdFile, ICmdExecutor* pCmdExec) = 0 ;
virtual bool Run( void) = 0 ;
} ;
//-----------------------------------------------------------------------------
EGN_EXPORT ICmdParser* CreateCmdParser( void) ;
+60
View File
@@ -0,0 +1,60 @@
//----------------------------------------------------------------------------
// EgalTech 2013-2013
//----------------------------------------------------------------------------
// File : EgtReleasePointer.h Data : 25.11.13 Versione : 1.3a1
// Contenuto : Dichiarazione classe template per puntatore con auto rilascio.
//
//
//
// Modifiche : 25.11.13 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
//----------------------------------------------------------------------------
template <class T>
class ReleasePtr
{
public :
explicit ReleasePtr( T* pT) { m_pT = pT ; }
~ReleasePtr( void) { if ( m_pT != nullptr) delete m_pT ; m_pT = nullptr ; }
T& operator*() const { return *m_pT ; }
T* operator->() const { return m_pT ; }
private :
T* m_pT ;
template <class T> friend bool IsValid( ReleasePtr<T>& RPT) ;
template <class T> friend T* Get( ReleasePtr<T>& RPT) ;
template <class T> friend T* Release( ReleasePtr<T>& RPT) ;
} ;
//----------------------------------------------------------------------------
template <class T>
bool
IsValid( ReleasePtr<T>& RPT)
{
return ( RPT.m_pT != nullptr) ;
}
//----------------------------------------------------------------------------
template <class T>
T*
Get( ReleasePtr<T>& RPT)
{
return RPT.m_pT ;
}
//----------------------------------------------------------------------------
template <class T>
T*
Release( ReleasePtr<T>& RPT)
{
T* pT = RPT.m_pT ;
RPT.m_pT = nullptr ;
return pT ;
}