Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/UIFactory.cpp

    rcc04b7 rd7940e  
    88
    99#include <cassert>
     10#include "Patterns/Singleton_impl.hpp"
    1011#include "UIElements/UIFactory.hpp"
    1112
    1213// all factories that can be used:
    1314#include "UIElements/TextUIFactory.hpp"
    14 
    15 UIFactory *UIFactory::theFactory = 0;
    1615
    1716UIFactory::UIFactory()
     
    2726
    2827void UIFactory::makeUserInterface(InterfaceTypes type) {
    29   assert(theFactory == 0 && "makeUserInterface should only be called once");
    3028  switch(type) {
    3129    case Text :
    32       theFactory = new TextUIFactory();
     30      setInstance(new TextUIFactory());
    3331      break;
    3432
     
    3937}
    4038
    41 UIFactory* UIFactory::get(){
    42   assert(theFactory != 0 && "No UserInterface created prior to factory access");
    43   return theFactory;
    44 }
    45 
    46 
    47 void UIFactory::purgeInstance(){
    48   if(theFactory) {
    49     delete theFactory;
    50     theFactory = 0;
    51   }
    52 }
     39CONSTRUCT_SINGLETON(UIFactory)
Note: See TracChangeset for help on using the changeset viewer.