/*************************************************** Created by: Venkat on Wed Aug 24 14:33:44 CDT 2005 Modified : Purpose : ****************************************************/ #ifndef EFFTOOL_HPP_ #define EFFTOOL_HPP_ #include "eff_utils/EffExceptions.hpp" #include "eff_utils/Efficiency.hpp" #include #include namespace eff_utils { class EffInfo; struct EffDuplicateMatchesToRequest : public EffException { EffDuplicateMatchesToRequest() : EffException("eff_utils : Ambiguous request - more than one match found in input stream") {;} }; class EffTool { public: // Constructors EffTool() : _isValid(false), _eff(0) {;} // path is a directory location with spc files EffTool(const EffInfo& spec, const std::string& path="./") { _isValid = _MakeEfficiencyObj(spec, path); if( !_isValid ) _eff = 0; } // Destructor (virtual since we will inherit this class) virtual ~EffTool(); // Query methods bool Info(const EffInfo& ); bool isValid() const { return _isValid; } const EffInfo& Info() const { if( _eff ) return _eff->Info(); else throw EffConfigException("Info: No Efficiency Object Present"); } const Efficiency& EffObj() const { if( _eff ) return *_eff; else throw EffConfigException("EffObj: No Efficiency Object Present"); } protected: bool _MakeEfficiencyObj(const EffInfo&, const std::string& path="./"); bool _isValid; Efficiency * _eff; private: //recursive search for spc files in directory void AddFiles2List(const char* path, std::vector& files) ; }; } #endif // _EFFTOOL_HPP_