-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorganize directory structure and other clean-ups #246
Merged
jonesmz
merged 11 commits into
TheOpenSpaceProgram:master
from
Capital-Asterisk:reorganize-lol
Sep 25, 2023
Merged
Reorganize directory structure and other clean-ups #246
jonesmz
merged 11 commits into
TheOpenSpaceProgram:master
from
Capital-Asterisk:reorganize-lol
Sep 25, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Capital-Asterisk
force-pushed
the
reorganize-lol
branch
2 times, most recently
from
September 25, 2023 00:08
898dcc8
to
078f6ff
Compare
Capital-Asterisk
force-pushed
the
reorganize-lol
branch
from
September 25, 2023 00:22
078f6ff
to
7d38f02
Compare
Comment on lines
+37
to
+90
/** | ||
* @brief Integer wrapper intended for identifiers usable as container indices/keys | ||
* | ||
* Default-initialized to null (max int value) | ||
* | ||
* @tparam INT_T Wrapped integer type, usually unsigned | ||
* @tparam DUMMY_T Dummy used to make separate unique types, avoids needing inheritance | ||
*/ | ||
template <typename INT_T, typename DUMMY_T> | ||
struct StrongId | ||
{ | ||
using entity_type = INT_T; // Name used for entt compatibility | ||
|
||
constexpr StrongId() noexcept = default; | ||
constexpr StrongId(StrongId const& copy) noexcept | ||
: m_value{copy.m_value} | ||
{ }; | ||
constexpr explicit StrongId(INT_T const value) noexcept | ||
: m_value{value} | ||
{ }; | ||
|
||
constexpr explicit operator std::size_t() const noexcept | ||
{ | ||
return m_value; | ||
} | ||
|
||
constexpr explicit operator INT_T() const noexcept | ||
{ | ||
return m_value; | ||
} | ||
|
||
constexpr auto operator<=>(StrongId const&) const = default; | ||
|
||
INT_T m_value{ lgrn::id_null<StrongId>() }; | ||
}; | ||
|
||
} // namespace osp | ||
|
||
// std::hash support for unordered containers | ||
template <typename INT_T, typename DUMMY_T> | ||
struct std::hash<osp::StrongId<INT_T, DUMMY_T>> { | ||
constexpr auto operator() (osp::StrongId<INT_T, DUMMY_T> const& key) const | ||
{ | ||
return key.m_value; | ||
} | ||
}; | ||
|
||
// Longeron++ underlying_int_type | ||
template<typename TYPE_T> | ||
struct lgrn::underlying_int_type< TYPE_T, std::enable_if_t< std::is_integral_v<typename TYPE_T::entity_type> > > | ||
{ | ||
using type = typename TYPE_T::entity_type; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New StrongId class. Adding move constructors breaks on msvc for some reason, but move constructors don't really have an effect anyways.
jonesmz
approved these changes
Sep 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It was getting difficult to navigate as lots of code was in the wrong place. This reorganizes the directory structure and moves some code around to stay sane.
The
src/osp
directory now has 10 subdirectories:core, tasks, universe, scientific, vehicles, link, activescene, drawing, util, drawing_gl
which depend on each other in a clean way:src/osp
,src/adera
, andsrc/ospnewton
is used 'as a library' by the test applicationsrc/testapp
to make the executable.Other important changes: