changes to makefiles / build system

Pablo d'Angelo pablo at mathematik.uni-ulm.de
Thu Jun 5 12:32:37 BST 2003


On Thu, 05 Jun 2003, Kai-Uwe Behrmann wrote:

> > When global objects are needed, they should be created using the
> > singleton design pattern that enforces only one global instance of
> > an class. usually such an object creates itself when it is first
> > asked for the instance with a static getInstance() function.
> >
> > The GlobalCmdHistory is another singleton in the hugin, code.
> 
> In the docu or the samples I hope something more to find to understand
> this better.

Its a really simple design pattern. The CommandHistory[.h|.cpp] files
contain a very simple wrapper around the CommandHistory class.

The idea behind a singleton is a class that can exist only with
one object, therefore its not possible to create one explicitly,
the Constructor is private. only the static getInstance() function
can create the instance. (And does it when called for the first time).

A good book about the basic design patterns is "Design Patterns"
by Gamma et. al. But it can be a tought to read (and it takes
time and experience to understand ;)

http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/patterns/
contains a little bit about singletons.

Destroying an singleton can be complicated, so almost nobody seems
to touch that subject. But usually this is not a problem, sind
it lives till the end of the program anyway.

ciao
  Pablo
--
http://wurm.wohnheim.uni-ulm.de/~redman/
Please use PGP


More information about the ptX mailing list