#ifndef _sdet_T2StatFileManager_h_
#define _sdet_T2StatFileManager_h_

/*
    \file ...

   \author Jose Luis Navarro Quirante
   \version $Id: T2StatFileManager.h 19041 2011-04-15 18:49:23Z javierg $
   \date Wed Apr 20 09:51:30 CET 2010
*/

#include <det/Detector.h>

#include <string>
#include <vector>

//static const char CVSId_sdet_T2StatFileManager[] =
//  "$Id: T2StatFileManager.h 19041 2011-04-15 18:49:23Z javierg $";

class TChain;
class TDirectory;

namespace sdet {

  class T2StatFileManager : public det::VManager {

  public:
    T2StatFileManager():
      fDataTree(0),
      fdir(0)
    {}
    virtual ~T2StatFileManager() { }

    VMANAGER_GETDATA_CALL(GetOkFlag, int)

    VMANAGER_GETDATA_NOTFOUND(double)
    VMANAGER_GETDATA_NOTFOUND(std::string)
    VMANAGER_GETDATA_NOTFOUND(std::list<int>)
    VMANAGER_GETDATA_NOTFOUND(std::list<double>)
    VMANAGER_GETDATA_NOTFOUND(std::list<std::string>)
    VMANAGER_GETDATA_NOTFOUND(std::list<std::pair<int, int> >)
    VMANAGER_GETDATA_NOTFOUND(std::vector<double>)
    VMANAGER_GETDATA_NOTFOUND(std::vector<int>)
    VMANAGER_GETDATA_NOTFOUND(std::vector<std::string>)
    VMANAGER_GETDATA_NOTFOUND(std::vector<bool>)
    VMANAGER_GETDATA_NOTFOUND(utl::TabulatedFunction)
    VMANAGER_GETDATA_NOTFOUND(utl::TabulatedFunctionComplexLgAmpPhase)
    VMANAGER_GETDATA_NOTFOUND(std::map<int, utl::TabulatedFunction>)

    VMANAGER_GETDATA_NOTFOUND(std::map<std::string, double>)

    void Init(const std::string& configLink);

  private:

    Status GetOkFlag(int& returnData,
                     const std::string& componentProperty,
                     const std::string& componentName,
                     const IndexMap& componentIndex) const;

    int GetStationStatus(const IndexMap& componentIndex) const;
    bool ReadData() const;

  private:
    int fVerbosity;
    int fCommsCrisis;
    std::vector <std::string> fAllT2Files;
    TChain* fDataTree;
    unsigned int fstartGPS;
    unsigned int fendGPS;
    TDirectory *fdir;

    // data cache
    std::vector<unsigned int> fStationList;

  };

} // sdet


#endif // _sdet_T2StatFileManager_h_

// Configure (x)emacs for this file ...
// Local Variables:
// mode: c++
// compile-command: "make -C .. -k"
// End: