Belle II Software development
PersistenceManagerFactory Class Reference

A factory class that creates specific PersistenceManager objects. More...

#include <PersistenceManagerFactory.h>

Static Public Member Functions

static std::unique_ptr< PersistenceManagercreate (const std::string &storageType)
 Creates a PersistenceManager instance based on the specified storage type.
 

Detailed Description

A factory class that creates specific PersistenceManager objects.

This factory allows clients to create different concrete PersistenceManager implementations by specifying a storage type (e.g., histogram, ntuple, etc.).

Definition at line 22 of file PersistenceManagerFactory.h.

Member Function Documentation

◆ create()

std::unique_ptr< PersistenceManager > create ( const std::string & storageType)
static

Creates a PersistenceManager instance based on the specified storage type.

Parameters
storageTypeA string indicating the type of storage (e.g., "ntuple", "histogram").
Returns
A unique_ptr to a newly created PersistenceManager object.

The exact implementation (concrete class) returned depends on the provided storageType. If the type is not recognized, this function may return a null pointer or throw an exception (depending on the implementation).

Definition at line 17 of file PersistenceManagerFactory.cc.

18 {
19 if ("ntuple" == storageType) {
20 return std::make_unique<ConcreteVariablesToNtuplePersistenceManager>();
21 } else if ("histogram" == storageType) {
22 return std::make_unique<ConcreteVariablesToHistogramPersistenceManager>();
23 } else {
24 B2ERROR("Incorrect storage type.");
25 return nullptr;
26 }
27 }

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