Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:17:32

0001 
0002 // Copyright 2007-2025, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 // Author: David Lawrence
0005 
0006 #pragma once
0007 #include <JANA/JException.h>
0008 
0009 #include <typeinfo>
0010 #include <stdint.h>
0011 #include <pthread.h>
0012 #include <iostream>
0013 #include <map>
0014 #include <string>
0015 #include <sstream>
0016 #include <vector>
0017 using std::map;
0018 using std::string;
0019 using std::stringstream;
0020 using std::vector;
0021 using std::pair;
0022 
0023 
0024 class JCalibration{
0025     public:
0026 
0027         enum containerType_t{
0028             kUnknownType,
0029             kVector,
0030             kMap,
0031             kVectorVector,
0032             kVectorMap
0033         };
0034 
0035                                JCalibration(string url, int run, string context="default");
0036                        virtual ~JCalibration();
0037            virtual const char* className(void){return static_className();}
0038             static const char* static_className(void){return "JCalibration";}
0039 
0040         // Returns "false" on success and "true" on error
0041                   virtual bool GetCalib(string namepath, map<string, string> &svals, uint64_t event_number=0)=0;
0042                   virtual bool GetCalib(string namepath, vector<string> &svals, uint64_t event_number=0)=0;
0043                   virtual bool GetCalib(string namepath, vector< map<string, string> > &svals, uint64_t event_number=0)=0;
0044                   virtual bool GetCalib(string namepath, vector< vector<string> > &svals, uint64_t event_number=0)=0;
0045                   virtual bool PutCalib(string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, map<string, string> &svals, string comment="");
0046                   virtual bool PutCalib(string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector< map<string, string> > &svals, string comment="");
0047                   virtual void GetListOfNamepaths(vector<string> &namepaths)=0;
0048                   virtual void GetEventBoundaries(vector<uint64_t> &event_boundaries); ///< User-callable access to event boundaries
0049 
0050         template<class T> bool Get(string namepath, map<string,T> &vals, uint64_t event_number=0);
0051         template<class T> bool Get(string namepath, vector<T> &vals, uint64_t event_number=0);
0052         template<class T> bool Get(string namepath, vector< map<string,T> > &vals, uint64_t event_number=0);
0053         template<class T> bool Get(string namepath, vector< vector<T> > &vals, uint64_t event_number=0);
0054         template<class T> bool Get(string namepath, T &val);
0055 
0056         template<class T> bool Put(string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, map<string,T> &vals, const string &comment="");
0057         template<class T> bool Put(string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector<T> &vals, const string &comment="");
0058         template<class T> bool Put(string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector< map<string,T> > &vals, const string &comment="");
0059         template<class T> bool Put(string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector< vector<T> > &vals, const string &comment="");
0060 
0061         template<class T> bool Get(string namepath, const T* &vals, uint64_t event_number=0);
0062 
0063                const int32_t& GetRun(void) const {return run_number;}
0064                  const string& GetContext(void) const {return context;}
0065                  const string& GetURL(void) const {return url;}
0066                           void GetAccesses(map<string, vector<string> > &accesses){accesses = this->accesses;}
0067                         string GetVariation(void);
0068 
0069                containerType_t GetContainerType(string typeid_name);
0070                           void DumpCalibrationsToFiles(string basedir="./");
0071                           void WriteCalibFileVector(string dir, string fname, string pathname);
0072                           void WriteCalibFileMap(string dir, string fname, string pathname);
0073                           void WriteCalibFileVectorVector(string dir, string fname, string pathname);
0074                           void WriteCalibFileVectorMap(string dir, string fname, string pathname);
0075 
0076     protected:
0077         int32_t run_number;
0078 
0079         pthread_mutex_t accesses_mutex;
0080         pthread_mutex_t stored_mutex;
0081         pthread_mutex_t boundaries_mutex;
0082 
0083         template<typename T> containerType_t TrycontainerType(string typeid_name);
0084 
0085         // If the database supports event-level boundaries for calibration constants,
0086         // then the RetrieveEventBoundaries() method may be implemented by the
0087         // subclass. It will be called automatically by GetEventBoundaries() when needed.
0088         // It will also be called while inside a mutex lock so there is no need to lock
0089         // a mutex inside this call. RetrieveEventBoundaries will be called exactly zero or
0090         // one time for this JCalibration object. Values should be copied into the event_boundaries
0091         // container. The retrieved_event_boundaries flag will be updated automatically
0092         // so the subclass should not set it.
0093         virtual void RetrieveEventBoundaries(void){} ///< Optional for DBs that support event-level boundaries
0094 
0095     private:
0096         JCalibration(){} // Don't allow trivial constructor
0097 
0098         string context;
0099         string url;
0100 
0101         // Container to hold map of event boundaries. For (rare) cases when multiple sets
0102         // of calibration constants are needed for a single run, event-level boundaries can
0103         // be used.
0104         vector<uint64_t> event_boundaries;
0105         bool retrieved_event_boundaries; // Set automatically. Do NOT set this in the subclass
0106 
0107         // Container to hold all stored sets of constants. The "key" is a pair made from
0108         // the namepath and the typid().name() of the type stored. The value is a pointer
0109         // to the data object container itself.
0110         map<pair<string,string>, void*> stored;
0111 
0112         /// Attempt to delete the element in "stored" pointed to by iter.
0113         /// Return true if deleted, false if not.
0114         template<typename T> bool TryDelete(map<pair<string,string>, void*>::iterator iter);
0115 
0116         // Container to keep track of which constants were requested. The key is the
0117         // namepath and the value is a vector of typeid::name() strings of the data
0118         // types making the request. The vector may contain multiple instances of the
0119         // same type string so that the size of the vector is the total number of
0120         // accesses (probably a mulitple of the number of threads).
0121         map<string, vector<string> > accesses;
0122 
0123         /// Record a request for the calibration constants
0124         void RecordRequest(string namepath, string type_name);
0125 };
0126 
0127 //-------------
0128 // Get  (map version)
0129 //-------------
0130 template<class T>
0131 bool JCalibration::Get(string namepath, map<string,T> &vals, uint64_t event_number)
0132 {
0133     /// Templated method used to get a set of calibration constants.
0134     ///
0135     /// This method will get the specified calibration constants in the form of
0136     /// strings using the virtual (non-templated) Get(...) method. It will
0137     /// then convert the strings into the data type on which the "value"
0138     /// part of <i>vals</i> is based. It does this using the stringstream
0139     /// class so T is restricted to the types it understands (int, float,
0140     /// double, string, ...).
0141     ///
0142     /// The values are copied into <i>vals</i> using the keys it finds
0143     /// in the database, if any. If no keys are present, then numerical
0144     /// indices starting from zero are used. Note though that if non-keyed
0145     /// constants are used, then it may be more efficient for you to use
0146     /// the vector version of this method instead of the map one.
0147 
0148     // Get values in the form of strings
0149     map<string, string> svals;
0150     bool res = GetCalib(namepath, svals, event_number);
0151     RecordRequest(namepath, typeid(map<string,T>).name());
0152 
0153     // Loop over values, converting the strings to type "T" and
0154     // copying them into the vals map.
0155     vals.clear();
0156     map<string,string>::const_iterator iter;
0157     for(iter=svals.begin(); iter!=svals.end(); ++iter){
0158         // Use stringstream to convert from a string to type "T"
0159         T v;
0160         stringstream ss(iter->second);
0161         ss >> v;
0162         vals[iter->first] = v;
0163     }
0164 
0165     return res;
0166 }
0167 
0168 
0169 template<>
0170 inline bool JCalibration::Get(string namepath, map<string,string> &vals, uint64_t event_number)
0171 {
0172     bool res = GetCalib(namepath, vals, event_number);
0173     RecordRequest(namepath, typeid(map<string,string>).name());
0174     return res;
0175 }
0176 
0177 //-------------
0178 // Get  (vector version)
0179 //-------------
0180 template<class T>
0181 bool JCalibration::Get(string namepath, vector<T> &vals, uint64_t event_number)
0182 {
0183     /// Templated method used to get a set of calibration constants.
0184     ///
0185     /// This method will get the specified calibration constants in the form of
0186     /// strings using the virtual (non-templated) Get(...) method. It will
0187     /// then convert the strings into the data type on which the "value"
0188     /// part of <i>vals</i> is based. It does this using the stringstream
0189     /// class so T is restricted to the types it understands (int, float,
0190     /// double, string, ...).
0191     ///
0192     /// The values are copied into <i>vals</i> in the order they are
0193     /// received from the virtual Get(...) method. If keys are returned
0194     /// with the data, they are discarded. Note though that if keyed
0195     /// constants are used, you may want to look at using
0196     /// the map version of this method instead of the vector one.
0197 
0198     // Get values in the form of strings
0199     vector<string> svals;
0200     bool res = GetCalib(namepath, svals, event_number);
0201     RecordRequest(namepath, typeid(vector<T>).name());
0202 
0203     // Loop over values, converting the strings to type "T" and
0204     // copying them into the vals map.
0205     vals.clear();
0206     vector<string>::const_iterator iter;
0207     for(iter=svals.begin(); iter!=svals.end(); ++iter){
0208         // Use stringstream to convert from a string to type "T"
0209         T v;
0210         stringstream ss(*iter);
0211         ss >> v;
0212         vals.push_back(v);
0213     }
0214 
0215     return res;
0216 }
0217 
0218 template<>
0219 inline bool JCalibration::Get(string namepath, vector<string> &vals, uint64_t event_number) {
0220     bool res = GetCalib(namepath, vals, event_number);
0221     RecordRequest(namepath, typeid(vector<string>).name());
0222     return res;
0223 }
0224 
0225 
0226 //-------------
0227 // Get  (table, map version)
0228 //-------------
0229 template<class T>
0230 bool JCalibration::Get(string namepath, vector< map<string,T> > &vals, uint64_t event_number)
0231 {
0232     /// Templated method used to get a set of calibration constants.
0233     ///
0234     /// This method will get the specified calibration constants in the form of
0235     /// strings using the virtual (non-templated) Get(...) method. It will
0236     /// then convert the strings into the data type on which the "value"
0237     /// part of the maps in <i>vals</i> are based. It does this using the stringstream
0238     /// class so T is restricted to the types it understands (int, float,
0239     /// double, string, ...).
0240     ///
0241     /// This version of <i>Get</i> is used to read in data formatted as a
0242     /// table. The values are stored in a vector of maps with keys obtained
0243     /// either from the last comment line before the first line of data,
0244     /// or, if no such comment line exists, using the column number as
0245     /// the key. For example:
0246     ///
0247     ///<p><table border=1><TR><TD><tt>
0248     ///# amp   mean  sigma
0249     ///4.71  8.9  0.234
0250     ///5.20  9.1  0.377
0251     ///4.89  8.8  0.314
0252     ///</tt></TD></TR></table></p>
0253     ///
0254     /// This would fill the vector <i>vals</i> with 3 elements. Each would be a map
0255     /// with 3 values using the keys "amp", "mean", and "sigma".
0256     /// To access them, use the syntax:
0257     ///
0258     /// <p> vals[row][key] </p>
0259     ///
0260     /// So, in the above example vals[0]["sigma"] would have the value 0.234 .
0261     ///
0262 
0263 
0264     // Get values in the form of strings
0265     vector< map<string, string> >svals;
0266     bool res = GetCalib(namepath, svals, event_number);
0267     RecordRequest(namepath, typeid(vector< map<string,T> >).name());
0268 
0269     // Loop over values, converting the strings to type "T" and
0270     // copying them into the vals map.
0271     vals.clear();
0272     for(unsigned int i=0; i<svals.size(); i++){
0273         map<string,string>::const_iterator iter;
0274         map<string,T> mvals;
0275         for(iter=svals[i].begin(); iter!=svals[i].end(); ++iter){
0276             // Use stringstream to convert from a string to type "T"
0277             T v;
0278             stringstream ss(iter->second);
0279             ss >> v;
0280             mvals[iter->first] = v;
0281         }
0282         vals.push_back(mvals);
0283     }
0284 
0285     return res;
0286 }
0287 template<>
0288 inline bool JCalibration::Get(string namepath, vector< map<string,string> > &vals, uint64_t event_number) {
0289     bool res = GetCalib(namepath, vals, event_number);
0290     RecordRequest(namepath, typeid(vector< map<string,string> >).name());
0291     return res;
0292 }
0293 
0294 //-------------
0295 // Get  (table, vector version)
0296 //-------------
0297 template<class T>
0298 bool JCalibration::Get(string namepath, vector< vector<T> > &vals, uint64_t event_number)
0299 {
0300     /// Templated method used to get a set of calibration constants.
0301     ///
0302     /// This method will get the specified calibration constants in the form of
0303     /// strings using the virtual (non-templated) Get(...) method. It will
0304     /// then convert the strings into the data type on which the inner vector
0305     /// is based. It does this using the stringstream
0306     /// class so T is restricted to the types it understands (int, float,
0307     /// double, string, ...).
0308     ///
0309     /// This version of <i>Get</i> is used to read in data formatted as a
0310     /// table. The values are stored in a vector of vectors with the inner
0311     /// vector representing a single row (i.e. one element for each column) and
0312     /// the outer vector collecting the rows. For example:
0313     ///
0314     ///<p><table border=1><TR><TD><tt>
0315     ///# amp   mean  sigma
0316     ///4.71  8.9  0.234
0317     ///5.20  9.1  0.377
0318     ///4.89  8.8  0.314
0319     ///</tt></TD></TR></table></p>
0320     ///
0321     /// This would fill the vector <i>vals</i> with 3 elements. Each would be a vector
0322     /// with 3 values. To access them, use the syntax:
0323     ///
0324     /// <p> vals[row][column] </p>
0325     ///
0326     /// So, in the above example vals[0][2] would have the value 0.234 .
0327     ///
0328 
0329     // Get values in the form of strings
0330     vector< vector<string> >svals;
0331     bool res = GetCalib(namepath, svals, event_number);
0332     RecordRequest(namepath, typeid(vector< vector<T> >).name());
0333 
0334     // Loop over values, converting the strings to type "T" and
0335     // copying them into the vals map.
0336     vals.clear();
0337     for(unsigned int i=0; i<svals.size(); i++){
0338         vector<string>::const_iterator iter;
0339         vector<T> vvals;
0340         for(iter=svals[i].begin(); iter!=svals[i].end(); ++iter){
0341             // Use stringstream to convert from a string to type "T"
0342             T v;
0343             stringstream ss(*iter);
0344             ss >> v;
0345             vvals.push_back(v);
0346         }
0347         vals.push_back(vvals);
0348     }
0349 
0350     return res;
0351 }
0352 
0353 template<>
0354 inline bool JCalibration::Get(string namepath, vector< vector<string> > &vals, uint64_t event_number) {
0355     bool res = GetCalib(namepath, vals, event_number);
0356     RecordRequest(namepath, typeid(vector< vector<string> >).name());
0357     return res;
0358 }
0359 
0360 //-------------
0361 // Get  (stored container version)
0362 //-------------
0363 template<class T>
0364 bool JCalibration::Get(string namepath, const T* &vals, uint64_t event_number)
0365 {
0366     /// Templated method used to get a set of calibration constants.
0367     ///
0368     /// Get a pointer to the specified set of constants but keep them
0369     /// in the JCalibration object. If the specified constants have already
0370     /// been retrieved using type T, then the pointer is copied and the
0371     /// routine returns immediately. Otherwise, the constants are retrieved
0372     /// using one of the other Get() methods and stored locally before returning
0373     /// a pointer so subsequent calls will get the same pointer.
0374 
0375     // Initialize return pointer to reasonable value
0376     vals = NULL;
0377 
0378     // Create key from namepath and data type
0379     pair<string, string> key;
0380     key.first = namepath;
0381     key.second = typeid(T).name();
0382 
0383     // Lock mutex while accessing stored data
0384     pthread_mutex_lock(&stored_mutex);
0385 
0386     // Look to see if we already have this stored
0387     map<pair<string,string>, void*>::iterator iter = stored.find(key);
0388     if(iter!=stored.end()){
0389         vals = (const T*)iter->second;
0390         pthread_mutex_unlock(&stored_mutex);
0391         RecordRequest(namepath, typeid(T).name());
0392         return false; // return false to indicated success
0393     }
0394 
0395 
0396     // Looks like we don't have it stored already. Allocate memory for
0397     // the container and fill it with the constants.
0398     T* t = new T;
0399     bool res = Get(namepath, *t, event_number);
0400 
0401     // If successfull, store the pointer and copy it into the vals variable
0402     if(!res){ // res==false means Get call was successful
0403         stored[key] = t;
0404         vals = t;
0405     }
0406 
0407     // Release stored mutex
0408     pthread_mutex_unlock(&stored_mutex);
0409 
0410     return res;
0411 }
0412 
0413 //-------------
0414 // GetCalib (single)
0415 //-------------
0416 template<class T> bool JCalibration::Get(string namepath, T &val)
0417 {
0418     /// This is a convenience method for getting a single entry. It
0419     /// simply calls the vector version and returns the first entry.
0420     /// It returns true if the vector version returns true AND there
0421     /// is at least one entry in the vector. No check is made for there
0422     /// there being more than one entry in the vector.
0423 
0424     vector<T> vals;
0425     bool ret = Get(namepath, vals);
0426     if(vals.empty()) return true;
0427     val = vals[0];
0428 
0429     return ret;
0430 }
0431 
0432 
0433 //-------------
0434 // Put  (map version)
0435 //-------------
0436 template<class T>
0437 bool JCalibration::Put(string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, map<string,T> &vals, const string &comment)
0438 {
0439     /// Templated method used to write a set of calibration constants.
0440     ///
0441     /// This method will write the specified calibration constants in the form of
0442     /// strings using the virtual (non-templated) PutCalib(...) method. It will
0443     /// then convert the strings into the data type on which the "value"
0444     /// part of <i>vals</i> is based. It does this using the stringstream
0445     /// class so T is restricted to the types it understands (int, float,
0446     /// double, string, ...).
0447 
0448     // Loop over values, converting the type "T" values to strings
0449     map<string,string> svals;
0450     //map<string,T>::const_iterator iter;
0451     __typeof__(vals.begin()) iter;
0452     for(iter=vals.begin(); iter!=vals.end(); ++iter){
0453         // Use stringstream to convert from a string to type "T"
0454         stringstream ss;
0455         ss<<iter->second;
0456         svals[iter->first] = ss.str();
0457     }
0458 
0459     // Put values that have been converted to strings
0460     bool res = PutCalib(namepath, run_min, run_max, event_min, event_max, author, svals, comment);
0461 
0462     return res;
0463 }
0464 
0465 //-------------
0466 // Put  (vector version)
0467 //-------------
0468 template<class T>
0469 bool JCalibration::Put(string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector<T> &vals, const string &comment)
0470 {
0471     /// Templated method used to write a set of calibration constants.
0472     ///
0473     /// This method will write the specified calibration constants in the form of
0474     /// strings using the virtual (non-templated) PutCalib(...) method. It will
0475     /// then convert the strings into the data type on which the "value"
0476     /// part of <i>vals</i> is based. It does this using the stringstream
0477     /// class so T is restricted to the types it understands (int, float,
0478     /// double, string, ...).
0479 
0480     // Loop over values, converting the type "T" values to strings
0481     map<string,string> svals;
0482     __typeof__(vals.begin()) iter;
0483     int i=0;
0484     for(iter=vals.begin(); iter!=vals.end(); ++iter, ++i){
0485         // Use stringstream to convert from a string to type "T"
0486         stringstream ss;
0487         ss<<iter->second;
0488         stringstream iss;
0489         iss<<i;
0490         svals[iss.str()] = ss.str();
0491     }
0492 
0493     // Put values that have been converted to strings
0494     bool res = PutCalib(namepath, run_min, run_max, event_min, event_max, author, svals, comment);
0495 
0496     return res;
0497 }
0498 
0499 //-------------
0500 // Put  (table, map version)
0501 //-------------
0502 template<class T>
0503 bool JCalibration::Put(string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector< map<string,T> > &vals, const string &comment)
0504 {
0505     /// Templated method used to write a set of calibration constants.
0506     ///
0507     /// This method will write the specified calibration constants in the form of
0508     /// strings using the virtual (non-templated) PutCalib(...) method. It will
0509     /// then convert the strings into the data type on which the "value"
0510     /// part of <i>vals</i> is based. It does this using the stringstream
0511     /// class so T is restricted to the types it understands (int, float,
0512     /// double, string, ...).
0513 
0514     // Loop over vector
0515     vector<map<string,string> > vsvals;
0516     for(unsigned int i=0; i<vals.size(); i++){
0517         // Loop over values, converting the type "T" values to strings
0518         map<string,string> svals;
0519         map<string, T> &mvals = vals[i];
0520         __typeof__(mvals.begin()) iter;
0521         for(iter=mvals.begin(); iter!=mvals.end(); ++iter){
0522             // Use stringstream to convert from a string to type "T"
0523             stringstream ss;
0524             ss<<iter->second;
0525             svals[iter->first] = ss.str();
0526         }
0527         vsvals.push_back(svals);
0528     }
0529 
0530     // Put values that have been converted to strings
0531     bool res = PutCalib(namepath, run_min, run_max, event_min, event_max, author, vsvals, comment);
0532 
0533     return res;
0534 }
0535 
0536 //-------------
0537 // Put  (table, vector version)
0538 //-------------
0539 template<class T>
0540 bool JCalibration::Put(string namepath, int32_t run_min, int32_t run_max, uint64_t event_min, uint64_t event_max, string &author, vector< vector<T> > &vals, const string &comment)
0541 {
0542     /// Templated method used to write a set of calibration constants.
0543     ///
0544     /// This method will write the specified calibration constants in the form of
0545     /// strings using the virtual (non-templated) PutCalib(...) method. It will
0546     /// then convert the strings into the data type on which the "value"
0547     /// part of <i>vals</i> is based. It does this using the stringstream
0548     /// class so T is restricted to the types it understands (int, float,
0549     /// double, string, ...).
0550 
0551     // Loop over vector
0552     vector<map<string,string> > vsvals;
0553     for(unsigned int i=0; i<vals.size(); i++){
0554         // Loop over values, converting the type "T" values to strings
0555         map<string,string> svals;
0556         vector<T> &mvals = vals[i];
0557         for(unsigned int j=0; j<mvals.size(); j++){
0558             // Use stringstream to convert from a string to type "T"
0559             stringstream ss;
0560             ss<<mvals[j];
0561             stringstream iss;
0562             iss<<i;
0563             svals[iss.str()] = ss.str();
0564         }
0565         vsvals.push_back(svals);
0566     }
0567 
0568     // Put values that have been converted to strings
0569     bool res = PutCalib(namepath, run_min, run_max, event_min, event_max, author, vsvals, comment);
0570 
0571     return res;
0572 }
0573 
0574 //-------------
0575 // TryDelete
0576 //-------------
0577 template<typename T>
0578 bool JCalibration::TryDelete(map<pair<string,string>, void*>::iterator iter)
0579 {
0580     /// Attempt to delete the element in "stored" pointed to by iter.
0581     /// Return true if deleted, false if not.
0582     ///
0583     /// This method is maily called from the JCalibration destructor.
0584     const string &type_name = iter->first.second;
0585     void *ptr = iter->second;
0586 
0587     switch(TrycontainerType<T>(type_name)){
0588         case kVector:           delete (vector<T>*)ptr;                     break;
0589         case kMap:              delete (map<string,T>*)ptr;             break;
0590         case kVectorVector: delete (vector<vector<T> >*)ptr;            break;
0591         case kVectorMap:        delete (vector<map<string,T> >*)ptr;    break;
0592         default:
0593             // Type T must not be the right type. Inform caller
0594             return false;
0595     }
0596 
0597     // If we get here, then we must have found the type above and deleted the container
0598     return true;
0599 }
0600 
0601 //-------------
0602 // TrycontainerType
0603 //-------------
0604 template<typename T>
0605 JCalibration::containerType_t JCalibration::TrycontainerType(string typeid_name)
0606 {
0607     if(typeid_name==typeid(vector<T>).name())return kVector;
0608     if(typeid_name==typeid(map<string,T>).name())return kMap;
0609     if(typeid_name==typeid(vector<vector<T> >).name())return kVectorVector;
0610     if(typeid_name==typeid(vector<map<string,T> >).name())return kVectorMap;
0611 
0612     return kUnknownType;
0613 }
0614