Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:00

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 // 
0029 // John Allison  31st December 1997.
0030 //
0031 // Class Description:
0032 //
0033 // G4CallbackModel calls a user-defined function containing, for
0034 // example, calls to the Draw methods of G4VVisManager or the
0035 // *Primitive* methods of G4VGraphicsScene.  This allows the user to
0036 // add his own graphical objects to a scene.  The idea is that the
0037 // callback function is invoked by the vis system to refresh the
0038 // screen or remake a graphical database whenever required.  The
0039 // function class must contain:
0040 //
0041 //   void operator()(G4VGraphicsScene&,const G4ModelingParameters*)
0042 //
0043 // A base class G4VUserVisAction is provided in the visualisation
0044 // category.  A G4CallbackModel is made by instantiating this template
0045 // with a pointer to the function object.  The G4VisManager does this
0046 // for the user if he/she registers it (Register*UserVisAction) and issues the
0047 // command /vis/scene/add/userAction.  See the User Guide for
0048 // Application Developers.
0049 
0050 #ifndef G4CALLBACKMODEL_HH
0051 #define G4CALLBACKMODEL_HH
0052 
0053 #include "G4VModel.hh"
0054 
0055 template <class F> class G4CallbackModel: public G4VModel {
0056 
0057  public:
0058   G4CallbackModel(F* function):
0059     fFunction(function) {}
0060   ~G4CallbackModel() {}
0061   void DescribeYourselfTo(G4VGraphicsScene& sceneHandler) {
0062     (*fFunction)(sceneHandler, fpMP);
0063   }
0064 
0065 protected:
0066 
0067   F* fFunction;
0068 
0069 private:
0070 
0071   // Private copy constructor and assigment operator - copying and
0072   // assignment not allowed.  Keeps CodeWizard happy.
0073   G4CallbackModel (const G4CallbackModel&);
0074   G4CallbackModel& operator = (const G4CallbackModel&);
0075 };
0076 
0077 #endif