Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
PropertyDeclarations.h
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/* PropertyDeclarations.h (C) 2000-2025 */
9/* */
10/* Declaration of types and macros for property management. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_COMMON_INTERNAL_PROPERTYDECLARATIONS_H
13#define ARCCORE_COMMON_INTERNAL_PROPERTYDECLARATIONS_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/base/String.h"
18#include "arccore/common/CommonGlobal.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane::properties
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
30template <typename T>
31class PropertyVisitor;
32template <typename T>
34template <typename T>
36{
37};
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
56#define ARCANE_DECLARE_PROPERTY_CLASS(class_name) \
57 public: \
58\
59 using PropertyInstanceType = class_name; \
60 static const char* propertyClassName() \
61 { \
62 return #class_name; \
63 } \
64 template <typename V> static void _applyPropertyVisitor(V& visitor); \
65 static void applyPropertyVisitor(Arcane::properties::PropertyVisitor<class_name>& p); \
66 static void applyPropertyVisitor(Arcane::properties::IPropertyVisitor* p)
67
68/*---------------------------------------------------------------------------*/
69/*---------------------------------------------------------------------------*/
70
94#define ARCANE_REGISTER_PROPERTY_CLASS(aclass, a_build_args) \
95 namespace \
96 { \
97 Arcane::properties::IPropertySettingsInfo* \
98 ARCANE_JOIN_WITH_LINE(arcaneCreatePropertySettingsInfo##aclass)(const Arcane::properties::PropertySettingsBuildInfo& sbi) \
99 { \
100 auto* si = Arcane::properties::PropertySettingsInfo<aclass>::create(sbi, __FILE__, __LINE__); \
101 return si; \
102 } \
103 Arcane::properties::PropertySettingsBuildInfo \
104 ARCANE_JOIN_WITH_LINE(arcaneCreatePropertySettingsBuildInfo##aclass)() \
105 { \
106 return Arcane::properties::PropertySettingsBuildInfo a_build_args; \
107 } \
108 } \
109 void aclass :: \
110 applyPropertyVisitor(Arcane::properties::PropertyVisitor<typename aclass ::PropertyInstanceType>& p) \
111 { \
112 aclass ::_applyPropertyVisitor(p); \
113 } \
114 void aclass :: \
115 applyPropertyVisitor(Arcane::properties::IPropertyVisitor* p) \
116 { \
117 Arcane::properties::GenericPropertyVisitorWrapper<aclass> xp(p); \
118 aclass ::_applyPropertyVisitor(xp); \
119 } \
120 Arcane::properties::PropertySettingsRegisterer ARCANE_EXPORT \
121 ARCANE_JOIN_WITH_LINE(globalPropertySettingsRegisterer##aclass)(&ARCANE_JOIN_WITH_LINE(arcaneCreatePropertySettingsInfo##aclass), \
122 &ARCANE_JOIN_WITH_LINE(arcaneCreatePropertySettingsBuildInfo##aclass), \
123 #aclass)
124
125/*---------------------------------------------------------------------------*/
126/*---------------------------------------------------------------------------*/
127
128} // End namespace Arcane::properties
129
130/*---------------------------------------------------------------------------*/
131/*---------------------------------------------------------------------------*/
132
133#endif
Property visitor interface.
Definition Property.h:190
Base class of a typed visitor on a property.
Definition Property.h:205