Skip to content

Commit

Permalink
Re #3746. Something didn't work with SingletonHolder.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Nov 14, 2011
1 parent a614596 commit 9cd26bc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,33 @@ namespace Mantid
File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>
*/
class MANTID_GEOMETRY_DLL OpenGLContextImpl
class MANTID_GEOMETRY_DLL OpenGLContext
{
public:
/// True if OpenGL is avalable
bool isAvailable() const {return m_isOn;}
/// Set avalability of OpenGL. Must be updated by the GL widget.
void setAvalable(bool yes) {m_isOn = yes;}
static OpenGLContext& Instance();
private:
friend struct Mantid::Kernel::CreateUsingNew<OpenGLContextImpl>;
//friend struct Mantid::Kernel::CreateUsingNew<OpenGLContextImpl>;

OpenGLContextImpl(); ///< Constructor
OpenGLContextImpl(const OpenGLContextImpl&); ///< Private copy constructor
OpenGLContextImpl& operator=(const OpenGLContextImpl&); ///< Private assignment operator
~OpenGLContextImpl(){} ///< Destructor
OpenGLContext(); ///< Constructor
OpenGLContext(const OpenGLContext&); ///< Private copy constructor
OpenGLContext& operator=(const OpenGLContext&); ///< Private assignment operator
~OpenGLContext(){} ///< Destructor

bool m_isOn; ///< flag indicating whether OpenGL is avalable or not
static Kernel::Logger& g_log; ///< The logger

};

///Forward declaration of a specialisation of SingletonHolder for OpenGLContextImpl (needed for dllexport/dllimport) and a typedef for it.
#ifdef _WIN32
// this breaks new namespace declaraion rules; need to find a better fix
template class MANTID_GEOMETRY_DLL Mantid::Kernel::SingletonHolder<OpenGLContextImpl>;
#endif /* _WIN32 */
typedef MANTID_GEOMETRY_DLL Mantid::Kernel::SingletonHolder<OpenGLContextImpl> OpenGLContext;
// ///Forward declaration of a specialisation of SingletonHolder for OpenGLContextImpl (needed for dllexport/dllimport) and a typedef for it.
//#ifdef _WIN32
//// this breaks new namespace declaraion rules; need to find a better fix
// template class MANTID_GEOMETRY_DLL Mantid::Kernel::SingletonHolder<OpenGLContextImpl>;
//#endif /* _WIN32 */
// typedef MANTID_GEOMETRY_DLL Mantid::Kernel::SingletonHolder<OpenGLContextImpl> OpenGLContext;

} // NAMESPACE Geometry

Expand Down
10 changes: 8 additions & 2 deletions Code/Mantid/Framework/Geometry/src/Rendering/OpenGLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ namespace Mantid
namespace Geometry
{

Kernel::Logger& OpenGLContextImpl::g_log(Kernel::Logger::get("OpenGLContextImpl"));
Kernel::Logger& OpenGLContext::g_log(Kernel::Logger::get("OpenGLContext"));

OpenGLContextImpl::OpenGLContextImpl():
OpenGLContext::OpenGLContext():
m_isOn(false)
{
}

OpenGLContext& OpenGLContext::Instance()
{
static OpenGLContext context;
return context;
}


} // Geometry
} // Mantid

0 comments on commit 9cd26bc

Please sign in to comment.