SGCT master (487fac4)
Simple Graphics Cluster Toolkit
Loading...
Searching...
No Matches
clustermanager.h
Go to the documentation of this file.
1/*****************************************************************************************
2 * SGCT *
3 * Simple Graphics Cluster Toolkit *
4 * *
5 * Copyright (c) 2012-2026 *
6 * For conditions of distribution and use, see copyright notice in LICENSE.md *
7 ****************************************************************************************/
8
9#ifndef __SGCT__CLUSTERMANAGER__H__
10#define __SGCT__CLUSTERMANAGER__H__
11
12#include <sgct/sgctexports.h>
13
14#include <sgct/math.h>
15#include <memory>
16#include <string>
17#include <string_view>
18#include <vector>
19
20namespace sgct {
21
22namespace config { struct Cluster; }
23class Node;
24class User;
25
30class SGCT_EXPORT ClusterManager {
31public:
32 static ClusterManager& instance();
33 static void create(const config::Cluster& cluster, int clusterID);
34 static void destroy();
35
44 const Node& node(int index) const;
45
53
60 const Node& thisNode() const;
61
69
76 User* user(std::string_view name);
77
85
89 int numberOfNodes() const;
90
94 const mat4& sceneTransform() const;
95
99 int thisNodeId() const;
100
104 const std::string& masterAddress() const;
105
110
115
119 void setUseIgnoreSync(bool state);
120
124 bool ignoreSync() const;
125
126private:
127 ClusterManager(const config::Cluster& cluster, int clusterID);
128 ClusterManager(const ClusterManager&) = delete;
129 ClusterManager(ClusterManager&&) = delete;
130 ClusterManager& operator=(const ClusterManager&) = delete;
131 ClusterManager& operator=(ClusterManager&&) = delete;
132
133 ~ClusterManager();
134
135 static ClusterManager* _instance;
136
137 const int _thisNodeId;
138 bool _firmFrameLockSync;
139 bool _ignoreSync = false;
140 std::string _masterAddress;
141
142 std::vector<std::unique_ptr<Node>> _nodes;
143 std::vector<std::unique_ptr<User>> _users;
144 mat4 _sceneTransform = mat4(1.f);
145};
146
147} // namespace sgct
148
149#endif // __SGCT__CLUSTERMANAGER__H__
static void create(const config::Cluster &cluster, int clusterID)
void setUseIgnoreSync(bool state)
Set if software sync between nodes should be ignored.
int numberOfNodes() const
bool ignoreSync() const
Get if software sync between nodes is disabled.
User & defaultUser()
Get the default user.
static ClusterManager & instance()
const Node & thisNode() const
Get the current node.
Node & thisNode()
Get the current node.
bool firmFrameLockSyncStatus() const
User * user(std::string_view name)
Get the user with the specific name.
User * trackedUser()
Get the tracked user.
static void destroy()
const mat4 & sceneTransform() const
const Node & node(int index) const
Get a pointer to a specific node.
void setFirmFrameLockSyncStatus(bool state)
const std::string & masterAddress() const
int thisNodeId() const
Definition node.h:24
Helper class for setting user variables.
Definition user.h:24
Definition clustermanager.h:22
Definition actions.h:16
Definition config.h:453
Definition math.h:89