00001 #include "IdSource.h" 00002 #include <iostream> 00003 #include "debug_tools.h" 00004 #include "ModulesParser.h" 00005 ClassImp(IDs::source); 00006 00007 std::string IDs::source::str(bool cpp_safe)const{ 00008 std::string tmp= fChannel.str() + IDs::field_separator +fGenerator.str(); 00009 if(cpp_safe) modules::parser::ToCppValid(tmp); 00010 return tmp; 00011 } 00012 00013 ostream& operator<< (ostream& os ,const IDs::source& id) { 00014 os<<id.str(); 00015 return os; 00016 } 00017 00018 IDs::source& IDs::source::operator=(const std::string& rhs){ 00019 // Find the first delimiter 00020 size_t delim=rhs.find(IDs::field_separator.c_str()); 00021 if(delim==std::string::npos){ 00022 std::cout<<"Warning: Strange looking string given to IDs::source: "<<rhs<<std::endl; 00023 Channel()=rhs; 00024 } else{ 00025 Channel()=rhs.substr(0,delim); 00026 Generator()=rhs.substr(delim+1); 00027 } 00028 return *this; 00029 } 00030 00031 void IDs::source::Debug()const{ 00032 Channel().Debug(); 00033 Generator().Debug(); 00034 }