NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
dependency.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2019 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19#ifndef DEPENDENCY_HPP
20#define DEPENDENCY_HPP
21
22#include <string>
23#include <map>
24#include <list>
25
26
33{
34 private:
35 std::string sProcedureName;
36 std::string sFileName;
37
38 public:
39 Dependency(const std::string& sProcName, const std::string& sFile) : sProcedureName(sProcName), sFileName(sFile) {}
40
41 std::string& getFileName()
42 {
43 return sFileName;
44 }
45
46 std::string& getProcedureName()
47 {
48 return sProcedureName;
49 }
50
51 const std::string& getProcedureName() const
52 {
53 return sProcedureName;
54 }
55};
56
57
63class DependencyList : public std::list<Dependency>
64{
65 public:
66 void unique();
67};
68
69
70// Forward declaration of the procedure element class
72
73
81{
82 private:
83 std::map<std::string, DependencyList> mDependencies;
84 std::string sFileName;
86 std::string sThisNameSpace;
87 std::string sMainProcedure;
88
89 void walk(ProcedureElement* procedureFile);
90 int getProcedureDependencies(ProcedureElement* procedureFile, int nCurrentLine);
91 std::string getProcedureName(std::string sCommandLine) const;
92 void resolveProcedureCalls(std::string sCommandLine, const std::string& sProcedureName, const std::string& sCurrentNameSpace);
93 std::string getProcedureFileName(std::string sProc) const;
94
95 public:
96 Dependencies(ProcedureElement* procedureFile);
97
98 std::map<std::string, DependencyList>& getDependencyMap()
99 {
100 return mDependencies;
101 }
102
103 std::string getMainProcedure() const
104 {
105 return sMainProcedure;
106 }
107};
108
109
110#endif // DEPENDENCY_HPP
111
112
This class handles the dependencies of the current procedure file (passed as pointer to a ProcedureEl...
Definition: dependency.hpp:81
std::string getProcedureName(std::string sCommandLine) const
This member function extracts the procedure name from the procedure head.
Definition: dependency.cpp:225
std::map< std::string, DependencyList > mDependencies
Definition: dependency.hpp:83
std::map< std::string, DependencyList > & getDependencyMap()
Definition: dependency.hpp:98
void resolveProcedureCalls(std::string sCommandLine, const std::string &sProcedureName, const std::string &sCurrentNameSpace)
This member function resilves the procedure calls contained in the current procedure command line.
Definition: dependency.cpp:248
std::string sMainProcedure
Definition: dependency.hpp:87
std::string sFileName
Definition: dependency.hpp:84
std::string getProcedureFileName(std::string sProc) const
This member function returns the file name of the current called procedure.
Definition: dependency.cpp:299
std::string sThisFileNameSpacePrefix
Definition: dependency.hpp:85
Dependencies(ProcedureElement *procedureFile)
Dependencies constructor.
Definition: dependency.cpp:82
int getProcedureDependencies(ProcedureElement *procedureFile, int nCurrentLine)
This member function calculates the dependencies of the current procedure.
Definition: dependency.cpp:162
std::string sThisNameSpace
Definition: dependency.hpp:86
void walk(ProcedureElement *procedureFile)
This member function will walk through the file and redirect the control to getProcedureDependencies(...
Definition: dependency.cpp:136
std::string getMainProcedure() const
Definition: dependency.hpp:103
This class resembles a simple dependency containing a procedure name and the corresponding file name.
Definition: dependency.hpp:33
const std::string & getProcedureName() const
Definition: dependency.hpp:51
Dependency(const std::string &sProcName, const std::string &sFile)
Definition: dependency.hpp:39
std::string & getFileName()
Definition: dependency.hpp:41
std::string sProcedureName
Definition: dependency.hpp:35
std::string & getProcedureName()
Definition: dependency.hpp:46
std::string sFileName
Definition: dependency.hpp:36
This class is a child of the std::list, where the function unique() has been overridden (i....
Definition: dependency.hpp:64
void unique()
Implementation of DependencyList::unique.
Definition: dependency.cpp:65
This class contains the pre-parsed contents of a single procedure file.