|
|
|||
File indexing completed on 2026-08-06 09:38:29
0001 // -*- C++ -*- 0002 // 0003 // Matcher.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_Matcher_H 0010 #define ThePEG_Matcher_H 0011 // This is the declaration of the Matcher class. 0012 0013 #include "MatcherBase.h" 0014 0015 namespace ThePEG { 0016 0017 /** 0018 * Matcher is a templated class inheriting from MatcherBase. It is 0019 * used to conveniently create interfaced classes inheriting from 0020 * MatcherBase giving a class with a static T::Check() method as 0021 * template argument. 0022 * 0023 * @see MatcherBase 0024 * 0025 */ 0026 template <class T> 0027 class Matcher: public MatcherBase { 0028 0029 public: 0030 0031 /** @name Standard constructors and destructors. */ 0032 //@{ 0033 /** 0034 * Destructor. 0035 */ 0036 virtual ~Matcher(); 0037 //@} 0038 0039 /** @name Special clone and create functions used by the Repository. */ 0040 //@{ 0041 /** 0042 * Create and clone Matcher objects. 0043 */ 0044 static PMPtr Create(const string & newName, string antiName); 0045 /** 0046 * Create and clone Matcher objects. 0047 */ 0048 virtual PMPtr pmclone() const; 0049 //@} 0050 0051 0052 protected: 0053 0054 /** @name Clone Methods. */ 0055 //@{ 0056 /** 0057 * Make a simple clone of this object. 0058 * @return a pointer to the new object. 0059 */ 0060 virtual IBPtr clone() const; 0061 0062 /** Make a clone of this object, possibly modifying the cloned object 0063 * to make it sane. 0064 * @return a pointer to the new object. 0065 */ 0066 virtual IBPtr fullclone() const; 0067 //@} 0068 0069 0070 /** @name Virtual and static versions of the check functions. */ 0071 //@{ 0072 /** 0073 * Virtual function overriding the one in MatcherBase. Simply calls 0074 * Check(). 0075 */ 0076 virtual bool check(const ParticleData & pd) const { return T::Check(pd); } 0077 0078 /** 0079 * Static check function. Return true if a given particle type, \a 0080 * pd, is matched by this Matcher, ie. if the T::Check() function of 0081 * the template argument returns true. 0082 */ 0083 static bool Check(const ParticleData & pd) { return T::Check(pd); } 0084 //@} 0085 0086 protected: 0087 0088 /** 0089 * Set antipartner. 0090 */ 0091 static void setCC(tPMPtr pm, tPMPtr apm) { MatcherBase::setCC(pm,apm); } 0092 0093 private: 0094 0095 /** 0096 * The static object used to initialize the description of this class. 0097 * Indicates that this is a concrete class without persistent data. 0098 */ 0099 static NoPIOClassDescription< Matcher<T> > initMatcher; 0100 0101 }; 0102 0103 /** 0104 * MatcherType is an empty non-polymorphic base class for all matcher 0105 * classes to be used as template argument to Matcher. 0106 */ 0107 struct MatcherType {}; 0108 0109 /** @cond TRAITSPECIALIZATIONS */ 0110 0111 /** This partial template specialization informs ThePEG about the base 0112 * classes of Matcher<T>. */ 0113 template <typename T> 0114 struct BaseClassTrait<Matcher<T>,1>: public ClassTraitsType { 0115 /** Typedef of the first base class of Matcher<T>. */ 0116 typedef MatcherBase NthBase; 0117 }; 0118 0119 /** This partial template specialization informs ThePEG about the name 0120 * of the Matcher<T> class. Note that the template argument class is 0121 * assumed to have a specialization of ClassTraits of its own.*/ 0122 template <typename T> 0123 struct ClassTraits< Matcher<T> >: public ClassTraitsBase< Matcher<T> > { 0124 /** Return a platform-independent class name */ 0125 static string className() { 0126 return "ThePEG::Matcher<" + T::className() + ">"; 0127 } 0128 }; 0129 0130 /** @endcond */ 0131 0132 } 0133 0134 #ifndef ThePEG_TEMPLATES_IN_CC_FILE 0135 #include "Matcher.tcc" 0136 #endif 0137 0138 #endif /* ThePEG_Matcher_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|