Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FIG Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BATON Theau
FIG Project
Commits
4794b2ea
Commit
4794b2ea
authored
6 months ago
by
BATON Theau
Browse files
Options
Downloads
Patches
Plain Diff
Add Kernel + Physic Engine
parent
d1f0d5c7
No related branches found
No related tags found
No related merge requests found
Changes
62
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/utility/Identifiable.cpp
+42
-0
42 additions, 0 deletions
source/utility/Identifiable.cpp
source/utility/Identifiable.hpp
+35
-0
35 additions, 0 deletions
source/utility/Identifiable.hpp
with
77 additions
and
0 deletions
source/utility/Identifiable.cpp
0 → 100644
+
42
−
0
View file @
4794b2ea
#include
"Identifiable.hpp"
namespace
megu
{
size_t
Identifiable
::
_GlobalId
=
0
;
Identifiable
::
Identifiable
()
:
_id
(
Identifiable
::
_GlobalId
++
)
{}
Identifiable
::
Identifiable
(
size_t
id
)
:
_id
(
id
)
{}
Identifiable
::
Identifiable
(
const
Identifiable
&
src
)
:
_id
(
src
.
_id
)
{}
Identifiable
::~
Identifiable
()
{
--
Identifiable
::
_GlobalId
;
}
bool
Identifiable
::
operator
==
(
const
Identifiable
&
identifiable
)
const
{
return
this
->
_id
==
identifiable
.
_id
;
}
bool
Identifiable
::
operator
!=
(
const
Identifiable
&
identifiable
)
const
{
return
!
(
*
this
==
identifiable
);
}
bool
Identifiable
::
operator
<=
(
const
Identifiable
&
identifiable
)
const
{
return
this
->
_id
<=
identifiable
.
_id
;
}
bool
Identifiable
::
operator
>=
(
const
Identifiable
&
identifiable
)
const
{
return
this
->
_id
<=
identifiable
.
_id
;
}
bool
Identifiable
::
operator
<
(
const
Identifiable
&
identifiable
)
const
{
return
!
(
this
->
_id
>=
identifiable
.
_id
);
}
bool
Identifiable
::
operator
>
(
const
Identifiable
&
identifiable
)
const
{
return
!
(
this
->
_id
<=
identifiable
.
_id
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
source/utility/Identifiable.hpp
0 → 100644
+
35
−
0
View file @
4794b2ea
#pragma once
#include
<map>
#include
<stddef.h>
namespace
megu
{
class
Identifiable
{
public:
Identifiable
();
Identifiable
(
size_t
);
Identifiable
(
const
Identifiable
&
);
virtual
~
Identifiable
();
inline
size_t
id
()
const
{
return
this
->
_id
;}
inline
void
setId
(
size_t
id
)
{
this
->
_id
=
id
;}
bool
operator
==
(
const
Identifiable
&
)
const
;
bool
operator
!=
(
const
Identifiable
&
)
const
;
bool
operator
>=
(
const
Identifiable
&
)
const
;
bool
operator
<=
(
const
Identifiable
&
)
const
;
bool
operator
>
(
const
Identifiable
&
)
const
;
bool
operator
<
(
const
Identifiable
&
)
const
;
private
:
size_t
_id
;
static
size_t
_GlobalId
;
};
template
<
class
T
>
using
Identifiable_Map
=
std
::
map
<
size_t
,
T
*>
;
template
<
class
T
>
class
Identifiable_Unique
:
public
Identifiable
{};
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
Next
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