Skip to content

Commit 4646741

Browse files
committed
Initial commit for logger
1 parent 66fcf05 commit 4646741

25 files changed

+2525
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.user
2+
.scannerwork

3rdparty/Singleton.h

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Copyright (c) 2020 Florian Becker <fb@vxapps.com> (VX APPS).
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
*
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
*
15+
* 3. Neither the name of the copyright holder nor the names of its
16+
* contributors may be used to endorse or promote products derived from
17+
* this software without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
#pragma once
32+
33+
/**
34+
* @brief vx (VX Apps) namespace.
35+
*/
36+
namespace vx {
37+
38+
/**
39+
* @brief Template instance class.
40+
* @author Florian Becker <fb\@vxapps.com> (VX Apps)
41+
*/
42+
template<class T>
43+
class Singleton {
44+
45+
public:
46+
/**
47+
* @~english
48+
* @brief C++11 Singleton thread-safe.
49+
* @return Singleton of T.
50+
*
51+
* @~german
52+
* @brief C++11 Singleton thread-safe.
53+
* @return Einzige Instanz von T.
54+
*/
55+
static T &instance() {
56+
57+
static T instance;
58+
return instance;
59+
}
60+
61+
/**
62+
* @~english
63+
* @brief Delete move constructor.
64+
*
65+
* @~german
66+
* @brief Entfernt den verschobenen Konstruktor.
67+
*/
68+
Singleton( Singleton && ) = delete;
69+
70+
/**
71+
* @~english
72+
* @brief Delete copy assign.
73+
* @return Nothing.
74+
*
75+
* @~german
76+
* @brief Entfernt die kopierte Zuweisung.
77+
* @return Keine Rückgabe.
78+
*/
79+
Singleton &operator=( Singleton const & ) = delete;
80+
81+
/**
82+
* @~english
83+
* @brief Delete move assign.
84+
* @return Nothing.
85+
*
86+
* @~german
87+
* @brief Entfernt die verschobene Zuweisung.
88+
* @return Keine Rückgabe.
89+
*/
90+
Singleton &operator=( Singleton && ) = delete;
91+
92+
protected:
93+
/**
94+
* @~english
95+
* @brief Default constructor for Singleton.
96+
*
97+
* @~german
98+
* @brief Standardkonstruktur für Singleton.
99+
*/
100+
Singleton() = default;
101+
102+
/**
103+
* @~english
104+
* @brief Default destructor for Singleton.
105+
*
106+
* @~german
107+
* @brief Standarddestruktor für Singleton.
108+
*/
109+
~Singleton() = default;
110+
};
111+
}

0 commit comments

Comments
 (0)