Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ServiceProperty.h
Go to the documentation of this file.
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/* ServiceProperty.h (C) 2000-2022 */
9/* */
10/* Properties of a service. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_SERVICEPROPERTY_H
13#define ARCANE_SERVICEPROPERTY_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28/*!
29 * \brief Properties for service factories.
30 *
31 * These are flags used with the binary OR operator (|).
32 */
34{
35 //! No specific property
37 //! Indicates that the service is a singleton
39 //! Indicates that the service loads automatically.
41};
42
43/*---------------------------------------------------------------------------*/
44/*---------------------------------------------------------------------------*/
45
46/*!
47 * \brief Service type.
48 *
49 * This enumeration allows knowing where a service can be created.
50 *
51 * These are flags used with the binary OR operator (|).
52 * A service can therefore be available in several places. For example,
53 * it can be present as a dataset option (#ST_CaseOption) and also
54 * at the subdomain level (#ST_SubDomain). In this latter case,
55 * it can be created via the ServiceBuilder class.
56 *
57 * \note This type must correspond to the corresponding C# type
58 */
60{
61 ST_None = 0,
62 //! The service is used at the application level
64 //! The service is used at the session level
66 //! The service is used at the subdomain level
68 //! The service is used at the dataset level.
70 // NOTE: This value is not yet used.
71 //! The service is used with an explicitly specified mesh.
73};
74
75/*---------------------------------------------------------------------------*/
76/*---------------------------------------------------------------------------*/
77
78/*!
79 * \brief Service creation properties.
80 *
81 * This class is used in service registration macros
82 * and can therefore be instantiated as a global variable before entering
83 * the code's main(). It should therefore only contain Plain Object Data (POD) fields.
84 *
85 * Generally, instances of this class are used when
86 * registering a service via the ARCANE_REGISTER_SERVICE() macro.
87 *
88 * In the constructor, the \a type and \a properties parameters
89 * can use a combination of enumerated values. For example,
90 * to specify a service that can be used both in the
91 * dataset and at the subdomain level, you can do the following:
92 *
93 * \code
94 * ServiceProperty("ServiceName",ST_SubDomain|ST_CaseOption);
95 * \endcode
96 */
97class ARCANE_CORE_EXPORT ServiceProperty
98{
99 public:
100
101 /*!
102 * \brief Constructs an instance for a service named \a aname and of type \a atype
103 * with properties \a properties.
104 */
105 ServiceProperty(const char* aname, int atype, eServiceFactoryProperties aproperties) ARCANE_NOEXCEPT
106 : m_name(aname)
107 , m_type(atype)
108 , m_properties(aproperties)
109 {
110 }
111
112 //! Constructs an instance for a service named \a aname and of type \a atype
113 ServiceProperty(const char* aname, int atype) ARCANE_NOEXCEPT
114 : m_name(aname)
115 , m_type(atype)
116 , m_properties(SFP_None)
117 {
118 }
119
120 //! Constructs an instance for a service named \a aname and of type \a atype
121 ServiceProperty(const char* aname, eServiceType atype) ARCANE_NOEXCEPT
122 : m_name(aname)
123 , m_type((int)atype)
124 , m_properties(SFP_None)
125 {
126 }
127
128 public:
129
130 //! Service name.
131 const char* name() const { return m_name; }
132
133 //! Service type (combination of eServiceType)
134 int type() const { return m_type; }
135
136 //! Service properties (combination of eServiceFactoryProperties)
137 eServiceFactoryProperties properties() const { return m_properties; }
138
139 private:
140
141 const char* m_name;
142 int m_type;
143 eServiceFactoryProperties m_properties;
144};
145
146/*---------------------------------------------------------------------------*/
147/*---------------------------------------------------------------------------*/
148
149} // namespace Arcane
150
151/*---------------------------------------------------------------------------*/
152/*---------------------------------------------------------------------------*/
153
154#endif
Arcane configuration file.
const char * name() const
Service name.
ServiceProperty(const char *aname, int atype, eServiceFactoryProperties aproperties) ARCANE_NOEXCEPT
Constructs an instance for a service named aname and of type atype with properties properties.
eServiceFactoryProperties properties() const
Service properties (combination of eServiceFactoryProperties).
ServiceProperty(const char *aname, int atype) ARCANE_NOEXCEPT
Constructs an instance for a service named aname and of type atype.
ServiceProperty(const char *aname, eServiceType atype) ARCANE_NOEXCEPT
Constructs an instance for a service named aname and of type atype.
int type() const
Service type (combination of eServiceType).
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
eServiceFactoryProperties
Properties for service factories.
@ SFP_Autoload
Indicates that the service loads automatically.
@ SFP_None
No specific property.
@ SFP_Singleton
Indicates that the service is a singleton.
eServiceType
Service type.
@ ST_Application
The service is used at the application level.
@ ST_CaseOption
The service is used at the dataset level.
@ ST_Session
The service is used at the session level.
@ ST_Mesh
The service is used with an explicitly specified mesh.
@ ST_SubDomain
The service is used at the subdomain level.