Problem 632 - G4VSteppingVerbose - please make it truly singleton
Summary: G4VSteppingVerbose - please make it truly singleton
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: tracking (show other problems)
Version: 6.1
Hardware: PC Linux
: P2 normal
Assignee: Takashi.Sasaki
URL:
Depends on:
Blocks:
 
Reported: 2004-06-10 14:35 CEST by seligman
Modified: 2004-11-07 21:22 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
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.