// DoPhysics1.cc -- Physicst code in module B for test of step1 // implementation of ErrorLogger mechanism. #ifndef ZMENVIRONMENT_H #include "ZMutility/ZMenvironment.h" #endif ZM_USING_NAMESPACE( zmel ) #include "frame1.h" #include "DoPhysics1.h" #include "ZMutility/iostream" #include "ZMutility/sstream" #include "ZMutility/iomanip" USING( std::cout ) USING( std::endl ) //============================================================================= // // PHYSICIST // //============================================================================= DoPhysics::DoPhysics( const string & name ) : Module( name ) // $$ 10.2 { } void DoPhysics::operator()( Event & event ) { cout << "doing DoPhysics step 1" << endl; event.data *= 3; errlog( ELerror, "wrong data" ) << event.data << endmsg; errlog( ELsuccess, "Did step 1" ) << endmsg; cout << "doing DoPhysics step 2" << endl; int i; for ( i = 0; i<6; i += 2 ) { ostringstream ost; errlog( ELinfo, "i =" ); errlog << i; event.data += i; // Let's be adventurous and show the data in hex ... // just to show how one might do it. // The problem here is that g++ doesn't seem to have // a showbase manipulator! // ost << std::showbase << std::hex << event.data; ost << std::hex << event.data; errlog << " data = " << ost.str(); errlog << endmsg; } event.data = event.data*event.data; errlog( ELsuccess, "Did step 2" ) << endmsg; cout << "data ends up as " << event.data << "\n\n"; } // DoPhysics::operator()( )