| 1 |
// Copyright(C) 1999-, 20242024 National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
#pragma once |
| 8 |
|
| 9 |
#include "ioss_export.h" |
| 10 |
|
| 11 |
#include "Ioss_CodeTypes.h" |
| 12 |
#include <string> |
| 13 |
|
| 14 |
#include "Ioss_DBUsage.h" |
| 15 |
#include "Ioss_ParallelUtils.h" |
| 16 |
#include "Ioss_PropertyManager.h" |
| 17 |
|
| 18 |
#include <map> |
| 19 |
#include <vector> |
| 20 |
|
| 21 |
/** \brief The main namespace for the Ioss library. |
| 22 |
*/ |
| 23 |
namespace Ioss { |
| 24 |
|
| 25 |
class IOFactory; |
| 26 |
|
| 27 |
using NameList = Ioss::NameList; |
| 28 |
using IOFactoryMap = std::map<std::string, IOFactory *, std::less<>>; |
| 29 |
|
| 30 |
class DatabaseIO; |
| 31 |
|
| 32 |
/** \brief The main public user interface for creating Ioss::DatabaseIO objects. |
| 33 |
*/ |
| 34 |
class IOSS_EXPORT IOFactory |
| 35 |
{ |
| 36 |
public: |
| 37 |
virtual ~IOFactory() = default; |
| 38 |
IOSS_NODISCARD static DatabaseIO * |
| 39 |
create(const std::string &type, const std::string &filename, DatabaseUsage db_usage, |
| 40 |
Ioss_MPI_Comm communicator = Ioss::ParallelUtils::comm_world(), |
| 41 |
const Ioss::PropertyManager &properties = Ioss::PropertyManager()); |
| 42 |
|
| 43 |
static int describe(NameList *names); |
| 44 |
IOSS_NODISCARD static NameList describe(); |
| 45 |
static void clean(); |
| 46 |
IOSS_NODISCARD static std::string show_configuration(); |
| 47 |
|
| 48 |
protected: |
| 49 |
explicit IOFactory(const std::string &type); |
| 50 |
|
| 51 |
IOSS_NODISCARD virtual DatabaseIO *make_IO(const std::string &filename, DatabaseUsage db_usage, |
| 52 |
Ioss_MPI_Comm communicator, |
| 53 |
const Ioss::PropertyManager &properties) const = 0; |
| 54 |
|
| 55 |
IOSS_NODISCARD virtual std::string show_config() const { return {""}; } |
| 56 |
|
| 57 |
static void alias(const std::string &base, const std::string &syn); |
| 58 |
|
| 59 |
private: |
| 60 |
IOSS_NODISCARD static IOFactoryMap *registry(); |
| 61 |
}; |
| 62 |
} // namespace Ioss |