Skip to content

Commit 34b9cd0

Browse files
committed
noexcept / final in ImplementHelper
1 parent 27525e1 commit 34b9cd0

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

src/common/classes/ImplementHelper.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ Firebird::UnloadDetector myModule;
4646
namespace Firebird
4747
{
4848

49-
UnloadDetectorHelper* getUnloadDetector()
49+
UnloadDetectorHelper* getUnloadDetector() noexcept
5050
{
5151
return &myModule;
5252
}
5353

54-
void CachedMasterInterface::set(IMaster* master)
54+
void CachedMasterInterface::set(IMaster* master) noexcept
5555
{
5656
fb_assert(master);
5757
fb_assert(!cached);
5858
cached = master;
5959
}
6060

61-
IMaster* CachedMasterInterface::getMasterInterface()
61+
IMaster* CachedMasterInterface::getMasterInterface() noexcept
6262
{
6363
if (!cached)
6464
{
@@ -70,14 +70,14 @@ IMaster* CachedMasterInterface::getMasterInterface()
7070
unsigned int ConfigKeys::getKey(IFirebirdConf* config, const char* keyName)
7171
{
7272
FbLocalStatus status;
73-
unsigned int version = config->getVersion(&status) & 0xFFFF0000;
73+
const unsigned int version = config->getVersion(&status) & 0xFFFF0000;
7474
for (const_iterator itr = this->begin(); itr != this->end(); ++itr)
7575
{
7676
if (((*itr) & 0xFFFF0000) == version)
7777
return *itr;
7878
}
7979

80-
unsigned int secDbKey = config->getKey(keyName);
80+
const unsigned int secDbKey = config->getKey(keyName);
8181
if (secDbKey != INVALID_KEY)
8282
this->push(secDbKey);
8383

src/common/classes/ImplementHelper.h

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ class VersionedIface : public C
5353
public:
5454
VersionedIface() { }
5555

56-
private:
57-
VersionedIface(const VersionedIface&);
58-
VersionedIface& operator=(const VersionedIface&);
56+
VersionedIface(const VersionedIface&) = delete;
57+
VersionedIface& operator=(const VersionedIface&) = delete;
5958
};
6059

6160
// Helps to implement versioned interfaces on stack or static
@@ -123,7 +122,7 @@ class RefCntIface : public VersionedIface<C>, public GlobalStorage
123122
}
124123

125124
protected:
126-
void refCntDPrt(char f)
125+
void refCntDPrt(char f) noexcept
127126
{
128127
#ifdef DEV_BUILD
129128
if (mark)
@@ -194,27 +193,27 @@ class SimpleFactory : public Static<SimpleFactoryBase<P> >
194193
class CachedMasterInterface
195194
{
196195
public:
197-
static void set(IMaster* master);
196+
static void set(IMaster* master) noexcept;
198197

199198
protected:
200-
static IMaster* getMasterInterface();
199+
static IMaster* getMasterInterface() noexcept;
201200
};
202201

203202
// Base for interface type independent accessors
204203
template <typename C>
205204
class AccessAutoInterface : public CachedMasterInterface
206205
{
207206
public:
208-
explicit AccessAutoInterface(C* aPtr)
207+
explicit AccessAutoInterface(C* aPtr) noexcept
209208
: ptr(aPtr)
210209
{ }
211210

212-
operator C*()
211+
operator C*() noexcept
213212
{
214213
return ptr;
215214
}
216215

217-
C* operator->()
216+
C* operator->() noexcept
218217
{
219218
return ptr;
220219
}
@@ -224,17 +223,17 @@ class AccessAutoInterface : public CachedMasterInterface
224223
};
225224

226225
// Master interface access
227-
class MasterInterfacePtr : public AccessAutoInterface<IMaster>
226+
class MasterInterfacePtr final : public AccessAutoInterface<IMaster>
228227
{
229228
public:
230-
MasterInterfacePtr()
229+
MasterInterfacePtr() noexcept
231230
: AccessAutoInterface<IMaster>(getMasterInterface())
232231
{ }
233232
};
234233

235234

236235
// Generic plugins interface access
237-
class PluginManagerInterfacePtr : public AccessAutoInterface<IPluginManager>
236+
class PluginManagerInterfacePtr final : public AccessAutoInterface<IPluginManager>
238237
{
239238
public:
240239
PluginManagerInterfacePtr()
@@ -244,7 +243,7 @@ class PluginManagerInterfacePtr : public AccessAutoInterface<IPluginManager>
244243

245244

246245
// Control timer interface access
247-
class TimerInterfacePtr : public AccessAutoInterface<ITimerControl>
246+
class TimerInterfacePtr final : public AccessAutoInterface<ITimerControl>
248247
{
249248
public:
250249
TimerInterfacePtr()
@@ -254,7 +253,7 @@ class TimerInterfacePtr : public AccessAutoInterface<ITimerControl>
254253

255254

256255
// Distributed transactions coordinator access
257-
class DtcInterfacePtr : public AccessAutoInterface<IDtc>
256+
class DtcInterfacePtr final : public AccessAutoInterface<IDtc>
258257
{
259258
public:
260259
DtcInterfacePtr()
@@ -264,7 +263,7 @@ class DtcInterfacePtr : public AccessAutoInterface<IDtc>
264263

265264

266265
// Dispatcher access
267-
class DispatcherPtr : public AccessAutoInterface<IProvider>
266+
class DispatcherPtr final : public AccessAutoInterface<IProvider>
268267
{
269268
public:
270269
DispatcherPtr()
@@ -279,7 +278,7 @@ class DispatcherPtr : public AccessAutoInterface<IProvider>
279278

280279

281280
// Misc utl access
282-
class UtilInterfacePtr : public AccessAutoInterface<IUtil>
281+
class UtilInterfacePtr final : public AccessAutoInterface<IUtil>
283282
{
284283
public:
285284
UtilInterfacePtr()
@@ -325,22 +324,22 @@ class UnloadDetectorHelper final :
325324
}
326325
}
327326

328-
bool unloadStarted()
327+
bool unloadStarted() const noexcept
329328
{
330329
return !flagOsUnload;
331330
}
332331

333-
void setCleanup(VoidNoParam* function)
332+
void setCleanup(VoidNoParam* function) noexcept
334333
{
335334
cleanup = function;
336335
}
337336

338-
void setThreadDetach(VoidNoParam* function)
337+
void setThreadDetach(VoidNoParam* function) noexcept
339338
{
340339
thdDetach = function;
341340
}
342341

343-
void doClean()
342+
void doClean() override
344343
{
345344
flagOsUnload = false;
346345

@@ -351,7 +350,7 @@ class UnloadDetectorHelper final :
351350
}
352351
}
353352

354-
void threadDetach()
353+
void threadDetach() override
355354
{
356355
if (thdDetach)
357356
thdDetach();
@@ -364,10 +363,10 @@ class UnloadDetectorHelper final :
364363
};
365364

366365
typedef GlobalPtr<UnloadDetectorHelper, InstanceControl::PRIORITY_DETECT_UNLOAD> UnloadDetector;
367-
UnloadDetectorHelper* getUnloadDetector();
366+
UnloadDetectorHelper* getUnloadDetector() noexcept;
368367

369368
// Generic status checker
370-
inline void check(IStatus* status, ISC_STATUS exclude = 0)
369+
inline void check(const IStatus* status, ISC_STATUS exclude = 0)
371370
{
372371
if (status->getState() & IStatus::STATE_ERRORS)
373372
{
@@ -377,14 +376,14 @@ inline void check(IStatus* status, ISC_STATUS exclude = 0)
377376
}
378377

379378
// Config keys cache
380-
class ConfigKeys : private HalfStaticArray<unsigned int, 8>
379+
class ConfigKeys final : private HalfStaticArray<unsigned int, 8>
381380
{
382381
public:
383382
ConfigKeys(MemoryPool& p)
384383
: HalfStaticArray<unsigned int, 8>(p)
385384
{ }
386385

387-
const static unsigned int INVALID_KEY = ~0u;
386+
static constexpr unsigned int INVALID_KEY = ~0u;
388387

389388
unsigned int getKey(IFirebirdConf* config, const char* keyName);
390389
};

0 commit comments

Comments
 (0)