Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IFactoryService.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* IFactoryService.h (C) 2000-2025 */
9/* */
10/* Factory service interface. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_IFACTORYSERVICE_H
13#define ARCANE_CORE_IFACTORYSERVICE_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/IService.h"
18#include "arcane/core/ServiceBuildInfo.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29/*!
30 * \internal
31 * \brief Factory interface for a class implementing \a InterfaceType.
32 */
33template <typename InterfaceType>
34class IFactoryServiceT
35: public IService
36{
37 protected:
38
39 IFactoryServiceT() = default;
40
41 public:
42
43 /*!
44 * \brief Create an instance.
45 *
46 * The returned object is guaranteed not to be null.
47 */
48 virtual InterfaceType* createInstance() = 0;
49
50 /*!
51 * \brief Create an instance for the mesh \a mesh.
52 *
53 * Only subdomain services support this type of creation.
54 *
55 * The returned object is guaranteed not to be null.
56 */
57 virtual InterfaceType* createInstance(IMesh* mesh) = 0;
58
59 /*! \brief Create a singleton instance.
60 *
61 * The returned object is guaranteed not to be null. The returned instance
62 * is always the same.
63 */
64 virtual InterfaceType* singletonInstance() = 0;
65};
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
69
70} // namespace Arcane
71
72/*---------------------------------------------------------------------------*/
73/*---------------------------------------------------------------------------*/
74
75#endif
virtual InterfaceType * singletonInstance()=0
Create a singleton instance.
virtual InterfaceType * createInstance()=0
Create an instance.
virtual InterfaceType * createInstance(IMesh *mesh)=0
Create an instance for the mesh mesh.
IService()
Constructor.
Definition IService.h:44
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --