OTest2
A C++ testing framework
registry.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Ondrej Starek
3  *
4  * This file is part of OTest2.
5  *
6  * OTest2 is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License,
9  * or (at your option) any later version.
10  *
11  * OTest2 is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with OTest2. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OTest2__INCLUDE_REGISTRY_H_
21 #define OTest2__INCLUDE_REGISTRY_H_
22 
23 #include <string>
24 
25 #include <otest2/scenarioiterptr.h>
26 #include <otest2/scenarioptr.h>
27 
28 namespace OTest2 {
29 
30 class RunnerFilter;
31 class RunnerFilterTags;
32 
38 class Registry {
39  private:
40  struct Impl;
41  Impl* pimpl;
42 
43  public:
44  /* -- avoid copying */
45  Registry(
46  const Registry&) = delete;
48  const Registry&) = delete;
49 
53  Registry();
54 
58  ~Registry();
59 
65  void registerScenario(
66  ScenarioPtr scenario_);
67 
76  void setTestName(
77  const std::string& name_);
78 
85  const RunnerFilter& filter_) const;
86 
96  static Registry& instance(
97  const std::string& domain_);
98 };
99 
100 } /* namespace OTest2 */
101 
102 #endif /* OTest2__INCLUDE_REGISTRY_H_ */
OTest2::Registry::operator=
Registry & operator=(const Registry &)=delete
OTest2::Registry::registerScenario
void registerScenario(ScenarioPtr scenario_)
Register a scenario object.
Definition: registry.cpp:121
scenarioiterptr.h
OTest2::RunnerFilter
Generic interface of a runner filter.
Definition: runnerfilter.h:35
OTest2
Definition: assertbean.h:25
OTest2::ScenarioIterPtr
std::shared_ptr< ScenarioIter > ScenarioIterPtr
Shared pointer of the scenario iter interface.
Definition: scenarioiterptr.h:27
OTest2::ScenarioPtr
std::shared_ptr< Scenario > ScenarioPtr
Shared pointer of the scenario object.
Definition: scenarioptr.h:27
OTest2::Registry::instance
static Registry & instance(const std::string &domain_)
Access of the global instances.
Definition: registry.cpp:143
OTest2::Registry
Test registry.
Definition: registry.h:38
OTest2::Registry::~Registry
~Registry()
Dtor.
Definition: registry.cpp:117
OTest2::Registry::Registry
Registry()
Ctor.
Definition: registry.cpp:112
OTest2::Registry::setTestName
void setTestName(const std::string &name_)
Set test name.
Definition: registry.cpp:126
OTest2::Registry::getTests
ScenarioIterPtr getTests(const RunnerFilter &filter_) const
Get iterator of test roots.
Definition: registry.cpp:132
scenarioptr.h