Skip to content

Commit c6a26fd

Browse files
committed
constexpr/const/final in UdrEngine
1 parent 2e9f089 commit c6a26fd

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

src/plugins/udr_engine/UdrEngine.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class UdrPluginImpl;
4848

4949
static GlobalPtr<ObjectsArray<PathName> > paths;
5050

51-
class Engine : public StdPlugin<IExternalEngineImpl<Engine, ThrowStatusWrapper> >
51+
class Engine final : public StdPlugin<IExternalEngineImpl<Engine, ThrowStatusWrapper> >
5252
{
5353
public:
5454
explicit Engine(IPluginConfig* par)
@@ -107,15 +107,15 @@ class Engine : public StdPlugin<IExternalEngineImpl<Engine, ThrowStatusWrapper>
107107
const GenericMap<Pair<Left<string, T*> > >& nodes, const string& entryPoint);
108108

109109
public:
110-
void open(ThrowStatusWrapper* status, IExternalContext* context, char* name, unsigned nameSize);
111-
void openAttachment(ThrowStatusWrapper* status, IExternalContext* context);
112-
void closeAttachment(ThrowStatusWrapper* status, IExternalContext* context);
110+
void open(ThrowStatusWrapper* status, IExternalContext* context, char* name, unsigned nameSize) override;
111+
void openAttachment(ThrowStatusWrapper* status, IExternalContext* context) override;
112+
void closeAttachment(ThrowStatusWrapper* status, IExternalContext* context) override;
113113
IExternalFunction* makeFunction(ThrowStatusWrapper* status, IExternalContext* context,
114-
IRoutineMetadata* metadata, IMetadataBuilder* inBuilder, IMetadataBuilder* outBuilder);
114+
IRoutineMetadata* metadata, IMetadataBuilder* inBuilder, IMetadataBuilder* outBuilder) override;
115115
IExternalProcedure* makeProcedure(ThrowStatusWrapper* status, IExternalContext* context,
116-
IRoutineMetadata* metadata, IMetadataBuilder* inBuilder, IMetadataBuilder* outBuilder);
116+
IRoutineMetadata* metadata, IMetadataBuilder* inBuilder, IMetadataBuilder* outBuilder) override;
117117
IExternalTrigger* makeTrigger(ThrowStatusWrapper* status, IExternalContext* context,
118-
IRoutineMetadata* metadata, IMetadataBuilder* fieldsBuilder);
118+
IRoutineMetadata* metadata, IMetadataBuilder* fieldsBuilder) override;
119119

120120
private:
121121
Mutex childrenMutex;
@@ -127,7 +127,7 @@ class Engine : public StdPlugin<IExternalEngineImpl<Engine, ThrowStatusWrapper>
127127
};
128128

129129

