Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Game Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
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
Onuralp SEZER
Game Library
Commits
734e07fd
Commit
734e07fd
authored
2 years ago
by
Joseph Walton-Rivers
Browse files
Options
Downloads
Patches
Plain Diff
start to document the library
parent
93b71591
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/fggl/fggl.hpp
+1
-0
1 addition, 0 deletions
include/fggl/fggl.hpp
include/fggl/modules/manager.hpp
+37
-0
37 additions, 0 deletions
include/fggl/modules/manager.hpp
with
38 additions
and
0 deletions
include/fggl/fggl.hpp
+
1
−
0
View file @
734e07fd
...
...
@@ -29,6 +29,7 @@
#include
"fggl/audio/null_audio.hpp"
#include
"fggl/audio/openal/module.hpp"
//! Root namespace
namespace
fggl
{
}
...
...
This diff is collapsed.
Click to expand it.
include/fggl/modules/manager.hpp
+
37
−
0
View file @
734e07fd
...
...
@@ -31,15 +31,36 @@
namespace
fggl
::
modules
{
/**
* A class used for representing a Directed Acyclic Graph.
*
* This class is mostly used for establishing the loading order of classes for module loading.
*
* @tparam T the type being represented
*/
template
<
typename
T
>
class
DependencyGraph
{
public:
DependencyGraph
()
=
default
;
/**
* Clear all currently stored dependencies.
*
* This method will result in the dependency graph being empty, with no known modules.
*/
void
clear
()
{
m_dependencies
.
clear
();
}
/**
* Add a series of dependencies for an entry.
*
* If the entry does not already exist, this will create the entry before adding the dependencies to it.
* If the entry already exists, this will append the provided dependencies to its existing list.
*
* @param name the entry having dependencies added
* @param dependencies the things it depends on
*/
void
addAll
(
const
T
&
name
,
const
std
::
vector
<
T
>
&
dependencies
)
{
auto
existing
=
m_dependencies
.
find
(
name
);
if
(
existing
==
m_dependencies
.
end
())
{
...
...
@@ -49,6 +70,15 @@ namespace fggl::modules {
}
}
/**
* Add a single dependency to the graph.
*
* If the entry does not already exist, this will create the entry before adding the dependencies to it.
* If the entry already exists, this will append the provided dependencies to its existing list.
*
* @param name the entry which depends something else
* @param depends the thing it depends on
*/
void
add
(
const
T
&
name
,
const
T
&
depends
)
{
m_dependencies
[
name
].
push_back
(
depends
);
}
...
...
@@ -103,6 +133,13 @@ namespace fggl::modules {
}
};
/**
* Store and initialise modules present in the engine.
*
* This class is responsible for keeping track of which modules the library user has requested, and ensuring that
* their dependencies are loaded in the correct order. Once the dependency graph has been built and instances
* created, it is responsible for providing references to these initialised classes.
*/
class
Manager
{
public:
Manager
()
=
default
;
...
...
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