MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Classes | Namespaces | Defines | Typedefs | Enumerations | Functions | Variables
mdsSingleton.h File Reference

Medical Data Segmentation Toolkit (MDSTk)
Copyright (c) 2003-2005 by Michal Spanel
. More...

#include "mdsAssert.h"
#include "mdsLock.h"
#include <cstdlib>
#include <algorithm>
#include <list>
#include "mdsSingleton.hxx"

Classes

class  mds::base::CSingleton< L >
 Class from which an singleton must be derived. More...
class  mds::base::CSingletonDestroyer< T >
 Concrete singleton destroyer which is used to delete a singleton instance. More...
class  mds::base::CSingletonHolder< T >
 Provides singleton amenities for a type T. More...
class  mds::base::CSingletonLifetime
 Singleton lifetime. More...

Namespaces

namespace  mds
 

Medical Data Segmentation Toolkit (MDSTk)
Copyright (c) 2003-2005 by Michal Spanel


namespace  mds::base

Defines

#define MDS_PRIVATE_SINGLETON(T)   friend class mds::base::CSingletonHolder<T>
 Macro used to declare important singleton member which allows instantiation only by CSingletonHolder.
#define MDS_SINGLETON(T)   mds::base::CSingletonHolder<T>::getInstance()
 Returns the singleton instance of a given class.

Typedefs

typedef CSingleton< SL_DEFAULT > mds::base::CDefaultSingleton
 Default singleton class.
typedef CSingleton< SL_LIBRARY > mds::base::CLibrarySingleton
 Singleton having 'mds::SL_LIBRARY' system longevity.
typedef std::list
< CSingletonLifetime * > 
mds::base::tSingletonTracker
 Vector of all created singleton instances.
typedef void(* mds::base::tVoidFunction )()
 Pointer to a void function.

Enumerations

enum  mds::base::ESingletonLongevity {
  mds::base::SL_DEFAULT = 0x0000, mds::base::SL_SHORT = 0x0100, mds::base::SL_MIDDLE = 0x0200, mds::base::SL_LONG = 0x0400,
  mds::base::SL_LIBRARY = 0x0800, mds::base::SL_ALLOCATOR = 0xffff
}
 Default singleton longevity values. More...

Functions

void mds::base::atExitFunction ()
 The number of elements in the array.

Variables

tSingletonTrackermds::base::pSingletonTracker = 0
 Extern vector of all created singleton instances.

Detailed Description

Medical Data Segmentation Toolkit (MDSTk)
Copyright (c) 2003-2005 by Michal Spanel
.

Author: Michal Spanel, spanel@fit.vutbr.cz
Date: 2004/10/17

Id:
mdsSingleton.h 1863 2010-08-31 20:40:15Z spanel

This code is based on The Loki Library which accompanies the famous book: Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design Patterns Applied". Copyright (c) 2001. Addison-Wesley.

The Loki Library Copyright (c) 2001 by Andrei Alexandrescu 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.

Description:


Define Documentation

#define MDS_PRIVATE_SINGLETON (   T)    friend class mds::base::CSingletonHolder<T>

Macro used to declare important singleton member which allows instantiation only by CSingletonHolder.

It should be located in the private part of the singleton class as well as default constructor and copy constructor.

#define MDS_SINGLETON (   T)    mds::base::CSingletonHolder<T>::getInstance()

Returns the singleton instance of a given class.