130-
class ModulesMap : public GenericMap<Pair<Left<PathName, UdrPluginImpl*> > >
130+
class ModulesMap final : public GenericMap<Pair<Left<PathName, UdrPluginImpl*> > >
131131
{
132132
public:
133133
explicit ModulesMap(MemoryPool& p)
@@ -149,7 +149,7 @@ static GlobalPtr<ModulesMap> modules;
149149
//--------------------------------------
150150

151151

152-
class UdrPluginImpl : public VersionedIface<IUdrPluginImpl<UdrPluginImpl, ThrowStatusWrapper> >
152+
class UdrPluginImpl final : public VersionedIface<IUdrPluginImpl<UdrPluginImpl, ThrowStatusWrapper> >
153153
{
154154
public:
155155
UdrPluginImpl(const PathName& aModuleName, ModuleLoader::Module* aModule)
@@ -190,13 +190,13 @@ class UdrPluginImpl : public VersionedIface<IUdrPluginImpl<UdrPluginImpl, ThrowS
190190
}
191191

192192
public:
193-
IMaster* getMaster()
193+
IMaster* getMaster() override
194194
{
195195
return MasterInterfacePtr();
196196
}
197197

198198
void registerFunction(ThrowStatusWrapper* status, const char* name,
199-
IUdrFunctionFactory* factory)
199+
IUdrFunctionFactory* factory) override
200200
{
201201
if (functionsMap.exist(name))
202202
{
@@ -214,7 +214,7 @@ class UdrPluginImpl : public VersionedIface<IUdrPluginImpl<UdrPluginImpl, ThrowS
214214
}
215215

216216
void registerProcedure(ThrowStatusWrapper* status, const char* name,
217-
IUdrProcedureFactory* factory)
217+
IUdrProcedureFactory* factory) override
218218
{
219219
if (proceduresMap.exist(name))
220220
{
@@ -232,7 +232,7 @@ class UdrPluginImpl : public VersionedIface<IUdrPluginImpl<UdrPluginImpl, ThrowS
232232
}
233233

234234
void registerTrigger(ThrowStatusWrapper* status, const char* name,
235-
IUdrTriggerFactory* factory)
235+
IUdrTriggerFactory* factory) override
236236
{
237237
if (triggersMap.exist(name))
238238
{
@@ -262,7 +262,7 @@ class UdrPluginImpl : public VersionedIface<IUdrPluginImpl<UdrPluginImpl, ThrowS
262262
};
263263

264264

265-
class SharedFunction : public DisposeIface<IExternalFunctionImpl<SharedFunction, ThrowStatusWrapper> >
265+
class SharedFunction final : public DisposeIface<IExternalFunctionImpl<SharedFunction, ThrowStatusWrapper> >
266266
{
267267
public:
268268
SharedFunction(ThrowStatusWrapper* status, Engine* aEngine, IExternalContext* context,
@@ -290,7 +290,7 @@ class SharedFunction : public DisposeIface<IExternalFunctionImpl<SharedFunction,
290290

291291
public:
292292
void getCharSet(ThrowStatusWrapper* status, IExternalContext* context,
293-
char* name, unsigned nameSize)
293+
char* name, unsigned nameSize) override
294294
{
295295
strncpy(name, context->getClientCharSet(), nameSize);
296296

@@ -301,7 +301,7 @@ class SharedFunction : public DisposeIface<IExternalFunctionImpl<SharedFunction,
301301
function->getCharSet(status, context, name, nameSize);
302302
}
303303

304-
void execute(ThrowStatusWrapper* status, IExternalContext* context, void* inMsg, void* outMsg)
304+
void execute(ThrowStatusWrapper* status, IExternalContext* context, void* inMsg, void* outMsg) override
305305
{
306306
IExternalFunction* function = engine->getChild<IUdrFunctionFactory, IExternalFunction>(
307307
status, children, this, context, engine->functions, moduleName);
@@ -324,7 +324,7 @@ class SharedFunction : public DisposeIface<IExternalFunctionImpl<SharedFunction,
324324
//--------------------------------------
325325

326326

327-
class SharedProcedure : public DisposeIface<IExternalProcedureImpl<SharedProcedure, ThrowStatusWrapper> >
327+
class SharedProcedure final : public DisposeIface<IExternalProcedureImpl<SharedProcedure, ThrowStatusWrapper> >
328328
{
329329
public:
330330
SharedProcedure(ThrowStatusWrapper* status, Engine* aEngine, IExternalContext* context,
@@ -352,7 +352,7 @@ class SharedProcedure : public DisposeIface<IExternalProcedureImpl<SharedProcedu
352352

353353
public:
354354
void getCharSet(ThrowStatusWrapper* status, IExternalContext* context,
355-
char* name, unsigned nameSize)
355+
char* name, unsigned nameSize) override
356356
{
357357
strncpy(name, context->getClientCharSet(), nameSize);
358358

@@ -364,7 +364,7 @@ class SharedProcedure : public DisposeIface<IExternalProcedureImpl<SharedProcedu
364364
}
365365

366366
IExternalResultSet* open(ThrowStatusWrapper* status, IExternalContext* context,
367-
void* inMsg, void* outMsg)
367+
void* inMsg, void* outMsg) override
368368
{
369369
IExternalProcedure* procedure = engine->getChild<IUdrProcedureFactory, IExternalProcedure>(
370370
status, children, this, context, engine->procedures, moduleName);
@@ -386,7 +386,7 @@ class SharedProcedure : public DisposeIface<IExternalProcedureImpl<SharedProcedu
386386
//--------------------------------------
387387

388388

389-
class SharedTrigger : public DisposeIface<IExternalTriggerImpl<SharedTrigger, ThrowStatusWrapper> >
389+
class SharedTrigger final : public DisposeIface<IExternalTriggerImpl<SharedTrigger, ThrowStatusWrapper> >
390390
{
391391
public:
392392
SharedTrigger(ThrowStatusWrapper* status, Engine* aEngine, IExternalContext* context,
@@ -413,7 +413,7 @@ class SharedTrigger : public DisposeIface<IExternalTriggerImpl<SharedTrigger, Th
413413

414414
public:
415415
void getCharSet(ThrowStatusWrapper* status, IExternalContext* context,
416-
char* name, unsigned nameSize)
416+
char* name, unsigned nameSize) override
417417
{
418418
strncpy(name, context->getClientCharSet(), nameSize);
419419

@@ -425,7 +425,7 @@ class SharedTrigger : public DisposeIface<IExternalTriggerImpl<SharedTrigger, Th
425425
}
426426

427427
void execute(ThrowStatusWrapper* status, IExternalContext* context,
428-
unsigned action, void* oldMsg, void* newMsg)
428+
unsigned action, void* oldMsg, void* newMsg) override
429429
{
430430
IExternalTrigger* trigger = engine->getChild<IUdrTriggerFactory, IExternalTrigger>(
431431
status, children, this, context, engine->triggers, moduleName);
@@ -449,25 +449,25 @@ class SharedTrigger : public DisposeIface<IExternalTriggerImpl<SharedTrigger, Th
449449

450450

451451
template <typename FactoryType> GenericMap<Pair<Left<string, FactoryType*> > >& getFactoryMap(
452-
UdrPluginImpl* udrPlugin)
452+
UdrPluginImpl* udrPlugin) noexcept
453453
{
454454
fb_assert(false);
455455
}
456456

457457
template <> GenericMap<Pair<Left<string, IUdrFunctionFactory*> > >& getFactoryMap(
458-
UdrPluginImpl* udrPlugin)
458+
UdrPluginImpl* udrPlugin) noexcept
459459
{
460460
return udrPlugin->functionsMap;
461461
}
462462

463463
template <> GenericMap<Pair<Left<string, IUdrProcedureFactory*> > >& getFactoryMap(
464-
UdrPluginImpl* udrPlugin)
464+
UdrPluginImpl* udrPlugin) noexcept
465465
{
466466
return udrPlugin->proceduresMap;
467467
}
468468

469469
template <> GenericMap<Pair<Left<string, IUdrTriggerFactory*> > >& getFactoryMap(
470-
UdrPluginImpl* udrPlugin)
470+
UdrPluginImpl* udrPlugin) noexcept
471471
{
472472
return udrPlugin->triggersMap;
473473
}
@@ -521,7 +521,7 @@ UdrPluginImpl* Engine::loadModule(ThrowStatusWrapper* status, IRoutineMetadata*
521521

522522
*entryPoint = str.substr(pos + 1);
523523

524-
string::size_type n = entryPoint->find('!');
524+
const auto n = entryPoint->find('!');
525525
*entryPoint = (n == string::npos ? *entryPoint : entryPoint->substr(0, n));
526526

527527
MutexLockGuard guard(modulesMutex, FB_FUNCTION);
@@ -541,8 +541,8 @@ UdrPluginImpl* Engine::loadModule(ThrowStatusWrapper* status, IRoutineMetadata*
541541
isc_arg_string, (ISC_STATUS) "UDR module not loaded",
542542
isc_arg_end
543543
};
544-
const unsigned ARG_TEXT = 3; // Keep both in sync
545-
const unsigned ARG_END = 4; // with status initializer!
544+
constexpr unsigned ARG_TEXT = 3; // Keep both in sync
545+
constexpr unsigned ARG_END = 4; // with status initializer!
546546

547547
ModuleLoader::Module* module = ModuleLoader::fixAndLoadModule(&statusArray[ARG_END], path);
548548
if (!module)
@@ -592,7 +592,7 @@ template <typename NodeType, typename ObjType, typename SharedObjType> ObjType*
592592
ObjType* obj;
593593
if (!children.get(context, obj))
594594
{
595-
GenericMap<Pair<Left<string, NodeType*> > >& nodes = getFactoryMap<NodeType>(
595+
const GenericMap<Pair<Left<string, NodeType*> > >& nodes = getFactoryMap<NodeType>(
596596
sharedObj->module);
597597

598598
NodeType* factory = findNode<NodeType>(status, nodes, sharedObj->entryPoint);
@@ -711,7 +711,7 @@ IExternalTrigger* Engine::makeTrigger(ThrowStatusWrapper* status, IExternalConte
711711
//--------------------------------------
712712

713713

714-
class IExternalEngineFactoryImpl : public SimpleFactory<Engine>
714+
class IExternalEngineFactoryImpl final : public SimpleFactory<Engine>
715715
{
716716
} factory;
717717

0 commit comments

Comments
 (0)