CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Graph.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Forward.hpp"
11
17
18namespace CeresEngine {
19
20 class Graph : public RefCounted<Graph> {
21 private:
23
24 public:
26
29
30 public:
31 explicit Graph() = default;
32 virtual ~Graph() noexcept = default;
33
34 public: // Node Management
36
39
41
42 template<typename T, typename... Args> [[nodiscard]] T& addNode(Args&&... args) requires(std::is_base_of_v<GraphNode, T>) {
43 const RC<T> node = ce_counted_new<T>(*this, std::forward<Args>(args)...);
44 addNode(*node);
45 return *node;
46 }
47
49
50 public: // Easy connections
52
53 public:
55 };
56
57} // namespace CeresEngine
A retain-release type of smart pointer.
Definition SmartPtr.hpp:132
Definition GraphConnection.hpp:19
Definition Graph.hpp:20
Event< void()> onChange
Definition Graph.hpp:25
virtual ~Graph() noexcept=default
T & addNode(Args &&... args)
Definition Graph.hpp:42
Vector< GraphNodePtr > mNodes
Definition Graph.hpp:22
GraphInstancePtr instantiate()
void addNode(GraphNode &node)
GraphNode * getNode(StringView name) const
GraphConnection * connect(GraphSocket &outputSocket, GraphSocket &inputSocket)
Event< void(GraphNode &)> onNodeRemoved
Definition Graph.hpp:28
Event< void(GraphNode &)> onNodeAdded
Definition Graph.hpp:27
void removeNode(GraphNode &node)
const Vector< GraphNodePtr > & getNodes() const noexcept
Definition Graph.hpp:38
Definition GraphNode.hpp:21
Definition GraphSocket.hpp:46
A simple reference counter base class.
Definition SmartPtr.hpp:438
Base template for the event class.
Definition Event.hpp:27
Definition Application.hpp:19
std::vector< T, ScopedAllocatorAdaptor< StdAllocator< T, RawAllocator > > > Vector
Vector is a sequence container that encapsulates dynamic size arrays.
Definition Vector.hpp:17
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25