8 #include "XdrFileOArchive.h" 31 filePtr_ = fopen(filename.c_str(),
"wb+");
32 if (filePtr_ == NULL) {
33 std::string msg =
"Failure to open C file: ";
34 msg += filename.c_str();
37 xdrstdio_create(&xdr_, filePtr_, XDR_ENCODE);
52 xdrstdio_create(&xdr_, filePtr_, XDR_ENCODE);
60 const unsigned int version)
62 static char* temp = 0;
63 static unsigned int tempsize = 0;
65 unsigned int size = data.size() + 1;
66 xdr_u_int(ar.
xdrPtr(), &size);
69 if (size > tempsize) {
72 temp =
new char[tempsize];
76 if (size > tempsize) {
79 temp =
new char[tempsize];
81 strcpy(temp, data.c_str());
82 xdr_string(ar.
xdrPtr(), &temp, size);
FILE * file()
Get the underlying ifstream by reference.
virtual ~XdrFileOArchive()
Destructor.
Saving / output archive for binary XDR file.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Utility classes for scientific computation.
void init(FILE *file)
Associate with an open file and initialize.
XDR * xdrPtr()
Get a pointer to the enclosed XDR object.
XdrFileOArchive()
Constructor.