G4VisCommandModelCreate< Factory > Class Template Reference

#include <G4VisCommandModelCreate.hh>

Inheritance diagram for G4VisCommandModelCreate< Factory >:

G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandModelCreate (Factory *, const G4String &placement)
virtual ~G4VisCommandModelCreate ()
G4String GetCurrentValue (G4UIcommand *)
void SetNewValue (G4UIcommand *command, G4String newValue)
G4String Placement () const

Detailed Description

template<typename Factory>
class G4VisCommandModelCreate< Factory >

Definition at line 46 of file G4VisCommandModelCreate.hh.


Constructor & Destructor Documentation

template<typename Factory>
G4VisCommandModelCreate< Factory >::G4VisCommandModelCreate ( Factory *  ,
const G4String placement 
)

Definition at line 74 of file G4VisCommandModelCreate.hh.

References G4VisCommandModelCreate< Factory >::Placement(), G4UIcommand::SetGuidance(), and G4UIcmdWithAString::SetParameterName().

00075   :fpFactory(factory)
00076   ,fPlacement(placement)
00077   ,fId(0)
00078 {  
00079   G4String factoryName = factory->Name();
00080 
00081   G4String command = Placement()+"/create/"+factoryName; 
00082   G4String guidance = "Create a "+factoryName+" model and associated messengers.";
00083 
00084   fpCommand = new G4UIcmdWithAString(command, this);      
00085   fpCommand->SetGuidance(guidance);
00086   fpCommand->SetGuidance("Generated model becomes current.");  
00087   fpCommand->SetParameterName("model-name", true);    
00088 }

template<typename Factory>
G4VisCommandModelCreate< Factory >::~G4VisCommandModelCreate (  )  [virtual]

Definition at line 91 of file G4VisCommandModelCreate.hh.

00092 {
00093   delete fpCommand;
00094   
00095   unsigned i(0);
00096   for (i=0; i<fDirectoryList.size(); ++i) {
00097     delete fDirectoryList[i];
00098   }
00099 }


Member Function Documentation

template<typename Factory>
G4String G4VisCommandModelCreate< Factory >::GetCurrentValue ( G4UIcommand  )  [virtual]

Reimplemented from G4UImessenger.

Definition at line 119 of file G4VisCommandModelCreate.hh.

00120 {
00121   return "";
00122 }

template<typename Factory>
G4String G4VisCommandModelCreate< Factory >::Placement (  )  const

Definition at line 103 of file G4VisCommandModelCreate.hh.

Referenced by G4VisCommandModelCreate< Factory >::G4VisCommandModelCreate(), and G4VisCommandModelCreate< Factory >::SetNewValue().

00104 {
00105   return fPlacement;
00106 }

template<typename Factory>
void G4VisCommandModelCreate< Factory >::SetNewValue ( G4UIcommand command,
G4String  newValue 
) [virtual]

Reimplemented from G4UImessenger.

Definition at line 125 of file G4VisCommandModelCreate.hh.

References G4VVisCommand::fpVisManager, G4String::isNull(), G4VisCommandModelCreate< Factory >::Placement(), G4VisManager::RegisterMessenger(), G4VisManager::RegisterModel(), and G4UIcommand::SetGuidance().

00126 {
00127   if (newName.isNull()) newName = NextName();
00128 
00129   assert (0 != fpFactory);
00130 
00131   // Create directory for new model commands
00132   G4String title = Placement()+"/"+newName+"/";
00133   G4String guidance = "Commands for "+newName+" model.";
00134 
00135   G4UIcommand* directory = new G4UIdirectory(title);
00136   directory->SetGuidance(guidance);
00137   fDirectoryList.push_back(directory);   
00138 
00139   // Create the model.
00140   typename Factory::ModelAndMessengers creation = fpFactory->Create(Placement(), newName);
00141 
00142   // Register model with vis manager
00143   fpVisManager->RegisterModel(creation.first);
00144 
00145   // Register associated messengers with vis manager
00146   typename Factory::Messengers::iterator iter = creation.second.begin();
00147 
00148   while (iter != creation.second.end()) {
00149     fpVisManager->RegisterMessenger(*iter);
00150     iter++;
00151   }
00152 }    


The documentation for this class was generated from the following file:
Generated on Mon May 27 17:53:45 2013 for Geant4 by  doxygen 1.4.7