29#include "KVNameValueList.h"
67 if (strcmp(namefile,
""))
return Form(
"%s/%s", xstr(ETCDIR), namefile);
68 return Form(
"%s", xstr(ETCDIR));
76 if (strcmp(namefile,
""))
return Form(
"%s/%s", xstr(DATADIR), namefile);
77 return Form(
"%s", xstr(DATADIR));
85 if (strcmp(namefile,
""))
return Form(
"%s/%s", xstr(TEMPLATEDIR), namefile);
86 return Form(
"%s", xstr(TEMPLATEDIR));
102 if (strcmp(namefile,
""))
return Form(
"%s/%s", xstr(LIBDIR), namefile);
103 return Form(
"%s", xstr(LIBDIR));
111 if (strcmp(namefile,
""))
return Form(
"%s/%s", xstr(INCDIR), namefile);
112 return Form(
"%s", xstr(INCDIR));
120 if (strcmp(namefile,
""))
return Form(
"%s/%s", xstr(BINDIR), namefile);
121 return Form(
"%s", xstr(BINDIR));
224 KVString add_dyn_path(ADD_DYN_PATH);
225 add_dyn_path.
Begin(
";");
226 while (!add_dyn_path.
End()) {
242#ifdef WITH_GNU_INSTALL
283 conflist.open(tmp.
Data());
284 if (!conflist.good()) {
285 ::Fatal(
"KVBase::ReadConfigFiles",
"Cannot open %s", tmp.
Data());
289 file.ReadLine(conflist);
292 while (!
file.End()) {
306 gROOT->GetPluginManager()->LoadHandlersFromEnv(
gEnv);
343#if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0)
346 ((
KVBase&) obj).Copy(*
this);
359 if (&other !=
this) {
389#if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0)
402 ((
KVBase&) obj).SetNumber(fNumber);
403 ((
KVBase&) obj).SetLabel(fLabel);
412 cout <<
"KVBase object: Name=" <<
GetName() <<
" Type=" <<
GetType();
503 va_start(args, ndirs);
505 for (; ndirs; ndirs--) {
561 if (strcmp(kvsubdir,
"")) {
566 kvfile_dir = kvsubdir;
571 return SearchFile(
name, fullpath, 3, kvfile_dir.
Data(),
664 dbfile.
open(fullpath);
723 else if (strcmp(kvsubdir,
"")) {
772 TString backup = fullpath +
"." + date;
775 if (lf1.Lock() && lf2.
Lock()) {
777 printf(
"Info in <KVBase::BackupFileWithDate(const Char_t *)> : Existing file %s renamed %s\n",
835 fp.open(base.
Data());
864 base = tmp1 + (++lnow);
877 static TString tmp(KV_VERSION);
890 static TString tmp(KV_BUILD_USER);
903 static TString tmp(KV_BUILD_DATE);
915 static TString tmp(KV_BUILD_TIME);
928 static TString tmp(KV_BUILD_TYPE);
941 static TString tmp(KV_SOURCE_DIR);
954 static TString tmp(KV_BUILD_DIR);
967 static TString tmp(KV_GIT_BRANCH);
979 static TString tmp(KV_GIT_COMMIT);
1017 TString spath(path), backup(exec), backup2(exec), expandexec(exec);
1028 if (!expandexec.
EndsWith(
".exe")) {
1029 expandexec +=
".exe";
1042 if (!backup.EndsWith(
".exe")) {
1064#ifdef __WITHOUT_TSYSTEM_FINDFILE
1138 ok_imp = ok_dec =
kFALSE;
1141 for (i = 0; i < impl_alt.
GetNpar(); i++) {
1148 for (i = 0; i < decl_alt.
GetNpar(); i++) {
1155 return (ok_imp && ok_dec);
1198 while ((er = (
TEnvRec*) next())) {
1200 if ((s = strstr(er->
GetName(),
"Plugin."))) {
1209 if (strcmp(s, base))
continue;
1214 if (regexp.
IsNull())
break;
1215 TString clss = strtok(0,
"; ");
1216 if (clss.
IsNull())
break;
1217 TString plugin = strtok(0,
"; ");
1218 if (plugin.
IsNull())
break;
1219 TString ctor = strtok(0,
";\"");
1221 ctor = strtok(0,
";\"");
1222 if (clss == derived) {
1227 regexp.
Remove(TString::kBoth,
'^');
1228 regexp.
Remove(TString::kBoth,
'$');
1278 while ((er = (
TEnvRec*) next())) {
1280 if ((s = strstr(er->
GetName(),
"Plugin."))) {
1289 if (strcmp(s, base))
continue;
1294 if (regexp.
IsNull())
break;
1295 TString clss = strtok(0,
"; ");
1296 if (clss.
IsNull())
break;
1297 TString plugin = strtok(0,
"; ");
1298 if (plugin.
IsNull())
break;
1299 TString ctor = strtok(0,
";\"");
1301 ctor = strtok(0,
";\"");
1311 tmp.
Remove(TString::kTrailing,
' ');
1342 while (!plugs.
End()) {
1343 if (tmp !=
"") tmp +=
" ";
1366 while ((er = (
TEnvRec*) next())) {
1373 while (!erval.
End()) {
1412 if (mimetypes !=
"") {
1414 mimetypes.
Begin(
" ");
1415 while (!mimetypes.
End()) {
1461 if (A == B)
return true;
1474 if (Aint < 0) Aint = zero.i - Aint;
1475 if (Bint < 0) Bint = zero.i - Bint;
1479 if (intDiff <= maxdif)
return true;
1507 obj->
Warning(
"OpenContextMenu",
"%s is not a method of %s", method, obj->
ClassName());
1510 TString Method = alt_method_name;
1511 if (Method ==
"") Method = method;
1535 ::Info(
"KVBase::CombineFiles",
"Copying all objects from %s and %s ===> into new file %s", file1, file2, newfilename);
1597 cout <<
"/----------------------------------------------------------------------\\" << endl;
1598 cout <<
"| Welcome to KaliVeda v" <<
GetKVVersion() <<
" gitlab.in2p3.fr/kaliveda-dev/kaliveda |" << endl;
1599 cout <<
"| (c) 2002-2023, The KaliVeda development team |" << endl;
1600 cout <<
"| |" << endl;
1602#ifdef WITH_GIT_INFOS
1605 printf(
"| From %-63s |\n", gitinfo.
Data());
1607 cout <<
"| See https://kaliveda.in2p3.fr for help |" << endl;
1608 cout <<
"\\----------------------------------------------------------------------/" << endl << endl;
1714 else if (val < func->GetMinimum(
xmin,
xmax)) {
1741 printf(
"Warning in <%s>: Method is deprecated in v%s and will be removed in future.\n%s\n",
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
char * StrDup(const char *str)
void AssignAndDelete(TString &target, char *tobedeleted)
R__EXTERN TSystem * gSystem
Base class for KaliVeda framework.
static TString fWorkingDirectory
user working directory for e.g. database files
static UInt_t fNbObj
Total number of KaliVeda objects (actually counts number of calls to default ctor)
UInt_t fNumber
for numbering objects
static Bool_t FindClassSourceFiles(const Char_t *class_name, KVString &imp_file, KVString &dec_file, const Char_t *dir_name=".")
static const Char_t * GetBINDIRFilePath(const Char_t *namefile="")
static void OpenTempFile(TString &base, std::ofstream &fp)
static const Char_t * GetDATADIRFilePath(const Char_t *namefile="")
static const Char_t * GetDATABASEFilePath()
static const Char_t * GetKVBuildDate()
Returns KaliVeda build date.
static const Char_t * FindFile(const Char_t *search, TString &wfil)
static const Char_t * GetINCDIRFilePath(const Char_t *namefile="")
static const Char_t * gitCommit()
Returns last git commit of sources.
static const Char_t * GetWORKDIRFilePath(const Char_t *namefile="")
void init()
Default initialisation.
static Bool_t FindExecutable(TString &exec, const Char_t *path="$(PATH)")
static const Char_t * GetKVBuildUser()
Returns username of person who performed build.
static void BackupFileWithDate(const Char_t *path)
static void ReadConfigFiles()
static const Char_t * gitBranch()
Returns git branch of sources.
static const Char_t * GetListOfPluginURIs(const Char_t *base)
TString fLabel
label for the object
virtual void Clear(Option_t *opt="")
Clear object properties : name, type/title, number, label.
KVBase()
Default constructor.
static const Char_t * GetListOfPlugins(const Char_t *base)
static Bool_t fEnvIsInit
set when environment is initialised
static Bool_t AreEqual(Double_t x, Double_t y, Long64_t maxdif=1)
Comparison between two 64-bit floating-point values.
KVBase & operator=(const KVBase &)
copy assignment operator
static void CombineFiles(const Char_t *file1, const Char_t *file2, const Char_t *newfilename, Bool_t keep=kTRUE)
static const Char_t * GetTEMPLATEDIRFilePath(const Char_t *namefile="")
static const Char_t * GetKVSourceDir()
Returns top-level directory of source tree used for build.
static void InitEnvironment()
virtual void Print(Option_t *option="") const
static const Char_t * GetDataSetEnv(const Char_t *dataset, const Char_t *type, const Char_t *defval)
static const Char_t * GetKVBuildTime()
Returns KaliVeda build time.
static void PrintSplashScreen()
Prints welcome message and infos on version etc.
static const Char_t * GetLIBDIRFilePath(const Char_t *namefile="")
static const Char_t * GetExampleFilePath(const Char_t *library, const Char_t *namefile)
Return full path to example file for given library (="KVMultiDet", "BackTrack", etc....
Double_t ProtectedGetX(const TF1 *func, Double_t val, int &status, Double_t xmin=0.0, Double_t xmax=0.0) const
static const Char_t * GetKVBuildDir()
Returns top-level directory used for build.
static void ReadGUIMimeTypes()
static Bool_t IsThisAPlugin(const TString &uri, TString &base)
virtual TObject * GetObject() const
static void GetTempFileName(TString &base)
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
static const Char_t * GetKVBuildType()
Returns KaliVeda build type (cmake build: Release, Debug, RelWithDebInfo, ...)
static const Char_t * GetPluginURI(const Char_t *base, const Char_t *plugin)
static const Char_t * GetETCDIRFilePath(const Char_t *namefile="")
static Bool_t OpenContextMenu(const char *method, TObject *obj, const char *alt_method_name="")
const Char_t * GetLabel() const
static Bool_t SearchAndOpenKVFile(const Char_t *name, KVSQLite::database &dbfile, const Char_t *kvsubdir="")
virtual void Copy(TObject &) const
Make a copy of this object.
virtual const Char_t * GetType() const
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
static const Char_t * GetKVVersion()
Returns KaliVeda version string.
static void Deprecated(const char *method, const char *advice)
Interface to (Linux) system lockfile command.
Bool_t Lock(const Char_t *filename="")
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
KVNamedParameter * GetParameter(Int_t idx) const
return the parameter object with index idx
void SetValue(const Char_t *name, value_type value)
Int_t GetNpar() const
return the number of stored parameters
Interface to ROOT SQLite database backend.
void open(const TString &dbfile)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const char *classname)=0
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
Int_t ReadBuffer(TBuffer &b, void *pointer)
TMethod * GetMethodAllAny(const char *method)
Int_t WriteBuffer(TBuffer &b, void *pointer, const char *info="")
const char * AsSQLString() const
const char * GetName() const override
THashList * GetTable() const
virtual const char * GetValue(const char *name, const char *dflt) const
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
Bool_t Defined(const char *name) const
virtual Double_t GetMinimumX(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
virtual Double_t GetX(Double_t y, Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
virtual Double_t GetMaximum(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
virtual Double_t GetMaximumX(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
virtual Bool_t OutputFile(const char *url, Bool_t force)
virtual Bool_t Merge(Bool_t=kTRUE)
virtual Bool_t AddFile(const char *url, Bool_t cpProgress=kTRUE)
TObject * FindObject(const char *name) const override
void Copy(TObject &named) const override
const char * GetName() const override
void Streamer(TBuffer &) override
void Clear(Option_t *option="") override
TClass * IsA() const override
virtual const char * ClassName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Fatal(const char *method, const char *msgfmt,...) const
virtual TClass * IsA() const
virtual void Info(const char *method, const char *msgfmt,...) const
Int_t CheckPlugin() const
virtual void SetSeed(ULong_t seed=0)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
const char * Data() const
Bool_t MaybeRegexp() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Prepend(char c, Ssiz_t rep=1)
void Form(const char *fmt,...)
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TString & ReplaceAll(const char *s1, const char *s2)
virtual TList * GetListOfFiles() const
virtual void AddIncludePath(const char *includePath)
virtual const char * Getenv(const char *env)
virtual char * ConcatFileName(const char *dir, const char *name)
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
virtual int Rename(const char *from, const char *to)
virtual Bool_t IsAbsoluteFileName(const char *dir)
virtual void AddDynamicPath(const char *pathname)
virtual char * ExpandPathName(const char *path)
virtual char * Which(const char *search, const char *file, EAccessMode mode=kFileExists)
virtual void Setenv(const char *name, const char *value)
virtual const char * HomeDirectory(const char *userName=nullptr)
virtual int Unlink(const char *name)
virtual const char * TempDirectory() const
RVec< PromoteType< T > > abs(const RVec< T > &v)
const Rcpp::internal::NamedPlaceHolder & Label
void EnableThreadSafety()