1 #ifndef __JEEP__JEEPTOOLKIT__ 
    2 #define __JEEP__JEEPTOOLKIT__ 
   25 namespace JPP { 
using namespace JEEP; }
 
   35   static const char* 
const PATH                 = 
"PATH";             
 
   36   static const char* 
const SHELL                = 
"SHELL";            
 
   66   inline std::string 
setWildCard(
const std::string& file_name, 
const std::string& value)
 
   71     string buffer = file_name;
 
   75     if (pos == string::npos) {
 
   79     return buffer.replace(pos, 1, value);
 
   89   inline std::string 
strip(
const std::string& file_name)
 
   93     string::const_iterator         p = file_name. begin();
 
   94     string::const_reverse_iterator q = file_name.rbegin();
 
   96     for ( ; p != file_name.end() && q != file_name.rend() && isspace(*p); ++p) {}
 
   97     for ( ; p != file_name.end() && q != file_name.rend() && isspace(*q); ++q) {}
 
   99     return string(p,q.base());
 
  115     if (pos != string::npos)
 
  116       return file_name.substr(pos + 1);
 
  132     const string buffer = 
strip(file_name);
 
  135     if (pos != string::npos)
 
  136       return buffer.substr(pos + 1);
 
  148   inline std::string 
getPath(
const std::string& file_name)
 
  152     const string buffer = 
strip(file_name);
 
  155     if (pos != string::npos)
 
  156       return buffer.substr(0, pos + 1);
 
  172     const string buffer = 
strip(path);
 
  192   inline std::string 
getFilename(
const std::string& path, 
const std::string& file_name)
 
  199       return strip(file_name);
 
  201       return buffer + 
strip(file_name);
 
  216   inline std::string 
getPath(
const std::string& variable, 
const std::string& file_name)
 
  224       const char* 
const p = getenv(variable.c_str());
 
  228         const string buffer(p);
 
  230         if (!buffer.empty()) {
 
  237             path = buffer.substr(pos,len);
 
  239           } 
while (!ifstream(
getFilename(path, file_name).c_str()).good() && len != string::npos && (pos += len + 1) != buffer.length());
 
  244     if (ifstream(
getFilename(path, file_name).c_str()).good())
 
  258   inline std::string 
getFullFilename(
const std::string& variable, 
const std::string& file_name)
 
  276     if (pos != string::npos)
 
  277       return type_name.substr(0, pos);
 
  295     if (pos != string::npos)
 
  296       return type_name.substr(pos + 2);
 
  314     if (pos != string::npos)
 
  315       return file_name.substr(0, pos);
 
  328     const char* 
const url = getenv(
JPP_PAGES);
 
  330     return std::string(url != NULL ? url : 
"");
 
  341   inline T* 
open(
const std::string& file_name);
 
  351   inline std::istream* 
open(
const std::string& file_name)
 
  359       return new ifstream (file_name.c_str());
 
  372   inline std::ostream* 
open(
const std::string& file_name)
 
  380       return new ofstream (file_name.c_str());
 
  396     if (
dynamic_cast<ifstream*
> (pf) != NULL) { 
dynamic_cast<ifstream*
> (pf)->
close(); 
return; }
 
  411     if (
dynamic_cast<ofstream*
> (pf) != NULL) { 
dynamic_cast<ofstream*
> (pf)->
close(); 
return; }
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
 
Exception for missing value.
 
General puprpose classes and methods.
 
static const char *const TYPENAME_SEPARATOR
type name separator
 
std::string getFullPath(const std::string &path)
Get full path, i.e. add JEEP::PATHNAME_SEPARATOR if necessary.
 
static const char *const PATH
binary file paths
 
static const char *const JPP_PAGES
Jpp document pages.
 
std::string getClassname(const std::string &type_name)
Get type name, i.e. part after JEEP::TYPENAME_SEPARATOR.
 
std::string getFilenameExtension(const std::string &file_name)
Get file name extension, i.e. part after last JEEP::FILENAME_SEPARATOR if any.
 
std::istream * open(const std::string &file_name)
Open file.
 
static const char FILENAME_SEPARATOR
file name separator
 
std::string setWildCard(const std::string &file_name, const std::string &value)
Get file name by setting wild card to given value.
 
static const char PATHNAME_SEPARATOR
path name separator
 
static const char PROTOCOL_SEPARATOR
protocol separator
 
static const char *const LD_LIBRARY_PATH
Nick names of environment variables.
 
std::string getFullFilename(const std::string &variable, const std::string &file_name)
Get full file name (see JEEP::getPath).
 
std::string getNamespace(const std::string &type_name)
Get name space, i.e. part before JEEP::TYPENAME_SEPARATOR.
 
void close(std::ostream *pf)
Close file.
 
std::string getFilename(const std::string &path, const std::string &file_name)
Compose full file name and introduce JEEP::PATHNAME_SEPARATOR if needed.
 
bool hasWildCard(const std::string &file_name)
Check presence of wild card.
 
std::string getProtocol(const std::string &file_name)
Get protocol, i.e. part before first JEEP::PROTOCOL_SEPARATOR if any.
 
std::string strip(const std::string &file_name)
Strip leading and trailing white spaces from file name.
 
std::string getURL()
Get URL of document pages.
 
std::string getPath(const std::string &variable, const std::string &file_name)
Get selected path from environment variable for given file name.
 
static const char FILENAME_WILDCARD
wild card character for file name substitution
 
static const char PATHLIST_SEPARATOR
path list separator
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).