Files
Include/EGkIntervals.h
T
Dario Sassi ca1c1ae28f Include :
- aggiornamenti.
2015-08-22 13:52:48 +00:00

58 lines
2.1 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : EGkIntervals.h Data : 03.08.15 Versione : 1.6h1
// Contenuto : Dichiarazione della classe insieme di intervalli Intervals.
//
//
//
// Modifiche : 03.08.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#pragma once
#include <list>
//----------------------- 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 Intervals
{
public :
EGK_EXPORT Intervals( void)
: m_Iter( m_lInts.end()) {}
public :
EGK_EXPORT void Reset( void) ;
EGK_EXPORT void Set( double dMin, double dMax) ;
EGK_EXPORT void Add( double dMin, double dMax) ;
EGK_EXPORT void Subtract( double dMin, double dMax) ;
EGK_EXPORT void Add( const Intervals& Other) ;
EGK_EXPORT void Subtract( const Intervals& Other) ;
EGK_EXPORT void Intersect( const Intervals& Other) ;
EGK_EXPORT bool IsEmpty( void) const
{ return m_lInts.empty() ; }
EGK_EXPORT int GetCount( void) const
{ return int( m_lInts.size()) ; }
EGK_EXPORT bool GetMinMax( double& dMin, double& dMax) ;
EGK_EXPORT bool GetFirst( double& dMin, double& dMax) ;
EGK_EXPORT bool GetNext( double& dMin, double& dMax) ;
private :
typedef std::pair<double,double> INTERV ; // intervallo, definito come insieme di minimo e massimo
typedef std::list<INTERV> INTERVLIST ; // lista di intervalli
typedef INTERVLIST::const_iterator INTL_CINT ; // iteratore costante a lista di intervalli
private :
INTERVLIST m_lInts ;
INTL_CINT m_Iter ;
} ;