34 #ifndef AIMS_IO_BCKW_H 35 #define AIMS_IO_BCKW_H 51 BckWriter(
const std::string& name,
bool ascii =
false )
52 : _name( name ), _itemw( 0 ), _ascii( ascii ) {}
57 {
delete _itemw; _itemw = iw; }
66 template<
class T>
inline 69 std::string openmode = ( _ascii ?
"ascii" :
"binar" );
77 std::ios::openmode omd = std::ios::app;
79 omd |= std::ios::binary;
80 std::ofstream os( hdr.filename().c_str(), omd );
86 std::unique_ptr< ItemWriter<AimsBucketItem<T> > > iw( _itemw->
writer( openmode,
false ) );
90 typename std::list<AimsBucketItem<T> >::const_iterator ibi, ebi;
93 os <<
"-dimt " << thing.size() << std::endl;
95 sw.write( os, (uint32_t)thing.size() );
97 for ( ib=thing.begin(); ib!=eb; ++ib )
99 typename std::list< AimsBucketItem<T> >::size_type n = ib->second.size();
102 os <<
"-time " << ib->first << std::endl;
103 os <<
"-dim " << n << std::endl;
107 sw.write( os, (uint32_t)ib->first );
108 sw.write( os, (uint32_t)n );
111 const std::list<AimsBucketItem<T> > & items = ib->second;
112 for ( ibi=items.begin(), ebi=items.end(); ibi!=ebi; ++ibi )
113 iw->write( os, *ibi );
120 template<
class T>
inline 124 writer.
write( thing );
Default low-levels writers.
float sizeX() const
returns the X resolution in mm
float sizeY() const
returns the Y resolution in mm
std::map< int, std::list< AimsBucketItem< T > > >::const_iterator const_iterator
const aims::PythonHeader & header() const
The class for EcatSino data write operation.
float sizeT() const
returns the T resolution in mm
static void launchErrnoExcept(const std::string &filename="")
Low-level "small item" writer, used by higher-level file readers.
The bucket base class to manage packages of points associated to their value during time...
BckWriter(const std::string &name, bool ascii=false)
#define AIMS_MAGIC_NUMBER
virtual ItemWriter< T > * writer(const std::string &openmode="binar", bool bswap=false) const =0
void setItemWriter(ItemWriter< T > *iw)
void write(const AimsBucket< T > &thing)
float sizeZ() const
returns the Z resolution in mm