本文整理汇总了C++中KVNameValueList::HasParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ KVNameValueList::HasParameter方法的具体用法?C++ KVNameValueList::HasParameter怎么用?C++ KVNameValueList::HasParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KVNameValueList
的用法示例。
在下文中一共展示了KVNameValueList::HasParameter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InfosNeedUpdate
Bool_t KVAvailableRunsFile::InfosNeedUpdate(Int_t run, const Char_t * filename)
{
// return kTRUE if the given file for this run is lacking some information
// e.g. the KV version and username
// N.B.: if no file is known for this run, we return kFALSE
ReadFile();
// is run already in list ?
KVNameValueList* NVL = (KVNameValueList*)fAvailableRuns->FindObject(Form("%d",run));
if(!NVL) return kFALSE;
Int_t Occurs = NVL->GetIntValue("Occurs");
for(Int_t OccNum=0; OccNum<Occurs; OccNum++){
if( NVL->IsValue( Form("Filename[%d]",OccNum) , filename ) ){
// infos need update if no KV version has been set
return ( !NVL->HasParameter(Form("KVVersion[%d]",OccNum)) );
}
}
return kFALSE;
}
示例2: Update
void KVAvailableRunsFile::Update(Bool_t no_existing_file)
{
// Examine the contents of the repository directory corresponding to this datatype
// for parent dataset fDataSet.
// For each file found which was not already in the list of available runs and
// which corresponds to a run in the database gDataBase,
// we add an entry to the available runlist file:
// [run number]|[date of modification]|[name of file]
// For "old" runs we keep the existing informations (including KV version & username)
//
// When no_existing_file=kTRUE we are making an available runs file
// for the first time. There is no pre-existing file.
TString runlist;
AssignAndDelete(runlist,
gSystem->ConcatFileName(GetFilePath(),
GetFileName()));
if(!no_existing_file){
// read all existing informations
ReadFile();
//use "lockfile" to make sure nobody else tries to modify available_runs file
//while we are working on it
if(!runlist_lock.Lock(runlist.Data())) return;
}
//open temporary file
TString tmp_file_path(GetFileName());
ofstream tmp_file;
KVBase::OpenTempFile(tmp_file_path, tmp_file);
KVDataRepository *repository = fDataSet->GetRepository();
cout << endl << "Updating runlist : " << flush;
//get directory listing from repository
KVUniqueNameList *dir_list =
repository->GetDirectoryListing(fDataSet, GetDataType());
if (!dir_list)
return;
TIter next(dir_list);
KVBase *objs;
//progress bar
Int_t ntot = dir_list->GetSize();
Int_t n5pc = TMath::Max(ntot / 20, 1);
Int_t ndone = 0;
KVDBTable *run_table = 0;
KVDataBase* db = fDataSet->GetDataBase();
if (!db){
db = new KVDataBase();
db->AddTable("Runs","List of Runs");
}
run_table = db->GetTable("Runs");
while ((objs = (KVBase *) next())) { // loop over all entries in directory
Int_t run_num;
//is this the correct name of a run in the repository ?
Info("Update","%s %d",objs->GetName(),IsRunFileName(objs->GetName()));
if ((run_num = IsRunFileName(objs->GetName()))) {
KVDBRun *run = (KVDBRun *) run_table->GetRecord(run_num);
if (run) {
FileStat_t fs;
//get file modification date
if (repository->
GetFileInfo(fDataSet, GetDataType(),
objs->GetName(), fs)) {
//runfile exists in repository
TDatime modt(fs.fMtime);
if(!no_existing_file){
// was there already an entry for exactly the same file in the previous file ?
Int_t occIdx=0;
KVNameValueList* prevEntry = RunHasFileWithDateAndName(run->GetNumber(), objs->GetName(), modt, occIdx);
if(prevEntry){
// copy infos of previous entry
tmp_file << run->GetNumber() << '|' << modt.AsSQLString() << '|' << objs->GetName();
if(prevEntry->HasParameter(Form("KVVersion[%d]",occIdx))){
tmp_file <<"|"<< prevEntry->GetStringValue(Form("KVVersion[%d]",occIdx)) <<"|"<<prevEntry->GetStringValue(Form("Username[%d]",occIdx));
}
tmp_file << endl;
}
else
{
// New Entry - write in temporary runlist file '[run number]|[date of modification]|[name of file]
tmp_file << run->GetNumber() << '|' << modt.AsSQLString() << '|' << objs->GetName() << endl;
}
}
else // no previous existing file
{
// New Entry in a new file - write in temporary runlist file '[run number]|[date of modification]|[name of file]
tmp_file << run->GetNumber() << '|' << modt.AsSQLString() << '|' << objs->GetName() << endl;
}
}
}
else{
Info("Update","the current run [%s] is not in database",objs->GetName());
FileStat_t fs;
if (repository->GetFileInfo(fDataSet, GetDataType(),objs->GetName(), fs))
{
TDatime modt(fs.fMtime);
// New Entry in a new file - write in temporary runlist file '[run number]|[date of modification]|[name of file]
//.........这里部分代码省略.........