TBTK
Need a break? Support the development by playing Polarity Puzzles
Solver.h
Go to the documentation of this file.
1 /* Copyright 2017 Kristofer Björnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
23 #ifndef COM_DAFER45_TBTK_SOLVER_SOLVER
24 #define COM_DAFER45_TBTK_SOLVER_SOLVER
25 
26 #include "TBTK/Model.h"
27 
28 namespace TBTK{
29 namespace Solver{
30 
42 class Solver{
43 public:
45  Solver();
46 
48  virtual ~Solver();
49 
53  virtual void setModel(Model &model);
54 
58  Model& getModel();
59 
63  const Model& getModel() const;
64 private:
66  Model *model;
67 };
68 
69 inline void Solver::setModel(Model &model){
70  this->model = &model;
71 }
72 
73 inline Model& Solver::getModel(){
74  TBTKAssert(
75  model != nullptr,
76  "Solver::getModel()",
77  "Model not set.",
78  "Use Solver::setSolver() to set model."
79  );
80  return *model;
81 }
82 
83 inline const Model& Solver::getModel() const{
84  TBTKAssert(
85  model != nullptr,
86  "Solver::getModel()",
87  "Model not set.",
88  "Use Solver::setSolver() to set model."
89  );
90  return *model;
91 }
92 
93 }; //End of namespace Solver
94 }; //End of namespace TBTK
95 
96 #endif
TBTK::Solver::Solver::~Solver
virtual ~Solver()
TBTK::Model
Container of Model related information.
Definition: Model.h:57
Model.h
Container of Model related information.
TBTK::Solver::Solver::setModel
virtual void setModel(Model &model)
Definition: Solver.h:69
TBTK::Solver::Solver::Solver
Solver()
TBTK::Solver::Solver::getModel
Model & getModel()
Definition: Solver.h:73
TBTK::Solver::Solver
Base class for Solvers.
Definition: Solver.h:42