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.
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2006-10-17 20:36:13 +00:00
|
|
|
|
// $Id$
|
|
|
|
|
|
2006-02-28 10:29:06 +00:00
|
|
|
|
|
2006-03-03 11:58:24 +00:00
|
|
|
|
#include "singletondll.h"
|
2006-02-28 10:29:06 +00:00
|
|
|
|
|
|
|
|
|
#include "foo.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef Loki::SingletonHolder<Foo> FooSingleton;
|
|
|
|
|
|
2006-02-28 10:48:16 +00:00
|
|
|
|
LOKI_SINGLETON_INSTANCE_DEFINITION(FooSingleton)
|
|
|
|
|
/*
|
2006-09-15 06:30:16 +00:00
|
|
|
|
This code will be generated by the macro,
|
|
|
|
|
(ObjectType is a typedef of SingletonHolder):
|
|
|
|
|
|
2006-03-15 08:47:19 +00:00
|
|
|
|
namespace Loki
|
2006-06-19 12:46:22 +00:00
|
|
|
|
{
|
|
|
|
|
template<>
|
|
|
|
|
FooSingleton::ObjectType& Singleton<FooSingleton::ObjectType>::Instance()
|
|
|
|
|
{
|
2006-03-15 08:47:19 +00:00
|
|
|
|
return FooSingleton::Instance();
|
2006-06-19 12:46:22 +00:00
|
|
|
|
}
|
2006-03-15 08:47:19 +00:00
|
|
|
|
}
|
2006-02-28 10:48:16 +00:00
|
|
|
|
*/
|
2006-02-28 10:29:06 +00:00
|
|
|
|
|
2006-03-15 08:47:19 +00:00
|
|
|
|
|
2006-03-03 11:58:24 +00:00
|
|
|
|
template<>
|
2006-02-28 10:48:16 +00:00
|
|
|
|
Foo& Singleton<Foo>::Instance()
|
2006-02-28 10:29:06 +00:00
|
|
|
|
{
|
2006-09-15 06:30:16 +00:00
|
|
|
|
return Loki::SingletonHolder<Foo>::Instance();
|
2006-03-03 11:58:24 +00:00
|
|
|
|
}
|
2006-02-28 10:48:16 +00:00
|
|
|
|
|
|
|
|
|
|
2006-09-15 06:30:16 +00:00
|
|
|
|
// explicit instantiations
|
|
|
|
|
template class Singleton<Foo>;
|
|
|
|
|
template class Loki::Singleton<Foo>;
|
2006-02-28 10:29:06 +00:00
|
|
|
|
|