Logo ROOT   6.12/07
Reference Guide
TCallContext.h
Go to the documentation of this file.
1 #ifndef PYROOT_TCALLCONTEXT_H
2 #define PYROOT_TCALLCONTEXT_H
3 
4 // Standard
5 #include <vector>
6 
7 
8 namespace PyROOT {
9 
10 // general place holder for function parameters
11  struct TParameter {
12  union Value {
25  void* fVoidp;
26  } fValue;
27  void* fRef;
28  char fTypeCode;
29  };
30 
31 // extra call information
32  struct TCallContext {
33  TCallContext( std::vector< TParameter >::size_type sz = 0 ) : fArgs( sz ), fFlags( 0 ) {}
34 
35  enum ECallFlags {
36  kNone = 0,
37  kIsSorted = 1, // if method overload priority determined
38  kIsCreator = 2, // if method creates python-owned objects
39  kIsConstructor = 4, // if method is a C++ constructor
40  kUseHeuristics = 8, // if method applies heuristics memory policy
41  kUseStrict = 16, // if method applies strict memory policy
42  kManageSmartPtr = 32, // if executor should manage smart pointers
43  kReleaseGIL = 64, // if method should release the GIL
44  kFast = 128, // if method should NOT handle signals
45  kSafe = 256 // if method should return on signals
46  };
47 
48  // memory handling
50  static Bool_t SetMemoryPolicy( ECallFlags e );
51 
52  // signal safety
54  static Bool_t SetSignalPolicy( ECallFlags e );
55 
56  // payload
57  std::vector< TParameter > fArgs;
59  };
60 
61  inline Bool_t IsSorted( UInt_t flags ) {
62  return flags & TCallContext::kIsSorted;
63  }
64 
65  inline Bool_t IsCreator( UInt_t flags ) {
66  return flags & TCallContext::kIsCreator;
67  }
68 
69  inline Bool_t IsConstructor( UInt_t flags ) {
70  return flags & TCallContext::kIsConstructor;
71  }
72 
75  }
76 
77  inline Bool_t ReleasesGIL( UInt_t flags ) {
78  return flags & TCallContext::kReleaseGIL;
79  }
80 
81  inline Bool_t ReleasesGIL( TCallContext* ctxt ) {
82  return ctxt ? (ctxt->fFlags & TCallContext::kReleaseGIL) : kFALSE;
83  }
84 
86  if ( ctxt && (ctxt->fFlags & TCallContext::kUseStrict) )
87  return kTRUE;
88  if ( ctxt && (ctxt->fFlags & TCallContext::kUseHeuristics) )
89  return kFALSE;
90 
92  }
93 
94 } // namespace PyROOT
95 
96 #endif // !PYROOT_TCALLCONTEXT_H
TCallContext(std::vector< TParameter >::size_type sz=0)
Definition: TCallContext.h:33
long long Long64_t
Definition: RtypesCore.h:69
float Float_t
Definition: RtypesCore.h:53
static ECallFlags sSignalPolicy
Definition: TCallContext.h:53
unsigned short UShort_t
Definition: RtypesCore.h:36
Bool_t ManagesSmartPtr(TCallContext *ctxt)
Definition: TCallContext.h:73
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
std::vector< TParameter > fArgs
Definition: TCallContext.h:57
Bool_t IsSorted(UInt_t flags)
Definition: TCallContext.h:61
Bool_t UseStrictOwnership(TCallContext *ctxt)
Definition: TCallContext.h:85
Bool_t ReleasesGIL(UInt_t flags)
Definition: TCallContext.h:77
union PyROOT::TParameter::Value fValue
Bool_t IsConstructor(UInt_t flags)
Definition: TCallContext.h:69
unsigned int UInt_t
Definition: RtypesCore.h:42
short Short_t
Definition: RtypesCore.h:35
long double LongDouble_t
Definition: RtypesCore.h:57
const Bool_t kFALSE
Definition: RtypesCore.h:88
long Long_t
Definition: RtypesCore.h:50
double Double_t
Definition: RtypesCore.h:55
unsigned long long ULong64_t
Definition: RtypesCore.h:70
unsigned long ULong_t
Definition: RtypesCore.h:51
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
Bool_t IsCreator(UInt_t flags)
Definition: TCallContext.h:65
const Bool_t kTRUE
Definition: RtypesCore.h:87
static ECallFlags sMemoryPolicy
Definition: TCallContext.h:49