soma-io  5.0.5
soma::AttributedWriter Class Reference

To write an AttributedObject to a file. More...

#include <soma-io/writer/awriter.h>

Collaboration diagram for soma::AttributedWriter:

Public Types

Associated types
typedef void(* Helper) (const carto::GenericObject &, const std::string &, std::ostream &)
 
typedef std::map< std::string, HelperHelperSet
 

Public Member Functions

Open, close
void open (const std::string &filename)
 open a new file More...
 
void attach (std::ostream &s)
 attach to an existing (and open) stream More...
 
void close ()
 close or detach the stream More...
 
Query
virtual std::string name () const
 name of the file to read from More...
 

Protected Attributes

Data
carto::SyntaxSet _rules
 rules for every syntactic attribute More...
 
std::ostream * _stream
 C++ stream to write into. More...
 
bool _ownStream
 

Constructors, destructor

 AttributedWriter (const std::string &filename, const carto::SyntaxSet &rules, const HelperSet &helpers=HelperSet())
 configure the parametres More...
 
 AttributedWriter (const carto::SyntaxSet &rules, const HelperSet &helpers=HelperSet())
 configure the parametres More...
 
virtual ~AttributedWriter ()
 clean up More...
 

Helpers

bool operator! () const
 return the status of the stream More...
 
bool is_open () const
 is the stream open? More...
 
void writeAttributes (const carto::GenericObject &object)
 
void writeAttributes (const carto::GenericObject &object, const std::set< std::string > &attributes, std::string::size_type size)
 
void writeAttributes (const carto::GenericObject *object) __attribute__((__deprecated__))
 
void writeAttributes (const carto::GenericObject *object, const std::set< std::string > &attributes, std::string::size_type size) __attribute__((__deprecated__))
 

Detailed Description

To write an AttributedObject to a file.

Definition at line 56 of file awriter.h.

Member Typedef Documentation

◆ Helper

typedef void(* soma::AttributedWriter::Helper) (const carto::GenericObject &, const std::string &, std::ostream &)

Definition at line 66 of file awriter.h.

◆ HelperSet

typedef std::map<std::string, Helper> soma::AttributedWriter::HelperSet

Definition at line 68 of file awriter.h.

Constructor & Destructor Documentation

◆ AttributedWriter() [1/2]

soma::AttributedWriter::AttributedWriter ( const std::string &  filename,
const carto::SyntaxSet rules,
const HelperSet helpers = HelperSet() 
)

configure the parametres

Parameters
filenamename of the file to write into
rulessyntactic attribute / rules pairs
helperswriting functions set

◆ AttributedWriter() [2/2]

soma::AttributedWriter::AttributedWriter ( const carto::SyntaxSet rules,
const HelperSet helpers = HelperSet() 
)

configure the parametres

Parameters
rulessyntactic attribute / rules pairs
helperswriting functions set

◆ ~AttributedWriter()

virtual soma::AttributedWriter::~AttributedWriter ( )
virtual

clean up

Member Function Documentation

◆ attach()

void soma::AttributedWriter::attach ( std::ostream &  s)

attach to an existing (and open) stream

◆ close()

void soma::AttributedWriter::close ( )

close or detach the stream

◆ is_open()

bool soma::AttributedWriter::is_open ( ) const

is the stream open?

Returns
ifstream::is_open()

◆ name()

virtual std::string soma::AttributedWriter::name ( ) const
virtual

name of the file to read from

◆ open()

void soma::AttributedWriter::open ( const std::string &  filename)

open a new file

Parameters
filenamename of the file to write into

◆ operator!()

bool soma::AttributedWriter::operator! ( ) const

return the status of the stream

Returns
true if ifstream::operator!() returns true

◆ writeAttributes() [1/4]

void soma::AttributedWriter::writeAttributes ( const carto::GenericObject object)
protected

◆ writeAttributes() [2/4]

void soma::AttributedWriter::writeAttributes ( const carto::GenericObject object,
const std::set< std::string > &  attributes,
std::string::size_type  size 
)
protected

◆ writeAttributes() [3/4]

void soma::AttributedWriter::writeAttributes ( const carto::GenericObject object)
protected

◆ writeAttributes() [4/4]

void soma::AttributedWriter::writeAttributes ( const carto::GenericObject object,
const std::set< std::string > &  attributes,
std::string::size_type  size 
)
protected

Member Data Documentation

◆ _ownStream

bool soma::AttributedWriter::_ownStream
protected

Definition at line 173 of file awriter.h.

◆ _rules

carto::SyntaxSet soma::AttributedWriter::_rules
protected

rules for every syntactic attribute

Definition at line 169 of file awriter.h.

◆ _stream

std::ostream* soma::AttributedWriter::_stream
protected

C++ stream to write into.

Definition at line 172 of file awriter.h.


The documentation for this class was generated from the following file: