CommonOptions.cpp
Go to the documentation of this file.
00001 /*
00002  * CommonOptions.cpp
00003  *
00004  *  Created on: Oct 17, 2011
00005  *      Author: mriedel
00006  */
00007 
00008 
00009 #include <telekyb_base/Options/CommonOptions.hpp>
00010 
00011 namespace TELEKYB_NAMESPACE
00012 {
00013 
00014 CommonOptions::CommonOptions()
00015         : OptionContainer("Common")
00016 {
00017         tConfigFile = addOption<std::string>("tConfigFile",
00018                         "Global configuration file. Parameters read into Options", std::string(), false, true);
00019         tDebugLevel = addBoundsOption<int>("tDebugLevel",
00020                         "Debug Level", 0, 0, 10, false, false);
00021         tPrintOptions = addOption<bool>("tPrintOptions",
00022                         "Print out Options and Description", false, false, true);
00023 }
00024 
00025 
00026 // empty. private overwrite
00027 CommonOptions::~CommonOptions() {};
00028 
00029 void CommonOptions::printOptions() const
00030 {
00031         // manual update required here :(
00032         tConfigFile->print();
00033         tDebugLevel->print();
00034         tPrintOptions->print();
00035 }
00036 
00037 void CommonOptions::setNodeName(const std::string& nodeName_)
00038 {
00039         nodeName = nodeName_;
00040 }
00041 
00042 
00043 std::string CommonOptions::getNodeName() const
00044 {
00045         return nodeName;
00046 }
00047 
00048 // -------- Singleton Stuff ------ //
00049 
00050 CommonOptions* CommonOptions::instance = NULL;
00051 
00052 CommonOptions& CommonOptions::Instance() {
00053         if (!instance) {
00054                 instance = new CommonOptions();
00055         }
00056 
00057         //return static_cast<CommonOptions&>(*instance);
00058         return *instance;
00059 }
00060 
00061 CommonOptions* CommonOptions::InstancePtr() {
00062         if (!instance) {
00063                 instance = new CommonOptions();
00064         }
00065 
00066         return instance;
00067 }
00068 
00069 bool CommonOptions::hasInstance() {
00070         return instance != NULL;
00071 }
00072 
00073 void CommonOptions::ShutDownInstance() {
00074         if (instance) {
00075                 delete instance;
00076         }
00077 
00078         instance = NULL;
00079 }
00080 
00081 }
00082 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines


telekyb_base
Author(s): Dr. Antonio Franchi and Martin Riedel
autogenerated on Mon Nov 11 2013 11:12:34