casacore
|
#include <STLIO.h>
Public Member Functions | |
template<class ITER > | |
void | showDataIter (ostream &, ITER begin, const ITER &end, const char *separator=",", const char *prefix="[", const char *postfix="]") |
Write out an ascii representation of any container using the given begin and end iterator. More... | |
template<class CONTAINER > | |
void | showContainer (ostream &os, const CONTAINER &c, const char *separator=",", const char *prefix="[", const char *postfix="]") |
Write out an ascii representation of any container having a forward iterator. More... | |
template<typename T , typename U > | |
ostream & | operator<< (ostream &os, const std::pair< T, U > &p) |
Write a std::pair. More... | |
template<typename T > | |
ostream & | operator<< (ostream &os, const std::vector< T > &v) |
Write the contents of a vector enclosed in square brackets, using a comma as separator. More... | |
template<typename T > | |
ostream & | operator<< (ostream &os, const std::set< T > &v) |
Write the contents of a set enclosed in square brackets, using a comma as separator. More... | |
template<typename T > | |
ostream & | operator<< (ostream &os, const std::list< T > &v) |
Write the contents of a list enclosed in square brackets, using a comma as separator. More... | |
template<typename T , typename U > | |
ostream & | operator<< (ostream &os, const std::map< T, U > &m) |
Print the contents of a map enclosed in braces, using a comma as separator. More... | |
template<typename T > | |
LogIO & | operator<< (LogIO &os, const std::vector< T > &a) |
Print the contents of a container on LogIO. More... | |
template<typename T > | |
LogIO & | operator<< (LogIO &os, const std::set< T > &a) |
template<typename T > | |
LogIO & | operator<< (LogIO &os, const std::list< T > &a) |
template<typename T , typename U > | |
LogIO & | operator<< (LogIO &os, const std::map< T, U > &a) |
template<typename T > | |
AipsIO & | operator>> (AipsIO &ios, std::vector< T > &) |
Read or write the contents of an STL vector from/to AipsIO. More... | |
template<typename T > | |
AipsIO & | operator<< (AipsIO &ios, const std::vector< T > &) |
template<typename K , typename V > | |
AipsIO & | operator>> (AipsIO &ios, std::map< K, V > &) |
Read and write the contents of a map object from/to AipsIO. More... | |
template<typename K , typename V > | |
AipsIO & | operator<< (AipsIO &ios, const std::map< K, V > &) |
Input/output operators for STL-like containers.
Public interface
The function showContainer
makes it possible to show any STL-like container (having forward iterators) on an ostream. This include casacore classes like Array, IPosition, and Block, but also STL classes like vector. The separator, prefix, and postfix can be defined at will (they default to, [ ]).
The function showDataIter
is similar to showContainer
, but uses iterators directly.
Effortless input/output is clearly a big win.
AipsIO& casacore::STLIO_global_functions_Container_IO::operator<< | ( | AipsIO & | ios, |
const std::map< K, V > & | |||
) |
AipsIO& casacore::STLIO_global_functions_Container_IO::operator<< | ( | AipsIO & | ios, |
const std::vector< T > & | |||
) |
|
inline |
Definition at line 170 of file STLIO.h.
References casacore::LogIO::output().
|
inline |
Definition at line 173 of file STLIO.h.
References casacore::LogIO::output().
|
inline |
Definition at line 167 of file STLIO.h.
References casacore::LogIO::output().
|
inline |
Print the contents of a container on LogIO.
Definition at line 164 of file STLIO.h.
References casacore::LogIO::output().
|
inline |
Write the contents of a list enclosed in square brackets, using a comma as separator.
Definition at line 146 of file STLIO.h.
References showContainer().
|
inline |
Print the contents of a map enclosed in braces, using a comma as separator.
Definition at line 155 of file STLIO.h.
References showContainer().
|
inline |
|
inline |
Write the contents of a set enclosed in square brackets, using a comma as separator.
Definition at line 137 of file STLIO.h.
References showContainer().
|
inline |
Write the contents of a vector enclosed in square brackets, using a comma as separator.
Definition at line 128 of file STLIO.h.
References showContainer().
AipsIO& casacore::STLIO_global_functions_Container_IO::operator>> | ( | AipsIO & | ios, |
std::map< K, V > & | |||
) |
Read and write the contents of a map object from/to AipsIO.
It is done in the same way as the old SimpleOrderedMap class, so persistent SimpleOrderedMap objects in CTDS can be read as std::map and vice-versa.
|
inline |
Write out an ascii representation of any container having a forward iterator.
Note that a multi-dimensional Array object is linearized. An arbitrary separator, prefix, and postfix can be given. E.g. for separator ', ' the output looks like [1, 2, 3].
Definition at line 111 of file STLIO.h.
References casacore::C::c, and showDataIter().
Referenced by operator<<().
void casacore::STLIO_global_functions_Container_IO::showDataIter | ( | ostream & | , |
ITER | begin, | ||
const ITER & | end, | ||
const char * | separator = "," , |
||
const char * | prefix = "[" , |
||
const char * | postfix = "]" |
||
) |
Write out an ascii representation of any container using the given begin and end iterator.
An arbitrary separator, prefix, and postfix can be given. E.g. for separator ', ' the output looks like [1, 2, 3].
Referenced by showContainer().