Panda3D
interrogateFunctionWrapper.cxx
1 // Filename: interrogateFunctionWrapper.cxx
2 // Created by: drose (06Aug00)
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 "interrogateFunctionWrapper.h"
16 #include "indexRemapper.h"
17 #include "interrogate_datafile.h"
18 
19 #include <algorithm>
20 
21 ////////////////////////////////////////////////////////////////////
22 // Function: InterrogateFunctionWrapper::Parameter::output
23 // Access: Public
24 // Description:
25 ////////////////////////////////////////////////////////////////////
26 void InterrogateFunctionWrapper::Parameter::
27 output(ostream &out) const {
28  idf_output_string(out, _name);
29  out << _parameter_flags << " " << _type << " ";
30 }
31 
32 ////////////////////////////////////////////////////////////////////
33 // Function: InterrogateFunctionWrapper::Parameter::input
34 // Access: Public
35 // Description:
36 ////////////////////////////////////////////////////////////////////
37 void InterrogateFunctionWrapper::Parameter::
38 input(istream &in) {
39  idf_input_string(in, _name);
40  in >> _parameter_flags >> _type;
41 }
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: InterrogateFunctionWrapper::output
45 // Access: Public
46 // Description: Formats the InterrogateFunctionWrapper data for
47 // output to a data file.
48 ////////////////////////////////////////////////////////////////////
50 output(ostream &out) const {
52  out << _flags << " "
53  << _function << " "
54  << _return_type << " "
55  << _return_value_destructor << " ";
56  idf_output_string(out, _unique_name);
57  idf_output_string(out, _comment);
58  idf_output_vector(out, _parameters);
59 }
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: InterrogateFunctionWrapper::input
63 // Access: Public
64 // Description: Reads the data file as previously formatted by
65 // output().
66 ////////////////////////////////////////////////////////////////////
68 input(istream &in) {
70  in >> _flags
71  >> _function
72  >> _return_type
73  >> _return_value_destructor;
74  idf_input_string(in, _unique_name);
75  idf_input_string(in, _comment);
76  idf_input_vector(in, _parameters);
77 }
78 
79 ////////////////////////////////////////////////////////////////////
80 // Function: InterrogateFunctionWrapper::remap_indices
81 // Access: Public
82 // Description: Remaps all internal index numbers according to the
83 // indicated map. This called from
84 // InterrogateDatabase::remap_indices().
85 ////////////////////////////////////////////////////////////////////
88  _return_value_destructor = remap.map_from(_return_value_destructor);
89  _return_type = remap.map_from(_return_type);
90 
91  Parameters::iterator pi;
92  for (pi = _parameters.begin(); pi != _parameters.end(); ++pi) {
93  (*pi)._type = remap.map_from((*pi)._type);
94  }
95 }
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 output(ostream &out) const
Formats the component for output to a data file.
void output(ostream &out) const
Formats the InterrogateFunctionWrapper data for output to a data file.
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.
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...