Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
LitteralExpressionImpl.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/* LitteralExpressionImpl.cc (C) 2000-2022 */
9/* */
10/* Implementation of a literal expression containing a scalar. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/expr/LitteralExpressionImpl.h"
17#include "arcane/expr/OperatorMng.h"
18#include "arcane/expr/BadOperationException.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29LitteralExpressionImpl::
30LitteralExpressionImpl(const ScalarVariant& value)
32, m_value(value)
33{
34}
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
39void LitteralExpressionImpl::
40apply(ExpressionResult* result)
41{
42 // cerr << ">> BEGIN LITTERAL EXPRESSION [" << *result << "]\n";
43
44 // search for the operator based on the expected result type
45 ScalarVariant::eType type = m_value.type();
46 LitteralOperator* op = m_op_mng->find(this, type);
47 if (!op)
48 throw BadOperationException("LitteralExpressionImpl::apply", "", type);
49
50 op->evaluate(result, m_value);
51
52 // cerr << "<< END LITTERAL EXPRESSION [" << *result << "]\n";
53}
54
55/*---------------------------------------------------------------------------*/
56/*---------------------------------------------------------------------------*/
57
58} // End namespace Arcane
59
60/*---------------------------------------------------------------------------*/
61/*---------------------------------------------------------------------------*/
Base class for the expression implementation.
Polymorphic base type for scalars (dimension 0).
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --