Panda3D

Loading...
Searching...
No Matches
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
14#include "interrogateFunctionWrapper.h"
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::
27output(ostream &out) const {
28 idf_output_string(out, _name);
29 out << _parameter_flags << " " << _type << " ";
30}
31
32/**
33 *
34 */
35 void InterrogateFunctionWrapper::Parameter::
36input(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 */
44 void InterrogateFunctionWrapper::
45 output(ostream &out) const {
46 InterrogateComponent::output(out);
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 */
59 void InterrogateFunctionWrapper::
60 input(istream &in) {
61 InterrogateComponent::input(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 */
75 void InterrogateFunctionWrapper::
76 remap_indices(const IndexRemapper &remap) {
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}
IndexRemapper
This class manages a mapping of integers to integers.
Definition indexRemapper.h:29
IndexRemapper::map_from
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...
Definition indexRemapper.cxx:61
InterrogateComponent::input
void input(std::istream &in)
Reads the data file as previously formatted by output().
Definition interrogateComponent.cxx:39
InterrogateComponent::output
void output(std::ostream &out) const
Formats the component for output to a data file.
Definition interrogateComponent.cxx:25
InterrogateFunctionWrapper::output
void output(std::ostream &out) const
Formats the InterrogateFunctionWrapper data for output to a data file.
Definition interrogateFunctionWrapper.cxx:45
InterrogateFunctionWrapper::remap_indices
void remap_indices(const IndexRemapper &remap)
Remaps all internal index numbers according to the indicated map.
Definition interrogateFunctionWrapper.cxx:76
InterrogateFunctionWrapper::input
void input(std::istream &in)
Reads the data file as previously formatted by output().
Definition interrogateFunctionWrapper.cxx:60
indexRemapper.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
interrogateFunctionWrapper.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
idf_input_string
void idf_input_string(istream &in, string &str)
Reads the given string from the input file, as previously written by output_string().
Definition interrogate_datafile.cxx:38
idf_output_string
void idf_output_string(ostream &out, const string &str, char whitespace)
Writes the indicated string to the output file.
Definition interrogate_datafile.cxx:26
interrogate_datafile.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
idf_output_vector
void idf_output_vector(std::ostream &out, const std::vector< Element > &vec)
Writes the indicated vector to the output file.
Definition interrogate_datafile.I:20
idf_input_vector
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().
Definition interrogate_datafile.I:36