58 virtual void read(std::string& result);
59 virtual void read(
char& result);
60 virtual void read(
int& result);
61 virtual void read(
unsigned int& result);
62 virtual void read(
short int& result);
63 virtual void read(
unsigned short int& result);
64 virtual void read(
long int& result);
65 virtual void read(
unsigned long int& result);
66 virtual void read(
long long int& result);
67 virtual void read(
float& result);
68 virtual void read(
double& result);
69 virtual void read(
bool& result);
128 void open(
const std::string& p);
131 std::string
str()
const;
141 std::istringstream f;
174 void open(
const std::string& p);
222 virtual void write(
const std::string& output);
223 virtual void write(
const char* output);
224 virtual void write(
const char& output);
225 virtual void write(
const int& output);
226 virtual void write(
const unsigned int& output);
227 virtual void write(
const short int& output);
228 virtual void write(
const unsigned short int& output);
229 virtual void write(
const long int& output);
230 virtual void write(
const unsigned long int& output);
231 virtual void write(
const long long int& output);
232 virtual void write(
const float& output);
233 virtual void write(
const double& output);
234 virtual void write(
const bool& output);
242 template<
typename T>
290 void open(
const std::string& s);
296 std::string
str()
const;
306 std::ostringstream f;
344 void open(
const std::string& p);
397 virtual void readArray(
char* output,
size_t nbytes,
size_t nmemb);
411 virtual void readDesc(std::string& result);
415 virtual void read(std::string& result,
size_t nbytes);
417 virtual void read(
char& result);
418 virtual void read(
int& result);
419 virtual void read(
unsigned int& result);
420 virtual void read(
short int& result);
421 virtual void read(
unsigned short int& result);
422 virtual void read(
long int& result);
423 virtual void read(
unsigned long int& result);
424 virtual void read(
long long int& result);
425 virtual void read(
float& result);
426 virtual void read(
double& result);
427 virtual void read(
bool& result);
470 template<
typename T>
536 for(
int i=0; i < d.
size(); ++i)
557 for(
int i=0; i < num; ++i)
578 for(
int i=0; i < num2; ++i)
579 for(
int j=0; j < num1; ++j)
606 for(
int i=0; i < d.
size1(); ++i)
607 for(
int j=0; j < d.
size2(); ++j)
639 for(
int i=0; i < d.
size1(); ++i)
641 for(
int j=0; j < d.
size2(); ++j)
643 for(
int k=0; k < d.
size3(); ++k)
645 read(bin, d[k][j][i]);
679 for(
int i=0; i < d.
size1(); ++i)
681 for(
int j=0; j < d.
size2(); ++j)
683 for(
int k=0; k < d.
size3(); ++k)
685 for(
int l=0; l < d.
size4(); ++l)
687 read(bin, d[l][k][j][i]);
724 for(
int i=0; i < d.
size1(); ++i)
726 for(
int j=0; j < d.
size2(); ++j)
728 for(
int k=0; k < d.
size3(); ++k)
730 for(
int l=0; l < d.
size4(); ++l)
732 for(
int m=0; m < d.
size5(); ++m)
734 read(bin, d[m][l][k][j][i]);
753 for(
int i=0; i < d.
numElem(); ++i)
777 for(
int i=0; i < d.size(); ++i)
802 for(
int i=0; i < n; ++i)
831 for(
int i=1; i <= d.
size(); ++i)
847 template<
typename K,
typename V>
856 for(
int i=0; i < n; ++i)
864 d.insert(std::make_pair(key,val));
880 template<
typename T1,
typename T2>
890 d = std::make_pair(f,s);
916 void open(
const std::string& s);
919 std::string
str()
const;
937 std::istringstream f;
977 void open(
const std::string& p);
1041 virtual void writeArray(
const char* output,
size_t nbytes,
size_t nmemb);
1046 virtual void writeDesc(
const std::string& output);
1051 virtual void write(
const std::string& output);
1055 virtual void write(
const char* output);
1056 virtual void write(
const char& output);
1057 virtual void write(
const int& output);
1058 virtual void write(
const unsigned int& output);
1059 virtual void write(
const short int& output);
1060 virtual void write(
const unsigned short int& output);
1061 virtual void write(
const long int& output);
1062 virtual void write(
const unsigned long int& output);
1063 virtual void write(
const long long int& output);
1064 virtual void write(
const float& output);
1065 virtual void write(
const double& output);
1066 virtual void write(
const bool& output);
1072 virtual bool fail();
1110 template<
typename T>
1172 for(
int i=0; i < d.
size(); ++i)
1189 for(
int i=0; i < num; ++i)
1202 for(
int i=0; i < d.
size1(); ++i)
1203 for(
int j=0; j < d.
size2(); ++j)
1205 write(bin, d[j][i]);
1221 for(
int i=0; i < d.
size1(); ++i)
1222 for(
int j=0; j < d.
size2(); ++j)
1223 for(
int k=0; k < d.
size3(); ++k)
1224 write(bin, d[k][j][i]);
1238 for(
int i=0; i < d.
size1(); ++i)
1239 for(
int j=0; j < d.
size2(); ++j)
1240 for(
int k=0; k < d.
size3(); ++k)
1241 for(
int l=0; l < d.
size4(); ++l)
1242 write(bin, d[l][k][j][i]);
1257 for(
int i=0; i < d.
size1(); ++i)
1258 for(
int j=0; j < d.
size2(); ++j)
1259 for(
int k=0; k < d.
size3(); ++k)
1260 for(
int l=0; l < d.
size4(); ++l)
1261 for(
int m=0; m < d.
size5(); ++m)
1262 write(bin, d[m][l][k][j][i]);
1273 for(
int i=0; i < d.
numElem(); ++i)
1292 for(
int i=0; i < d.size(); ++i)
1311 for(
typename std::list<T>::const_iterator p = d.begin(); p != d.end(); ++p)
1330 for(
int i=1; i <= d.
size(); ++i)
1343 template<
typename K,
typename V>
1350 for(
typename std::map<K,V>::const_iterator v = d.begin();
1354 write(bin, v->first);
1355 write(bin, v->second);
1368 template<
typename T1,
typename T2>
1372 write(bin, d.first);
1373 write(bin, d.second);
1401 void open(
const std::string& s);
1404 std::string
str()
const;
1425 std::ostringstream f;
1466 void open(
const std::string& p);
1514 virtual bool fail();
1581 void open(
const std::string& s);
1584 std::string
str()
const;
1611 std::stringstream f;
1639 explicit BinaryFileReaderWriter(
const std::string& p, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out);
1651 void open(
const std::string& p, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out);
1d array, with 1-based indices
std::string str() const
Return entire buffer as a string.
void flush()
Flushes the buffer.
std::ostream & getOstream()
Get the internal output stream.
void clear()
Clear the buffer.
void open(const std::string &s)
Construct from a string.
std::string strPrimaryNode() const
Return entire buffer as a string.
~BinaryBufferReaderWriter()
Closes the buffer.
std::istream & getIstream()
Get the internal input stream.
QDPUtil::n_uint32_t & internalChecksum()
Get the current checksum to modify.
BinaryBufferReaderWriter()
std::iostream & getIOstream()
Get the internal inpu/output stream.
QDPUtil::n_uint32_t & internalChecksum()
Get the current checksum to modify.
std::string str() const
Return entire buffer as a string.
std::string strPrimaryNode() const
Return entire buffer as a string.
std::istream & getIstream()
Get the internal input stream.
void clear()
Clear the buffer.
~BinaryBufferReader()
Closes the buffer.
void open(const std::string &s)
Construct from a string.
std::ostream & getOstream()
Get the internal output stream.
~BinaryBufferWriter()
Closes the buffer.
void open(const std::string &s)
Construct from a string.
void clear()
Clear the buffer.
std::string str() const
Return entire buffer as a string.
void flush()
Flushes the buffer.
std::string strPrimaryNode() const
Return entire buffer as a string.
QDPUtil::n_uint32_t & internalChecksum()
Get the current checksum to modify.
void close()
Closes the last file opened.
void open(const std::string &p, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out)
Opens a file for reading.
std::istream & getIstream()
Get the internal input stream.
std::ostream & getOstream()
Get the internal output stream.
std::iostream & getIOstream()
Get the internal inpu/output stream.
~BinaryFileReaderWriter()
bool is_open()
Queries whether the file is open.
QDPUtil::n_uint32_t & internalChecksum()
Get the current checksum to modify.
void flush()
Flushes the buffer.
std::istream & getIstream()
Get the internal input stream.
bool is_open()
Queries whether the file is open.
QDPUtil::n_uint32_t & internalChecksum()
Get the current checksum to modify.
void open(const std::string &p)
Opens a file for reading.
void close()
Closes the last file opened.
QDPUtil::n_uint32_t & internalChecksum()
Get the current checksum to modify.
bool is_open()
Queries whether the file is open.
void close()
Closes the last file opened.
void flush()
Flushes the buffer.
void open(const std::string &p)
std::ostream & getOstream()
Get the internal output stream.
Binary input/output base class.
virtual QDPUtil::n_uint32_t & internalChecksum()=0
Get the current checksum to modify.
std::iostream::off_type off_type
virtual std::iostream & getIOstream()=0
Get the internal input/output stream.
virtual pos_type currentPosition()
Current position.
virtual void resetChecksum()
Reset the current checksum.
virtual ~BinaryReaderWriter()
virtual void seek(pos_type off)
Set the current position.
virtual bool fail()
Checks status of the previous IO operation.
virtual void rewind()
Rewind object to the beginning.
virtual void seekBegin(off_type off)
Set the position relative from the start.
virtual void seekRelative(off_type off)
Set the position relative to the current position.
virtual std::ostream & getOstream()=0
Get the internal output stream.
std::iostream::pos_type pos_type
virtual QDPUtil::n_uint32_t getChecksum()
Get the current checksum.
virtual std::istream & getIstream()=0
Get the internal input stream.
virtual void seekEnd(off_type off)
Set the position relative from the end.
std::istream::pos_type pos_type
virtual void read(std::string &result, size_t nbytes)
Read some max number of characters - 1 upto and excluding a newline.
virtual void seek(pos_type off)
Set the current position.
virtual void readArray(char *output, size_t nbytes, size_t nmemb)
Read data on the primary node and broadcast to all nodes.
virtual void seekEnd(off_type off)
Set the position relative from the end.
virtual void rewind()
Rewind object to the beginning.
virtual void seekRelative(off_type off)
Set the position relative to the current position.
void readPrimitive(T &output)
The universal data-reader.
virtual void resetChecksum()
Reset the current checksum.
virtual QDPUtil::n_uint32_t getChecksum()
Get the current checksum.
virtual pos_type currentPosition()
Current position.
virtual QDPUtil::n_uint32_t & internalChecksum()=0
Get the current checksum to modify.
virtual void readArrayLittleEndian(char *output, size_t nbytes, size_t nmemb)
virtual bool fail()
Checks status of the previous IO operation.
virtual void seekBegin(off_type off)
Set the position relative from the start.
virtual void readArrayPrimaryNodeLittleEndian(char *output, size_t nbytes, size_t nmemb)
virtual void readDesc(std::string &result)
virtual std::istream & getIstream()=0
Get the internal input stream.
std::istream::off_type off_type
virtual void readArrayPrimaryNode(char *output, size_t nbytes, size_t nmemb)
Read data on the primary node only.
Binary writer base class.
virtual void writeArrayPrimaryNode(const char *output, size_t nbytes, size_t nmemb)
Write data on the primary node only.
virtual void writeDesc(const std::string &output)
Writes a fixed length of characters like an array.
virtual void rewind()
Rewind object to the beginning.
BinaryWriter()
Default constructor.
virtual void flush()=0
Flushes the buffer.
void writePrimitive(const T &output)
The universal data-writer.
virtual void writeArray(const char *output, size_t nbytes, size_t nmemb)
Write data from the primary node.
virtual pos_type currentPosition()
Current position.
virtual QDPUtil::n_uint32_t & internalChecksum()=0
Get the current checksum to modify.
virtual std::ostream & getOstream()=0
Get the internal output stream.
virtual void seekBegin(off_type off)
Set the position relative from the start.
std::ostream::pos_type pos_type
virtual bool fail()
Checks status of the previous IO operation.
virtual void seek(pos_type off)
Set the current position.
virtual void write(const std::string &output)
std::ostream::off_type off_type
virtual void seekRelative(off_type off)
Set the position relative to the current position.
virtual QDPUtil::n_uint32_t getChecksum()
Get the current checksum.
virtual void resetChecksum()
Reset the current checksum.
virtual void seekEnd(off_type off)
Set the position relative from the end.
std::string strPrimaryNode() const
Return entire buffer as a string.
~TextBufferReader()
Shutdown the buffer.
std::istream & getIstream()
Get the internal input stream.
void open(const std::string &p)
Opens a buffer for reading.
std::string str() const
Return entire buffer as a string.
void flush()
Flushes the buffer.
std::string strPrimaryNode() const
Return entire buffer as a string.
~TextBufferWriter()
Shutdown the buffer.
std::string str() const
Return entire buffer as a string.
std::ostream & getOstream()
Get the internal output stream.
void open(const std::string &s)
Construct from a string.
bool is_open()
Queries whether the file is open.
std::istream & getIstream()
Get the internal input stream.
void open(const std::string &p)
Opens a file for reading.
void close()
Closes the last file opened.
void flush()
Flushes the buffer.
std::ostream & getOstream()
Get the internal output stream.
void open(const std::string &p)
void close()
Closes the last file opened.
bool is_open()
Queries whether the file is open.
virtual bool fail()
Checks status of the previous IO operation.
virtual std::istream & getIstream()=0
Get the internal input stream.
virtual void read(std::string &result)
void readPrimitive(T &output)
The universal data-reader.
virtual void write(const std::string &output)
void writePrimitive(const T &output)
The universal data-writer.
virtual std::ostream & getOstream()=0
Get the internal output stream.
virtual bool fail()
Checks status of the previous IO operation.
virtual void flush()=0
Flushes the object.
Container for a multi-dimensional 1D array.
int size() const
Size of array.
void resize(int ns1)
Resize routine, call a templated resize, using *this to disambiguate.
Container for a multi-dimensional 2D array.
void resize(int ns2, int ns1)
Allocate mem for the array.
int size1() const
Size of array.
Container for a multi-dimensional 3D array.
int size1() const
Size of array.
void resize(int ns3, int ns2, int ns1)
Allocate mem for the array.
Container for a multi-dimensional 4D array.
int size1() const
Size of array.
void resize(int ns4, int ns3, int ns2, int ns1)
Allocate mem for the array.
Container for a multi-dimensional 5D array.
int size1() const
Size of array.
void resize(int ns5, int ns4, int ns3, int ns2, int ns1)
Allocate mem for the array.
Container for a generic N dimensional array.
void resize(const multi1d< int > &_nz)
Allocate mem for the array.
T & getElem(int off)
Return ref to an element with index flattened over indices.
int size(int i) const
Size of i-th array index. Indices run from left to right in operator().
int numElem() const
Number of elements in the array.
TextWriter & operator<<(TextWriter &txt, const std::string &output)
TextReader & operator>>(TextReader &txt, std::string &input)
void write(BinaryWriter &bin, const std::string &output)
void readDesc(BinaryReader &bin, std::string &input)
void writeDesc(BinaryWriter &bin, const std::string &output)
void read(BinaryReader &bin, std::string &input, size_t maxBytes)
Yet another random number generator.