library: libCore #include "TMethodCall.h"

# TMethodCall

class description - source file - inheritance tree (.pdf)

## class TMethodCall : public TObject

| Inheritance Chart:

`TObject`

<-

`TMethodCall`

        private:

          virtual void Execute(const char*, const char*, int* = 0)
          virtual void Execute(TMethod*, TObjArray*, int* = 0)

        public:

                                   TMethodCall()
                                   TMethodCall(TClass* cl, const char* method, const char* params)
                                   TMethodCall(const char* function, const char* params)
                                   TMethodCall(const TMethodCall& org)
                                   ~TMethodCall()
                              void CallDtorOnly(Bool_t set = kTRUE)
                    static TClass* Class()
                  virtual TObject* Clone(const char* newname = "") const
                              void Execute(void* object)
                              void Execute(void* object, const char* params)
                              void Execute(void* object, Long_t& retLong)
                              void Execute(void* object, const char* params, Long_t& retLong)
                              void Execute(void* object, Double_t& retDouble)
                              void Execute(void* object, const char* params, Double_t& retDouble)
                              void Execute(void* object, char** retText)
                              void Execute(void* object, const char* params, char** retText)
                              void Execute()
                              void Execute(const char* params)
                              void Execute(Long_t& retLong)
                              void Execute(const char* params, Long_t& retLong)
                              void Execute(Double_t& retDouble)
                              void Execute(const char* params, Double_t& retDouble)
                        TFunction* GetMethod()
                       const char* GetMethodName() const
                       const char* GetParams() const
                       const char* GetProto() const
                              void Init(TClass* cl, const char* method, const char* params)
                              void Init(const char* function, const char* params)
                              void InitWithPrototype(TClass* cl, const char* method, const char* proto)
                              void InitWithPrototype(const char* function, const char* proto)
                   virtual TClass* IsA() const
                            Bool_t IsValid() const
                      TMethodCall& operator=(const TMethodCall& rhs)
                              void ResetParam()
          TMethodCall::EReturnType ReturnType()
                              void SetParam(Long_t l)
                              void SetParam(Double_t d)
                              void SetParam(Long64_t ll)
                              void SetParam(ULong64_t ull)
                              void SetParamPtrs(void* paramArr, Int_t nparam = -1)
                      virtual void ShowMembers(TMemberInspector& insp, char* parent)
                      virtual void Streamer(TBuffer& b)
                              void StreamerNVirtual(TBuffer& b)

### Data Members

        private:

                      G__CallFunc* fFunc      CINT method invocation environment
                            Long_t fOffset    offset added to object pointer before method invocation
                           TClass* fClass     pointer to the class info
                        TFunction* fMetPtr    pointer to the method or function info
                           TString fMethod    method name
                           TString fParams    argument string
                           TString fProto     prototype string
                            Bool_t fDtorOnly  call only dtor and not delete when calling ~xxx
          TMethodCall::EReturnType fRetType   method return type

        public:

          static const TMethodCall::EReturnType kLong
          static const TMethodCall::EReturnType kDouble
          static const TMethodCall::EReturnType kString
          static const TMethodCall::EReturnType kOther
          static const TMethodCall::EReturnType kNone

## Class Description

     TMethodCall

     Method or function calling interface. Objects of this class contain
     the (CINT) environment to call a global function or a method for an
     object of a specific class with the desired arguments. This class is
     espicially useful when a method has to be called more times for
     different objects and/or with different arguments. If a function or
     method needs to be called only once one better uses
     TInterpreter::Execute().

TMethodCall()

     Default TMethodCall ctor. Use Init() to initialize the method call
     environment.

TMethodCall(TClass *cl, const char *method, const char *params)

     Create a method invocation environment for a specific class, method and
     parameters. The parameter string has the form: "\"aap\", 3, 4.35".
     To execute the method call TMethodCall::Execute(object,...).
     This two step method is much more efficient than calling for
     every invocation TInterpreter::Execute(...).

TMethodCall(const char *function, const char *params)

     Create a global function invocation environment. The parameter
     string has the form: "\"aap\", 3, 4,35". To execute the
     function call TMethodCall::Execute(...).
     This two step method is much more efficient than calling for
     every invocation TInterpreter::Execute(...).

