Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::DataHandling::LoadGroupMapFile Class Reference

Class used to load a grouping information from .map file. More...

#include <LoadDetectorsGroupingFile.h>

Public Member Functions

std::map< int, std::vector< int > > getGroupSpectraMap ()
 Return the map parsed from file. More...
 
 LoadGroupMapFile (const std::string &fileName, Kernel::Logger &log)
 Constructor. Opens a file. More...
 
void parseFile ()
 Parses grouping information from .map file. More...
 
 ~LoadGroupMapFile ()
 Desctructor. Closes a file. More...
 

Private Member Functions

bool nextDataLine (std::string &line)
 Skips all the empty lines and comment lines, and returns next line with real data. More...
 

Private Attributes

std::ifstream m_file
 The file being parsed. More...
 
const std::string m_fileName
 The name of the file being parsed. More...
 
std::map< int, std::vector< int > > m_groupSpectraMap
 group_id -> [list of spectra] More...
 
int m_lastLineRead
 Number of the last line parsed. More...
 
Kernel::Loggerm_log
 Logger used. More...
 

Detailed Description

Class used to load a grouping information from .map file.

Author
Arturs Bekasovs
Date
21/08/2013

Definition at line 161 of file LoadDetectorsGroupingFile.h.

Constructor & Destructor Documentation

◆ LoadGroupMapFile()

Mantid::DataHandling::LoadGroupMapFile::LoadGroupMapFile ( const std::string &  fileName,
Kernel::Logger log 
)

Constructor. Opens a file.

Constructor.

Opens a file.

Parameters
fileNameFull path to the .map file
logLogger to use

Definition at line 593 of file LoadDetectorsGroupingFile.cpp.

References m_file, and m_fileName.

◆ ~LoadGroupMapFile()

Mantid::DataHandling::LoadGroupMapFile::~LoadGroupMapFile ( )

Desctructor. Closes a file.

Destructor.

Closes the file.

Definition at line 604 of file LoadDetectorsGroupingFile.cpp.

References m_file.

Member Function Documentation

◆ getGroupSpectraMap()

std::map< int, std::vector< int > > Mantid::DataHandling::LoadGroupMapFile::getGroupSpectraMap ( )
inline

Return the map parsed from file.

Should only be called after the file is parsed, otherwise a map will always be empty.

Definition at line 175 of file LoadDetectorsGroupingFile.h.

Referenced by Mantid::DataHandling::LoadDetectorsGroupingFile::exec().

◆ nextDataLine()

bool Mantid::DataHandling::LoadGroupMapFile::nextDataLine ( std::string &  line)
private

Skips all the empty lines and comment lines, and returns next line with real data.

Returns a next data line.

By "data line" I mean not empty and not a comment line.

Parameters
lineWhere a line string will be stored
Returns
true if line is read, false if eof or file error

Definition at line 681 of file LoadDetectorsGroupingFile.cpp.

References m_file, and m_lastLineRead.

Referenced by parseFile().

◆ parseFile()

void Mantid::DataHandling::LoadGroupMapFile::parseFile ( )

Parses grouping information from .map file.

Creates a group -> [spectra list] map by parsing the input file.

Definition at line 613 of file LoadDetectorsGroupingFile.cpp.

References Mantid::Kernel::Strings::convert(), m_fileName, m_groupSpectraMap, m_lastLineRead, m_log, nextDataLine(), Mantid::Kernel::Strings::parseRange(), and Mantid::Kernel::Logger::warning().

Referenced by Mantid::DataHandling::LoadDetectorsGroupingFile::exec().

Member Data Documentation

◆ m_file

std::ifstream Mantid::DataHandling::LoadGroupMapFile::m_file
private

The file being parsed.

Definition at line 192 of file LoadDetectorsGroupingFile.h.

Referenced by LoadGroupMapFile(), nextDataLine(), and ~LoadGroupMapFile().

◆ m_fileName

const std::string Mantid::DataHandling::LoadGroupMapFile::m_fileName
private

The name of the file being parsed.

Definition at line 183 of file LoadDetectorsGroupingFile.h.

Referenced by LoadGroupMapFile(), and parseFile().

◆ m_groupSpectraMap

std::map<int, std::vector<int> > Mantid::DataHandling::LoadGroupMapFile::m_groupSpectraMap
private

group_id -> [list of spectra]

Definition at line 189 of file LoadDetectorsGroupingFile.h.

Referenced by parseFile().

◆ m_lastLineRead

int Mantid::DataHandling::LoadGroupMapFile::m_lastLineRead
private

Number of the last line parsed.

Definition at line 195 of file LoadDetectorsGroupingFile.h.

Referenced by nextDataLine(), and parseFile().

◆ m_log

Kernel::Logger& Mantid::DataHandling::LoadGroupMapFile::m_log
private

Logger used.

Definition at line 186 of file LoadDetectorsGroupingFile.h.

Referenced by parseFile().


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