Wire Sysio
Wire Sysion 1.0.0
Loading...
Searching...
No Matches
catch_singletons.cpp
Go to the documentation of this file.
1
/*
2
* Created by Phil Nash on 15/6/2018.
3
*
4
* Distributed under the Boost Software License, Version 1.0. (See accompanying
5
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
*/
7
8
#include "
catch_singletons.hpp
"
9
10
#include <vector>
11
12
namespace
Catch
{
13
14
namespace
{
15
static
auto
getSingletons() -> std::vector<ISingleton*>*& {
16
static
std::vector<ISingleton*>* g_singletons =
nullptr
;
17
if
( !g_singletons )
18
g_singletons =
new
std::vector<ISingleton*>();
19
return
g_singletons;
20
}
21
}
22
23
ISingleton::~ISingleton
() {}
24
25
void
addSingleton
(
ISingleton
* singleton ) {
26
getSingletons()->push_back( singleton );
27
}
28
void
cleanupSingletons
() {
29
auto
& singletons = getSingletons();
30
for
(
auto
singleton : *singletons )
31
delete
singleton;
32
delete
singletons;
33
singletons =
nullptr
;
34
}
35
36
}
// namespace Catch
catch_singletons.hpp
Catch
Definition
231-Cfg-OutputStreams.cpp:32
Catch::addSingleton
void addSingleton(ISingleton *singleton)
Definition
catch_singletons.cpp:25
Catch::cleanupSingletons
void cleanupSingletons()
Definition
catch_singletons.cpp:28
Catch::ISingleton
Definition
catch_singletons.hpp:12
Catch::ISingleton::~ISingleton
virtual ~ISingleton()
Definition
catch_singletons.cpp:23
libraries
sys-vm
external
Catch2
include
internal
catch_singletons.cpp
Generated by
1.12.0