int Policy::Func::ff(const Category::Enum::Type type, const vector<string> &basepaths, const string &fusepath, const size_t minfreespace, vector<string> &paths) { if(type == Category::Enum::create) return _ff_create(basepaths,fusepath,paths); return _ff(basepaths,fusepath,paths); }
// ============================================================================ void DataOnDemandSvc::dump ( const MSG::Level level , const bool mode ) const { if ( m_algs.empty() && m_nodes.empty() ) { return ; } typedef std::pair<std::string,std::string> Pair ; typedef std::map<std::string,Pair> PMap ; PMap _m ; for ( AlgMap::const_iterator alg = m_algs.begin() ; m_algs.end() != alg ; ++alg ) { PMap::const_iterator check = _m.find(alg->first) ; if ( _m.end() != check ) { stream() << MSG::WARNING << " The data item is activated for '" << check->first << "' as '" << check->second.first << "'" << endmsg ; } const Leaf& l = alg->second ; std::string nam = ( l.name == l.type ? l.type : (l.type+"/"+l.name) ) ; // if ( !mode && 0 == l.num ) { continue ; } // std::string val ; if ( mode ) { val = ( 0 == l.algorithm ) ? "F" : "T" ; } else { val = boost::lexical_cast<std::string>( l.num ) ; } // _m[ no_prefix ( alg->first , m_prefix ) ] = std::make_pair ( nam , val ) ; } // nodes: for ( NodeMap::const_iterator node = m_nodes.begin() ; m_nodes.end() != node ; ++node ) { PMap::const_iterator check = _m.find(node->first) ; if ( _m.end() != check ) { stream() << MSG::WARNING << " The data item is already activated for '" << check->first << "' as '" << check->second.first << "'" << endmsg ; } const Node& n = node->second ; std::string nam = "'" + n.name + "'" ; // std::string val ; if ( !mode && 0 == n.num ) { continue ; } if ( mode ) { val = ( 0 == n.clazz ) ? "F" : "T" ; } else { val = boost::lexical_cast<std::string>( n.num ) ; } // _m[ no_prefix ( node->first , m_prefix ) ] = std::make_pair ( nam , val ) ; } // if ( _m.empty() ) { return ; } // find the correct formats size_t n1 = 0 ; size_t n2 = 0 ; size_t n3 = 0 ; for ( PMap::const_iterator it = _m.begin() ; _m.end() != it ; ++it ) { n1 = std::max ( n1 , it->first.size() ) ; n2 = std::max ( n2 , it->second.first.size() ) ; n3 = std::max ( n3 , it->second.second.size() ) ; } if ( 10 > n1 ) { n1 = 10 ; } if ( 10 > n2 ) { n2 = 10 ; } if ( 60 < n1 ) { n1 = 60 ; } if ( 60 < n2 ) { n2 = 60 ; } // const std::string _f = " | %%1$-%1%.%1%s | %%2$-%2%.%2%s | %%3$%3%.%3%s |" ; boost::format _ff ( _f ) ; _ff % n1 % n2 % n3 ; const std::string _format = _ff.str() ; MsgStream& msg = stream() << level ; if ( mode ) { msg << "Data-On-Demand Actions enabled for:" ; } else { msg << "Data-On-Demand Actions has been used for:" ; } boost::format fmt1( _format) ; fmt1 % "Address" % "Creator" % ( mode ? "S" : "#" ) ; // const std::string header = fmt1.str() ; std::string line = std::string( header.size() , '-' ) ; line[0] = ' ' ; msg << std::endl << line << std::endl << header << std::endl << line ; // make the actual printout: for ( PMap::const_iterator item = _m.begin() ; _m.end() != item ; ++item ) { boost::format fmt( _format) ; msg << std::endl << ( fmt % item->first % item->second.first % item->second.second ) ; } msg << std::endl << line << endmsg ; }