Skip to content

Commit

Permalink
fixed undefined reference and added getNumGroups to SSGManager
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorier committed Jan 25, 2024
1 parent f759a48 commit d190447
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/bedrock/SSGManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ class SSGManager {
*/
std::shared_ptr<NamedDependency> getGroup(uint32_t index) const;

/**
* @brief Get the number of groups.
*/
size_t getNumGroups() const;

/**
* @brief Resolve an address starting with ssg://
* These address may be:
Expand Down
1 change: 1 addition & 0 deletions python/src/py-bedrock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ PYBIND11_MODULE(pybedrock_server, m) {

py11::class_<SSGManager> (m, "SSGManager")
.def_property_readonly("config", &SSGManager::getCurrentConfig)
.def_property_readonly("num_groups", &SSGManager::getNumGroups)
.def("get_group", [](const SSGManager& ssg, const std::string& name) {
return ssg.getGroup(name);
}, "name_a")
Expand Down
18 changes: 18 additions & 0 deletions src/SSGManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,24 @@ std::shared_ptr<NamedDependency> SSGManager::getGroup(const std::string& group_n
#endif
}

std::shared_ptr<NamedDependency> SSGManager::getGroup(uint32_t group_index) const {
#ifdef ENABLE_SSG
if(group_index >= self->m_ssg_groups.size()) return nullptr;
return self->m_ssg_groups[group_index];
#else
(void)group_index;
return nullptr;
#endif
}

size_t SSGManager::getNumGroups() const {
#ifdef ENABLE_SSG
return self->m_ssg_groups.size();
#else
return 0;
#endif
}

std::shared_ptr<NamedDependency>
SSGManager::createGroup(const std::string& name,
const ssg_group_config_t* config,
Expand Down

0 comments on commit d190447

Please sign in to comment.