![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2007 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 5, D-52074 Aachen, Germany 00008 * phone: ++49-241-80-27910, 00009 * fax: ++49-241-80-22242 00010 * email: info@openwns.org 00011 * www: http://www.openwns.org 00012 * _____________________________________________________________________________ 00013 * 00014 * openWNS is free software; you can redistribute it and/or modify it under the 00015 * terms of the GNU Lesser General Public License version 2 as published by the 00016 * Free Software Foundation; 00017 * 00018 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00020 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00021 * details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 * 00026 ******************************************************************************/ 00027 00028 #ifndef LTE_HELPER_HASMODENAME_HPP 00029 #define LTE_HELPER_HASMODENAME_HPP 00030 00031 #include <WNS/pyconfig/View.hpp> 00032 #include <WNS/Assure.hpp> 00033 00034 namespace lte 00035 { 00036 00037 namespace helper 00038 { 00039 00040 class HasModeName 00041 { 00042 00043 public: 00044 HasModeName( const wns::pyconfig::View& config ) : 00045 mode( config.get<std::string>( "modeName" ) ), 00046 modeBase( config.get<std::string>( "modeBase" ) ), 00047 separator( config.get<std::string>( "separator" ) ), 00048 taskID( config.get<std::string>( "taskID" ) ), 00049 rsNameSuffix( config.get<std::string>( "rsNameSuffix" ) ) 00050 { 00051 assure( modeBase == getTaskStrippedModeName(), "Mode Base Name mismatch!" ); 00052 }; 00053 00054 std::string getMode() 00055 { 00056 return mode; 00057 }; 00058 00059 std::string getRSName() 00060 { 00061 return mode+separator+rsNameSuffix; 00062 }; 00063 00064 std::string getTaskSuffix() 00065 { 00066 return taskID; 00067 }; 00068 00069 std::string getTimerName() 00070 { 00071 return modeBase+separator+"Timer"; 00072 }; 00073 00074 std::string getTaskTimerName( std::string task ) 00075 { 00076 return modeBase+separator+task+separator+"Timer"; 00077 }; 00078 00079 protected: 00080 std::string mode; 00081 std::string modeBase; 00082 std::string separator; 00083 std::string taskID; 00084 std::string rsNameSuffix; 00085 00086 private: 00087 std::string getTaskStrippedModeName() 00088 { 00089 if ( taskID!="" ) 00090 { 00093 assure( mode.find( separator+taskID ) != std::string::npos, "Can't strip Task from modeName" ); 00094 std::string retVal = mode; 00095 retVal.erase( retVal.find( separator+taskID ), std::string::npos ); 00096 return retVal; 00097 } 00098 else 00099 return mode; 00100 }; 00101 00102 }; 00103 00104 } // helper 00105 } // lte 00106 00107 #endif // NOT defined LTE_HELPER_HASMODENAME_HPP 00108 00109
1.5.5