Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
VariableFactoryRegisterer.cc
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/* VariableFactoryRegisterer.cc (C) 2000-2020 */
9/* */
10/* Singleton for registering a variable factory. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/core/VariableFactoryRegisterer.h"
17#include "arcane/core/VariableFactory.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28VariableFactoryRegisterer* arcaneFirstVariableFactory = nullptr;
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
35 const VariableTypeInfo& var_type_info)
36: m_function(func)
37, m_variable_type_info(var_type_info)
38, m_previous(nullptr)
39, m_next(nullptr)
40{
41 if (!arcaneFirstVariableFactory) {
42 arcaneFirstVariableFactory = this;
43 }
44 else {
45 VariableFactoryRegisterer* next = arcaneFirstVariableFactory->nextVariableFactory();
46 setNextVariableFactory(arcaneFirstVariableFactory);
47 arcaneFirstVariableFactory = this;
48 if (next)
50 }
51}
52
53/*---------------------------------------------------------------------------*/
54/*---------------------------------------------------------------------------*/
55
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
65VariableFactoryRegisterer* VariableFactoryRegisterer::
66firstVariableFactory()
67{
68 return arcaneFirstVariableFactory;
69}
70
71/*---------------------------------------------------------------------------*/
72/*---------------------------------------------------------------------------*/
73
74} // End namespace Arcane
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
Interface for a variable factory.
VariableFactoryVariableRefCreateFunc VariableFactoryFunc
Type of the function that creates the variable.
VariableFactoryFunc m_function
Creation function for IVariableFactoryFactory.
VariableFactoryRegisterer * m_previous
Previous VariableFactory.
IVariableFactory * createFactory()
Creates a factory for this variable type.
VariableFactoryRegisterer * m_next
Next VariableFactory.
void setNextVariableFactory(VariableFactoryRegisterer *s)
Positions the next VariableFactory.
VariableTypeInfo m_variable_type_info
Information about the variable type.
VariableFactoryRegisterer(VariableFactoryFunc func, const VariableTypeInfo &var_type_info)
void setPreviousVariableFactory(VariableFactoryRegisterer *s)
Positions the previous VariableFactory.
Registerer of a variable factory.
Information characterizing the type of a variable.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --