G4PhysicalVolumeStore.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // class G4PhysicalVolume
00030 //
00031 // Class description:
00032 //
00033 // Container for all solids, with functionality derived from
00034 // std::vector<T>. The class is a `singleton', in that only
00035 // one can exist, and access is provided via the static method
00036 // G4PhysicalVolumeStore::GetInstance()
00037 //
00038 // All solids should be registered with G4PhysicalVolumeStore, and removed on
00039 // their destruction. Intended principally for UI browser. The underlying
00040 // container initially has a capacity of 100.
00041 //
00042 // If much additional functionality is added, should consider containment
00043 // instead of inheritance for std::vector<T>
00044 //
00045 // Member data:
00046 //
00047 // static G4PhysicalVolumeStore*
00048 //   - Ptr to the single G4PhysicalVolumeStore.
00049 
00050 // History:
00051 // 18.04.01 G.Cosmo Migrated to STL vector
00052 // 25.07.95 P.Kent  Initial version
00053 // --------------------------------------------------------------------
00054 #ifndef G4PHYSICALVOLUMESTORE_HH
00055 #define G4PHYSICALVOLUMESTORE_HH
00056 
00057 #include <vector>
00058 
00059 #include "G4VPhysicalVolume.hh"
00060 #include "G4VStoreNotifier.hh"
00061 
00062 class G4PhysicalVolumeStore : public std::vector<G4VPhysicalVolume*>
00063 {
00064   public:  // with description
00065 
00066     static void Register(G4VPhysicalVolume* pSolid);
00067       // Add the volume to the collection.
00068     static void DeRegister(G4VPhysicalVolume* pSolid);
00069       // Remove the volume from the collection.
00070     static G4PhysicalVolumeStore* GetInstance();
00071       // Get a ptr to the unique G4PhysicalVolumeStore, creating it if necessary.
00072     static void SetNotifier(G4VStoreNotifier* pNotifier);
00073       // Assign a notifier for allocation/deallocation of the physical volumes.
00074     static void Clean();
00075       // Delete all physical volumes from the store. Mother logical volumes
00076       // are automatically notified and have their daughters de-registered.
00077 
00078     G4VPhysicalVolume* GetVolume(const G4String& name,
00079                                  G4bool verbose=true) const;
00080       // Return the pointer of the first volume in the collection having
00081       // that name.
00082 
00083     virtual ~G4PhysicalVolumeStore();
00084       // Destructor: takes care to delete allocated physical volumes.
00085 
00086   protected:
00087 
00088     G4PhysicalVolumeStore();
00089 
00090   private:
00091 
00092     static G4PhysicalVolumeStore* fgInstance;
00093     static G4VStoreNotifier* fgNotifier;
00094     static G4bool locked;
00095 };
00096 
00097 #endif

Generated on Mon May 27 17:49:19 2013 for Geant4 by  doxygen 1.4.7