Panda3D
 All Classes Functions Variables Enumerations
interrogateFunction.cxx
1 // Filename: interrogateFunction.cxx
2 // Created by: drose (01Aug00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "interrogateFunction.h"
16 #include "indexRemapper.h"
17 #include "interrogate_datafile.h"
18 #include "interrogateDatabase.h"
19 
20 ////////////////////////////////////////////////////////////////////
21 // Function: InterrogateFunction::Constructor
22 // Access: Public
23 // Description:
24 ////////////////////////////////////////////////////////////////////
25 InterrogateFunction::
26 InterrogateFunction(InterrogateModuleDef *def) :
28 {
29  _flags = 0;
30  _class = 0;
31  _instances = (Instances *)NULL;
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: InterrogateFunction::Copy Constructor
36 // Access: Public
37 // Description:
38 ////////////////////////////////////////////////////////////////////
39 InterrogateFunction::
40 InterrogateFunction(const InterrogateFunction &copy) {
41  (*this) = copy;
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: InterrogateFunction::Copy Assignment Operator
46 // Access: Public
47 // Description:
48 ////////////////////////////////////////////////////////////////////
49 void InterrogateFunction::
50 operator = (const InterrogateFunction &copy) {
51  InterrogateComponent::operator = (copy);
52  _flags = copy._flags;
53  _scoped_name = copy._scoped_name;
54  _comment = copy._comment;
55  _prototype = copy._prototype;
56  _class = copy._class;
57  _c_wrappers = copy._c_wrappers;
58  _python_wrappers = copy._python_wrappers;
59 
60  _instances = copy._instances;
61  _expression = copy._expression;
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: InterrogateFunction::output
66 // Access: Public
67 // Description: Formats the InterrogateFunction data for output to a data
68 // file.
69 ////////////////////////////////////////////////////////////////////
71 output(ostream &out) const {
73  out << _flags << " "
74  << _class << " ";
75  idf_output_string(out, _scoped_name);
76  idf_output_vector(out, _c_wrappers);
77  idf_output_vector(out, _python_wrappers);
78  idf_output_string(out, _comment, '\n');
79  idf_output_string(out, _prototype, '\n');
80 }
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function: InterrogateFunction::input
84 // Access: Public
85 // Description: Reads the data file as previously formatted by
86 // output().
87 ////////////////////////////////////////////////////////////////////
89 input(istream &in) {
91  in >> _flags >> _class;
92  idf_input_string(in, _scoped_name);
93  idf_input_vector(in, _c_wrappers);
94  idf_input_vector(in, _python_wrappers);
95  idf_input_string(in, _comment);
96 
98  idf_input_string(in, _prototype);
99  }
100 }
101 
102 ////////////////////////////////////////////////////////////////////
103 // Function: InterrogateFunction::remap_indices
104 // Access: Public
105 // Description: Remaps all internal index numbers according to the
106 // indicated map. This called from
107 // InterrogateDatabase::remap_indices().
108 ////////////////////////////////////////////////////////////////////
111  _class = remap.map_from(_class);
112  Wrappers::iterator wi;
113  for (wi = _c_wrappers.begin(); wi != _c_wrappers.end(); ++wi) {
114  (*wi) = remap.map_from(*wi);
115  }
116  for (wi = _python_wrappers.begin(); wi != _python_wrappers.end(); ++wi) {
117  (*wi) = remap.map_from(*wi);
118  }
119 }
static int get_file_minor_version()
Returns the minor version number of the interrogate database file currently being read...
This class manages a mapping of integers to integers.
Definition: indexRemapper.h:33
void input(istream &in)
Reads the data file as previously formatted by output().
void remap_indices(const IndexRemapper &remap)
Remaps all internal index numbers according to the indicated map.
An internal representation of a function.
void input(istream &in)
Reads the data file as previously formatted by output().
The base class for things that are part of the interrogate database.
void output(ostream &out) const
Formats the InterrogateFunction data for output to a data file.
int map_from(int from) const
Returns the integer that the given &#39;from&#39; integer had been set to map to, or the same integer if noth...
void output(ostream &out) const
Formats the component for output to a data file.