00001 #define RootAddress_cpp
00002
00003 #include <iostream>
00004 #include <stdio.h>
00005 #include "RootCnvSvc/RootAddress.h"
00006
00007 RootAddress::RootAddress(unsigned char svc, const CLID& clid, const std::string path,const std::string treename,const std::string branchname,int entry)
00008 : GenericAddress(svc, clid, path, "", 0, 0)
00009 {
00010
00011 m_branchname = branchname;
00012 int s=branchname.size();
00013 m_nrBranches=0;
00014 if (branchname.size()) {
00015 int pos=0,where=1;
00016 while (where!=std::string::npos) {
00017 m_nrBranches++;
00018 where=branchname.find(":",pos);
00019 pos=where+1;
00020 }
00021 }
00022
00023 m_treename = treename;
00024 m_path=path;
00025 m_entrynr=entry;
00026 }
00027 void RootAddress::Print() const {
00028 std::cout << "RootAddress: path "<<m_path<< ", treename "<<m_treename <<" branchname "<<m_branchname<<" entry "<<m_entrynr<<std::endl;
00029 }
00030
00031 std::string RootAddress::getBranchname(int nb) const {
00032 int pos,where=-1;
00033 int i=0;
00034 while (i<=nb) {
00035 pos=where+1;
00036 where=m_branchname.find(":",pos);
00037 i++;
00038 }
00039 if (where==std::string::npos) where=m_branchname.size();
00040
00041 return m_branchname.substr(pos,where-pos);
00042 }