Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
VariableComputeFunction.h
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/* VariableComputeFunction.h (C) 2000-2013 */
9/* */
10/* Classe fonctor de recalcul d'une variable. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_VARIABLECOMPUTEFUNCTION_H
13#define ARCANE_VARIABLECOMPUTEFUNCTION_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/Functor.h"
18#include "arcane/utils/TraceInfo.h"
19
20#include "arcane/IVariableComputeFunction.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25ARCANE_BEGIN_NAMESPACE
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
35/*!
36 \brief Interface de la classe fonctor de recalcul d'une variable.
37 */
40{
41 public:
42
43 template<typename ClassType>
44 VariableComputeFunction(ClassType* instance,void (ClassType::*func)())
45 : m_functor(new FunctorT<ClassType>(instance,func))
46 {
47 }
48 template<typename ClassType>
49 VariableComputeFunction(ClassType* instance,void (ClassType::*func)(),const TraceInfo& tinfo)
50 : m_functor(new FunctorT<ClassType>(instance,func)), m_trace_info(tinfo)
51 {
52 }
53
54 //! Libère les ressources
56 {
57 delete m_functor;
58 }
59
60 public:
61
62 //! Exécute la fonction de calcul
63 virtual void execute()
64 {
65 m_functor->executeFunctor();
66 }
67
68 virtual const TraceInfo& traceInfo() const
69 {
70 return m_trace_info;
71 }
72
73 private:
74
75 IFunctor* m_functor;
76 TraceInfo m_trace_info;
77};
78
79/*---------------------------------------------------------------------------*/
80/*---------------------------------------------------------------------------*/
81
82ARCANE_END_NAMESPACE
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
87#endif
88
Interface de la classe fonctor de recalcul d'une variable.
Interface de la classe fonctor de recalcul d'une variable.
virtual const TraceInfo & traceInfo() const
Informations de trace de la définition de la fonction de calcul.
virtual void execute()
Exécute la fonction de calcul.
virtual ~VariableComputeFunction()
Libère les ressources.