Use override and final to ensure clarity/avoid override at unwanted levels

This commit is contained in:
Alex Harker
2018-06-15 14:20:27 +01:00
parent 3541134be2
commit 9c70012900
6 changed files with 105 additions and 103 deletions
+1 -1
View File
@@ -14,4 +14,4 @@ CLANG_CXX_LIBRARY = libc++
CLANG_X86_VECTOR_INSTRUCTIONS = avx CLANG_X86_VECTOR_INSTRUCTIONS = avx
OTHER_CFLAGS = -fvisibility=hidden OTHER_CFLAGS = -fvisibility=hidden
OTHER_CPLUSPLUSFLAGS = -fvisibility=hidden OTHER_CPLUSPLUSFLAGS = -fvisibility=hidden -Winconsistent-missing-override
+12 -12
View File
@@ -93,25 +93,25 @@ public:
// Set Fixed Inputs // Set Fixed Inputs
virtual void setFixedInput(unsigned long idx, double *input, unsigned long size); void setFixedInput(unsigned long idx, double *input, unsigned long size) final;
virtual const double *getFixedInput(unsigned long idx, unsigned long *size); const double *getFixedInput(unsigned long idx, unsigned long *size) final;
// Audio Processing // Audio Processing
virtual void blockUpdate(const double * const *ins, double **outs, unsigned long blockSize); void blockUpdate(const double * const *ins, double **outs, unsigned long blockSize) final;
virtual void reset(double samplingRate, unsigned long maxBlockSize); void reset(double samplingRate, unsigned long maxBlockSize) final;
// Info (individual objects should override other methods to provide info) // Info (individual objects should override other methods to provide info)
virtual const FrameLib_Parameters *getParameters() const { return &mParameters; } const FrameLib_Parameters *getParameters() const final { return &mParameters; }
virtual FrameType inputType(unsigned long idx) const { return mInputs[idx].mType; } FrameType inputType(unsigned long idx) const final { return mInputs[idx].mType; }
virtual FrameType outputType(unsigned long idx) const { return mOutputs[idx].mType; } FrameType outputType(unsigned long idx) const final { return mOutputs[idx].mType; }
// Automatic Oredering Connections // Automatic Ordering Connections
virtual void autoOrderingConnections(); void autoOrderingConnections() final;
virtual void clearAutoOrderingConnections(); void clearAutoOrderingConnections() final;
protected: protected:
@@ -250,8 +250,8 @@ private:
// Connections // Connections
virtual void connectionUpdate(Queue *queue); void connectionUpdate(Queue *queue) final;
virtual void autoOrderingConnections(LocalQueue *queue); void autoOrderingConnections(LocalQueue *queue);
protected: protected:
+4 -4
View File
@@ -45,7 +45,7 @@ private:
// Thread for Allocating System Memory // Thread for Allocating System Memory
class NewThread : public DelegateThread class NewThread final : public DelegateThread
{ {
public: public:
@@ -54,7 +54,7 @@ private:
private: private:
virtual void doTask() { mAllocator->addScheduledPool(); }; void doTask() override { mAllocator->addScheduledPool(); };
CoreAllocator *mAllocator; CoreAllocator *mAllocator;
}; };
@@ -63,7 +63,7 @@ private:
// Thread for Freeing System Memory // Thread for Freeing System Memory
class FreeThread : public TriggerableThread class FreeThread final : public TriggerableThread
{ {
public: public:
@@ -72,7 +72,7 @@ private:
private: private:
virtual void doTask() { mAllocator->destroyScheduledPool(); }; void doTask() override { mAllocator->destroyScheduledPool(); };
CoreAllocator *mAllocator; CoreAllocator *mAllocator;
}; };
+60 -48
View File
@@ -40,16 +40,8 @@ public:
virtual ~FrameLib_MultiChannel() {} virtual ~FrameLib_MultiChannel() {}
// Set Fixed Inputs // Default is not to handle audio
virtual void setFixedInput(unsigned long idx, double *input, unsigned long size) {};
virtual const double *getFixedInput(unsigned long idx, unsigned long *size) { return getEmptyFixedInput(idx, size); }
// Audio Processing
virtual void blockUpdate(const double * const *ins, double **outs, unsigned long blockSize) {}
virtual void reset(double samplingRate, unsigned long maxBlockSize) {}
static bool handlesAudio() { return false; } static bool handlesAudio() { return false; }
// Number of Streams // Number of Streams
@@ -85,7 +77,7 @@ private:
// Connection Methods (private) // Connection Methods (private)
void connectionUpdate(Queue *queue) void connectionUpdate(Queue *queue) final
{ {
if (inputUpdate()) if (inputUpdate())
outputUpdate(queue); outputUpdate(queue);
@@ -109,7 +101,7 @@ private:
// FrameLib_Pack - Pack Multichannel Signals // FrameLib_Pack - Pack Multichannel Signals
class FrameLib_Pack : public FrameLib_MultiChannel class FrameLib_Pack final : public FrameLib_MultiChannel
{ {
enum AtrributeList { kInputs }; enum AtrributeList { kInputs };
@@ -117,27 +109,37 @@ class FrameLib_Pack : public FrameLib_MultiChannel
public: public:
virtual const FrameLib_Parameters::Serial *getSerialised() { return &mSerialisedParameters; } const FrameLib_Parameters::Serial *getSerialised() override { return &mSerialisedParameters; }
FrameLib_Pack(FrameLib_Context context, FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy, unsigned long nStreams); FrameLib_Pack(FrameLib_Context context, FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy, unsigned long nStreams);
// Set Fixed Inputs
void setFixedInput(unsigned long idx, double *input, unsigned long size) override {};
const double *getFixedInput(unsigned long idx, unsigned long *size) override { return getEmptyFixedInput(idx, size); }
// Audio Processing
void blockUpdate(const double * const *ins, double **outs, unsigned long blockSize) override {}
void reset(double samplingRate, unsigned long maxBlockSize) override {}
// Info // Info
virtual std::string objectInfo(bool verbose); std::string objectInfo(bool verbose) override;
virtual std::string inputInfo(unsigned long idx, bool verbose); std::string inputInfo(unsigned long idx, bool verbose) override;
virtual std::string outputInfo(unsigned long idx, bool verbose); std::string outputInfo(unsigned long idx, bool verbose) override;
virtual const FrameLib_Parameters *getParameters() const { return &mParameters; } const FrameLib_Parameters *getParameters() const override { return &mParameters; }
virtual FrameType inputType(unsigned long idx) const { return kFrameAny; } FrameType inputType(unsigned long idx) const override { return kFrameAny; }
virtual FrameType outputType(unsigned long idx) const { return kFrameAny; } FrameType outputType(unsigned long idx) const override { return kFrameAny; }
virtual void autoOrderingConnections() {} void autoOrderingConnections() override {}
virtual void clearAutoOrderingConnections() {} void clearAutoOrderingConnections() override {}
private: private:
virtual bool inputUpdate(); bool inputUpdate() override;
FrameLib_Parameters::AutoSerial mSerialisedParameters; FrameLib_Parameters::AutoSerial mSerialisedParameters;
@@ -150,7 +152,7 @@ private:
// FrameLib_Unpack - Unpack Multichannel Signals // FrameLib_Unpack - Unpack Multichannel Signals
class FrameLib_Unpack : public FrameLib_MultiChannel class FrameLib_Unpack final : public FrameLib_MultiChannel
{ {
enum AtrributeList { kOutputs }; enum AtrributeList { kOutputs };
@@ -158,27 +160,37 @@ class FrameLib_Unpack : public FrameLib_MultiChannel
public: public:
virtual const FrameLib_Parameters::Serial *getSerialised() { return &mSerialisedParameters; } const FrameLib_Parameters::Serial *getSerialised() override { return &mSerialisedParameters; }
FrameLib_Unpack(FrameLib_Context context, FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy, unsigned long nStreams); FrameLib_Unpack(FrameLib_Context context, FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy, unsigned long nStreams);
// Set Fixed Inputs
void setFixedInput(unsigned long idx, double *input, unsigned long size) override {};
const double *getFixedInput(unsigned long idx, unsigned long *size) override { return getEmptyFixedInput(idx, size); }
// Audio Processing
void blockUpdate(const double * const *ins, double **outs, unsigned long blockSize) override {}
void reset(double samplingRate, unsigned long maxBlockSize) override {}
// Info // Info
virtual std::string objectInfo(bool verbose); std::string objectInfo(bool verbose) override;
virtual std::string inputInfo(unsigned long idx, bool verbose); std::string inputInfo(unsigned long idx, bool verbose) override;
virtual std::string outputInfo(unsigned long idx, bool verbose); std::string outputInfo(unsigned long idx, bool verbose) override;
virtual const FrameLib_Parameters *getParameters() const { return &mParameters; } const FrameLib_Parameters *getParameters() const override { return &mParameters; }
virtual FrameType inputType(unsigned long idx) const { return kFrameAny; } FrameType inputType(unsigned long idx) const override { return kFrameAny; }
virtual FrameType outputType(unsigned long idx) const { return kFrameAny; } FrameType outputType(unsigned long idx) const override { return kFrameAny; }
virtual void autoOrderingConnections() {} void autoOrderingConnections() override {}
virtual void clearAutoOrderingConnections() {} void clearAutoOrderingConnections() override {}
private: private:
virtual bool inputUpdate(); virtual bool inputUpdate() override;
FrameLib_Parameters::AutoSerial mSerialisedParameters; FrameLib_Parameters::AutoSerial mSerialisedParameters;
@@ -191,12 +203,12 @@ private:
// FrameLib_Expand - MultiChannel expansion for FrameLib_Block objects // FrameLib_Expand - MultiChannel expansion for FrameLib_Block objects
template <class T> class FrameLib_Expand : public FrameLib_MultiChannel template <class T> class FrameLib_Expand final : public FrameLib_MultiChannel
{ {
public: public:
virtual const FrameLib_Parameters::Serial *getSerialised() { return &mSerialisedParameters; } const FrameLib_Parameters::Serial *getSerialised() override { return &mSerialisedParameters; }
FrameLib_Expand(FrameLib_Context context, FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy, unsigned long nStreams) FrameLib_Expand(FrameLib_Context context, FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy, unsigned long nStreams)
: FrameLib_MultiChannel(T::getType(), context, proxy, nStreams), mSerialisedParameters(serialisedParameters->size()) : FrameLib_MultiChannel(T::getType(), context, proxy, nStreams), mSerialisedParameters(serialisedParameters->size())
@@ -239,7 +251,7 @@ public:
// Fixed Inputs // Fixed Inputs
virtual void setFixedInput(unsigned long idx, double *input, unsigned long size) void setFixedInput(unsigned long idx, double *input, unsigned long size) override
{ {
if (idx < mFixedInputs.size()) if (idx < mFixedInputs.size())
{ {
@@ -248,14 +260,14 @@ public:
} }
} }
virtual const double *getFixedInput(unsigned long idx, unsigned long *size) const double *getFixedInput(unsigned long idx, unsigned long *size) override
{ {
return mBlocks[0]->getFixedInput(idx, size); return mBlocks[0]->getFixedInput(idx, size);
} }
// Audio Processing // Audio Processing
virtual void blockUpdate(const double * const *ins, double **outs, unsigned long blockSize) void blockUpdate(const double * const *ins, double **outs, unsigned long blockSize) override
{ {
unsigned long internalNumIns = mBlocks[0]->getNumAudioIns(); unsigned long internalNumIns = mBlocks[0]->getNumAudioIns();
unsigned long internalNumOuts = mBlocks[0]->getNumAudioOuts(); unsigned long internalNumOuts = mBlocks[0]->getNumAudioOuts();
@@ -296,7 +308,7 @@ public:
// Reset // Reset
virtual void reset(double samplingRate, unsigned long maxBlockSize) void reset(double samplingRate, unsigned long maxBlockSize) override
{ {
mSamplingRate = samplingRate; mSamplingRate = samplingRate;
mMaxBlockSize = maxBlockSize; mMaxBlockSize = maxBlockSize;
@@ -311,29 +323,29 @@ public:
// Info // Info
virtual std::string objectInfo(bool verbose) { return mBlocks[0]->objectInfo(verbose); } std::string objectInfo(bool verbose) override { return mBlocks[0]->objectInfo(verbose); }
virtual std::string inputInfo(unsigned long idx, bool verbose) { return mBlocks[0]->inputInfo(idx, verbose); } std::string inputInfo(unsigned long idx, bool verbose) override { return mBlocks[0]->inputInfo(idx, verbose); }
virtual std::string outputInfo(unsigned long idx, bool verbose) { return mBlocks[0]->outputInfo(idx, verbose); } std::string outputInfo(unsigned long idx, bool verbose) override { return mBlocks[0]->outputInfo(idx, verbose); }
virtual std::string audioInfo(unsigned long idx, bool verbose) std::string audioInfo(unsigned long idx, bool verbose) override
{ {
return formatInfo((mBlocks[0]->audioInfo(idx % mBlocks[0]->getNumAudioChans(), verbose) + " [#]").c_str(), idx / mBlocks[0]->getNumAudioChans()); return formatInfo((mBlocks[0]->audioInfo(idx % mBlocks[0]->getNumAudioChans(), verbose) + " [#]").c_str(), idx / mBlocks[0]->getNumAudioChans());
} }
virtual FrameType inputType(unsigned long idx) const { return mBlocks[0]->inputType(idx); } FrameType inputType(unsigned long idx) const override { return mBlocks[0]->inputType(idx); }
virtual FrameType outputType(unsigned long idx) const { return mBlocks[0]->outputType(idx); } FrameType outputType(unsigned long idx) const override { return mBlocks[0]->outputType(idx); }
virtual const FrameLib_Parameters *getParameters() const { return mBlocks[0]->getParameters(); } const FrameLib_Parameters *getParameters() const override { return mBlocks[0]->getParameters(); }
// Ordering Connections // Ordering Connections
virtual void autoOrderingConnections() void autoOrderingConnections() override
{ {
for (auto it = mBlocks.begin(); it != mBlocks.end(); it++) for (auto it = mBlocks.begin(); it != mBlocks.end(); it++)
(*it)->autoOrderingConnections(); (*it)->autoOrderingConnections();
} }
virtual void clearAutoOrderingConnections() void clearAutoOrderingConnections() override
{ {
for (auto it = mBlocks.begin(); it != mBlocks.end(); it++) for (auto it = mBlocks.begin(); it != mBlocks.end(); it++)
(*it)->clearAutoOrderingConnections(); (*it)->clearAutoOrderingConnections();
@@ -351,7 +363,7 @@ private:
// Update (expand) // Update (expand)
virtual bool inputUpdate() bool inputUpdate() override
{ {
// Find number of channels (always keep at least one channel) // Find number of channels (always keep at least one channel)
+28 -28
View File
@@ -338,7 +338,7 @@ private:
// Enum Parameter Class // Enum Parameter Class
class Enum : public Parameter class Enum final : public Parameter
{ {
public: public:
@@ -347,21 +347,21 @@ private:
// Setters // Setters
void addEnumItem(const char *str); void addEnumItem(const char *str) override;
virtual SetError set(double value); SetError set(double value) override;
virtual SetError set(double *values, size_t N); SetError set(double *values, size_t N) override;
virtual SetError set(const char *str); virtual SetError set(const char *str) override;
virtual void clear() { Enum::set(0.0); }; void clear() override { Enum::set(0.0); }
virtual Type type() { return kEnum; } virtual Type type() override { return kEnum; }
// Getters // Getters
virtual double getValue() const { return mValue; } virtual double getValue() const override { return mValue; }
virtual const char *getString() const { return mItems[mValue].c_str(); } virtual const char *getString() const override { return mItems[mValue].c_str(); }
virtual const char *getItemString(unsigned long item) const { return mItems[item].c_str(); } virtual const char *getItemString(unsigned long item) const override { return mItems[item].c_str(); }
private: private:
@@ -373,7 +373,7 @@ private:
// Value Parameter Class // Value Parameter Class
class Value : public Parameter class Value final : public Parameter
{ {
public: public:
@@ -383,16 +383,16 @@ private:
// Setters // Setters
virtual SetError set(double value); SetError set(double value) override;
virtual SetError set(double *values, size_t N); SetError set(double *values, size_t N) override;
virtual void clear() { Value::set(mDefault); }; void clear() override { Value::set(mDefault); };
// Getters // Getters
virtual Type type() { return kValue; } Type type() override { return kValue; }
virtual double getValue() const { return mValue; } double getValue() const override { return mValue; }
private: private:
@@ -403,7 +403,7 @@ private:
// String Parameter Class // String Parameter Class
class String : public Parameter class String final : public Parameter
{ {
const static size_t maxLen = 128; const static size_t maxLen = 128;
@@ -413,15 +413,15 @@ private:
// Setters // Setters
virtual SetError set(const char *str); SetError set(const char *str) override;
virtual void clear() { String::set(nullptr); }; void clear() override { String::set(nullptr); };
// Getters // Getters
virtual Type type() { return kString; } Type type() override { return kString; }
virtual const char *getString() const { return mCString; } const char *getString() const override { return mCString; }
private: private:
@@ -432,7 +432,7 @@ private:
// Array Parameter Class // Array Parameter Class
class Array : public Parameter, private std::vector<double> class Array final : public Parameter, private std::vector<double>
{ {
public: public:
@@ -442,17 +442,17 @@ private:
// Setters // Setters
virtual SetError set(double *values, size_t N); SetError set(double *values, size_t N) override;
virtual void clear() { Array::set(nullptr, 0); }; void clear() override { Array::set(nullptr, 0); };
// Getters // Getters
virtual Type type() { return mVariableSize ? kVariableArray : kArray; } Type type() override { return mVariableSize ? kVariableArray : kArray; }
virtual size_t getArraySize() const { return mSize; } size_t getArraySize() const override { return mSize; }
virtual size_t getArrayMaxSize() const { return mItems.size(); } size_t getArrayMaxSize() const override { return mItems.size(); }
virtual const double * getArray() const { return mItems.data(); } const double * getArray() const override { return mItems.data(); }
private: private:
-10
View File
@@ -2336,7 +2336,6 @@
B8DF3FA2198AABAD00CA8BB6 /* FrameLib_Parameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FrameLib_Parameters.h; sourceTree = "<group>"; }; B8DF3FA2198AABAD00CA8BB6 /* FrameLib_Parameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FrameLib_Parameters.h; sourceTree = "<group>"; };
B8E058AE198DA34D00721359 /* FrameLib_Object.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FrameLib_Object.h; sourceTree = "<group>"; }; B8E058AE198DA34D00721359 /* FrameLib_Object.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FrameLib_Object.h; sourceTree = "<group>"; };
B8E41AE620C307EB003BBD86 /* fl.expression~.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "fl.expression~.cpp"; sourceTree = "<group>"; }; B8E41AE620C307EB003BBD86 /* fl.expression~.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "fl.expression~.cpp"; sourceTree = "<group>"; };
B8E41AE820C30AE2003BBD86 /* exprtk.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = exprtk.hpp; sourceTree = "<group>"; };
B8E41B0720C36599003BBD86 /* FrameLib_ExprParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FrameLib_ExprParser.h; sourceTree = "<group>"; }; B8E41B0720C36599003BBD86 /* FrameLib_ExprParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FrameLib_ExprParser.h; sourceTree = "<group>"; };
B8E41B1C20C5E71C003BBD86 /* fl.expr~.mxo */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "fl.expr~.mxo"; sourceTree = BUILT_PRODUCTS_DIR; }; B8E41B1C20C5E71C003BBD86 /* fl.expr~.mxo */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "fl.expr~.mxo"; sourceTree = BUILT_PRODUCTS_DIR; };
B8E41B1E20C5E763003BBD86 /* FrameLib_Expression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameLib_Expression.h; sourceTree = "<group>"; }; B8E41B1E20C5E763003BBD86 /* FrameLib_Expression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameLib_Expression.h; sourceTree = "<group>"; };
@@ -4481,7 +4480,6 @@
B8C2D6071F6BFF60009A7C96 /* TableReader.hpp */, B8C2D6071F6BFF60009A7C96 /* TableReader.hpp */,
B87E876619C8EEB900B1D0CD /* HISSTools_FFT */, B87E876619C8EEB900B1D0CD /* HISSTools_FFT */,
B8F6E4DA199D24820073E06D /* tlsf */, B8F6E4DA199D24820073E06D /* tlsf */,
B8E41AE920C30AF1003BBD86 /* exprtk */,
); );
name = Dependencies; name = Dependencies;
path = FrameLib_Dependencies; path = FrameLib_Dependencies;
@@ -4778,14 +4776,6 @@
path = FrameLib_Max_Objects/Expressions; path = FrameLib_Max_Objects/Expressions;
sourceTree = SOURCE_ROOT; sourceTree = SOURCE_ROOT;
}; };
B8E41AE920C30AF1003BBD86 /* exprtk */ = {
isa = PBXGroup;
children = (
B8E41AE820C30AE2003BBD86 /* exprtk.hpp */,
);
path = exprtk;
sourceTree = "<group>";
};
B8F5A4DF1F2A619200D4777C /* Spatial */ = { B8F5A4DF1F2A619200D4777C /* Spatial */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (