Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

dtool/src/interrogate/parameterRemap.h

Go to the documentation of this file.
00001 // Filename: parameterRemap.h
00002 // Created by:  drose (01Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef PARAMETERREMAP_H
00020 #define PARAMETERREMAP_H
00021 
00022 #include <dtoolbase.h>
00023 
00024 #include <interrogate_interface.h>
00025 
00026 class CPPType;
00027 class CPPExpression;
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : ParameterRemap
00031 // Description : An abstract base class for a number of different
00032 //               kinds of ways to remap parameters for passing to
00033 //               wrapper functions.
00034 //
00035 //               Certain kinds of function parameters that are legal
00036 //               in C++ (for instance, passing by reference, or
00037 //               passing structures as concrete values) are not legal
00038 //               for a typical scripting language.  We map these types
00039 //               of parameters to something equivalent (for instance,
00040 //               a reference becomes a pointer).
00041 //
00042 //               For each kind of possible remapping, we define a
00043 //               class derived from ParameterRemap that defines the
00044 //               exact nature of the remap.
00045 ////////////////////////////////////////////////////////////////////
00046 class ParameterRemap {
00047 public:
00048   INLINE ParameterRemap(CPPType *orig_type);
00049   virtual ~ParameterRemap();
00050 
00051   INLINE bool is_valid() const;
00052 
00053   INLINE CPPType *get_orig_type() const;
00054   INLINE CPPType *get_new_type() const;
00055   INLINE CPPType *get_temporary_type() const;
00056   INLINE bool has_default_value() const;
00057   INLINE CPPExpression *get_default_value() const;
00058   INLINE void set_default_value(CPPExpression *expr);
00059 
00060   virtual void pass_parameter(ostream &out, const string &variable_name);
00061   virtual string prepare_return_expr(ostream &out, int indent_level,
00062                                      const string &expression);
00063   virtual string get_return_expr(const string &expression);
00064   virtual string temporary_to_return(const string &temporary);
00065   virtual bool return_value_needs_management();
00066   virtual FunctionIndex get_return_value_destructor();
00067   virtual bool return_value_should_be_simple();
00068   virtual bool new_type_is_atomic_string();
00069   virtual bool is_this();
00070 
00071 protected:
00072   bool _is_valid;
00073 
00074   CPPType *_orig_type;
00075   CPPType *_new_type;
00076   CPPType *_temporary_type;
00077   CPPExpression *_default_value;
00078 };
00079 
00080 #include "parameterRemap.I"
00081 
00082 #endif

Generated on Thu May 1 22:13:03 2003 for DTool by doxygen1.3