2006-02-28 10:29:06 +00:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// The Loki Library
|
|
|
|
|
// Copyright (c) 2006 Peter K<>mmel
|
|
|
|
|
// Permission to use, copy, modify, distribute and sell this software for any
|
|
|
|
|
// purpose is hereby granted without fee, provided that the above copyright
|
|
|
|
|
// notice appear in all copies and that both that copyright notice and this
|
|
|
|
|
// permission notice appear in supporting documentation.
|
|
|
|
|
// The author makes no representations about the
|
|
|
|
|
// suitability of this software for any purpose. It is provided "as is"
|
|
|
|
|
// without express or implied warranty.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
#ifndef LOKI_SINGLETONDLL_H
|
|
|
|
|
#define LOKI_SINGLETONDLL_H
|
|
|
|
|
|
2006-10-17 20:36:13 +00:00
|
|
|
|
// $Id$
|
|
|
|
|
|
2006-02-28 10:29:06 +00:00
|
|
|
|
|
|
|
|
|
#include "singletondll_export.h"
|
|
|
|
|
|
|
|
|
|
class Foo;
|
|
|
|
|
|
|
|
|
|
// Use the predefined Loki::Singleton
|
2006-09-15 06:30:16 +00:00
|
|
|
|
// of loki/Singleton.h and use the export
|
|
|
|
|
// specifier of the current library
|
|
|
|
|
#define LOKI_SINGLETON_EXPORT SINGLETONDLL_EXPORT
|
2006-02-28 10:29:06 +00:00
|
|
|
|
#include <loki/Singleton.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// declare the Singleton template by yourself
|
2006-09-15 06:30:16 +00:00
|
|
|
|
// and export Singleton<Foo>, so the singleton
|
|
|
|
|
// is not in the Loki namespace
|
2006-02-28 10:29:06 +00:00
|
|
|
|
template<class T>
|
2006-09-15 06:30:16 +00:00
|
|
|
|
class SINGLETONDLL_EXPORT Singleton
|
2006-02-28 10:29:06 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2006-06-19 12:46:22 +00:00
|
|
|
|
static T& Instance();
|
2006-02-28 10:29:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-03-02 21:19:41 +00:00
|
|
|
|
#endif
|