Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
Observer.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/* Observer.cc (C) 2000-2021 */
9/* */
10/* Observateur. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/Observer.h"
15#include "arcane/utils/FatalErrorException.h"
16#include "arcane/utils/TraceInfo.h"
17
18/*---------------------------------------------------------------------------*/
19/*---------------------------------------------------------------------------*/
20
21namespace Arcane
22{
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27AbstractObserver::
28~AbstractObserver()
29{
30 if (m_observable)
31 m_observable->detachObserver(this);
32}
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
39{
40 if (m_observable)
41 ARCANE_FATAL("Observer is already attached");
42 m_observable = obs;
43}
44
45/*---------------------------------------------------------------------------*/
46/*---------------------------------------------------------------------------*/
47
49detach()
50{
51 m_observable = 0;
52}
53
54/*---------------------------------------------------------------------------*/
55/*---------------------------------------------------------------------------*/
56
57} // End namespace Arcane
58
59/*---------------------------------------------------------------------------*/
60/*---------------------------------------------------------------------------*/
61
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
void detach() override
Se détache de l'observable.
Definition Observer.cc:49
void attachToObservable(IObservable *obs) override
S'attache à l'observable obs.
Definition Observer.cc:38
Interface d'un observable.
virtual void detachObserver(IObserver *obs)=0
Détache l'observateur obs de cette observable.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-