Problem 632

Summary: G4VSteppingVerbose - please make it truly singleton
Product: Geant4 Reporter: seligman
Component: trackingAssignee: Takashi.Sasaki
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 6.1   
Hardware: PC   
OS: Linux   

Description seligman 2004-06-10 14:35:21 CEST
I'm using a class inherited from G4VSteppingVerbose in Athena, the ATLAS
software framework.  When I'm using this class outside of Athena, I can make it
work.  But inside Athena, in which I cannot call
G4VSteppingVerbose::SetInstance() before the G4RunManager is initialized, I'm
having enormous problems getting the class to work.

While tracing through elaborate debug procedures, I discovered the reason for my
difficulty: Although G4VSteppingVerbose is supposed to be a singleton class,
almost all of the "protected" and "private" variables are _not_ declared static.
 This means that if I somehow manage to instantiate a second class that inherits
from G4VSteppingVerbose, I'm probably going to get segmentation faults and
uninitialized variables all over the place.

As you can guess, this is exactly what happens when I try to run my code within
Athena.

I know you're not responsible for Athena, but since G4VSteppingVerbose is
supposed to be singleton anyway, would it be possible to declare _all_ of its
variables to be static?  That would re-inforce the OO design of the class -- and
incidentally make my life much easier.

Thanks.
Comment 1 Takashi.Sasaki 2004-06-23 04:42:59 CEST
The class will be changed to be truely singleton. When the second object is
instantiated, G4Eception will be called without core dumps. This
implementation may differ from the user's wish, but the desired behavior for
the class designed as singleton.