// This code implementation is the intellectual property of // the RD44 GEANT4 collaboration. // // By copying, distributing or modifying the Program (or any work // based on the Program) you indicate your acceptance of this statement, // and all its terms. // // $Id: G4VisCommandTemplates.icc,v 2.4 1998/07/19 05:53:51 allison Exp $ // GEANT4 tag $Name: geant4-00 $ // // // Command Messenger Templates. // John Allison 7th September 1997 #include "G4UIcommand.hh" #include "G4UIdirectory.hh" #include "G4UIcmdWithoutParameter.hh" #include "G4ios.hh" /************************************** // What follows is just a try at a general template. But I think I'll abandon templates for this job - JA. template G4VisCommandMessenger ::G4VisCommandMessenger () { fpCommand = G4VisCommandMessengerRegister (fCommand.GetCommandName (), fCommand.GetGuidance (), this); } template G4VisCommandMessenger ::~G4VisCommandMessenger () { delete fpCommand; } template void G4VisCommandMessenger ::SetNewValue (G4UIcommand*, G4String newValues) { switch (G4VisCommandMessengerInterpret (newValues)) { case 0: fCommand.SetValue (false); break; case 1: fCommand.SetValue (true); break; default: break; } G4cout << "Current value of " << fCommand.GetValueName () << " is " << fCommand.GetValue () << endl; } ************************************/ // OLD STYLE!! template G4VisCommandDirectoryMessenger ::G4VisCommandDirectoryMessenger () { fpCommand = new G4UIdirectory (fCommandDirectory.GetCommandName ()); fpCommand -> SetGuidance (fCommandDirectory.GetGuidance ()); } // OLD STYLE!! template G4VisCommandDirectoryMessenger ::~G4VisCommandDirectoryMessenger () { delete fpCommand; } // OLD STYLE!! template G4VisSimpleCommandMessenger ::G4VisSimpleCommandMessenger () { fpCommand = new G4UIcmdWithoutParameter (fSimpleCommand.GetCommandName (), this); fpCommand -> SetGuidance (fSimpleCommand.GetGuidance ()); } // OLD STYLE!! template G4VisSimpleCommandMessenger ::~G4VisSimpleCommandMessenger () { delete fpCommand; } // OLD STYLE!! template void G4VisSimpleCommandMessenger ::SetNewValue (G4UIcommand*, G4String) { fSimpleCommand.SetValue (); } // OLD STYLE!! template G4VisButtonCommandMessenger ::G4VisButtonCommandMessenger () { fpCommand = G4VisButtonCommandMessengerRegister (fButtonCommand.GetCommandName (), fButtonCommand.GetGuidance (), this); } // OLD STYLE!! template G4VisButtonCommandMessenger ::~G4VisButtonCommandMessenger () { delete fpCommand; } // OLD STYLE!! template void G4VisButtonCommandMessenger ::SetNewValue (G4UIcommand*, G4String newValues) { switch (G4VisButtonCommandMessengerInterpret (newValues)) { case 0: fButtonCommand.SetValue (false); break; case 1: fButtonCommand.SetValue (true); break; default: break; } G4cout << "Current value of " << fButtonCommand.GetValueName () << " is " << fButtonCommand.GetValue () << endl; }