Panda3D
interrogateFunctionWrapper.cxx
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 interrogateFunctionWrapper.cxx
10  * @author drose
11  * @date 2000-08-06
12  */
13 
15 #include "indexRemapper.h"
16 #include "interrogate_datafile.h"
17 
18 #include <algorithm>
19 
20 using std::istream;
21 using std::ostream;
22 
23 /**
24  *
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  *
34  */
35 void InterrogateFunctionWrapper::Parameter::
36 input(istream &in) {
37  idf_input_string(in, _name);
38  in >> _parameter_flags >> _type;
39 }
40 
41 /**
42  * Formats the InterrogateFunctionWrapper data for output to a data file.
43  */
45 output(ostream &out) const {
47  out << _flags << " "
48  << _function << " "
49  << _return_type << " "
50  << _return_value_destructor << " ";
51  idf_output_string(out, _unique_name);
52  idf_output_string(out, _comment);
53  idf_output_vector(out, _parameters);
54 }
55 
56 /**
57  * Reads the data file as previously formatted by output().
58  */
60 input(istream &in) {
62  in >> _flags
63  >> _function
64  >> _return_type
65  >> _return_value_destructor;
66  idf_input_string(in, _unique_name);
67  idf_input_string(in, _comment);
68  idf_input_vector(in, _parameters);
69 }
70 
71 /**
72  * Remaps all internal index numbers according to the indicated map. This
73  * called from InterrogateDatabase::remap_indices().
74  */
77  _return_value_destructor = remap.map_from(_return_value_destructor);
78  _return_type = remap.map_from(_return_type);
79 
80  Parameters::iterator pi;
81  for (pi = _parameters.begin(); pi != _parameters.end(); ++pi) {
82  (*pi)._type = remap.map_from((*pi)._type);
83  }
84 }
void idf_input_vector(std::istream &in, std::vector< Element > &vec)
Reads the given vector from the input file, as previously written by output_string().
This class manages a mapping of integers to integers.
Definition: indexRemapper.h:29
void idf_output_string(ostream &out, const string &str, char whitespace)
Writes the indicated string to the output file.
void idf_input_string(istream &in, string &str)
Reads the given string from the input file, as previously written by output_string().
void output(std::ostream &out) const
Formats the component for output to a data file.
void output(std::ostream &out) const
Formats the InterrogateFunctionWrapper data for output to a data file.
void input(std::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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void input(std::istream &in)
Reads the data file as previously formatted by output().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void idf_output_vector(std::ostream &out, const std::vector< Element > &vec)
Writes the indicated vector to the output file.
int map_from(int from) const
Returns the integer that the given 'from' integer had been set to map to, or the same integer if noth...