Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Frida
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coenen, Joachim
Frida
Commits
4a8c9e40
Commit
4a8c9e40
authored
9 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
modernize and simplify singleton base class
parent
5fbe3a9f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pub/CHANGELOG
+1
-0
1 addition, 0 deletions
pub/CHANGELOG
pub/lib/toplevel.cpp
+1
-6
1 addition, 6 deletions
pub/lib/toplevel.cpp
pub/trivia/singleton.hpp
+2
-14
2 additions, 14 deletions
pub/trivia/singleton.hpp
with
4 additions
and
20 deletions
pub/CHANGELOG
+
1
−
0
View file @
4a8c9e40
...
...
@@ -3,6 +3,7 @@ Release:
- New functionality:
- functions kwwmc, kwwms, kwwmp take argument <tau> instead of tau
- Code cleanup:
- modernize and simplify singleton base class
- got rid of global instances of singletons
Release 2.3.2f of 17nov15:
...
...
This diff is collapsed.
Click to expand it.
pub/lib/toplevel.cpp
+
1
−
6
View file @
4a8c9e40
...
...
@@ -53,15 +53,10 @@ void my_gsl_error_handler ( const char * reason, const char * file, int line, in
}
//! At exit,
tear down globals
.
//! At exit,
currently nothing to do
.
void
atexit_handler
()
{
SFuncRegistry
::
reset_instance
();
SGeniRegistry
::
reset_instance
();
SCvinRegistry
::
reset_instance
();
SVariRegistry
::
reset_instance
();
SPloWin
::
reset_instance
();
}
...
...
This diff is collapsed.
Click to expand it.
pub/trivia/singleton.hpp
+
2
−
14
View file @
4a8c9e40
...
...
@@ -19,26 +19,14 @@ class ISingleton {
private:
ISingleton
(
ISingleton
const
&
)
=
delete
;
//! To prevent copying
void
operator
=
(
ISingleton
const
&
)
=
delete
;
//! To prevent copying
static
T
*
instance
;
protected:
~
ISingleton
()
{};
ISingleton
()
{}
typedef
T
*
T_Pointer
;
public
:
static
T
*
get_instance
()
{
if
(
instance
==
nullptr
)
instance
=
new
T
();
return
instance
;
}
static
void
reset_instance
()
{
delete
instance
;
instance
=
nullptr
;
}
static
T
*
get_instance
()
{
static
T
*
instance
=
new
T
();
return
instance
;
}
};
// Instantiate static member:
template
<
class
T
>
typename
ISingleton
<
T
>::
T_Pointer
ISingleton
<
T
>::
instance
=
nullptr
;
}
}
// namespace triv
#endif // ISINGLETON_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment