Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
VariantBase.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/* VariantBase.cc (C) 2000-2004 */
9/* */
10/* Polymorphic base type for mono-dimensional arrays (dimension 1). */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/datatype/VariantBase.h"
17
18/*---------------------------------------------------------------------------*/
19/*---------------------------------------------------------------------------*/
20
21namespace Arcane
22{
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27ARCANE_DATATYPE_EXPORT const char* VariantBase::
28typeName(eType type)
29{
30 switch (type) {
31 case TReal:
32 return "Real";
33 case TInt32:
34 return "Int32";
35 case TInt64:
36 return "Int64";
37 case TBool:
38 return "Bool";
39 case TString:
40 return "String";
41 case TReal2:
42 return "Real2";
43 case TReal3:
44 return "Real3";
45 case TReal2x2:
46 return "Real2x2";
47 case TReal3x3:
48 return "Real3x3";
49 default:
50 break;
51 }
52 return "Unknown";
53}
54
55/*---------------------------------------------------------------------------*/
56/*---------------------------------------------------------------------------*/
57
58VariantBase::eType VariantBase::
59fromDataType(eDataType type)
60{
61 switch (type) {
62 case DT_Real:
63 return VariantBase::TReal;
64 case DT_Int32:
65 return VariantBase::TInt32;
66 case DT_Int64:
67 return VariantBase::TInt64;
68 case DT_String:
69 return VariantBase::TString;
70 case DT_Real2:
71 return VariantBase::TReal2;
72 case DT_Real3:
73 return VariantBase::TReal3;
74 case DT_Real2x2:
75 return VariantBase::TReal2x2;
76 case DT_Real3x3:
77 return VariantBase::TReal3x3;
78 default:
79 break;
80 }
81 return VariantBase::TUnknown;
82}
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
87} // namespace Arcane
88
89/*---------------------------------------------------------------------------*/
90/*---------------------------------------------------------------------------*/
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
eDataType
Data type.
Definition DataTypes.h:41
@ DT_Real2x2
2x2 tensor data type
Definition DataTypes.h:50
@ DT_Real3x3
3x3 tensor data type
Definition DataTypes.h:51
@ DT_Int32
32-bit integer data type
Definition DataTypes.h:45
@ DT_Real3
Vector 3 data type.
Definition DataTypes.h:49
@ DT_Int64
64-bit integer data type
Definition DataTypes.h:46
@ DT_String
UTF-8 character string data type.
Definition DataTypes.h:47
@ DT_Real2
Vector 2 data type.
Definition DataTypes.h:48
@ DT_Real
Real data type.
Definition DataTypes.h:43