Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
EntryPointMng.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/* EntryPointMng.cc (C) 2000-2023 */
9/* */
10/* Entry Point Manager. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/List.h"
15#include "arcane/utils/Iostream.h"
16#include "arcane/utils/String.h"
17#include "arcane/utils/TraceAccessor.h"
18
20#include "arcane/core/IEntryPointMng.h"
21#include "arcane/core/IEntryPoint.h"
22#include "arcane/core/ISubDomain.h"
23#include "arcane/core/IModule.h"
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
37class EntryPointMng
38: public TraceAccessor
39, public IEntryPointMng
40{
41 public:
42
43 explicit EntryPointMng(ISubDomain*);
44 ~EntryPointMng() override;
45
46 public:
47
48 void addEntryPoint(IEntryPoint*) override;
49 void dumpList(std::ostream&) override;
50 IEntryPoint* findEntryPoint(const String& s) override;
51 IEntryPoint* findEntryPoint(const String& module_name, const String& s) override;
53
54 private:
55
57};
58
59/*---------------------------------------------------------------------------*/
60/*---------------------------------------------------------------------------*/
61
62extern "C++" IEntryPointMng*
63arcaneCreateEntryPointMng(ISubDomain* sd)
64{
65 return new EntryPointMng(sd);
66}
67
68/*---------------------------------------------------------------------------*/
69/*---------------------------------------------------------------------------*/
70
71EntryPointMng::
72EntryPointMng(ISubDomain* sd)
73: TraceAccessor(sd->traceMng())
74{
75}
76
77/*---------------------------------------------------------------------------*/
78/*---------------------------------------------------------------------------*/
79
80EntryPointMng::
81~EntryPointMng()
82{
84 delete *i;
85}
86
87/*---------------------------------------------------------------------------*/
88/*---------------------------------------------------------------------------*/
89
92{
93 log() << " Add an entry point <" << v->module()->name() << "::" << v->name() << ">";
94 m_entry_points.add(v);
95}
96
97/*---------------------------------------------------------------------------*/
98/*---------------------------------------------------------------------------*/
99
101dumpList(std::ostream& o)
102{
103 o << "** EntryPointMng::dump_list: " << m_entry_points.count();
104 o << '\n';
106 o << "** EntryPoint: " << (*i)->name();
107 o << '\n';
108 }
109}
110
111/*---------------------------------------------------------------------------*/
112/*---------------------------------------------------------------------------*/
113
115findEntryPoint(const String& s)
116{
118 if ((*i)->name() == s)
119 return *i;
120 return 0;
121}
122
123/*---------------------------------------------------------------------------*/
124/*---------------------------------------------------------------------------*/
125
127findEntryPoint(const String& module_name, const String& s)
128{
130 if ((*i)->name() == s && (*i)->module()->name() == module_name)
131 return *i;
132 return nullptr;
133}
134
135/*---------------------------------------------------------------------------*/
136/*---------------------------------------------------------------------------*/
137
138} // namespace Arcane
139
140/*---------------------------------------------------------------------------*/
141/*---------------------------------------------------------------------------*/
Declarations of Arcane's general types.
Entry Point Manager.
IEntryPoint * findEntryPoint(const String &s) override
Entry point by name s.
EntryPointCollection entryPoints() override
List of entry points.
void addEntryPoint(IEntryPoint *) override
Adds an entry point to the manager.
void dumpList(std::ostream &) override
Displays the list of entry points of the manager in \o.
EntryPointList m_entry_points
List of entry points.
Interface for the entry point manager.
Interface of a module entry point.
Definition IEntryPoint.h:35
virtual IModule * module() const =0
Returns the module associated with the entry point.
virtual String name() const =0
Returns the name of the entry point.
virtual String name() const =0
Module name.
Interface of the subdomain manager.
Definition ISubDomain.h:75
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
TraceMessage log() const
Flow for a log message.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
List< IEntryPoint * > EntryPointList
Array of entry points.
Collection< IEntryPoint * > EntryPointCollection
Collection of entry points.