1 #ifndef __JSUPPORT__JMETA__
2 #define __JSUPPORT__JMETA__
34 namespace JPP {
using namespace JSUPPORT; }
72 public std::map<std::string, std::string>
87 JMeta(
const int argc,
const char*
const argv[])
102 "which " << argv[0]));
104 istream in(proc.getInputStreamBuffer());
109 for (
int i = 1; i != argc; ++i) {
132 for (const_iterator i = this->begin(); i != this->end(); ++i) {
133 comment.
add(i->first +
' ' + i->second);
146 static void copy(
const char*
const file_name, TFile& out);
175 istringstream is(buffer);
179 for (JEquation equation; is >> equation; ) {
180 meta[equation.getKey()] = equation.getValue();
201 for (JMeta::const_iterator i = this->begin(); i != this->end(); ++i) {
222 if (p != meta.end()) {
223 for (const_iterator i = meta.begin(); i != meta.end(); ++i) {
225 out << p->second <<
' ' << i->second << endl;
264 file->GetObject(key, __p);
270 const TString title = __p->GetTitle();
274 const string::size_type pos = buffer.find(
';');
276 if (pos != string::npos) {
280 istringstream(buffer.substr(pos + 1)) >> cycle;
282 buffer = buffer.substr(0, pos);
284 for (
int i = 1; i < cycle; ++i) {
288 if (__p != NULL && __p->GetTitle() == title) {
323 if (number_of_cycles != 0) {
351 inline bool putMeta(TDirectory* dir,
const std::string key,
const std::string buffer)
353 static TNamed object;
363 object.SetName (key.c_str());
364 object.SetTitle(buffer.c_str());
366 return (dir->WriteTObject(&
object) > 0);
384 if (p != meta.end()) {
404 JRootFileReader<JMeta> in(file_name);
406 while (in.hasNext()) {
408 const JMeta* p = in.next();
452 const char* buffer[number_of_items] = {
472 if (number_of_cycles != 0) {
476 file->GetObject(key, __p);
482 for (
int i = 1; i != number_of_items; ++i) {
487 (*ps)[buffer[i]] = __p->GetTitle();
505 return putObject(dir, static_cast<const JMeta&>(meta));
static const char *const application_t
Definition of meta data parameters.
TObject * getObject(const JRootObjectID &id)
Get TObject.
static const char *const GITrelease_t
GIT release.
bool putMeta(TDirectory *dir, const std::string key, const std::string buffer)
Write meta data as ROOT TNamed object.
#define MAKE_CSTRING(A)
Make C-string.
static equation_type< T > make_equation(const std::string &key, const T &value)
Auxiliary method to create equation type.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Auxiliary class for a type holder.
std::string getNamespace(const std::string &type_name)
Get name space, i.e.
static const char *const ROOTrelease_t
ROOT release.
static const char *const SVNrelease_t
SVN release.
#define MAKE_STRING(A)
Make string.
I/O formatting auxiliaries.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
const char * getGITVersion()
Get GIT version.
size_t get_number_of_tokens(const std::string &buffer)
Count number of white space separated tokens.
static const char *const system_t
system information
static const char *const namespace_t
name space
JLANG::JEquationFacet setequation
Type definition of stream manipulator for equational I/O.
Shell interaction via I/O streams.
static const char *const META_NAME
ROOT name for meta data.
std::string getFilename(const std::string &file_name)
Get file name part, i.e.
const char * getName()
Get ROOT name of given data type.
virtual const char * what() const
Get error message.
static const char *const command_t
Linux command.
int getNumberOfCycles(TFile *file, const TString key)
Get number of cycles of named objects with same title as given key.
static const char *const META_DIRECTORY
ROOT sub-directory for meta data.
bool putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.