Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giulia Facchi
Skyward Boardcore
Commits
69f6fb3b
Commit
69f6fb3b
authored
8 years ago
by
Federico
Browse files
Options
Downloads
Patches
Plain Diff
Improved singleton
parent
d6e77f04
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/shared/Singleton.h
+25
-8
25 additions, 8 deletions
src/shared/Singleton.h
src/shared/boards/AnakinBoard.h
+0
-5
0 additions, 5 deletions
src/shared/boards/AnakinBoard.h
with
25 additions
and
13 deletions
src/shared/Singleton.h
+
25
−
8
View file @
69f6fb3b
...
...
@@ -23,16 +23,33 @@
#ifndef SINGLETON_H
#define SINGLETON_H
/**
* WARNING: deriving from this class is not enough to make a singleton,
* you also have to declare the constructor of your class private!
*
* \code
* class Foo : public Singleton<Foo>
* {
* private:
* Foo() {} //Ok, private constructor
* };
* \endcode
*/
template
<
typename
T
>
class
Singleton
{
public:
/**
* \return a pointer to the only instance of the class T
*/
inline
static
T
*
getInstance
()
{
static
T
instance
;
return
&
instance
;
}
protected
:
Singleton
(){}
private
:
Singleton
(
const
Singleton
&
)
=
delete
;
Singleton
&
operator
=
(
const
Singleton
&
)
=
delete
;
};
...
...
This diff is collapsed.
Click to expand it.
src/shared/boards/AnakinBoard.h
+
0
−
5
View file @
69f6fb3b
...
...
@@ -86,11 +86,6 @@ private:
ms580_t
*
mS_MS580
;
AnakinBoard
();
AnakinBoard
(
const
AnakinBoard
&
)
=
delete
;
AnakinBoard
(
AnakinBoard
&&
)
=
delete
;
AnakinBoard
&
operator
=
(
const
AnakinBoard
&
)
=
delete
;
AnakinBoard
&
operator
=
(
AnakinBoard
&&
)
=
delete
;
};
#ifdef sBoard
...
...
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