Flow123d  release_2.1.0-87-gfbc1563
reader_instances.cc
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file reader_instances.cc
15  * @brief
16  */
17 
18 #include "mesh/reader_instances.hh"
19 
22  return instance;
23 }
24 
25 std::shared_ptr<GmshMeshReader> ReaderInstances::get_reader(const FilePath &file_path) {
26  ReaderTable::iterator it = reader_table_.find( string(file_path) );
27  if (it == reader_table_.end()) {
28  std::shared_ptr<GmshMeshReader> reader_ptr = std::make_shared<GmshMeshReader>(file_path);
29  reader_table_.insert( std::pair<string, std::shared_ptr<GmshMeshReader>>(string(file_path), reader_ptr) );
30  return reader_ptr;
31  } else {
32  return (*it).second;
33  }
34 }
ReaderTable reader_table_
Table of readers.
ReaderInstances()
Constructor.
Dedicated class for storing path to input and output files.
Definition: file_path.hh:48
std::shared_ptr< GmshMeshReader > get_reader(const FilePath &file_path)
static ReaderInstances * instance()
Returns singleton instance.