Files
EgtInterface/GseContext.cpp
T
Dario Sassi 0e4a7397e8 EgtInterface 1.5i1 :
- profondo riordinamento e modifica.
2014-09-01 17:06:57 +00:00

66 lines
1.8 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2014-2014
//----------------------------------------------------------------------------
// File : GseContext.cpp Data : 01.09.14 Versione : 1.5i1
// Contenuto : Gestione contesti GSE ( Geometria, Scena, Esecuzione).
//
//
//
// Modifiche : 01.09.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "GseContext.h"
//----------------------------------------------------------------------------
static const int MAX_CTX = 10 ;
static bool s_GseOn[MAX_CTX] = { false, false, false, false, false, false, false, false, false, false} ;
static GseContext s_GseCtx[MAX_CTX] ;
//----------------------------------------------------------------------------
int
CreateGseContext( void)
{
for ( int i = 0 ; i < MAX_CTX ; ++ i) {
if ( ! s_GseOn[i]) {
s_GseCtx[i].Clear() ;
s_GseOn[i] = true ;
return ( i + 1) ;
}
}
return 0 ;
}
//----------------------------------------------------------------------------
bool
DeleteGseContext( int nInd)
{
if ( nInd < 1 || nInd > MAX_CTX)
return false ;
s_GseOn[nInd-1] = false ;
s_GseCtx[nInd-1].Clear() ;
return true ;
}
//----------------------------------------------------------------------------
bool
ClearAllGseContexts( void)
{
for ( int i = 0 ; i < MAX_CTX ; ++ i) {
s_GseOn[i] = false ;
s_GseCtx[i].Clear() ;
}
return true ;
}
//----------------------------------------------------------------------------
GseContext*
GetGseContext( int nInd)
{
if ( nInd < 1 || nInd > MAX_CTX || ! s_GseOn[nInd-1])
return nullptr ;
return &(s_GseCtx[nInd-1]) ;
}