Ignore:
Timestamp:
Mar 10, 2010, 5:51:48 PM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
4fc41a
Parents:
025ca2
Message:

Added generic singleton Pattern that can be inherited to any class making that class a singleton.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/unittests/atomsCalculationTest.cpp

    r025ca2 r4c60ef  
    5151// set up and tear down
    5252void atomsCalculationTest::setUp(){
    53   World::get();
     53  World::getInstance();
    5454  for(int i=0;i<ATOM_COUNT;++i){
    5555    atoms[i]= new AtomStub(i);
    56     World::get()->registerAtom(atoms[i]);
     56    World::getInstance().registerAtom(atoms[i]);
    5757  }
    5858}
    5959void atomsCalculationTest::tearDown(){
    60   World::destroy();
     60  World::purgeInstance();
    6161  ActionRegistry::purgeRegistry();
    6262}
     
    9292}
    9393
    94 static void operation(atom* _atom){
    95   AtomStub *atom = dynamic_cast<AtomStub*>(_atom);
    96   assert(atom);
    97   atom->doSomething();
    98 }
    99 
    100 
    10194void atomsCalculationTest::testCalculateSimple(){
    102   AtomsCalculation<int> *calc = World::get()->calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms());
     95  AtomsCalculation<int> *calc = World::getInstance().calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms());
    10396  std::vector<int> allIds = (*calc)();
    10497  CPPUNIT_ASSERT(hasAll(allIds,0,ATOM_COUNT));
     
    108101void atomsCalculationTest::testCalculateExcluded(){
    109102  int excluded = ATOM_COUNT/2;
    110   AtomsCalculation<int> *calc = World::get()->calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms() && !AtomById(excluded));
     103  AtomsCalculation<int> *calc = World::getInstance().calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms() && !AtomById(excluded));
    111104  std::vector<int> allIds = (*calc)();
    112105  std::set<int> excluded_set;
Note: See TracChangeset for help on using the changeset viewer.