Panda3D
Loading...
Searching...
No Matches
interrogateFunction.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file interrogateFunction.h
10 * @author drose
11 * @date 2000-08-01
12 */
13
14#ifndef INTERROGATEFUNCTION_H
15#define INTERROGATEFUNCTION_H
16
17#include "dtoolbase.h"
18
20
21#include <vector>
22#include <map>
23
24class IndexRemapper;
25class CPPInstance;
26
27/**
28 * An internal representation of a function.
29 */
30class EXPCL_INTERROGATEDB InterrogateFunction : public InterrogateComponent {
31public:
34 void operator = (const InterrogateFunction &copy);
35
36 INLINE bool is_global() const;
37 INLINE bool is_virtual() const;
38 INLINE bool is_method() const;
39 INLINE bool is_unary_op() const;
40 INLINE bool is_operator_typecast() const;
41 INLINE bool is_constructor() const;
42 INLINE bool is_destructor() const;
43 INLINE TypeIndex get_class() const;
44
45 INLINE bool has_scoped_name() const;
46 INLINE const std::string &get_scoped_name() const;
47
48 INLINE bool has_comment() const;
49 INLINE const std::string &get_comment() const;
50
51 INLINE bool has_prototype() const;
52 INLINE const std::string &get_prototype() const;
53
54 INLINE int number_of_c_wrappers() const;
55 INLINE FunctionWrapperIndex get_c_wrapper(int n) const;
56
57 INLINE int number_of_python_wrappers() const;
58 INLINE FunctionWrapperIndex get_python_wrapper(int n) const;
59
60 void output(std::ostream &out) const;
61 void input(std::istream &in);
62
63 void remap_indices(const IndexRemapper &remap);
64
65private:
66 enum Flags {
67 F_global = 0x0001,
68 F_virtual = 0x0002,
69 F_method = 0x0004,
70 F_typecast = 0x0008,
71 F_getter = 0x0010,
72 F_setter = 0x0020,
73 F_unary_op = 0x0040,
74 F_operator_typecast = 0x0080,
75 F_constructor = 0x0100,
76 F_destructor = 0x0200,
77 };
78
79 int _flags;
80 std::string _scoped_name;
81 std::string _comment;
82 std::string _prototype;
83 TypeIndex _class;
84
85 typedef std::vector<FunctionWrapperIndex> Wrappers;
86 Wrappers _c_wrappers;
87 Wrappers _python_wrappers;
88
89public:
90 // The rest of the members in this class aren't part of the public interface
91 // to interrogate, but are used internally as the interrogate database is
92 // built. They are valid only during the session of interrogate that
93 // generates the database, and will not be filled in when the database is
94 // reloaded from disk.
95
96 // This must be a pointer, rather than a concrete map, so we don't risk
97 // trying to create a map in one DLL and access it in another. Silly
98 // Windows.
99 typedef std::map<std::string, CPPInstance *> Instances;
100 Instances *_instances;
101 std::string _expression;
102
103 friend class InterrogateBuilder;
104 friend class InterrogateDatabase;
105 friend class InterfaceMakerC;
106 friend class InterfaceMakerPythonSimple;
107 friend class InterfaceMakerPythonNative;
108 friend class FunctionRemap;
109};
110
111INLINE std::ostream &operator << (std::ostream &out, const InterrogateFunction &function);
112INLINE std::istream &operator >> (std::istream &in, InterrogateFunction &function);
113
114#include "interrogateFunction.I"
115
116#endif
This class manages a mapping of integers to integers.
The base class for things that are part of the interrogate database.
void input(std::istream &in)
Reads the data file as previously formatted by output().
void output(std::ostream &out) const
Formats the component for output to a data file.
This stores all of the interrogate data and handles reading the data from a disk file when necessary.
An internal representation of a function.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.