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 );
 
aims::BckWriter< T > & operator<<(aims::BckWriter< T > &writer, const AimsBucket< T > &thing)
The bucket base class to manage packages of points associated to their value during time.
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
float sizeZ() const
returns the Z resolution in mm
float sizeT() const
returns the T resolution in mm
const aims::PythonHeader & header() const
void setItemWriter(ItemWriter< T > *iw)
BckWriter(const std::string &name, bool ascii=false)
void write(const AimsBucket< T > &thing)
Default low-levels writers.
virtual void write(std::ostream &os, const T &item) const
Low-level "small item" writer, used by higher-level file readers.
static void launchErrnoExcept(const std::string &filename="")
#define AIMS_MAGIC_NUMBER
The class for EcatSino data write operation.