Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 09:13:09

0001 // Author: Enric Tejedor CERN  08/2019
0002 // Original PyROOT code by Wim Lavrijsen, LBL
0003 //
0004 // /*************************************************************************
0005 //  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.               *
0006 //  * All rights reserved.                                                  *
0007 //  *                                                                       *
0008 //  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009 //  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010 //  *************************************************************************/
0011 
0012 #ifndef ROOT_TPyArg
0013 #define ROOT_TPyArg
0014 
0015 // ROOT
0016 #include "Rtypes.h"
0017 
0018 // Python
0019 struct _object;
0020 typedef _object PyObject;
0021 
0022 // Standard
0023 #include <vector>
0024 
0025 /// Morphing argument type from evaluating python expressions.
0026 class TPyArg {
0027 public:
0028    // converting constructors
0029    TPyArg(PyObject *);
0030    TPyArg(Int_t);
0031    TPyArg(Long_t);
0032    TPyArg(Double_t);
0033    TPyArg(const char *);
0034 
0035    TPyArg(const TPyArg &);
0036    TPyArg &operator=(const TPyArg &);
0037    virtual ~TPyArg();
0038 
0039    // "extractor"
0040    operator PyObject *() const;
0041 
0042    // constructor and generic dispatch
0043    static void CallConstructor(PyObject *&pyself, PyObject *pyclass, const std::vector<TPyArg> &args);
0044    static void CallConstructor(PyObject *&pyself, PyObject *pyclass); // default ctor
0045    static PyObject *CallMethod(PyObject *pymeth, const std::vector<TPyArg> &args);
0046    static void CallDestructor(PyObject *&pyself, PyObject *pymeth, const std::vector<TPyArg> &args);
0047    static void CallDestructor(PyObject *&pyself);
0048 
0049    ClassDef(TPyArg, 1) // Python morphing argument type
0050 
0051 private:
0052    mutable PyObject *fPyObject; //! converted C++ value as python object
0053 };
0054 
0055 #endif