#include "gats/float.h" #include "gats/integer.h" #include Gats::Float::Float() : fVal( 0.0 ) { } Gats::Float::Float( double f ) : fVal( f ) { } Gats::Float::~Float() { } void Gats::Float::write( Bu::Stream &rOut ) const { char buf[50]; int iSize = snprintf( buf, 50, "%la", fVal ); rOut.write("f", 1 ); Gats::Integer::writePackedInt( rOut, iSize ); rOut.write( buf, iSize ); } void Gats::Float::read( Bu::Stream &rIn, char cType ) { int iSize; Gats::Integer::readPackedInt( rIn, iSize ); char buf[50]; rIn.read( buf, iSize ); sscanf( buf, "%la", &fVal ); } Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Float &flt ) { return f << "(float) " << flt.getValue(); }