Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:32

0001 // -*- C++ -*-
0002 //
0003 // Level.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef ThePEG_Level_H
0010 #define ThePEG_Level_H
0011 // This is the declaration of the Level class.
0012 
0013 #include "ThePEG/Config/ThePEG.h"
0014 
0015 namespace ThePEG {
0016 
0017 /**
0018  * Level is used to increment temporarily a given integer
0019  * variable. Everytime a Level object is created with a given integer
0020  * variable as argument, the variable will be incremented. When the
0021  * corresponding Level object is destroyed, the associated integer
0022  * variable is decremented again.
0023  *
0024  * @see HoldFlag
0025  */
0026 template <typename T = int>
0027 class Level {
0028 
0029 public:
0030 
0031   /** Constructor taking an integer variable which is incremented. A
0032    *  reference to the variable will be stored. */
0033   Level(T & newLevel) : theLevel(++newLevel) {}
0034 
0035   /** Destructor decrementing the associated integer variable. */
0036   ~Level() { --theLevel; }
0037 
0038 private:
0039 
0040   /** A reference to the integer variable to be decremmmented when
0041    *  this object is destroyed. */
0042   T & theLevel;
0043 
0044   /**
0045    * Default constructor is private and not implemented.
0046    */
0047   Level();
0048 
0049   /**
0050    * Copy constructor is private and not implemented.
0051    */
0052   Level(const Level &);
0053 
0054   /**
0055    * Assignment is private and not implemented.
0056    */
0057   Level & operator=(const Level &) = delete;
0058 
0059 };
0060 
0061 }
0062 
0063 #endif /* ThePEG_Level_H */