OpenWalnut  1.5.0dev
Public Member Functions | Private Types | Private Attributes | List of all members
WRoiProjectFileIO Class Reference

IO Class for writing the ROI structure to a project file. More...

#include <WRoiProjectFileIO.h>

+ Inheritance diagram for WRoiProjectFileIO:
+ Collaboration diagram for WRoiProjectFileIO:

Public Member Functions

 WRoiProjectFileIO ()
 Default constructor. More...
 
virtual ~WRoiProjectFileIO ()
 Destructor. More...
 
virtual bool parse (std::string line, unsigned int lineNumber)
 This method parses the specified line and interprets it. More...
 
virtual void done ()
 Called whenever the end of the project file has been reached. More...
 
virtual void save (std::ostream &output)
 Saves the state to the specified stream. More...
 
virtual SPtr clone (WProjectFile *project) const
 Create a clone of the IO. More...
 
- Public Member Functions inherited from WProjectFileIO
 WProjectFileIO ()
 Default constructor. More...
 
virtual ~WProjectFileIO ()
 Destructor. More...
 
bool hadErrors () const
 Checks whether there where errors during load or save. More...
 
const std::vector< std::string > & getErrors () const
 Get error list. More...
 
bool hadWarnings () const
 Checks whether there where warnings during load or save. More...
 
const std::vector< std::string > & getWarnings () const
 Get warnings list. More...
 
void setProject (WProjectFile *project)
 Set the project using this parser. More...
 
ApplyOrder getApplyOrder () const
 Return the apply order of this IO. More...
 

Private Types

typedef unsigned int Branch
 Branch by ID. More...
 
typedef boost::tuple< std::string, std::string > Property
 Property for branch/roi with ID. More...
 
typedef std::vector< PropertyProperties
 The properties as vector. More...
 
typedef unsigned int RoiID
 ID of a ROI. More...
 
typedef boost::tuple< RoiID, BranchRoi
 ROI by ID, second is parent branch ID. More...
 

Private Attributes

std::vector< Branchm_branches
 All loaded branch IDs. More...
 
std::map< Branch, Propertiesm_branchProperties
 Properties of each branch. More...
 
std::vector< Roim_rois
 All loaded rois. More...
 
std::map< RoiID, Propertiesm_roiProperties
 Properties of each branch. More...
 

Additional Inherited Members

- Public Types inherited from WProjectFileIO
enum  ApplyOrder { PRE_MODULES = 0 , POST_MODULES }
 When to apply this parser. More...
 
typedef std::shared_ptr< WProjectFileIOSPtr
 Abbreviation for a shared pointer. More...
 
typedef std::shared_ptr< const WProjectFileIOConstSPtr
 Abbreviation for const shared pointer. More...
 
- Protected Member Functions inherited from WProjectFileIO
void addError (std::string description)
 Add an error. More...
 
void addWarning (std::string description)
 Add an warning. More...
 
void printProperties (std::ostream &output, std::shared_ptr< WProperties > props, std::string indent, std::string prefix, unsigned int index, std::string indexPrefix="")
 Recursively prints the properties and nested properties. More...
 
void setApplyOrder (ApplyOrder order)
 Set the order of calls to "done". More...
 
WProjectFilegetProject () const
 The project using this parser. More...
 

Detailed Description

IO Class for writing the ROI structure to a project file.

Definition at line 41 of file WRoiProjectFileIO.h.

Member Typedef Documentation

◆ Branch

typedef unsigned int WRoiProjectFileIO::Branch
private

Branch by ID.

Definition at line 92 of file WRoiProjectFileIO.h.

◆ Properties

typedef std::vector< Property > WRoiProjectFileIO::Properties
private

The properties as vector.

Definition at line 102 of file WRoiProjectFileIO.h.

◆ Property

typedef boost::tuple< std::string, std::string > WRoiProjectFileIO::Property
private

