SpiecsEngine
 
Loading...
Searching...
No Matches
Tree.h
Go to the documentation of this file.
1/**
2* @file Tree.h.
3* @brief The Tree Class Definitions and Implementation.
4* @author Spices.
5*/
6
7#pragma once
8#include "Core/Core.h"
9
10namespace scl {
11
12 /**
13 * @brief simple tree.
14 * @tparam T specific stored type.
15 */
16 template<typename T>
17 class tree
18 {
19 private:
20
21 /**
22 * @brief Children node.
23 */
25
26 /**
27 * @brief This node stored data.
28 */
30
31 public:
32
33 /**
34 * @brief Constructor Function.
35 */
36 template<typename ...Args>
37 tree(Args&&... args)
38 : m_Data{ std::forward<Args>(args)... }
39 , m_Childs{}
40 {}
41
42 /**
43 * @brief Destructor Function.
44 */
45 virtual ~tree() = default;
46
47 /**
48 * @brief Add a child to this tree.
49 * @param[in] args T construct params.
50 */
51 template<typename ...Args>
52 tree* AddChild(Args&&... args)
53 {
54 m_Childs.push_back(std::make_unique<tree>(std::forward<Args>(args)...));
55
56 return m_Childs[m_Childs.size() - 1].get();
57 }
58
59 /**
60 * @brief Get all this node children.
61 * @return Returns all this node children.
62 */
63 const std::vector<std::unique_ptr<tree>>& GetChilds() const { return m_Childs; }
64
65 /**
66 * @breif Get this node data.
67 * @return Returns this node data.
68 */
69 T& GetData() { return m_Data; }
70 };
71}
#define ICON_TEXT(icon, text)
Definition ImguiHelper.h:24
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
This Class is the basic Event Class. Inherit from it and create specific event class.
Definition Event.h:96
FrameInfo Class. This class defines the FrameInfo data.
Definition FrameInfo.h:32
static void Checkbox(bool *isChecked)
ImGuiHelper Style Checkbox.
The ImGuiH Class. This class defines helper function for slate render.
Definition ImguiHelper.h:61
virtual void OnRender() override
This interface is called On SlateRenderer Render.
virtual ~ImguiRendererProfilerHUD() override=default
Destructor Function.
virtual void OnUpdate(TimeStep &ts) override
This interface is called On SlateSystem Update.
virtual void OnEvent(Event &event) override
This interface is called on global event function pointer execute.
ImguiRendererProfilerHUD(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
void End()
End a slate.
ImguiSlate(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function. Init with Slate's name.
Definition ImguiUtils.h:35
This Class defines the basic behaves of specific slate. When we add an new Slate, we need inherit fro...
Definition ImguiUtils.h:27
RendererManager Class. This class Manages all renderer.
Renderer Class. This class defines the basic behaves of renderer. When we add an new Renderer,...
Definition Renderer.h:57
This Class handles our engine time step during frames. Global Unique.
Definition TimeStep.h:22
tree(Args &&... args)
Constructor Function.
Definition Tree.h:37
const std::vector< std::unique_ptr< tree > > & GetChilds() const
Get all this node children.
Definition Tree.h:63
T m_Data
This node stored data.
Definition Tree.h:29
virtual ~tree()=default
Destructor Function.
std::vector< std::unique_ptr< tree > > m_Childs
Children node.
Definition Tree.h:24
T & GetData()
Definition Tree.h:69
tree * AddChild(Args &&... args)
Add a child to this tree.
Definition Tree.h:52
simple tree.
Definition Tree.h:18