OnixS C++ CME MDP Conflated UDP Handler 1.1.2
API documentation
Loading...
Searching...
No Matches
SettingGroup.h
Go to the documentation of this file.
1// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2//
3// This software owned by Onix Solutions Limited [OnixS] and is
4// protected by copyright law and international copyright treaties.
5//
6// Access to and use of the software is governed by the terms of the applicable
7// OnixS Software Services Agreement (the Agreement) and Customer end user license
8// agreements granting a non-assignable, non-transferable and non-exclusive license
9// to use the software for it's own data processing purposes under the terms defined
10// in the Agreement.
11//
12// Except as otherwise granted within the terms of the Agreement, copying or
13// reproduction of any part of this source code or associated reference material
14// to any other location for further reproduction or redistribution, and any
15// amendments to this copyright notice, are expressly prohibited.
16//
17// Any reproduction or redistribution for sale or hiring of the Software not in
18// accordance with the terms of the Agreement is a violation of copyright law.
19//
20
21#pragma once
22
24
26
28(
29 SettingGroup
30);
31
36{
43 virtual
44 void
46 const SettingGroup&,
47 const Char*) = 0;
48
54 virtual
55 void
56 endAssign() = 0;
57};
58
59// Default attributes and functionality.
63{
65 void
67 const SettingGroup&,
68 const Char*)
69 {
70 }
71
73 void
75 {
76 }
77
80 static
83 {
84 static
86 trivial;
87
88 return trivial;
89 }
90};
91
94{
95 SettingAssignController& controller_;
96
97 SettingAssignGuard(
98 const SettingAssignGuard&);
99
100 SettingAssignGuard&
101 operator =(
102 const SettingAssignGuard&);
103
104public:
107 SettingAssignController& controller,
108 const SettingGroup& group,
109 const Char* details)
110 : controller_(controller)
111 {
112 controller_.beginAssign(group, details);
113 }
114
117 {
118 controller_.endAssign();
119 }
120};
121
124{
125 // Controller for the given group of settings.
126 SettingAssignController& controller_;
127
128 SettingGroup(
129 const SettingGroup&);
130
131 SettingGroup&
132 operator =(
133 const SettingGroup&);
134
135public:
140 controller = NULL)
141 : controller_
142 (
143 controller
144 ? *controller
146 self()
147 )
148 {
149 }
150
153 {
154 }
155
158 template
159 <
160 class Assignee,
161 class Value
162 >
163 void
165 const Char* description,
166 Assignee& assignee,
167 Value value) const
168 {
169 const
171 guard(
172 controller_,
173 *this,
174 description);
175 {
176 assignee = value;
177 }
178 }
179
184 template
185 <
186 class Assignee,
187 class Value,
188 class AssignRoutine
189 >
190 void
192 const Char* description,
193 AssignRoutine routine,
194 Assignee& assignee,
195 const Value& value) const
196 {
197 const
199 guard(
200 controller_,
201 *this,
202 description);
203 {
204 (assignee.*routine)(value);
205 }
206 }
207
211 static
212 const SettingGroup&
214 {
215 static
216 const
217 SettingGroup
218 nullInstance;
219
220 return nullInstance;
221 }
222};
223
225inline
226bool
227operator ==(
228 const SettingGroup& left,
229 const SettingGroup& right)
230{
231 return (&left == &right);
232}
233
235inline
236bool
237operator !=(
238 const SettingGroup& left,
239 const SettingGroup& right)
240{
241 return (&left != &right);
242}
243
#define ONIXS_CONFLATEDUDP_LTWT_EXPORTED
Definition Bootstrap.h:103
#define ONIXS_CONFLATEDUDP_LTWT_CLASS
Definition Bootstrap.h:95
#define ONIXS_CONFLATEDUDP_EXPORTED_STRUCT
Definition Bootstrap.h:59
#define ONIXS_CONFLATEDUDP_NAMESPACE_END
Definition Bootstrap.h:157
#define ONIXS_CONFLATEDUDP_LTWT_CLASS_DECL(name)
Definition Bootstrap.h:107
#define ONIXS_CONFLATEDUDP_NAMESPACE_BEGIN
Definition Bootstrap.h:153
Scope guard to update setting in the safe way.
~SettingAssignGuard()
Accomplishes setting update.
SettingAssignGuard(SettingAssignController &controller, const SettingGroup &group, const Char *details)
Initializes the guard for the given setting update.
Base services for settings grouped by a certain criteria.
void controlAssignment(const Char *description, Assignee &assignee, Value value) const
void controlAssignment(const Char *description, AssignRoutine routine, Assignee &assignee, const Value &value) const
SettingGroup(SettingAssignController *controller=NULL)
static ONIXS_CONFLATEDUDP_EXPORTED const SettingGroup & null()
~SettingGroup()
Does actually nothing.
char Char
Character type alias.
Definition String.h:36
virtual void beginAssign(const SettingGroup &, const Char *)=0
void beginAssign(const SettingGroup &, const Char *)
Implements base class interface.
static SettingAssignController & self()
void endAssign()
Implements base class interface.