Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::writers::structure::StructureWriterFactory Class Reference

Factory registry for all atomic structure writers. More...

#include <StructureWriterFactory.hpp>

Public Member Functions

bool registerWriter (std::unique_ptr< BaseStructureWriter > writer)
 Registers a new structure writer instance.
BaseStructureWriter * getWriterForExtension (std::string_view extension) const
 Finds a writer matching a file extension.
BaseStructureWriter * getWriterForFormat (std::string_view format) const
 Finds a writer matching a format identifier.
std::vector< std::string > getSupportedFormats () const
 Returns names of all registered structure formats.
std::vector< std::string > getSupportedExtensions () const
 Returns list of all registered file extensions.

Static Public Member Functions

static StructureWriterFactory & instance ()
 Returns the global singleton factory instance.
template<typename T>
static bool registerTypeSafe (const char *name) noexcept
 Static helper to register a writer type safely without throwing during static init.

Private Member Functions

 StructureWriterFactory ()=default
 ~StructureWriterFactory ()=default
 StructureWriterFactory (const StructureWriterFactory &)=delete
StructureWriterFactory & operator= (const StructureWriterFactory &)=delete
 StructureWriterFactory (StructureWriterFactory &&)=delete
StructureWriterFactory & operator= (StructureWriterFactory &&)=delete

Private Attributes

std::vector< std::unique_ptr< BaseStructureWriter > > writers_
std::map< std::string, BaseStructureWriter * > extension_map_
std::map< std::string, BaseStructureWriter * > format_map_

Detailed Description

Factory registry for all atomic structure writers.

Constructor & Destructor Documentation

◆ StructureWriterFactory() [1/3]

correlation::writers::structure::StructureWriterFactory::StructureWriterFactory ( )
privatedefault
Here is the caller graph for this function:

◆ ~StructureWriterFactory()

correlation::writers::structure::StructureWriterFactory::~StructureWriterFactory ( )
privatedefault

◆ StructureWriterFactory() [2/3]

correlation::writers::structure::StructureWriterFactory::StructureWriterFactory ( const StructureWriterFactory & )
privatedelete
Here is the call graph for this function:

◆ StructureWriterFactory() [3/3]

correlation::writers::structure::StructureWriterFactory::StructureWriterFactory ( StructureWriterFactory && )
privatedelete
Here is the call graph for this function:

Member Function Documentation

◆ getSupportedExtensions()

std::vector< std::string > correlation::writers::structure::StructureWriterFactory::getSupportedExtensions ( ) const
nodiscard

Returns list of all registered file extensions.

Returns
Vector of extensions.

◆ getSupportedFormats()

std::vector< std::string > correlation::writers::structure::StructureWriterFactory::getSupportedFormats ( ) const
nodiscard

Returns names of all registered structure formats.

Returns
Vector of format names.

◆ getWriterForExtension()

BaseStructureWriter * correlation::writers::structure::StructureWriterFactory::getWriterForExtension ( std::string_view extension) const
nodiscard

Finds a writer matching a file extension.

Parameters
[in]extensionFile extension (e.g. ".poscar", "vasp", ".cell").
Returns
Non-owning pointer to writer, or nullptr if unsupported.
Here is the caller graph for this function:

◆ getWriterForFormat()

BaseStructureWriter * correlation::writers::structure::StructureWriterFactory::getWriterForFormat ( std::string_view format) const
nodiscard

Finds a writer matching a format identifier.

Parameters
[in]formatFormat name (e.g. "poscar", "vasp", "cif", "cell", "car").
Returns
Non-owning pointer to writer, or nullptr if unsupported.

◆ instance()

StructureWriterFactory & correlation::writers::structure::StructureWriterFactory::instance ( )
static

Returns the global singleton factory instance.

Returns
Reference to StructureWriterFactory.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

StructureWriterFactory & correlation::writers::structure::StructureWriterFactory::operator= ( const StructureWriterFactory & )
privatedelete
Here is the call graph for this function:

◆ operator=() [2/2]

StructureWriterFactory & correlation::writers::structure::StructureWriterFactory::operator= ( StructureWriterFactory && )
privatedelete
Here is the call graph for this function:

◆ registerTypeSafe()

template<typename T>
bool correlation::writers::structure::StructureWriterFactory::registerTypeSafe ( const char * name)
inlinestaticnoexcept

Static helper to register a writer type safely without throwing during static init.

Template Parameters
TConcrete writer type deriving from BaseStructureWriter.
Parameters
[in]nameDebug name of the writer for error diagnostics.
Returns
true if registration succeeded.
Here is the call graph for this function:

◆ registerWriter()

bool correlation::writers::structure::StructureWriterFactory::registerWriter ( std::unique_ptr< BaseStructureWriter > writer)

Registers a new structure writer instance.

Parameters
[in]writerOwning pointer to the writer instance.
Returns
true if successfully registered, false on collision.
Here is the caller graph for this function:

Member Data Documentation

◆ extension_map_

std::map<std::string, BaseStructureWriter *> correlation::writers::structure::StructureWriterFactory::extension_map_
private

◆ format_map_

std::map<std::string, BaseStructureWriter *> correlation::writers::structure::StructureWriterFactory::format_map_
private

◆ writers_

std::vector<std::unique_ptr<BaseStructureWriter> > correlation::writers::structure::StructureWriterFactory::writers_
private

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