|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
Loads an array of T from a text file in the constructor. More...
#include <ArrayIO.hh>
Public Types | |
| enum | STATUS { LOADED =0 , DEFAULT , UNREADABLE , UNDEFINED } |
| Load status reported by status(). More... | |
| typedef psalg::types::shape_t | shape_t |
| Alias for psalg::types::shape_t (uint32_t). | |
| typedef psalg::types::size_t | size_t |
| Alias for psalg::types::size_t (uint32_t). | |
Public Member Functions | |
| ArrayIO (const std::string &fname, void *buf=0) | |
| Read fname right away. | |
| ~ArrayIO () | |
| Destructor; only logs a trace message. | |
| const STATUS | status () const |
| Return the load status. | |
| const std::string | str_status () const |
| Return the status name ("LOADED", "DEFAULT", "UNREADABLE" or "UNDEFINED"). | |
| const std::string & | dtype_name () const |
| Return the DATATYPE value read from the file (empty if there was none). | |
| NDArray< T > & | ndarray () |
| Return the loaded array. | |
Public Attributes | |
| std::string | STRAUS [4] ={"LOADED", "DEFAULT", "UNREADABLE", "UNDEFINED"} |
| Names of the STATUS values, used by str_status(). | |
Loads an array of T from a text file in the constructor.
Lines starting with '#' are metadata ("SHAPE (d0,d1,...)" sets the shape, "DATATYPE x" the type name); the first other non-empty line and everything after it are read as whitespace-separated values. Instantiated in ArrayIO.cc for int, unsigned, unsigned short and float.
| typedef psalg::types::shape_t psalg::ArrayIO< T >::shape_t |
Alias for psalg::types::shape_t (uint32_t).
| typedef psalg::types::size_t psalg::ArrayIO< T >::size_t |
Alias for psalg::types::size_t (uint32_t).
| enum psalg::ArrayIO::STATUS |
Load status reported by status().
| psalg::ArrayIO< T >::ArrayIO | ( | const std::string & | fname, |
| void * | buf = 0 |
||
| ) |
Read fname right away.
Values go into buf if it is non-null, otherwise into a buffer the NDArray allocates. Logs a warning if the file cannot be opened (status UNREADABLE) or if the number of values differs from the shape size; extra values are still written past the end of the buffer.
| psalg::ArrayIO< T >::~ArrayIO | ( | ) |
Destructor; only logs a trace message.
|
inline |
Return the DATATYPE value read from the file (empty if there was none).
|
inline |
Return the loaded array.
|
inline |
Return the load status.
|
inline |
Return the status name ("LOADED", "DEFAULT", "UNREADABLE" or "UNDEFINED").
| std::string psalg::ArrayIO< T >::STRAUS[4] ={"LOADED", "DEFAULT", "UNREADABLE", "UNDEFINED"} |
Names of the STATUS values, used by str_status().