00001 #include "macros.h" // needs to be declared as first entry in .cpp or .h file! 00002 #include <iostream> 00003 #include <string> 00004 #include "ExerciseStore.h" 00005 #include "AbstractExercise.h" 00006 using namespace std; 00013 AbstractExercise *ExerciseStore::getExercise(string key){ 00014 return fExerciseMap[key]; 00015 } 00016 00017 int ExerciseStore::putExercise(string key, AbstractExercise *exercise){ 00018 // cout << "stored: <"<< exercise->getName() << "> under key <" << key << ">" << endl; 00019 fExerciseMap[key] = exercise; 00020 return 0; 00021 } 00022 00023 int ExerciseStore::putExercise(AbstractExercise *exercise){ 00024 putExercise(exercise->getName(), exercise); 00025 return 0; 00026 } 00027 00028 ExerciseStore *ExerciseStore::instance(){ 00029 if(fInstance == 0){ 00030 fInstance = new ExerciseStore(); 00031 } 00032 return fInstance; 00033 } 00034 00035 void ExerciseStore::destroyInstance(){ 00036 delete fInstance; 00037 } 00038 00039 ExerciseStore *ExerciseStore::fInstance;