Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // TypeInfo.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_TypeInfo_H
0010 #define ThePEG_TypeInfo_H
0011 
0012 #include "DescriptionList.h"
0013 
0014 namespace ThePEG {
0015 
0016 /** TypeInfo is a simple wrapper around the ClassDescription system in
0017  *  ThePEG. Defines a few static functions for returning the mane and
0018  *  version of the class given objects of that class. */
0019 struct TypeInfo {
0020 
0021   /** Return the name of the class of the given object. */
0022   template <typename T>
0023   static string name(const T &)
0024   {
0025     const ClassDescriptionBase * cd = DescriptionList::find(typeid(T));
0026     if ( cd ) return cd->name();
0027     return "**** CLASS NOT REGISTERED ****";
0028   }
0029 
0030   /** Return the version number of the class of the given object. */
0031   template <typename T>
0032   static int version(const T &)
0033   {
0034     const ClassDescriptionBase * cd = DescriptionList::find(typeid(T));
0035     if ( cd ) return cd->version();
0036     return -1;
0037   }
0038 
0039 };
0040 
0041 }
0042 
0043 #endif /* ThePEG_TypeInfo_H */