Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
VariableFactory.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/* VariableFactory.h C) 2000-2025 */
9/* */
10/* Factory for a variable of a given type. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CORE_VARIABLEFACTORY_H
13#define ARCANE_CORE_VARIABLEFACTORY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/String.h"
18
19#include "arcane/core/IVariableFactory.h"
20#include "arcane/core/VariableTypeInfo.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31/*!
32 * \internal
33 * \brief Registerer of a variable factory.
34 */
36: public IVariableFactory
37{
38 public:
39
40 /*!
41 * \brief Creates a variable factory.
42 *
43 * \param func function creating the variable
44 * \param item_kind kind of the variable entity
45 * \param data_type data type of the variable
46 * \param dimension dimension of the variable
47 * \param multi_tag tag indicating if it is a multi-sized array.
48 * \param is_partial indicates if it is a partial variable.
49 */
50 ARCCORE_DEPRECATED_2020("Use overload with 'VariableTypeInfo' argument")
52 eItemKind item_kind, Integer dimension, Integer multi_tag, bool is_partial);
53 VariableFactory(VariableFactoryFunc func, const VariableTypeInfo& var_type_info);
54
55 public:
56
57 VariableRef* createVariable(const VariableBuildInfo& name) override;
58 eItemKind itemKind() const override { return m_variable_type_info.itemKind(); }
59 eDataType dataType() const override { return m_variable_type_info.dataType(); }
60 Integer dimension() const override { return m_variable_type_info.dimension(); }
61 Integer multiTag() const override { return m_variable_type_info.multiTag(); }
62 bool isPartial() const { return m_variable_type_info.isPartial(); }
63 const String& fullTypeName() const override { return m_full_type_name; }
64 VariableTypeInfo variableTypeInfo() const override { return m_variable_type_info; }
65
66 private:
67
68 //! Creation function for IVariableFactoryFactory
69 VariableFactoryFunc m_function;
70
71 //! Information about the variable type
72 VariableTypeInfo m_variable_type_info;
73
74 //! Full name of the variable type
75 String m_full_type_name;
76};
77
78/*---------------------------------------------------------------------------*/
79/*---------------------------------------------------------------------------*/
80
81} // End namespace Arcane
82
83/*---------------------------------------------------------------------------*/
84/*---------------------------------------------------------------------------*/
85
86#endif
VariableFactoryVariableRefCreateFunc VariableFactoryFunc
Type of the function that creates the variable.
Parameters necessary for building a variable.
VariableTypeInfo variableTypeInfo() const override
Information about the variable type.
Integer multiTag() const override
Multi tag.
eItemKind itemKind() const override
Kind of the data variables created by this factory.
VariableFactory(VariableFactoryFunc func, eDataType data_type, eItemKind item_kind, Integer dimension, Integer multi_tag, bool is_partial)
Creates a variable factory.
VariableRef * createVariable(const VariableBuildInfo &name) override
Creates a variable with the build_info and returns its reference.
Integer dimension() const override
Dimension of the variable created by this factory.
eDataType dataType() const override
Data type of the variable created by this factory.
const String & fullTypeName() const override
Full name of the variable type.
Reference to a variable.
Definition VariableRef.h:56
Information characterizing the type of a variable.
constexpr bool isPartial() const
Indicates if the variable is partial.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
eItemKind
Mesh entity type.
eDataType
Data type.
Definition DataTypes.h:41