Property for branch/roi with ID.

Property name and value are stored as string

Definition at line 97 of file WRoiProjectFileIO.h.

◆ Roi

typedef boost::tuple< RoiID, Branch > WRoiProjectFileIO::Roi
private

ROI by ID, second is parent branch ID.

Definition at line 122 of file WRoiProjectFileIO.h.

◆ RoiID

typedef unsigned int WRoiProjectFileIO::RoiID
private

ID of a ROI.

Definition at line 117 of file WRoiProjectFileIO.h.

Constructor & Destructor Documentation

◆ WRoiProjectFileIO()

WRoiProjectFileIO::WRoiProjectFileIO ( )

Default constructor.

Definition at line 46 of file WRoiProjectFileIO.cpp.

Referenced by clone().

+ Here is the caller graph for this function:

◆ ~WRoiProjectFileIO()

WRoiProjectFileIO::~WRoiProjectFileIO ( )
virtual

Destructor.

Definition at line 52 of file WRoiProjectFileIO.cpp.

Member Function Documentation

◆ clone()

WProjectFileIO::SPtr WRoiProjectFileIO::clone ( WProjectFile project) const
virtual

Create a clone of the IO.

This is especially useful for custom parsers registered at WProjectFile::registerParser. Implement this function.

Parameters
projectthe project file using this parser instance.
Returns
Cloned instance.

Implements WProjectFileIO.

Definition at line 57 of file WRoiProjectFileIO.cpp.

References WRoiProjectFileIO().

+ Here is the call graph for this function:

◆ done()

void WRoiProjectFileIO::done ( )
virtual

Called whenever the end of the project file has been reached.

This is useful if your specific parser class wants to do some post processing after parsing line by line.

Reimplemented from WProjectFileIO.

Definition at line 120 of file WRoiProjectFileIO.cpp.

References WProjectFileIO::addError(), WKernel::getRoiManager(), WKernel::getRunningKernel(), m_branches, m_branchProperties, m_roiProperties, and m_rois.

+ Here is the call graph for this function:

◆ parse()

bool WRoiProjectFileIO::parse ( std::string  line,
unsigned int  lineNumber 
)
virtual

This method parses the specified line and interprets it.

It gets called line by line by WProjectFile.

Parameters
linethe current line as string
lineNumberthe current line number. Useful for error/warning/debugging output.
Returns
true if the line could be parsed.

Implements WProjectFileIO.

Definition at line 65 of file WRoiProjectFileIO.cpp.

References wlog::debug(), m_branches, m_branchProperties, m_roiProperties, and m_rois.

+ Here is the call graph for this function:

◆ save()

void WRoiProjectFileIO::save ( std::ostream &  output)
virtual

Saves the state to the specified stream.

Parameters
outputthe stream to print the state to.

Implements WProjectFileIO.

Definition at line 186 of file WRoiProjectFileIO.cpp.

References WROI::getProperties(), WKernel::getRoiManager(), WKernel::getRunningKernel(), and WProjectFileIO::printProperties().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_branches

std::vector< Branch > WRoiProjectFileIO::m_branches
private

All loaded branch IDs.

Definition at line 107 of file WRoiProjectFileIO.h.

Referenced by done(), and parse().

◆ m_branchProperties

std::map< Branch, Properties > WRoiProjectFileIO::m_branchProperties
private

Properties of each branch.

Definition at line 112 of file WRoiProjectFileIO.h.

Referenced by done(), and parse().

◆ m_roiProperties

std::map< RoiID, Properties > WRoiProjectFileIO::m_roiProperties
private

Properties of each branch.

Definition at line 132 of file WRoiProjectFileIO.h.

Referenced by done(), and parse().

◆ m_rois

std::vector< Roi > WRoiProjectFileIO::m_rois
private

All loaded rois.

Definition at line 127 of file WRoiProjectFileIO.h.

Referenced by done(), and parse().


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