Skip to content
Snippets Groups Projects
Commit 734e07fd authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

start to document the library

parent 93b71591
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "fggl/audio/null_audio.hpp" #include "fggl/audio/null_audio.hpp"
#include "fggl/audio/openal/module.hpp" #include "fggl/audio/openal/module.hpp"
//! Root namespace
namespace fggl { namespace fggl {
} }
......
...@@ -31,15 +31,36 @@ ...@@ -31,15 +31,36 @@
namespace fggl::modules { 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> template<typename T>
class DependencyGraph { class DependencyGraph {
public: public:
DependencyGraph() = default; DependencyGraph() = default;
/**
* Clear all currently stored dependencies.
*
* This method will result in the dependency graph being empty, with no known modules.
*/
void clear() { void clear() {
m_dependencies.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) { void addAll(const T &name, const std::vector<T> &dependencies) {
auto existing = m_dependencies.find(name); auto existing = m_dependencies.find(name);
if (existing == m_dependencies.end()) { if (existing == m_dependencies.end()) {
...@@ -49,6 +70,15 @@ namespace fggl::modules { ...@@ -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) { void add(const T &name, const T &depends) {
m_dependencies[name].push_back(depends); m_dependencies[name].push_back(depends);
} }
...@@ -103,6 +133,13 @@ namespace fggl::modules { ...@@ -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 { class Manager {
public: public:
Manager() = default; Manager() = default;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment