00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #include "Record/RecRecordImp.h"
00012
00013 #ifdef MACOSX
00014 using namespace std;
00015 #endif
00016
00017 ClassImpT(RecRecordImp,T)
00018
00019
00020
00021
00022 template<class T>
00023 const VldContext* RecRecordImp<T>::GetVldContext() const {
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 const RecHeader* hdr = dynamic_cast<const RecHeader*>(&GetHeader());
00035 if ( hdr)
00036 return &(hdr->GetVldContext());
00037 else
00038 return 0;
00039
00040 }
00041
00042 template<class T>
00043 void RecRecordImp<T>::HasBeenModified() {
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 fTempTags.RemoveKey("outstream");
00062 return;
00063
00064 }
00065
00066 template<class T>
00067 void RecRecordImp<T>::PersistedToOutputStream(const char* stream,
00068 const char* file, const char* tree, int index) {
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 Registry outStreamRegistry;
00101 int nout = 0;
00102 if ( fTempTags.Get("outstream",outStreamRegistry) ) {
00103 outStreamRegistry.Get("nout",nout);
00104 }
00105 outStreamRegistry.UnLockValues();
00106
00107
00108 Registry newOutStream;
00109 newOutStream.Set("stream",stream);
00110 newOutStream.Set("file",file);
00111 newOutStream.Set("tree",tree);
00112 newOutStream.Set("index",index);
00113
00114
00115 char cnoutkey[20];
00116 sprintf(cnoutkey,"%i",nout);
00117 outStreamRegistry.Set(cnoutkey,newOutStream);
00118 nout++;
00119 outStreamRegistry.Set("nout",nout);
00120 outStreamRegistry.LockValues();
00121
00122
00123 fTempTags.UnLockValues();
00124 fTempTags.Set("outstream",outStreamRegistry);
00125 fTempTags.LockValues();
00126
00127 }
00128
00129 template<class T>
00130 bool RecRecordImp<T>::IsPersistedToOutputStream(const char* stream,
00131 const char* file,const char* tree,int index) const {
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 std::string s(stream);
00148 std::string f(file);
00149 std::string t(tree);
00150
00151 Registry outStreamRegistry;
00152 int nout = 0;
00153 if ( fTempTags.Get("outstream",outStreamRegistry) ) {
00154 outStreamRegistry.Get("nout",nout);
00155 for ( int iout = 0; iout < nout; iout++) {
00156 char cioutkey[20];
00157 sprintf(cioutkey,"%i",iout);
00158 Registry outStream;
00159 outStreamRegistry.Get(cioutkey,outStream);
00160 bool isMatch = true;
00161 if ( !s.empty() ) {
00162 const char* cstream = 0;
00163 outStream.Get("stream",cstream);
00164 if ( std::string(cstream) != s ) isMatch = false;
00165 }
00166 if ( !f.empty() ) {
00167 const char* cfile = 0;
00168 outStream.Get("file",cfile);
00169 if ( std::string(cfile) != f ) isMatch = false;
00170 }
00171
00172 if ( !t.empty() ) {
00173 const char* ctree = 0;
00174 outStream.Get("tree",ctree);
00175 if ( std::string(ctree) != t ) isMatch = false;
00176 }
00177 if ( index > -1 ) {
00178 int storedindex = -1;
00179 outStream.Get("index",storedindex);
00180 if ( storedindex != index ) isMatch = false;
00181 }
00182 if ( isMatch ) {
00183 return true;
00184 }
00185 }
00186 }
00187
00188 return false;
00189
00190 }
00191
00192 template<class T>
00193 bool RecRecordImp<T>::IsPerOwned() const {
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206 int isPerOwned = 0;
00207 if ( !fTempTags.Get("isPerOwned",isPerOwned) ) return false;
00208 return ( isPerOwned ) ? true : false;
00209
00210 }
00211
00212 template<class T>
00213 bool RecRecordImp<T>::IsTransient() const {
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225 int isTransient = 1;
00226 if ( !fTempTags.Get("isTransient",isTransient) ) return true;
00227 return ( isTransient ) ? true : false;
00228
00229 }
00230
00231 template<class T>
00232 void RecRecordImp<T>::SetTransient(bool isTransient) {
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244 fTempTags.UnLockValues();
00245 if ( isTransient ) fTempTags.Set("isTransient",1);
00246 else fTempTags.Set("isTransient",0);
00247 fTempTags.LockValues();
00248 return;
00249
00250 }
00251
00252 template<class T>
00253 void RecRecordImp<T>::SetPerOwned(bool isPerOwned) {
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265 fTempTags.UnLockValues();
00266 if ( isPerOwned ) fTempTags.Set("isPerOwned",1);
00267 else fTempTags.Set("isPerOwned",0);
00268 fTempTags.LockValues();
00269 return;
00270
00271 }
00272
00273 template<class T>
00274 std::ostream& RecRecordImp<T>::Print(std::ostream& os) const {
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285 os << "RecRecordImp::Print:\n" << fHeader << std::endl;
00286 fJobHistory.Print();
00287
00288 return os;
00289
00290 }
00291
00292 template<class T>
00293 void RecRecordImp<T>::Print(Option_t* ) const {
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304 Print(std::cout);
00305
00306 return;
00307
00308 }
00309
00310
00311
00312
00313