Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
VariantBase.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/* VariantBase.h (C) 2000-2025 */
9/* */
10/* Base class for polymorphic types. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13#ifndef ARCANE_CORE_DATATYPE_VARIANTBASE_H
14#define ARCANE_CORE_DATATYPE_VARIANTBASE_H
15/*---------------------------------------------------------------------------*/
16/*---------------------------------------------------------------------------*/
17
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
33class ARCANE_DATATYPE_EXPORT VariantBase
34{
35 public:
36
37 enum eType
38 {
39 TReal = 0,
40 TInt32 = 1,
41 TInt64 = 2,
42 TBool = 3,
43 TString = 4,
44 TReal2 = 5,
45 TReal3 = 6,
46 TReal2x2 = 7,
47 TReal3x3 = 8,
48 TUnknown = 9
49 };
50
51 public:
52
53 VariantBase(Integer dim, eType atype)
54 : m_dim(dim)
55 , m_type(atype)
56 {}
57 virtual ~VariantBase() {}
58
59 public:
60
68 Integer dimension() const { return m_dim; }
69 eType type() const { return m_type; }
70 const char* typeName() const { return typeName(m_type); }
71 static const char* typeName(eType type);
72 static eType fromDataType(eDataType type);
73
74 protected:
75
77 eType m_type;
78};
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
82
83} // namespace Arcane
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
87
88#endif
File containing the definitions of data types managed by Arcane.
Integer m_dim
variant dimension.
Definition VariantBase.h:76
eType m_type
Guaranteed valid type of the value.
Definition VariantBase.h:77
Integer dimension() const
Variant dimension.
Definition VariantBase.h:68
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.