Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
Loading...
Searching...
No Matches
database::core::backend_registrar< BackendType > Class Template Reference

Helper class for automatic backend registration. More...

#include <backend_registry.h>

Collaboration diagram for database::core::backend_registrar< BackendType >:
Collaboration graph

Public Member Functions

 backend_registrar (const std::string &name)
 Constructor that registers the backend.
 

Detailed Description

template<typename BackendType>
class database::core::backend_registrar< BackendType >

Helper class for automatic backend registration.

This class uses static initialization to automatically register backends at program startup. Each backend implementation should create a static instance of this class.

Example Usage in backend implementation:

// postgresql_backend.cpp
namespace {
backend_registrar<postgresql_backend> registrar("postgresql");
}
Helper class for automatic backend registration.

This pattern ensures that all compiled-in backends are automatically registered without explicit initialization code.

Definition at line 202 of file backend_registry.h.

Constructor & Destructor Documentation

◆ backend_registrar()

template<typename BackendType >
database::core::backend_registrar< BackendType >::backend_registrar ( const std::string & name)
inlineexplicit

Constructor that registers the backend.

Parameters
nameBackend name for registration

Definition at line 209 of file backend_registry.h.

210 {
211 backend_registry::instance().register_backend(name, &BackendType::create);
212 }
static backend_registry & instance()
Get the singleton instance.
kcenon::common::VoidResult register_backend(const std::string &name, backend_factory_fn factory)
Register a backend factory function.

References database::core::backend_registry::instance(), and database::core::backend_registry::register_backend().

Here is the call graph for this function:

The documentation for this class was generated from the following file: