Arcane  v3.14.11.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
Dispatchers.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 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/* Dispatchers.h (C) 2000-2024 */
9/* */
10/* Conteneur des dispatchers. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_MESSAGEPASSING_DISPATCHERS_H
13#define ARCCORE_MESSAGEPASSING_DISPATCHERS_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/message_passing/IDispatchers.h"
18
19#include "arccore/base/BuiltInDataTypeContainer.h"
20
21/*---------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
25{
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29/*!
30 * \brief Interface du conteneur des dispatchers.
31 */
32class ARCCORE_MESSAGEPASSING_EXPORT Dispatchers
33: public IDispatchers
34{
35 private:
36
37 template <typename DataType>
38 class ContainerTraits
39 {
40 public:
41
42 using InstanceType = ITypeDispatcher<DataType>*;
43 };
44
45 public:
46
48 ~Dispatchers() override;
49
50 public:
51
52 ITypeDispatcher<char>* dispatcher(char* v) override { return m_container.instance(v); }
53 ITypeDispatcher<signed char>* dispatcher(signed char* v) override { return m_container.instance(v); }
54 ITypeDispatcher<unsigned char>* dispatcher(unsigned char* v) override { return m_container.instance(v); }
55 ITypeDispatcher<short>* dispatcher(short* v) override { return m_container.instance(v); }
56 ITypeDispatcher<unsigned short>* dispatcher(unsigned short* v) override { return m_container.instance(v); }
57 ITypeDispatcher<int>* dispatcher(int* v) override { return m_container.instance(v); }
58 ITypeDispatcher<unsigned int>* dispatcher(unsigned int* v) override { return m_container.instance(v); }
59 ITypeDispatcher<long>* dispatcher(long* v) override { return m_container.instance(v); }
60 ITypeDispatcher<unsigned long>* dispatcher(unsigned long* v) override { return m_container.instance(v); }
61 ITypeDispatcher<long long>* dispatcher(long long* v) override { return m_container.instance(v); }
62 ITypeDispatcher<unsigned long long>* dispatcher(unsigned long long* v) override { return m_container.instance(v); }
63 ITypeDispatcher<float>* dispatcher(float* v) override { return m_container.instance(v); }
64 ITypeDispatcher<double>* dispatcher(double* v) override { return m_container.instance(v); }
65 ITypeDispatcher<long double>* dispatcher(long double* v) override { return m_container.instance(v); }
66 ITypeDispatcher<BFloat16>* dispatcher(BFloat16* v) override { return m_container.instance(v); }
67 ITypeDispatcher<Float16>* dispatcher(Float16* v) override { return m_container.instance(v); }
68
69 IControlDispatcher* controlDispatcher() override { return m_control; }
70 ISerializeDispatcher* serializeDispatcher() override { return m_serialize; }
71
72 public:
73
74 template <typename DataType> void setDispatcher(ITypeDispatcher<DataType>* x)
75 {
76 DataType* ptr = nullptr;
77 m_container.instance(ptr) = x;
78 }
79
80 void setDispatcher(IControlDispatcher* x) { m_control = x; }
81 void setDispatcher(ISerializeDispatcher* x) { m_serialize = x; }
82
83 //! Indique si lors de la destruction on appelle l'opérateur delete sur les instances (faux par défaut)
84 void setDeleteDispatchers(bool v) { m_is_delete_dispatchers = v; }
85
86 private:
87
89
90 IControlDispatcher* m_control = nullptr;
91 ISerializeDispatcher* m_serialize = nullptr;
92
93 bool m_is_delete_dispatchers = false;
94
95 private:
96};
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
100
101} // End namespace Arccore::MessagePassing
102
103/*---------------------------------------------------------------------------*/
104/*---------------------------------------------------------------------------*/
105
106#endif
Conteneur contenant une instance d'une classe par type de donnée.
Type flottant demi-précision.
Interface du conteneur des dispatchers.
Definition Dispatchers.h:34
void setDeleteDispatchers(bool v)
Indique si lors de la destruction on appelle l'opérateur delete sur les instances (faux par défaut)
Definition Dispatchers.h:84
Interface du conteneur des dispatchers.
Interface des messages de sérialisation.
Espace de nommage contenant les types et déclarations qui gèrent le mécanisme de parallélisme par éch...