10#ifndef __KVTEMPLATEPARTICLECONDITION_H
11#define __KVTEMPLATEPARTICLECONDITION_H
15#include "KVHashList.h"
18#include <KVClassFactory.h>
66template<
typename ParticleType>
70 using LambdaFunc = std::function<bool(
const ParticleType*)>;
133 cf->
AddMethod(
"optimized_test",
"Bool_t",
"public",
false,
true);
138 KVString body(
" //Optimized Test method for particle condition\n");
162 Error(
"Optimize",
" *** Optimization failed for KVParticleCondition : %s",
fCondition.
Data());
163 Error(
"Optimize",
" *** Use method AddExtraInclude(const Char_t*) to give the names of all necessary header files for compilation of your condition.");
164 Fatal(
"Optimize",
" *** THIS CONDITION WILL BE EVALUATED AS kFALSE FOR ALL PARTICLES!!!");
181 Error(
"Optimize",
" *** Optimization failed for KVParticleCondition : %s",
fCondition.
Data());
182 Error(
"Optimize",
" *** Use method AddExtraInclude(const Char_t*) to give the names of all necessary header files for compilation of your condition.");
183 Fatal(
"Optimize",
" *** THIS CONDITION WILL BE EVALUATED AS kFALSE FOR ALL PARTICLES!!!");
194 Info(
"Optimize",
"Success");
212 new_class.
Prepend(
"KVParticleCondition_");
229 :
KVBase(
"KVParticleCondition",
"Particle selection criteria")
239 :
KVBase(cond,
"KVParticleCondition")
268 :
KVBase(cond,
"KVParticleCondition")
297 :
KVBase(
"KVParticleCondition",
"Particle selection criteria")
495 if (&obj !=
this) obj.
Copy(*
this);
563 ::Error(
"KVTemplateParticleCondition::operator&&",
"Both KVParticleCondition objects must use lambda captures in order to do this");
609 ::Error(
"operator&&",
"Both KVParticleCondition objects must use lambda captures in order to do this");
647 Info(
"Print",
"object name = %s, address = %p",
GetName(),
this);
650 std::cout <<
" * fOptimal = " <<
fOptimal << std::endl;
651 std::cout <<
" * fNUsing = " <<
fNUsing << std::endl;
653 std::cout <<
" * classfactory :" << std::endl;
658 std::cout <<
GetName() << std::endl;
678template<
typename ParticleClass>
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
char * Form(const char *fmt,...)
Base class for KaliVeda framework.
virtual void Copy(TObject &) const
Make a copy of this object.
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Factory class for generating skeleton files for new classes.
void Print(Option_t *opt="") const
Print infos on object.
const Char_t * GetClassName() const
void GenerateCode()
Generate header and implementation file for currently-defined class.
void SetInheritAllConstructors(Bool_t yes=kTRUE)
void AddHeaderIncludeFile(const Char_t *filename)
void Copy(TObject &obj) const
Copy the state of this KVClassFactory to the one referenced by 'obj'.
void AddImplIncludeFile(const Char_t *filename)
const Char_t * GetImpFileName() const
void AddMethodBody(const Char_t *method_name, const KVString &body)
void AddMethodArgument(const Char_t *method_name, const Char_t *argument_type, const Char_t *argument_name="", const Char_t *default_value="")
KVClassMethod * AddMethod(const Char_t *name, const Char_t *return_type, const Char_t *access="public", Bool_t isVirtual=kFALSE, Bool_t isConst=kFALSE)
Extended version of ROOT THashList.
virtual TObject * FindObject(const char *name) const
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from list.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
An object for handling particle selection.
friend KVTemplateParticleCondition operator||(const KVTemplateParticleCondition &A, const KVTemplateParticleCondition &B)
LambdaFunc fLambdaCondition
void Copy(TObject &obj) const
void CreateClassFactory() const
void Set(const KVString &cond)
KVTemplateParticleCondition(const Char_t *cond)
void SetClassFactory(KVClassFactory *CF)
friend KVTemplateParticleCondition operator&&(const KVTemplateParticleCondition &A, const KVTemplateParticleCondition &B)
Bool_t Test(const ParticleType *nuc) const
KVTemplateParticleCondition()
KVTemplateParticleCondition(const KVTemplateParticleCondition &obj)
KVTemplateParticleCondition & operator&=(const KVTemplateParticleCondition &other)
Bool_t Test(const ParticleType &nuc) const
KVTemplateParticleCondition & operator=(const LambdaFunc &f)
void Set(const KVString &name, const LambdaFunc &F)
virtual bool optimized_test(const ParticleType *) const
void AddExtraInclude(const Char_t *inc_file)
~KVTemplateParticleCondition()
KVTemplateParticleCondition & operator=(const KVString &sel)
KVTemplateParticleCondition(const KVString &cond)
void SetParticleClassName(const Char_t *cl)
KVTemplateParticleCondition & operator=(const KVTemplateParticleCondition &obj)
const KVTemplateParticleCondition * fOptimal
KVTemplateParticleCondition & operator|=(const KVTemplateParticleCondition &other)
void Optimize() const
false if optimisation failed (can't load generated code)
KVString fOptimizedClassName
used to generate code for optimisation
static KVHashList fgOptimized
Bool_t fOptOK
name of generated class used for optimisation
KVString fCondition_brackets
static void PrintOptimizedList()
std::function< bool(const ParticleType *)> LambdaFunc
number of classes using this as an optimized condition
void logical_operator_lambda_condition_test() const
KVTemplateParticleCondition(const KVString &name, const LambdaFunc &F)
void Print(Option_t *opt="") const
enum KVTemplateParticleCondition::LogOp fOpType
virtual void Print(Option_t *option, const char *wildcard, Int_t recurse=1) const
const char * GetName() const override
virtual void SetName(const char *name)
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Fatal(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
Longptr_t ExecPlugin(int nargs)
TSubString Strip(EStripType s=kTrailing, char c=' ') const
const char * Data() const
TString & Prepend(char c, Ssiz_t rep=1)
void Form(const char *fmt,...)
TString & Remove(EStripType s, char c)
TString & ReplaceAll(const char *s1, const char *s2)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
const char * AsString() const