Logo ROOT   6.10/09
Reference Guide
TCut.h
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Rene Brun 14/04/97
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TCut
13 #define ROOT_TCut
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TCut //
18 // //
19 // A specialized string object used in TTree selections. //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TNamed.h"
24 
25 class TCut : public TNamed {
26 private:
27  // Prevent meaningless operator (which otherwise can be reached via
28  // the conversion to 'const char*'
29  Bool_t operator<(const TCut &rhs); // Intentional left unimplemented
30  Bool_t operator<=(const TCut &rhs); // Intentional left unimplemented
31  Bool_t operator>(const TCut &rhs); // Intentional left unimplemented
32  Bool_t operator>=(const TCut &rhs); // Intentional left unimplemented
33 public:
34  TCut();
35  TCut(const char *title);
36  TCut(const char *name, const char *title);
37  TCut(const TCut &cut);
38  virtual ~TCut();
39 
40  // Assignment
41  TCut& operator=(const char *rhs);
42  TCut& operator=(const TCut &rhs);
43  TCut& operator+=(const char *rhs);
44  TCut& operator+=(const TCut &rhs);
45  TCut& operator*=(const char *rhs);
46  TCut& operator*=(const TCut &rhs);
47 
48  // Comparison
49  Bool_t operator==(const char *rhs) const;
50  Bool_t operator==(const TCut &rhs) const;
51  Bool_t operator!=(const char *rhs) const;
52  Bool_t operator!=(const TCut &rhs) const;
53 
54  friend TCut operator+(const TCut &lhs, const char *rhs);
55  friend TCut operator+(const char *lhs, const TCut &rhs);
56  friend TCut operator+(const TCut &lhs, const TCut &rhs);
57  friend TCut operator*(const TCut &lhs, const char *rhs);
58  friend TCut operator*(const char *lhs, const TCut &rhs);
59  friend TCut operator*(const TCut &lhs, const TCut &rhs);
60 // Preventing warnings with -Weffc++ in GCC since the overloading of the && and || operators was a design choice.
61 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
62 #pragma GCC diagnostic push
63 #pragma GCC diagnostic ignored "-Weffc++"
64 #endif
65  friend TCut operator&&(const TCut &lhs, const char *rhs);
66  friend TCut operator&&(const char *lhs, const TCut &rhs);
67  friend TCut operator&&(const TCut &lhs, const TCut &rhs);
68  friend TCut operator||(const TCut &lhs, const char *rhs);
69  friend TCut operator||(const char *lhs, const TCut &rhs);
70  friend TCut operator||(const TCut &lhs, const TCut &rhs);
71 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
72 #pragma GCC diagnostic pop
73 #endif
74  friend TCut operator!(const TCut &rhs);
75 
76  // Type conversion
77  operator const char*() const { return GetTitle(); }
78 
79  ClassDef(TCut,1) //A specialized string object used for TTree selections
80 };
81 
82 // Declarations.
83 TCut operator+(const TCut &lhs, const char *rhs);
84 TCut operator+(const char *lhs, const TCut &rhs);
85 TCut operator+(const TCut &lhs, const TCut &rhs);
86 TCut operator*(const TCut &lhs, const char *rhs);
87 TCut operator*(const char *lhs, const TCut &rhs);
88 TCut operator*(const TCut &lhs, const TCut &rhs);
89 // Preventing warnings with -Weffc++ in GCC since the overloading of the && and || operators was a design choice.
90 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
91 #pragma GCC diagnostic push
92 #pragma GCC diagnostic ignored "-Weffc++"
93 #endif
94 TCut operator&&(const TCut &lhs, const char *rhs);
95 TCut operator&&(const char *lhs, const TCut &rhs);
96 TCut operator&&(const TCut &lhs, const TCut &rhs);
97 TCut operator||(const TCut &lhs, const char *rhs);
98 TCut operator||(const char *lhs, const TCut &rhs);
99 TCut operator||(const TCut &lhs, const TCut &rhs);
100 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
101 #pragma GCC diagnostic pop
102 #endif
103 TCut operator!(const TCut &rhs);
104 
105 #endif
TCut & operator+=(const char *rhs)
Addition.
Definition: TCut.cxx:132
friend TCut operator*(const TCut &lhs, const char *rhs)
Multiplication.
Definition: TCut.cxx:208
bool Bool_t
Definition: RtypesCore.h:59
Bool_t operator!=(const char *rhs) const
Comparison.
Definition: TCut.cxx:98
#define ClassDef(name, id)
Definition: Rtypes.h:297
virtual ~TCut()
Typical destructor.
Definition: TCut.cxx:75
TCut & operator=(const char *rhs)
Assignment.
Definition: TCut.cxx:114
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TCut & operator*=(const char *rhs)
Multiplication.
Definition: TCut.cxx:158
A specialized string object used for TTree selections.
Definition: TCut.h:25
friend TCut operator||(const TCut &lhs, const char *rhs)
Logical or.
Definition: TCut.cxx:256
Bool_t operator>=(const TCut &rhs)
Bool_t operator<(const TCut &rhs)
friend TCut operator &&(const TCut &lhs, const char *rhs)
Logical and.
Definition: TCut.cxx:232
Bool_t operator>(const TCut &rhs)
Bool_t operator<=(const TCut &rhs)
friend TCut operator!(const TCut &rhs)
Logical negation.
Definition: TCut.cxx:292
Bool_t operator==(const char *rhs) const
Comparison.
Definition: TCut.cxx:82
friend TCut operator+(const TCut &lhs, const char *rhs)
Addition.
Definition: TCut.cxx:184
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
TCut()
Constructor.
Definition: TCut.cxx:47