* ./hurricane/src/hurricane :

- Bug : Timer.h/.cpp, friend overload of the operator<<(ostream&) introduce
        a ostream<<() function in the Hurricane namespace which prevent the
        overload to resolve correctly under MacOS X (gcc 4.0).
This commit is contained in:
Jean-Paul Chaput 2009-01-05 20:47:13 +00:00
parent 9edbed80ae
commit 5afca323b2
2 changed files with 14 additions and 11 deletions

View File

@ -143,11 +143,11 @@ namespace Hurricane {
} }
std::ostream& operator<<(std::ostream& os, const Timer& tm) string Timer::_getString () const
{ {
//CPUNormalizer cpunorm; //CPUNormalizer cpunorm;
double userSec = tm.getUserTime (); double userSec = getUserTime ();
double normSec = tm.getUserTime (); // * cpunorm.getNormalizingFactor(); double normSec = getUserTime (); // * cpunorm.getNormalizingFactor();
char buffer[20]; char buffer[20];
if ( userSec > 0.01 ) { if ( userSec > 0.01 ) {
@ -160,15 +160,16 @@ namespace Hurricane {
normSec -= delta; normSec -= delta;
} }
sprintf ( buffer, "%.1e", tm.getSysTime() ); sprintf ( buffer, "%.1e", getSysTime() );
ostringstream os;
os << " " << userSec << " user," os << " " << userSec << " user,"
<< " " << buffer << " system," << " " << buffer << " system,"
<< " " << tm.getRealTime() << " real," << " " << getRealTime() << " real,"
<< " " << normSec << " norm'd " << " " << normSec << " norm'd "
<< "sec "; << "sec ";
return os; return os.str();
} }

View File

@ -100,8 +100,7 @@ namespace Hurricane {
inline size_t getMemorySize () const; inline size_t getMemorySize () const;
inline size_t getIncrease () const; inline size_t getIncrease () const;
inline void resetIncrease (); inline void resetIncrease ();
// Friends Functions. string _getString () const;
friend std::ostream& operator<< ( std::ostream& os, const Timer& tm );
protected: protected:
// Internal: Enum. // Internal: Enum.
@ -183,4 +182,7 @@ namespace Hurricane {
} // End of Hurricane namespace. } // End of Hurricane namespace.
IOSTREAM_VALUE_SUPPORT(Hurricane::Timer);
#endif // __HURRICANE_TIMER__ #endif // __HURRICANE_TIMER__