Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
LitteralExpressionImpl.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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/* LitteralExpressionImpl.cc (C) 2000-2022 */
9/* */
10/* Implémentation d'une expression littérale contenant un scalaire. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14
15#include "arcane/utils/ArcanePrecomp.h"
16
17#include "arcane/expr/LitteralExpressionImpl.h"
18#include "arcane/expr/OperatorMng.h"
19#include "arcane/expr/BadOperationException.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24namespace Arcane
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30LitteralExpressionImpl::
31LitteralExpressionImpl(const ScalarVariant& value)
32: ExpressionImpl()
33, m_value(value)
34{
35}
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39
40void LitteralExpressionImpl::
41apply(ExpressionResult* result)
42{
43 // cerr << ">> BEGIN LITTERAL EXPRESSION [" << *result << "]\n";
44
45 // recherche de l'operateur en fonction du type attendu en resultat
46 ScalarVariant::eType type = m_value.type();
47 LitteralOperator* op = m_op_mng->find(this, type);
48 if (!op)
49 throw BadOperationException("LitteralExpressionImpl::apply","",type);
50
51 op->evaluate(result, m_value);
52
53 // cerr << "<< END LITTERAL EXPRESSION [" << *result << "]\n";
54}
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
59} // End namespace Arcane
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-