TTree::SetBranchAddressStatus protected?

From: Paul Seyfert <Paul.Seyfert_at_cern.ch>
Date: Sun, 4 Dec 2011 15:00:13 +0100


Dear rooters,

so far I haven't used the return value of TTree::SetBranchAddress at all and let my code crash e.g. when a branch doesn't exist. For debuging reasons I just changed this. To keep the code readable I don't check whether the return value is some integer, but use the enum SetBranchAddressStatus:

class myclass{
 private:
  TTree* m_tree;
  float m_branchvalue;
 public:
  TTree::SetBranchAddressStatus do_something();   // something else
};

TTree::SetBranchAddressStatus myclass::do_something() {   std::string branchname;
  //cryptic determination of the branch name

  return m_tree->SetBranchAddress(branchname.c_str(),&m_branchvalue);
}

int main() {
  myclass instance;
  if (TTree::kMatch == instance.do_something()) {     // start working
  } else {
    // print some output which indicates what went wrong   }
  return 0;
}

This however doesn't compile because the enum SetBranchAddressStatus is protected in TTree (in root 5.30/04).

Is there a reason to keep it protected which I just don't see right now?

Cheers,
Paul Received on Sun Dec 04 2011 - 15:00:21 CET

This archive was generated by hypermail 2.2.0 : Wed Dec 07 2011 - 05:50:01 CET