soma-io  5.0.5
soma::AttributedReader Class Reference

To read GenericObject from a file. More...

#include <soma-io/reader/areader.h>

Collaboration diagram for soma::AttributedReader:

Public Types

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

Public Member Functions

Constructors, destructor
 AttributedReader (carto::rc_ptr< DataSource > ds, const carto::SyntaxSet &rules, const HelperSet &helpers=HelperSet())
 
 AttributedReader (const std::string &filename, const carto::SyntaxSet &rules, const HelperSet &helpers=HelperSet())
 configure the parametres More...
 
 AttributedReader (const carto::SyntaxSet &rules, const HelperSet &helpers=HelperSet())
 configure the parametres More...
 
virtual ~AttributedReader ()
 clean up More...
 
Open, close
void open (const std::string &filename)
 open a new file More...
 
void attach (carto::rc_ptr< DataSource > ds)
 
void attach (std::istream &stream, int line_num=1)
 attach to an existing istream More...
 
void close ()
 detach or close the stream More...
 
carto::rc_ptr< DataSourcedataSource ()
 
Query
virtual std::string name () const
 name of the file to read from More...
 
int line () const
 

Protected Attributes

Data
carto::SyntaxSet _rules
 rules for every syntactic attribute More...
 
carto::rc_ptr< DataSource_datasource
 filtering stream to read from More...
 
HelperSet _helpers
 helper functions read basic data type More...
 

Helpers

bool operator! () const
 return the status of the stream More...
 
bool is_open () const
 is the stream open? More...
 
bool eof () const
 have we hit EOF? More...
 
void readAttribute (carto::GenericObject &object, const std::string &semantic)
 construct the value of a semantic attribute More...
 
void readAttribute (carto::GenericObject *object, const std::string &semantic) __attribute__((__deprecated__))
 

Detailed Description

To read GenericObject from a file.

Definition at line 55 of file areader.h.

Member Typedef Documentation

◆ Helper

typedef void(* soma::AttributedReader::Helper) (carto::GenericObject &, const std::string &, DataSource &)

Definition at line 65 of file areader.h.

◆ HelperSet

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

Definition at line 67 of file areader.h.

Constructor & Destructor Documentation

◆ AttributedReader() [1/3]

soma::AttributedReader::AttributedReader ( carto::rc_ptr< DataSource ds,
const carto::SyntaxSet rules,
const HelperSet helpers = HelperSet() 
)

◆ AttributedReader() [2/3]

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

configure the parametres

Parameters
filenamename of the file to read into
ruleslist of all possible semantic attributes
helpersfor reading basic data types

◆ AttributedReader() [3/3]

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

configure the parametres

Parameters
ruleslist of all possible semantic attributes
helpersfor reading basic data types

◆ ~AttributedReader()

virtual soma::AttributedReader::~AttributedReader ( )
virtual

clean up

Member Function Documentation

◆ attach() [1/2]

void soma::AttributedReader::attach ( carto::rc_ptr< DataSource ds)

◆ attach() [2/2]

void soma::AttributedReader::attach ( std::istream &  stream,
int  line_num = 1 
)

attach to an existing istream

◆ close()

void soma::AttributedReader::close ( )

detach or close the stream

◆ dataSource()

carto::rc_ptr<DataSource> soma::AttributedReader::dataSource ( )
inline

Definition at line 118 of file areader.h.

References __attribute__, and __deprecated__.

◆ eof()

bool soma::AttributedReader::eof ( ) const

have we hit EOF?

Returns
true if EOF already hit, false otherwise

◆ is_open()

bool soma::AttributedReader::is_open ( ) const

is the stream open?

Returns
ifstream::is_open()

◆ line()

int soma::AttributedReader::line ( ) const

◆ name()

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

name of the file to read from

◆ open()

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

open a new file

Parameters
filenamename of the file to read from

◆ operator!()

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

return the status of the stream

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

◆ readAttribute() [1/2]

void soma::AttributedReader::readAttribute ( carto::GenericObject object,
const std::string &  semantic 
)
protected

construct the value of a semantic attribute

Parameters
objectGenericObject to attach to
semanticsemantic attribute name

◆ readAttribute() [2/2]

void soma::AttributedReader::readAttribute ( carto::GenericObject object,
const std::string &  semantic 
)
protected

Member Data Documentation

◆ _datasource

carto::rc_ptr<DataSource> soma::AttributedReader::_datasource
protected

filtering stream to read from

Definition at line 187 of file areader.h.

◆ _helpers

HelperSet soma::AttributedReader::_helpers
protected

helper functions read basic data type

Definition at line 190 of file areader.h.

◆ _rules

carto::SyntaxSet soma::AttributedReader::_rules
protected

rules for every syntactic attribute

Definition at line 184 of file areader.h.


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