My Project
|
Read a binary data file. More...
#include <NeutronReadBinaryData.hh>
Public Member Functions | |
NeutronReadBinaryData (string _SwapFlag="None") | |
vector< T > | ReadData (string Filename) |
void | PrintData (string FileName) |
vector< UInt4 > | PutUInt4Vector (string Filename) |
vector< Double > | PutDoubleVector (string Filename) |
PyObject * | PutDoubleList (string FileName) |
PyObject * | PutUInt4List (string FileName) |
UInt8 | ReadData (string FileName, T *&array) |
Read a binary data file.
This template class reads a binary data file, and provide its data as a array and vector. The dimensions of the reading binary file is not required to read, it is obtained from the data type and the size of the target file.
Because this template is designed to read the whole of file, if the size of target file is large, the reading procedure is rather slow. If you want to read the section of the target file, you can use "NeutronReadBinaryDataSection".
NeutronReadBinaryData< T >::NeutronReadBinaryData | ( | string | _SwapFlag = "None" | ) |
The mean of the argument is swap-flag. The argument should be selected from "NoSwap", "Swap", "big" and "little", and its default value is "None".
If you selected "Swap", the byte-order of the target binary file is changed in this class. When the argument is "NoSwap", the byte-order of it is not changed.
If the byte-order of the target file is "little-endian", you must set the argument as "little". The architecture of the computer running "Manyo-Lib" is obtained in this constructor, and the argument is compared with the architecture. This method will decide whether the byte-order should be changed or not.
When the byte-order of the target file is "big-endian", you must set the argument as "big".
void NeutronReadBinaryData< T >::PrintData | ( | string | FileName | ) |
The content of "FileName" is dumped to the standard-output.
PyObject * NeutronReadBinaryData< T >::PutDoubleList | ( | string | FileName | ) |
Returns a python list object. The content of the return object is the same as the PutDoubleVector(string).
vector< Double > NeutronReadBinaryData< T >::PutDoubleVector | ( | string | Filename | ) |
Returns a vector<Double>. The content of the vector is the same as the vector returned by the method of "vector<T> ReadData(Char*)".
PyObject * NeutronReadBinaryData< T >::PutUInt4List | ( | string | FileName | ) |
Returns a python list object. The content of the return object is the same as the PutUInt4Vector(string).
vector< UInt4 > NeutronReadBinaryData< T >::PutUInt4Vector | ( | string | Filename | ) |
Returns a vector<UInt4>. The content of the vector is the same as the vector returned by the method of "vector<T> ReadData(Char*)".
vector< T > NeutronReadBinaryData< T >::ReadData | ( | string | Filename | ) |
The "FileName" is the name of the target binary file. The data length of "FileName" is checked and obtained automatically using the data type of "T" and the file size.
UInt8 NeutronReadBinaryData< T >::ReadData | ( | string | FileName, |
T *& | array | ||
) |
The "FileName" is the name of the target binary file. The data length of "FileName" is checked automatically using the data type of "T" and its file size. The second argument is the pointer of the array whose value should be NULL. The pointer will be assigned to the pointer of the array obtained and produced by this method. The returned value of this method is the size of the array.