// Filename: interrogate_datafile.I // Created by: drose (09Aug00) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved // // All use of this software is subject to the terms of the Panda 3d // Software license. You should have received a copy of this license // along with this source code; you will also find a current copy of // the license at http://etc.cmu.edu/panda3d/docs/license/ . // // To contact the maintainers of this program write to // panda3d-general@lists.sourceforge.net . // //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// // Function: idf_output_vector // Description: Writes the indicated vector to the output file. Each // component is written using its normal ostream output // operator. //////////////////////////////////////////////////////////////////// template void idf_output_vector(ostream &out, const vector &vec) { out << vec.size() << " "; TYPENAME vector::const_iterator vi; for (vi = vec.begin(); vi != vec.end(); ++vi) { out << (*vi) << " "; } } //////////////////////////////////////////////////////////////////// // Function: idf_input_vector // Description: Reads the given vector from the input file, as // previously written by output_string(). Each // component is read using its normal istream input // operator. //////////////////////////////////////////////////////////////////// template void idf_input_vector(istream &in, vector &vec) { int length; in >> length; if (in.fail()) { return; } vec.clear(); vec.reserve(length); while (length > 0) { Element elem; in >> elem; vec.push_back(elem); length--; } }