File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,11 +70,22 @@ class Xdr
7070public:
7171
7272 /* *
73- * Constructor . Takes the filename and the mode.
73+ * File-based constructor . Takes the filename and the mode.
7474 * Valid modes are ENCODE, DECODE, READ, and WRITE.
7575 */
7676 Xdr (std::string name=" " , const XdrMODE m=UNKNOWN);
7777
78+ /* *
79+ * Output stream based constructor.
80+ * Assumes mode WRITE.
81+ */
82+ Xdr (std::ostream & stream);
83+ /* *
84+ * Input stream based constructor.
85+ * Assumes mode READ.
86+ */
87+ Xdr (std::istream & stream);
88+
7889 /* *
7990 * Destructor. Closes the file if it is open.
8091 */
Original file line number Diff line number Diff line change @@ -122,6 +122,42 @@ Xdr::Xdr (std::string name,
122122
123123
124124
125+ Xdr ::Xdr (std ::ostream & stream ) :
126+ mode (WRITE ),
127+ file_name (),
128+ #ifdef LIBMESH_HAVE_XDR
129+ fp (nullptr ),
130+ #endif
131+ in (),
132+ out (std ::make_unique < std ::ostream > (stream .rdbuf ())),
133+ comm_len (xdr_MAX_STRING_LENGTH ),
134+ gzipped_file (false),
135+ bzipped_file (false),
136+ xzipped_file (false),
137+ version_number (LIBMESH_VERSION_ID (LIBMESH_MAJOR_VERSION , LIBMESH_MINOR_VERSION , LIBMESH_MICRO_VERSION ))
138+ {
139+ }
140+
141+
142+
143+ Xdr ::Xdr (std ::istream & stream ) :
144+ mode (READ ),
145+ file_name (),
146+ #ifdef LIBMESH_HAVE_XDR
147+ fp (nullptr ),
148+ #endif
149+ in (std ::make_unique < std ::istream > (stream .rdbuf ())),
150+ out (),
151+ comm_len (xdr_MAX_STRING_LENGTH ),
152+ gzipped_file (false),
153+ bzipped_file (false),
154+ xzipped_file (false),
155+ version_number (LIBMESH_VERSION_ID (LIBMESH_MAJOR_VERSION , LIBMESH_MINOR_VERSION , LIBMESH_MICRO_VERSION ))
156+ {
157+ }
158+
159+
160+
125161Xdr ::~Xdr ()
126162{
127163 this -> close ();
You can’t perform that action at this time.
0 commit comments