1 #ifndef __JEEP__JEEPTOOLKIT__
2 #define __JEEP__JEEPTOOLKIT__
24 namespace JPP {
using namespace JEEP; }
32 static const char*
const PATH =
"PATH";
33 static const char*
const SHELL =
"SHELL";
49 inline std::string
strip(
const std::string& file_name)
53 string::const_iterator p = file_name. begin();
54 string::const_reverse_iterator q = file_name.rbegin();
56 for ( ; p != file_name.end() && q != file_name.rend() && isspace(*p); ++p) {}
57 for ( ; p != file_name.end() && q != file_name.rend() && isspace(*q); ++q) {}
59 return string(p,q.base());
75 if (pos != string::npos)
76 return file_name.substr(pos + 1);
92 const string buffer =
strip(file_name);
95 if (pos != string::npos)
96 return buffer.substr(pos + 1);
108 inline std::string
getPath(
const std::string& file_name)
112 const string buffer =
strip(file_name);
115 if (pos != string::npos)
116 return buffer.substr(0, pos + 1);
132 const string buffer =
strip(path);
159 return strip(file_name);
161 return buffer +
strip(file_name);
176 inline std::string
getPath(
const std::string& variable,
const std::string& file_name)
184 const string buffer(getenv(variable.c_str()));
186 if (!buffer.empty()) {
193 path = buffer.substr(pos,len);
195 }
while (!ifstream(
getFilename(
path, file_name).c_str()).good() && len != string::npos && (pos += len + 1) != buffer.length());
213 inline std::string
getFullFilename(
const std::string& variable,
const std::string& file_name)
231 if (pos != string::npos)
232 return type_name.substr(0, pos);
250 if (pos != string::npos)
251 return type_name.substr(pos + 2);
269 if (pos != string::npos)
270 return file_name.substr(0, pos);
283 const char*
const url = getenv(
JPP_PAGES);
285 return std::string(url != NULL ? url :
"");
296 inline T*
open(
const std::string& file_name);
306 inline std::istream*
open(
const std::string& file_name)
314 return new ifstream (file_name.c_str());
327 inline std::ostream*
open(
const std::string& file_name)
335 return new ofstream (file_name.c_str());
351 if (dynamic_cast<ifstream*> (pf) != NULL) {
dynamic_cast<ifstream*
> (pf)->
close();
return; }
352 if (dynamic_cast<igzstream*>(pf) != NULL) {
dynamic_cast<igzstream*
>(pf)->
close();
return; }
366 if (dynamic_cast<ofstream*> (pf) != NULL) {
dynamic_cast<ofstream*
> (pf)->
close();
return; }
367 if (dynamic_cast<ogzstream*>(pf) != NULL) {
dynamic_cast<ogzstream*
>(pf)->
close();
return; }
static const char *const TYPENAME_SEPARATOR
type name separator
static const char *const LD_LIBRARY_PATH
Nick names of environment variables.
std::string getPath(const std::string &file_name)
Get path, i.e. part before last JEEP::PATHNAME_SEPARATOR if any.
std::string getFullPath(const std::string &path)
Get full path, i.e. add JEEP::PATHNAME_SEPARATOR if necessary.
std::string getNamespace(const std::string &type_name)
Get name space, i.e. part before JEEP::TYPENAME_SEPARATOR.
T * open(const std::string &file_name)
Open file.
static const char PROTOCOL_SEPARATOR
protocol separator
$WORKDIR driver txt done cat $WORKDIR driver txt<< EOFprocess ${DATAFILTER}$FILTER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&JDataFilter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAFILTER}-P $PORT</dev/null > &/dev/null)&';process ${DATAWRITER}$WRITER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&JDataWriter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAWRITER}</dev/null > &/dev/null)&';print enterevent ev_init{RC_CMD}event ev_reset{RC_CMD}event ev_init{RC_CMD}event ev_configure{RC_DFLTR%<$WORKDIR/ev_configure_datafilter.txt > RC_DOM<$WORKDIR/ev_configure_domsimulator.txt > RC_DWRT path
std::string getClassname(const std::string &type_name)
Get type name, i.e. part after JEEP::TYPENAME_SEPARATOR.
void close(std::istream *pf)
Close file.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
std::string getURL()
Get URL of document pages.
std::string strip(const std::string &file_name)
Strip leading and trailing white spaces from file name.
std::string getProtocol(const std::string &file_name)
Get protocol, i.e. part before first JEEP::PROTOCOL_SEPARATOR if any.
std::string getFilenameExtension(const std::string &file_name)
Get file name extension, i.e. part after last JEEP::FILENAME_SEPARATOR if any.
static const char FILENAME_SEPARATOR
file name separator
static const char PATHLIST_SEPARATOR
path list separator
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
static const char *const JPP_PAGES
Jpp document pages.
std::string getFullFilename(const std::string &variable, const std::string &file_name)
Get full file name (see JEEP::getPath).
static const char *const SHELL
SHELL.
static const char PATHNAME_SEPARATOR
path name separator
static const char *const PATH
binary file paths