TMethodCall(const TMethodCall &orig) : TObject(orig)

     Copy ctor.

~TMethodCall()

     TMethodCall dtor.

TObject* Clone(const char *) const

void Init(TClass *cl, const char *method, const char *params)

     Initialize the method invocation environment. Necessary input
     information: the class, method name and the parameter string
     of the form "\"aap\", 3, 4.35".
     To execute the method call TMethodCall::Execute(object,...).
     This two step method is much more efficient than calling for
     every invocation TInterpreter::Execute(...).

void Init(const char *function, const char *params)

     Initialize the function invocation environment. Necessary input
     information: the function name and the parameter string of
     the form "\"aap\", 3, 4.35".
     To execute the method call TMethodCall::Execute(...).
     This two step method is much more efficient than calling for
     every invocation TInterpreter::Execute(...).

void InitWithPrototype(TClass *cl, const char *method, const char *proto)

     Initialize the method invocation environment. Necessary input
     information: the class, method name and the prototype string of
     the form: "char*,int,float".
     To execute the method call TMethodCall::Execute(object,...).
     This two step method is much more efficient than calling for
     every invocation TInterpreter::Execute(...).

void InitWithPrototype(const char *function, const char *proto)

     Initialize the function invocation environment. Necessary input
     information: the function name and the prototype string of
     the form: "char*,int,float".
     To execute the method call TMethodCall::Execute(...).
     This two step method is much more efficient than calling for
     every invocation TInterpreter::Execute(...).

Bool_t IsValid() const

     Return true if the method call has been properly initialized and is
     usable.

TFunction* GetMethod()

     Returns the TMethod describing the method to be executed. This takes
     all overriding and overloading into account (call TClass::GetMethod()).
     Since finding the method is expensive the result is cached.

void Execute(void *object)

     Execute the method (with preset arguments) for the specified object.

void Execute(void *object, const char *params)

     Execute the method for the specified object and argument values.

void Execute(void *object, Long_t &retLong)

     Execute the method (with preset arguments) for the specified object.

void Execute(void *object, const char *params, Long_t &retLong)

     Execute the method for the specified object and argument values.

void Execute(void *object, Double_t &retDouble)

     Execute the method (with preset arguments) for the specified object.

void Execute(void *object, const char *params, Double_t &retDouble)

     Execute the method for the specified object and argument values.

void Execute(void *object, char **retText)

     Execute the method (with preset arguments) for the specified object.

void Execute(void *object, const char *params, char **retText)

     Execute the method for the specified object and argument values.

void SetParamPtrs(void *paramArr, Int_t nparam)

     ParamArr is an array containing the function argument values.
     If nparam = -1 then paramArr must contain values for all function
     arguments, otherwise Nargs-NargsOpt <= nparam <= Nargs, where
     Nargs is the number of all arguments and NargsOpt is the number
     of default arguments.

void ResetParam()

     Reset parameter list. To be used before the first call the SetParam().

void SetParam(Long_t l)

     Set long method parameter.

void SetParam(Double_t d)

     Set double method parameter.

void SetParam(Long64_t ll)

     Set long long method parameter.

void SetParam(ULong64_t ull)

     Set unsigned long long method parameter.

### Inline Functions

                        TMethodCall& operator=(const TMethodCall& rhs)
                                void CallDtorOnly(Bool_t set = kTRUE)
                         const char* GetMethodName() const
                         const char* GetParams() const
                         const char* GetProto() const
            TMethodCall::EReturnType ReturnType()
                                void Execute(void* object, char** retText)
                                void Execute(void* object, const char* params, char** retText)
                                void Execute()
                                void Execute(const char* params)
                                void Execute(Long_t& retLong)
                                void Execute(const char* params, Long_t& retLong)
                                void Execute(Double_t& retDouble)
                                void Execute(const char* params, Double_t& retDouble)
                             TClass* Class()
                             TClass* IsA() const
                                void ShowMembers(TMemberInspector& insp, char* parent)
                                void Streamer(TBuffer& b)
                                void StreamerNVirtual(TBuffer& b)

Author: Fons Rademakers 13/06/96
Last update: root/meta:$Name: $:$Id: TMethodCall.cxx,v 1.21 2005/06/22 20:18:11 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *