#include <JGeometry.h>
Inheritance diagram for jana::JGeometry:
The primary advantage here is that it allows one to work with local files, but then easily switch to a remote source method when appropriate without requiring modifications to the end user code.
On the user side they will call one of the Get(...) methods which all get translated into a call of one of the two vitural methods:
virtual bool Get(string namepath, string &sval, map<string, string> &where)=0; virtual bool Get(string namepath, map<string, string> &svals, map<string, string> &where)=0;
These two virtual methods along with one to get a list of the available namepaths are the only things that need to be implemented in a concrete subclass of JGeometry.
A geometry element is specified by its namepath and an optional set of qualifiers (the where argument). The namepath is a hierarchal list of elements separated by forward slashes(/) analogous to a path on a unix filesystem. This path is always assumed to be relative to the url specified in the constructor. So, for instance, suppose one kept the geometry in a set XML files on the local filesystem and wished to access information from the file
/home/joe/calib/geom_Oct10_2017.xml
One would specify the url as:
file:///home/joe/calib/geom_Oct10_2017.xml
and then the namepath could be specified as the string:
"TOF/bar/X_Y_Z"
which would indicate the attribute "X_Y_Z" of the subtag "bar" of the tag "TOF" in the file "/home/joe/calib/geom_Oct10_2017.xml"
Definition at line 70 of file JGeometry.h.
Public Types | |
enum | ATTR_LEVEL_t { attr_level_none = 0, attr_level_last = 1, attr_level_all = 2 } |
Public Member Functions | |
virtual const char * | className (void) |
template<class T> | |
bool | Get (string xpath, map< string, T > &vals) |
template<class T> | |
bool | Get (string xpath, vector< T > &vals, string delimiter=" ") |
template<class T> | |
bool | Get (string xpath, T &val) |
virtual bool | Get (string xpath, map< string, string > &svals)=0 |
virtual bool | Get (string xpath, string &sval)=0 |
const string & | GetContext (void) const |
const int & | GetRunFound (void) const |
const int & | GetRunMax (void) const |
const int & | GetRunMin (void) const |
const int & | GetRunRequested (void) const |
const string & | GetURL (void) const |
virtual void | GetXPaths (vector< string > &xpaths, ATTR_LEVEL_t level=attr_level_last, const string &filter="")=0 |
JGeometry (string url, int run, string context="default") | |
virtual | ~JGeometry () |
Static Public Member Functions | |
static const char * | static_className (void) |
Protected Attributes | |
int | run_found |
int | run_max |
int | run_min |
Private Member Functions | |
JGeometry () | |
Private Attributes | |
map< string, string > | anywhere |
string | context |
int | run_requested |
string | url |
Definition at line 81 of file JGeometry.h.
jana::JGeometry::JGeometry | ( | string | url, | |
int | run, | |||
string | context = "default" | |||
) | [inline] |
virtual jana::JGeometry::~JGeometry | ( | ) | [inline, virtual] |
Definition at line 77 of file JGeometry.h.
jana::JGeometry::JGeometry | ( | ) | [inline, private] |
Definition at line 112 of file JGeometry.h.
virtual const char* jana::JGeometry::className | ( | void | ) | [inline, virtual] |
Reimplemented in jana::JGeometryXML.
Definition at line 78 of file JGeometry.h.
References static_className().
Here is the call graph for this function:
bool jana::JGeometry::Get | ( | string | xpath, | |
map< string, T > & | vals | |||
) |
Definition at line 202 of file JGeometry.h.
References Get().
Here is the call graph for this function:
bool jana::JGeometry::Get | ( | string | xpath, | |
vector< T > & | vals, | |||
string | delimiter = " " | |||
) |
Definition at line 158 of file JGeometry.h.
References Get().
Here is the call graph for this function:
bool jana::JGeometry::Get | ( | string | xpath, | |
T & | val | |||
) |
Definition at line 126 of file JGeometry.h.
References Get().
Here is the call graph for this function:
virtual bool jana::JGeometry::Get | ( | string | xpath, | |
map< string, string > & | svals | |||
) | [pure virtual] |
virtual bool jana::JGeometry::Get | ( | string | xpath, | |
string & | sval | |||
) | [pure virtual] |
Referenced by Get(), jana::JEventLoop::GetGeom(), and main().
Here is the caller graph for this function:
const string& jana::JGeometry::GetContext | ( | void | ) | const [inline] |
const int& jana::JGeometry::GetRunFound | ( | void | ) | const [inline] |
const int& jana::JGeometry::GetRunMax | ( | void | ) | const [inline] |
const int& jana::JGeometry::GetRunMin | ( | void | ) | const [inline] |
const int& jana::JGeometry::GetRunRequested | ( | void | ) | const [inline] |
const string& jana::JGeometry::GetURL | ( | void | ) | const [inline] |
Definition at line 104 of file JGeometry.h.
References url.
Referenced by main().
Here is the caller graph for this function:
virtual void jana::JGeometry::GetXPaths | ( | vector< string > & | xpaths, | |
ATTR_LEVEL_t | level = attr_level_last , |
|||
const string & | filter = "" | |||
) | [pure virtual] |
static const char* jana::JGeometry::static_className | ( | void | ) | [inline, static] |
Reimplemented in jana::JGeometryXML.
Definition at line 79 of file JGeometry.h.
Referenced by className().
Here is the caller graph for this function:
map<string,string> jana::JGeometry::anywhere [private] |
Definition at line 117 of file JGeometry.h.
string jana::JGeometry::context [private] |
int jana::JGeometry::run_found [protected] |
int jana::JGeometry::run_max [protected] |
int jana::JGeometry::run_min [protected] |
int jana::JGeometry::run_requested [private] |
string jana::JGeometry::url [private] |