#include <PerStream.h>
Inheritance diagram for PerStream:

Public Member Functions | |
| PerStream (std::string treename) | |
| virtual | ~PerStream () |
| std::string | GetTreeName () const |
| std::string | GetClassName () const |
| Per::EErrorCode | GetErrorCode () const |
| std::string | GetFullFilePathName () const |
| Int_t | GetEntry () const |
| Int_t | GetNumEntries () const |
| std::string | GetStreamName () const |
| bool | GetTestMode () const |
| bool | IsEnabled () const |
| bool | IsOpen () const |
| bool | IsModified () const |
| bool | IsPerOwned () const |
| bool | IsPerOwnedDisabled () const |
| virtual std::ostream & | Print (std::ostream &s) const |
| virtual void | Close () |
| virtual void | CloseFile () |
| void | Reset (bool ishard=false) |
| void | SetEnable (bool enable=true) |
| void | SetPerOwned (bool perowned=true) |
| void | SetPerOwnedDisabled (bool perowneddisabled=true) |
| void | SetTestMode (bool testmode) |
| virtual bool | SetFile (std::string fullfilepathname, Per::EAccessMode accessmode)=0 |
| virtual void | SetStreamName (std::string streamname) |
Protected Attributes | |
| std::string | fTreeName |
| std::string | fStreamName |
| std::string | fClassName |
| std::string | fFullFilePathName |
| TFile * | fTFile |
| TTree * | fTTree |
| TBranch * | fTBranch |
| TObject * | fTObject |
| Int_t | fEntry |
| bool | fEnable |
| bool | fPerOwned |
| bool | fPerOwnedDisabled |
| Per::EErrorCode | fErrorCode |
| bool | fTestMode |
|
|
Definition at line 97 of file PerStream.cxx. 00097 : 00098 fTreeName(treename),fStreamName(""),fClassName(""), 00099 fFullFilePathName(""),fTFile(0),fTTree(0),fTBranch(0),fTObject(0), 00100 fEntry(-1),fEnable(true),fPerOwned(false),fPerOwnedDisabled(false), 00101 fErrorCode(Per::kErrSuccess),fTestMode(false) { 00102 // 00103 // Purpose: Default constructor. 00104 // 00105 // Arguments: 00106 // treename string name of the tree served by this stream. 00107 // streamname string name of this stream (default = treename) 00108 // Return: n/a. 00109 // 00110 // Contact: S. Kasahara 00111 // 00112 00113 TTree::SetBranchStyle(1); // use new 3.01 style of creating branches 00114 00115 }
|
|
|
Definition at line 119 of file PerStream.cxx. References Close(). 00119 {
00120 //
00121 // Purpose: PerStream destructor. Closes stream and retrieves
00122 // allocated memory.
00123 //
00124 // Contact: S. Kasahara
00125 //
00126
00127 Close();
00128
00129 }
|
|
|
Reimplemented in PerInputStream, and PerOutputStream. Definition at line 40 of file PerStream.cxx. Referenced by ~PerStream(). 00040 {
00041 //
00042 // Purpose: Close the stream.
00043 //
00044 // Arguments: none.
00045 //
00046 // Return: none.
00047 //
00048 // Contact: S. Kasahara
00049 //
00050
00051 CloseFile(); // close file for this stream
00052
00053 }
|
|
|
Reimplemented in PerInputStream, and PerOutputStream. Definition at line 57 of file PerStream.cxx. References PerFileManager::CloseFile(), fEntry, fFullFilePathName, fPerOwned, fTBranch, fTFile, fTObject, fTTree, and PerFileManager::Instance(). Referenced by PerOutputStream::CloseFile(), and PerInputStream::CloseFile(). 00057 {
00058 //
00059 // Purpose: Close current file serving this stream.
00060 //
00061 // Arguments: none.
00062 //
00063 // Return: none.
00064 //
00065 // Contact: S. Kasahara
00066 //
00067
00068 if ( fPerOwned && fTObject ) {
00069 delete fTObject;
00070 }
00071 fPerOwned = false;
00072 fTObject = 0; // the cached object is not owned by the stream.
00073
00074 // delete TTree. This also deletes managed TBranches.
00075 if( fTTree) delete fTTree; fTTree = 0; fTBranch = 0;
00076
00077 // Starting with root ~v5.13 the fTTree dtor will create
00078 // a new object at the fTObject ptr address, but only
00079 // some of the time (oddly). Check to see if a new object has
00080 // been created by the TTree dtor, and delete it if so.
00081 if ( fTObject ) delete fTObject; fTObject = 0;
00082
00083 if (!fFullFilePathName.empty()) {
00084 PerFileManager& filemanager = PerFileManager::Instance();
00085 filemanager.CloseFile(fFullFilePathName);
00086 fFullFilePathName = "";
00087 fTFile = 0;
00088 fEntry = -1;
00089 }
00090
00091 return;
00092
00093 }
|
|
|
Definition at line 38 of file PerStream.h. Referenced by PerInputStreamManager::LoadRecordWithTag(), PerOutputStreamManager::Print(), and PerInputStream::UpdateTree(). 00038 { return fClassName; }
|
|
|
Definition at line 41 of file PerStream.h. Referenced by PerInputStreamManager::Print(). 00041 { return fEntry; }
|
|
|
Definition at line 39 of file PerStream.h. Referenced by RotoServer::OpenFile(), OltNewModule::OpenFile(), and OltNewModule::OpenSpy(). 00039 { return fErrorCode; }
|
|
|
Definition at line 40 of file PerStream.h. Referenced by PerStreamManager::GetCurrentFile(), PerInputStream::GetObject(), DDSChildServer::Next(), PerInputStreamManager::Print(), PerOutputStream::SetObject(), PerOutputStream::Store(), and PerInputStreamManager::UpdateTreeFormula(). 00040 { return fFullFilePathName; }
|
|
|
Definition at line 42 of file PerStream.h. Referenced by PerInputStream::AdvanceTagsList(), PerInputStream::GetVldContext(), PerInputStream::IsEnd(), PerInputStreamManager::Print(), PerInputStream::RewindTagsList(), PerInputStream::UpdateTree(), and PerInputStreamManager::UpdateTreeFormula().
|
|
|
Definition at line 44 of file PerStream.h. Referenced by PerInputStreamManager::LoadRecordWithTag(), PerInputStream::NextFile(), and SetPerOwned(). 00044 { return fStreamName; }
|
|
|
Definition at line 45 of file PerStream.h. Referenced by PerInputStream::GetObject(). 00045 { return fTestMode; }
|
|
|
Definition at line 37 of file PerStream.h. Referenced by PerInputStream::GetObject(), PerInputStream::GetVldContext(), PerOutputStream::SetObject(), and PerOutputStream::Store(). 00037 { return fTreeName; }
|
|
|
Definition at line 47 of file PerStream.h. Referenced by Print(), PerOutputStream::SetFile(), PerOutputStream::SetObject(), PerOutputStream::Store(), and PerOutputStream::Write(). 00047 { return fEnable;}
|
|
|
Definition at line 51 of file PerStream.h. Referenced by PerOutputStream::SetObject(), and PerOutputStream::Store(). 00051 { return (fTObject != (TObject*)0) ? true : false;}
|
|
|
Reimplemented in PerInputStream. Definition at line 48 of file PerStream.h. Referenced by PerOutputStream::IsFileChange(), PerInputStream::IsOpen(), Print(), PerOutputStream::SetObject(), PerOutputStream::Store(), and PerOutputStream::Write().
|
|
|
Definition at line 52 of file PerStream.h. Referenced by PerInputStream::GetVldContext(), Reset(), and SetPerOwnedDisabled(). 00052 { return fPerOwned; }
|
|
|
Definition at line 53 of file PerStream.h. Referenced by PerInputStream::GetObject(), and SetPerOwned(). 00053 { return fPerOwnedDisabled; }
|
|
|
Reimplemented in PerInputStream, and PerOutputStream. Definition at line 172 of file PerStream.cxx. References fClassName, fTreeName, fTTree, IsEnabled(), and IsOpen(). Referenced by operator<<(), PerOutputStream::Print(), and PerInputStream::Print(). 00172 {
00173 //
00174 // Purpose: Print status of stream on std::ostream.
00175 //
00176 // Arguments: ms std::ostream to display on.
00177 //
00178 // Return: std::ostream reference.
00179 //
00180 // Contact: S. Kasahara
00181 //
00182
00183 ms << "Stream serving tree " << fTreeName
00184 << (IsOpen() ? " is open " : " is not open ") << "and"
00185 << (IsEnabled() ? " enabled." : " disabled.") << endl;
00186 if ( IsOpen() ) {
00187 ms << " Total entries in stream tree = " << (Int_t)fTTree ->GetEntries()
00188 << endl;
00189 ms << " The current file assigned to this stream is "
00190 << fTTree->GetCurrentFile()->GetName() << endl;
00191 }
00192 ms << " This stream serves objects of classname " << fClassName << "."
00193 << endl;
00194
00195 return ms;
00196
00197 }
|
|
|
Definition at line 199 of file PerStream.cxx. References fTObject, and IsPerOwned(). Referenced by PerInputStream::GetObject(), PerInputStreamManager::IsSelectedSet(), PerInputStream::Next(), PerInputStream::Previous(), and PerOutputStream::SetObject(). 00199 {
00200 //
00201 // Purpose: Reset.
00202 //
00203 // Arguments: ishard, true => implies delete or Clear object (object owned)
00204 // false => implies set object ptr to 0 (default)
00205 //
00206 // Return: none.
00207 //
00208 // Contact: S. Kasahara
00209 //
00210
00211 if (!fTObject) return;
00212
00213 if ( IsPerOwned() ) {
00214 if (ishard) {
00215 RecRecord* recrecord = dynamic_cast<RecRecord*>(fTObject);
00216 recrecord -> Clear();
00217 recrecord -> HasBeenModified(); // clear tags so that i/o will repersist
00218 }
00219 }
00220 else {
00221 if ( ishard ) {
00222 if ( fTObject ) delete fTObject;
00223 fTObject = 0;
00224 }
00225 else {
00226 // object cache not owned, reset
00227 fTObject = 0;
00228 }
00229 }
00230
00231 return;
00232
00233 }
|
|
|
Definition at line 62 of file PerStream.h. 00062 { fEnable = enable; }
|
|
||||||||||||
|
Implemented in PerOutputStream. |
|
|
Definition at line 133 of file PerStream.cxx. References fPerOwned, GetStreamName(), IsPerOwnedDisabled(), and MSG. Referenced by PerInputStream::GetObject(). 00133 {
00134 //
00135 // Purpose: Designate this stream as owning it's records. This will
00136 // allow it to reuse the same record on each stream read to increase
00137 // the efficiency of i/o.
00138 //
00139 // Contact: S. Kasahara
00140 //
00141
00142 if ( perowned && IsPerOwnedDisabled() ) {
00143 MSG("Per",Msg::kWarning)
00144 << "PerStream::SetPerOwned called for stream " << GetStreamName()
00145 << " but user has SetPerOwnedDisabled for this stream. Ignored."
00146 << endl;
00147 }
00148 else fPerOwned = perowned;
00149
00150 return;
00151
00152 }
|
|
|
Definition at line 156 of file PerStream.cxx. References fPerOwned, fPerOwnedDisabled, and IsPerOwned(). 00156 {
00157 //
00158 // Purpose: Disable Per ownership for this stream.
00159 //
00160 // Contact: S. Kasahara
00161 //
00162
00163 if ( perowneddisabled && IsPerOwned() ) fPerOwned = false;
00164 fPerOwnedDisabled = perowneddisabled;
00165
00166 return;
00167
00168 }
|
|
|
Definition at line 69 of file PerStream.h. 00069 {fStreamName=streamname;}
|
|
|
Definition at line 65 of file PerStream.h. 00065 { fTestMode = testmode; }
|
|
|
Definition at line 76 of file PerStream.h. Referenced by Print(). |
|
|
Definition at line 83 of file PerStream.h. |
|
|
Definition at line 82 of file PerStream.h. Referenced by CloseFile(). |
|
|
Definition at line 86 of file PerStream.h. |
|
|
Definition at line 77 of file PerStream.h. Referenced by CloseFile(). |
|
|
Definition at line 84 of file PerStream.h. Referenced by CloseFile(), SetPerOwned(), and SetPerOwnedDisabled(). |
|
|
Definition at line 85 of file PerStream.h. Referenced by SetPerOwnedDisabled(). |
|
|
Definition at line 75 of file PerStream.h. |
|
|
Definition at line 80 of file PerStream.h. Referenced by CloseFile(). |
|
|
Definition at line 88 of file PerStream.h. |
|
|
Definition at line 78 of file PerStream.h. Referenced by CloseFile(). |
|
|
Definition at line 81 of file PerStream.h. Referenced by CloseFile(), PerInputStreamManager::IsSelectedSet(), and Reset(). |
|
|
Definition at line 74 of file PerStream.h. Referenced by Print(). |
|
|
Definition at line 79 of file PerStream.h. Referenced by CloseFile(), PerInputStreamManager::IsSelectedSet(), Print(), and PerInputStreamManager::UpdateTreeFormula(). |
1.3.9.1