#ifndef ROOT_HELPERS_
#define ROOT_HELPERS_
#include "TString.h"
#include "TObjString.h"
#include "TCollection.h"
#include <string>
#include <functional>
#include <algorithm>
#include <cctype>
class TObject;
namespace Memstat
{
std::string dig2bytes(Long64_t bytes);
struct SFind_t : std::binary_function<TObject*, TString, bool> {
bool operator()(TObject *_Obj, const TString &_ToFind) const
{
TObjString *str(dynamic_cast<TObjString*>(_Obj));
if (!str)
return false;
return !str->String().CompareTo(_ToFind);
}
};
template<class T>
Int_t find_string( const T &_Container, const TString &_ToFind )
{
typedef TIterCategory<T> iterator_t;
iterator_t iter(&_Container);
iterator_t found(
std::find_if(iter.Begin(), iterator_t::End(), bind2nd(SFind_t(), _ToFind))
);
return ( ( !(*found) )? -1: std::distance(iter.Begin(), found) );
}
struct ToLower_t
{
char operator() ( char c ) const
{
return std::tolower( c );
}
};
};
#endif
Last change: Wed Jun 25 08:29:11 2008
Last generated: 2008-06-25 08:29
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.