00001 // BESCatalogUtils.h 00002 00003 #ifndef S_BESCatalogUtils_h 00004 #define S_BESCatalogUtils_h 1 00005 00006 #include <map> 00007 #include <list> 00008 #include <string> 00009 00010 using std::map ; 00011 using std::list ; 00012 using std::string ; 00013 00014 #include "BESObj.h" 00015 #include "BESUtil.h" 00016 00017 class BESCatalogUtils : public BESObj 00018 { 00019 private: 00020 static map<string, BESCatalogUtils *> _instances ; 00021 00022 string _root_dir ; 00023 list<string> _exclude ; 00024 list<string> _include ; 00025 bool _follow_syms ; 00026 00027 public: 00028 struct type_reg 00029 { 00030 string type ; 00031 string reg ; 00032 } ; 00033 00034 private: 00035 list< type_reg > _match_list ; 00036 00037 BESCatalogUtils() {} 00038 void build_list( list<string> &theList, 00039 const string &listStr ) ; 00040 public: 00041 BESCatalogUtils( const string &name ) ; 00042 virtual ~BESCatalogUtils() {} 00043 const string & get_root_dir() const { return _root_dir ; } 00044 bool follow_sym_links() const { return _follow_syms ; } 00045 virtual bool include( const string &inQuestion ) const ; 00046 virtual bool exclude( const string &inQuestion ) const ; 00047 00048 typedef list< type_reg >::const_iterator match_citer ; 00049 BESCatalogUtils::match_citer match_list_begin() const ; 00050 BESCatalogUtils::match_citer match_list_end() const ; 00051 00052 virtual void dump( ostream &strm ) const ; 00053 00054 static const BESCatalogUtils *Utils( const string &name ) ; 00055 } ; 00056 00057 #endif // S_BESCatalogUtils_h 00058