JANA2
C++ framework for multi-threaded data processing
|
Public Types | |
typedef pair< string, map< string, string > > | node_t |
typedef vector< node_t >::iterator | node_iter_t |
Public Types inherited from JGeometry | |
enum | ATTR_LEVEL_t { attr_level_none = 0 , attr_level_last = 1 , attr_level_all = 2 } |
Public Member Functions | |
JGeometryXML (string url, int run, string context="default") | |
void | Init (string xmlfile, string xml) |
virtual const char * | className (void) |
bool | Get (string xpath, string &sval) |
bool | Get (string xpath, map< string, string > &svals) |
bool | GetMultiple (string xpath, vector< string > &vsval) |
bool | GetMultiple (string xpath, vector< map< string, string > > &vsvals) |
void | GetXPaths (vector< string > &xpaths, ATTR_LEVEL_t level, const string &filter="") |
string | GetChecksum (void) const |
void | ParseXPath (string xpath, vector< node_t > &nodes, string &attribute, unsigned int &attr_depth) const |
bool | NodeCompare (node_iter_t iter1, node_iter_t end1, node_iter_t iter2, node_iter_t end2) |
Public Member Functions inherited from JGeometry | |
JGeometry (string url, int run, string context="default") | |
void | SetVerbose (int newval) |
template<class T > | |
bool | Get (string xpath, T &val) |
template<class T > | |
bool | Get (string xpath, vector< T > &vals, string delimiter=" ") |
template<class T > | |
bool | Get (string xpath, map< string, T > &vals) |
template<class T > | |
bool | GetMultiple (string xpath, vector< T > &vval) |
template<class T > | |
bool | GetMultiple (string xpath, vector< vector< T > > &vvals, string delimiter=" ") |
template<class T > | |
bool | GetMultiple (string xpath, vector< map< string, T > > &vvals) |
const int & | GetRunRequested (void) const |
const int & | GetRunFound (void) const |
const int & | GetRunMin (void) const |
const int & | GetRunMax (void) const |
const string & | GetContext (void) const |
const string & | GetURL (void) const |
Static Public Member Functions | |
static const char * | static_className (void) |
Static Public Member Functions inherited from JGeometry | |
static const char * | static_className (void) |
Protected Attributes | |
string | xmlfile |
bool | valid_xmlfile |
JCalibration * | jcalib |
string | md5_checksum |
map< string, string > | found_xpaths |
pthread_mutex_t | found_xpaths_mutex |
Protected Attributes inherited from JGeometry | |
int | run_min |
int | run_max |
int | run_found |
int | verbose =1 |
JGeometryXML::JGeometryXML | ( | string | url, |
int | run, | ||
string | context = "default" |
||
) |
File URL should be of form:
xmlfile:///path-to-xmlfile
or
ccdb://path-to-dir-in-ccdb
If multiple XML files are required, then this should point to a top level file that includes all of the others. If using CCDB, the given directory is search for items corresponding to the specified run and context. All items found are assumed to be XML files and are read in.
References JApplication::GetService(), Init(), and JGeometryXML().
Referenced by JGeometryXML().
|
virtual |
Get all of the attribute names and values for the specified xpath. Only the first matching occurance will be returned. The value of xpath may contain restrictions on the attributes anywhere along the node path via the XPATH 1.0 specification.
Implements JGeometry.
|
virtual |
Get the value of the attribute pointed to by the specified xpath and attribute by searching the XML DOM tree. Only the first matching occurance will be returned. The value of xpath may contain restrictions on the attributes anywhere along the node path via the XPATH 1.0 specification.
Implements JGeometry.
|
virtual |
Get the value of the attribute pointed to by the specified xpath and attribute by searching the XML DOM tree. All matching occurances will be returned. The value of xpath may contain restrictions on the attributes anywhere along the node path.
Implements JGeometry.
|
virtual |
Get the value of the attribute pointed to by the specified xpath and attribute by searching the XML DOM tree. All matching occurances will be returned. The value of xpath may contain restrictions on the attributes anywhere along the node path.
Implements JGeometry.
|
virtual |
Get all of the xpaths associated with the current geometry. Optionally append the attributes according to the value of level. (See JGeometry.h for valid values). If a non-empty string is passed in for "filter" then it is used to match xpaths that should be kept. If no filter is specified (i.e. an empty string) then all xpaths are returned.
Implements JGeometry.
References NodeCompare().
void JGeometryXML::Init | ( | string | xmlfile, |
string | xml | ||
) |
This will do the actual work of parsing the XML. It is called from the constructor. Upon entry, xmlfile will contain the path to the top-level file (with any protocol prefix stripped away). This may be a file in the local filesystem or a path in the Calib DB. If we are reading from the Calib DB, then xml will be a non-empty string with the contents of the top-level file already read in. The value of data member jcalib will also be non-NULL.
Referenced by JGeometryXML().
bool JGeometryXML::NodeCompare | ( | node_iter_t | iter1, |
node_iter_t | end1, | ||
node_iter_t | iter2, | ||
node_iter_t | end2 | ||
) |
Loop over nodes starting at iter1 and iter2 through end1 and end2 to see if they match. The number of nodes and their names must match as well as the attributes. The attributes themselves are matched in the following way: All attributes appearing in the iter1 to end1 list must also appear in the iter2 to end2 list. The reverse however, need not be true. Furthermore, if the attribute value in the first list is an empty string, then the corresponding attribute value in the second list can be anything. Otherwise, they must be an exact match.
Referenced by GetXPaths().