#include <CondCore/Utilities/interface/CondIter.h>
Public Member Functions | |
CondIter () | |
void | create (const std::string &NameDB, const std::string &File, const std::string &User="", const std::string &Pass="", const std::string &nameBlob="") |
tell Iter to point to a database. | |
void | free () |
free the object T *Reference from the class CondIter: object T *Reference isn't deleted when the class CondIter is deleted. | |
unsigned int | getMax () |
It returns the maximum of the range of interest of the Iterator of the IOVs. | |
unsigned int | getMin () |
It returns the minimum of the range of interest of the Iterator of the IOVs. | |
void | getRange (unsigned int *, unsigned int *) |
It enables to retrieve the minimum and the maximum of the range of interest of the Iterator of the IOVs. | |
unsigned int | getStartTime () |
get the SINCE TIME of the Interval of Validity | |
unsigned int | getStopTime () |
get the TILL TIME of the Interval of Validity | |
unsigned int | getTime () |
get the mean time of the Iterval of Validity | |
void | jump () |
It passes to the following IOV without returning anything. | |
T const * | next (int test=1) |
Obtain the pointer to an object T. | |
void | setMax (int max) |
void | setMax (unsigned int max) |
Set the maximum of the range of interest of the Iterator of the IOVs: thus when you call the method next() you get up to max. | |
void | setMin (int min) |
void | setMin (unsigned int min) |
Set the minimum of the range of interest of the Iterator of the IOVs: thus when you call the method next() you get from min. | |
void | setRange (int min, int max) |
void | setRange (unsigned int min, unsigned int max) |
Set the range of interest of the Iterator of the IOVs: thus when you call the method next() you get from min to max. | |
cond::TypedRef< T > const * | whatRef () |
I need this method in order to manage the memory leak. | |
~CondIter () | |
Public Attributes | |
bool | NumberOfTimes |
Private Attributes | |
CondBasicIter | bIter |
cond::TypedRef< T > * | ref |
const T * | Reference |
Friends | |
class | CondCachedIter |
Definition at line 31 of file CondIter.h.
Definition at line 153 of file CondIter.h.
References CondIter< T >::ref, and CondIter< T >::Reference.
void CondIter< T >::create | ( | const std::string & | NameDB, | |
const std::string & | File, | |||
const std::string & | User = "" , |
|||
const std::string & | Pass = "" , |
|||
const std::string & | nameBlob = "" | |||
) | [inline] |
tell Iter to point to a database.
After this call CondIter can be used.
It needs:
NameDB
-> name of the database File
-> Tag human-readable of the content of the database User
-> name of the User (if you don't need to authenticate don't write anything here) Pass
-> Password to access database (if you don't need to authenticate don't write anything here) nameBlob
-> to handle blob type of data (if it is not needed this field has to be left empty) Definition at line 166 of file CondIter.h.
References CondIter< T >::bIter, CondBasicIter::create(), CondIter< T >::NumberOfTimes, CondIter< T >::ref, and CondIter< T >::Reference.
00166 { 00167 00168 bIter.create(NameDB,File,User,Pass,nameBlob); 00169 NumberOfTimes = true; 00170 ref = 0; 00171 Reference = 0; 00172 00173 }
free the object T *Reference from the class CondIter: object T *Reference isn't deleted when the class CondIter is deleted.
Definition at line 294 of file CondIter.h.
References CondIter< T >::ref, and CondIter< T >::Reference.
It returns the maximum of the range of interest of the Iterator of the IOVs.
Definition at line 342 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::getMax().
It returns the minimum of the range of interest of the Iterator of the IOVs.
Definition at line 340 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::getMin().
void CondIter< T >::getRange | ( | unsigned int * | Min_out, | |
unsigned int * | Max_out | |||
) | [inline] |
It enables to retrieve the minimum and the maximum of the range of interest of the Iterator of the IOVs.
Definition at line 344 of file CondIter.h.
References CondIter< T >::bIter, CondBasicIter::getMax(), and CondBasicIter::getMin().
get the SINCE TIME of the Interval of Validity
Definition at line 352 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::getStartTime().
00352 {return bIter.getStartTime();}
get the TILL TIME of the Interval of Validity
Definition at line 354 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::getStopTime().
00354 {return bIter.getStopTime();}
get the mean time of the Iterval of Validity
Definition at line 350 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::getTime().
It passes to the following IOV without returning anything.
Definition at line 275 of file CondIter.h.
References CondIter< T >::bIter, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), CondBasicIter::getMin(), i, CondBasicIter::ioviterator, and CondIter< T >::NumberOfTimes.
00275 { 00276 00277 if (NumberOfTimes){ 00278 unsigned int minTemp = bIter.getMin(); 00279 00280 for (unsigned int i=0; i< minTemp; i++){//iter_Min <= run since at least I have one IOV for each run 00281 //control if the min is too high 00282 if (!((bIter.ioviterator)->next())) { 00283 std::cout << "No data. Minimum too high." << std::endl; 00284 //return a pointer to NULL 00285 } 00286 if (((bIter.ioviterator)->validity().second)>=minTemp) i = minTemp; //Minimum reached 00287 } 00288 NumberOfTimes = false; 00289 } 00290 else (bIter.ioviterator)->next(); 00291 }
Obtain the pointer to an object T.
If it is the last T the method returns a null pointer. As default the next() delete the previous object. Set "test = 0" in order to store the datum.
Definition at line 180 of file CondIter.h.
References CondIter< T >::bIter, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), CondBasicIter::getMax(), CondBasicIter::getMin(), CondBasicIter::getStartTime(), CondBasicIter::getStopTime(), i, int, CondBasicIter::ioviterator, CondBasicIter::iter_Max, CondBasicIter::iter_Min, CondIter< T >::NumberOfTimes, CondBasicIter::payloadContainer, CondBasicIter::pooldb, CondIter< T >::ref, CondIter< T >::Reference, CondBasicIter::setStartTime(), CondBasicIter::setStopTime(), CondBasicIter::setTime(), and pyDBSRunClass::temp.
00180 { 00181 00182 if ((bIter.iter_Min)==0 && (bIter.iter_Max)==0){ 00183 // method next without range 00184 00185 if( (bIter.ioviterator)->next() ){ 00186 00187 std::cout<<"PayloadContainerName "<<bIter.payloadContainer<<"\n"; 00188 std::cout<<"since \t till \t payloadToken"<<std::endl; 00189 std::cout<< (bIter.ioviterator)->validity().first<<" \t "<< (bIter.ioviterator)->validity().second<<" \t "<<(bIter.ioviterator)->payloadToken()<<std::endl; 00190 if (test && ref) { 00191 // delete Reference; 00192 delete ref; 00193 } 00194 ref = new cond::TypedRef<T> (*(bIter.pooldb),(bIter.ioviterator)->payloadToken()); 00195 Reference = (const T*) ref->ptr(); 00196 bIter.setStartTime((bIter.ioviterator)->validity().first); 00197 bIter.setStopTime((bIter.ioviterator)->validity().second); 00198 00199 long long int temp = (long long int) (( bIter.getStartTime()+ bIter.getStopTime()) / 2.); 00200 if (temp<0) temp = - temp; 00201 bIter.setTime((unsigned int) temp); 00202 return Reference; 00203 } 00204 else { 00205 std::cout << "No more data ! " << std::endl; 00206 Reference = 0; 00207 ref = 0; 00208 return Reference; 00209 //return a pointer to NULL 00210 } 00211 } 00212 else{ 00213 //test to see if it is the first time 00214 if (NumberOfTimes){ 00215 unsigned int minTemp = bIter.getMin(); 00216 for (unsigned int i=0; i< minTemp; i++){//iter_Min <= run since at least I have one IOV for each run 00217 //control if the min is too high 00218 if (!((bIter.ioviterator)->next())) { 00219 std::cout << "No data. Minimum too high." << std::endl; 00220 Reference = 0; 00221 ref = 0; 00222 return Reference; 00223 //return a pointer to NULL 00224 } 00225 if (((bIter.ioviterator)->validity().second)>=minTemp) i = minTemp; //Minimum reached 00226 } 00227 NumberOfTimes = false; 00228 } 00229 if( (bIter.ioviterator)->next() ){ 00230 if (((bIter.ioviterator)->validity().first)>=(bIter.getMax())){ 00231 std::cout << "No more data in the range" << std::endl; 00232 Reference = 0; 00233 ref = 0; 00234 return Reference; 00235 //return a pointer to NULL 00236 } 00237 else { 00238 std::cout<<"PayloadContainerName "<<bIter.payloadContainer<<"\n"; 00239 std::cout<<"since \t till \t payloadToken"<<std::endl; 00240 std::cout<< (bIter.ioviterator)->validity().first<<" \t "<< (bIter.ioviterator)->validity().second<<" \t "<<(bIter.ioviterator)->payloadToken()<<std::endl; 00241 00242 00243 if (test && ref) { 00244 // delete Reference; 00245 delete ref; 00246 } //test to choose if mantain the object or not 00247 ref = new cond::TypedRef<T> (*(bIter.pooldb),(bIter.ioviterator)->payloadToken()); 00248 Reference = (const T*) ref->ptr(); 00249 bIter.setStartTime((bIter.ioviterator)->validity().first); 00250 bIter.setStopTime((bIter.ioviterator)->validity().second); 00251 00252 long long int temp = (long long int) (( bIter.getStartTime()+ bIter.getStopTime()) / 2.); 00253 if (temp<0) temp = - temp; 00254 bIter.setTime((unsigned int) temp); 00255 return Reference; 00256 } 00257 } 00258 00259 else { 00260 std::cout << "No more data ! " << std::endl; 00261 Reference = 0; 00262 ref = 0; 00263 return Reference; 00264 //return a pointer to NULL 00265 } 00266 } 00267 00268 }
Definition at line 335 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::setMax().
Set the maximum of the range of interest of the Iterator of the IOVs: thus when you call the method next() you get up to max.
Definition at line 323 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::setMax().
Definition at line 331 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::setMin().
Set the minimum of the range of interest of the Iterator of the IOVs: thus when you call the method next() you get from min.
Definition at line 319 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::setMin().
Definition at line 327 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::setRange().
Set the range of interest of the Iterator of the IOVs: thus when you call the method next() you get from min to max.
Definition at line 315 of file CondIter.h.
References CondIter< T >::bIter, and CondBasicIter::setRange().
cond::TypedRef< T > const * CondIter< T >::whatRef | ( | ) | [inline] |
I need this method in order to manage the memory leak.
If I use method "next(0)" I mantain the Ref which may cause a memory leak if I don't delete it. In order to delete it I need its pointer: the method "whatRef" gives me the pointer.
Definition at line 302 of file CondIter.h.
References CondIter< T >::ref.
00302 { 00303 00304 return ref; 00305 00306 }
friend class CondCachedIter [friend] |
Definition at line 48 of file CondIter.h.
CondBasicIter CondIter< T >::bIter [private] |
Definition at line 37 of file CondIter.h.
Referenced by CondIter< T >::create(), CondIter< T >::getMax(), CondIter< T >::getMin(), CondIter< T >::getRange(), CondIter< T >::getStartTime(), CondIter< T >::getStopTime(), CondIter< T >::getTime(), CondIter< T >::jump(), CondIter< T >::next(), CondIter< T >::setMax(), CondIter< T >::setMin(), and CondIter< T >::setRange().
bool CondIter< T >::NumberOfTimes |
Definition at line 41 of file CondIter.h.
Referenced by CondIter< T >::create(), CondIter< T >::jump(), and CondIter< T >::next().
cond::TypedRef<T>* CondIter< T >::ref [private] |
Definition at line 36 of file CondIter.h.
Referenced by CondIter< T >::CondIter(), CondIter< T >::create(), CondIter< T >::free(), CondIter< T >::next(), CondIter< T >::whatRef(), and CondIter< T >::~CondIter().
Definition at line 35 of file CondIter.h.
Referenced by CondIter< T >::CondIter(), CondIter< T >::create(), CondIter< T >::free(), and CondIter< T >::next().