12#ifndef ARCANE_CORE_DATATYPE_SCALARVARIANT_H
13#define ARCANE_CORE_DATATYPE_SCALARVARIANT_H
17#include "arcane/utils/String.h"
18#include "arcane/utils/Real2.h"
19#include "arcane/utils/Real3.h"
20#include "arcane/utils/Real2x2.h"
21#include "arcane/utils/Real3x3.h"
23#include "arcane/core/datatype/VariantBase.h"
37class ARCANE_DATATYPE_EXPORT ScalarVariant
44 ScalarVariant(
const ScalarVariant& v);
45 ScalarVariant(
Real v);
46 ScalarVariant(
Real2 v);
47 ScalarVariant(
Real3 v);
50 ScalarVariant(
Int32 v);
51 ScalarVariant(
Int64 v);
52 ScalarVariant(
bool v);
53 ScalarVariant(
const String& v);
56 ScalarVariant& operator= (
const ScalarVariant& v);
58 bool isInteger()
const {
return m_type==TInt32 ||
m_type==TInt64; }
60 void setValue(
Real v) { m_real_value = v;
m_type = TReal; }
61 void setValue(
Real2 v) { m_real2_value = v;
m_type = TReal2; }
62 void setValue(
Real3 v) { m_real3_value = v;
m_type = TReal3; }
63 void setValue(
Real2x2 v) { m_real2x2_value = v;
m_type = TReal2x2; }
64 void setValue(
Real3x3 v) { m_real3x3_value = v;
m_type = TReal3x3; }
65 void setValue(
Int32 v) { m_int32_value = v;
m_type = TInt32; }
66 void setValue(
Int64 v) { m_int64_value = v;
m_type = TInt64; }
67 void setValue(
bool v) { m_bool_value = v;
m_type = TBool; }
68 void setValue(
const String& v) { m_string_value = v;
m_type = TString; }
70 void value(
Real& v)
const { v = m_real_value; }
71 void value(
Real2& v)
const { v = m_real2_value; }
72 void value(
Real3& v)
const { v = m_real3_value; }
73 void value(
Real2x2& v)
const { v = m_real2x2_value; }
74 void value(
Real3x3& v)
const { v = m_real3x3_value; }
75 void value(
Int32& v)
const { v = m_int32_value; }
76 void value(
Int64& v)
const { v = m_int64_value; }
77 void value(
bool& v)
const { v = m_bool_value; }
78 void value(
String& v)
const { v = m_string_value; }
80 Real asReal()
const {
return m_real_value; }
81 Real2 asReal2()
const {
return m_real2_value; }
82 Real3 asReal3()
const {
return m_real3_value; }
83 Real2x2 asReal2x2()
const {
return m_real2x2_value; }
84 Real3x3 asReal3x3()
const {
return m_real3x3_value; }
86 Int32 asInt32()
const {
return m_int32_value; }
87 Int64 asInt64()
const {
return m_int64_value; }
88 bool asBool()
const {
return m_bool_value; }
89 const String& asString()
const {
return m_string_value; }
Classe gérant un vecteur réel 2-dimensionnel.
Classe gérant une matrice 2x2 de réels.
Classe gérant un vecteur réel de 3 dimensions.
Classe gérant une matrice réelle 3x3.
Chaîne de caractères unicode.
eType m_type
Type garanti valide de la valeur.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
double Real
Type représentant un réel.
std::int32_t Int32
Type entier signé sur 32 bits.