diff options
130 files changed, 905 insertions, 1091 deletions
diff --git a/config/src/vespa/config/common/configcontext.h b/config/src/vespa/config/common/configcontext.h index 20cfbe8711e..c00bceaef47 100644 --- a/config/src/vespa/config/common/configcontext.h +++ b/config/src/vespa/config/common/configcontext.h @@ -15,8 +15,8 @@ class ConfigContext : public IConfigContext public: ConfigContext(const SourceSpec & spec = ServerSpec()); ConfigContext(const TimingValues & timingValues, const SourceSpec & spec = ServerSpec()); - IConfigManager & getManagerInstance(); - void reload(); + IConfigManager & getManagerInstance() override; + void reload() override; private: TimingValues _timingValues; diff --git a/config/src/vespa/config/common/configholder.h b/config/src/vespa/config/common/configholder.h index abcc9c059cd..70330740d45 100644 --- a/config/src/vespa/config/common/configholder.h +++ b/config/src/vespa/config/common/configholder.h @@ -14,11 +14,11 @@ class ConfigHolder : public IConfigHolder public: ConfigHolder(); - ConfigUpdate::UP provide(); - void handle(ConfigUpdate::UP update); - bool wait(uint64_t timeoutInMillis); - bool poll(); - void interrupt(); + ConfigUpdate::UP provide() override; + void handle(ConfigUpdate::UP update) override; + bool wait(uint64_t timeoutInMillis) override; + bool poll() override; + void interrupt() override; public: vespalib::Monitor _monitor; ConfigUpdate::UP _current; diff --git a/config/src/vespa/config/common/configmanager.h b/config/src/vespa/config/common/configmanager.h index 9cd46750959..77ebb0d2772 100644 --- a/config/src/vespa/config/common/configmanager.h +++ b/config/src/vespa/config/common/configmanager.h @@ -25,13 +25,13 @@ public: ~ConfigManager(); // Implements IConfigManager - ConfigSubscription::SP subscribe(const ConfigKey & key, uint64_t timeoutInMillis); + ConfigSubscription::SP subscribe(const ConfigKey & key, uint64_t timeoutInMillis) override; // Implements IConfigManager - void unsubscribe(const ConfigSubscription::SP & subscription); + void unsubscribe(const ConfigSubscription::SP & subscription) override; // Implements IConfigManager - void reload(int64_t generation); + void reload(int64_t generation) override; private: SubscriptionId _idGenerator; diff --git a/config/src/vespa/config/common/misc.cpp b/config/src/vespa/config/common/misc.cpp index 071411f170a..804ca5b24d5 100644 --- a/config/src/vespa/config/common/misc.cpp +++ b/config/src/vespa/config/common/misc.cpp @@ -5,7 +5,6 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/data/slime/slime.h> -#include <vespa/vespalib/data/memory.h> #include "exceptions.h" using vespalib::Memory; @@ -72,7 +71,7 @@ private: Cursor & _dest; public: CopyObjectTraverser(Cursor & dest) : _dest(dest) {} - void field(const Memory & symbol, const Inspector & inspector) { + void field(const Memory & symbol, const Inspector & inspector) override { switch(inspector.type().getId()) { case NIX::ID: _dest.addNix(); @@ -108,7 +107,7 @@ private: Cursor & _dest; public: CopyArrayTraverser(Cursor & dest) : _dest(dest) {} - void entry(size_t idx, const Inspector & inspector) { + void entry(size_t idx, const Inspector & inspector) override { (void) idx; switch(inspector.type().getId()) { case NIX::ID: diff --git a/config/src/vespa/config/common/payload_converter.h b/config/src/vespa/config/common/payload_converter.h index 63a4b0a7964..351e6a4b073 100644 --- a/config/src/vespa/config/common/payload_converter.h +++ b/config/src/vespa/config/common/payload_converter.h @@ -16,8 +16,8 @@ public: PayloadConverter(const vespalib::slime::Inspector & inspector); ~PayloadConverter(); const std::vector<vespalib::string> & convert(); - void field(const vespalib::Memory & symbol, const vespalib::slime::Inspector & inspector); - void entry(size_t idx, const vespalib::slime::Inspector & inspector); + void field(const vespalib::Memory & symbol, const vespalib::slime::Inspector & inspector) override; + void entry(size_t idx, const vespalib::slime::Inspector & inspector) override; private: void printPrefix(); void encode(const vespalib::slime::Inspector & inspector); diff --git a/config/src/vespa/config/common/trace.cpp b/config/src/vespa/config/common/trace.cpp index 5698c60d0e4..ba733e606b7 100644 --- a/config/src/vespa/config/common/trace.cpp +++ b/config/src/vespa/config/common/trace.cpp @@ -10,7 +10,7 @@ namespace config { struct SystemClock : public Clock { - int64_t currentTimeMillis() const { + int64_t currentTimeMillis() const override { fastos::TimeStamp ts(fastos::ClockSystem::now()); return ts.ms(); } diff --git a/config/src/vespa/config/file/filesource.h b/config/src/vespa/config/file/filesource.h index 141d14faf5c..a26089ae9c7 100644 --- a/config/src/vespa/config/file/filesource.h +++ b/config/src/vespa/config/file/filesource.h @@ -1,10 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <string> -#include <vector> -#include <map> -#include <stack> #include <vespa/config/common/source.h> #include <vespa/config/common/iconfigholder.h> #include <vespa/vespalib/stllike/string.h> @@ -29,9 +25,9 @@ private: public: FileSource(const IConfigHolder::SP & holder, const vespalib::string & fileName); - void getConfig(); - void close(); - void reload(int64_t generation); + void getConfig() override; + void close() override; + void reload(int64_t generation) override; }; } // namespace config diff --git a/config/src/vespa/config/file/filesourcefactory.h b/config/src/vespa/config/file/filesourcefactory.h index c38b00aa034..ab42ff994cd 100644 --- a/config/src/vespa/config/file/filesourcefactory.h +++ b/config/src/vespa/config/file/filesourcefactory.h @@ -4,7 +4,6 @@ #include <vespa/config/common/sourcefactory.h> #include <vespa/vespalib/stllike/string.h> - namespace config { class DirSpec; @@ -21,7 +20,7 @@ public: /** * Create source handling config described by key. */ - Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const; + Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const override; private: vespalib::string _fileName; }; @@ -37,7 +36,7 @@ public: /** * Create source handling config described by key. */ - Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const; + Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const override; private: vespalib::string _dirName; std::vector<vespalib::string> _fileNames; diff --git a/config/src/vespa/config/frt/connectionfactory.h b/config/src/vespa/config/frt/connectionfactory.h index c2c5bfe0c96..a9ca2155f20 100644 --- a/config/src/vespa/config/frt/connectionfactory.h +++ b/config/src/vespa/config/frt/connectionfactory.h @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include <memory> class FNET_Scheduler; diff --git a/config/src/vespa/config/frt/frtconfigagent.h b/config/src/vespa/config/frt/frtconfigagent.h index b058d184ea0..d8a2e750cc6 100644 --- a/config/src/vespa/config/frt/frtconfigagent.h +++ b/config/src/vespa/config/frt/frtconfigagent.h @@ -26,10 +26,10 @@ class FRTConfigAgent : public ConfigAgent { public: FRTConfigAgent(const IConfigHolder::SP & holder, const TimingValues & timingValues); - void handleResponse(const ConfigRequest & request, ConfigResponse::UP response); - uint64_t getTimeout() const; - uint64_t getWaitTime() const; - const ConfigState & getConfigState() const; + void handleResponse(const ConfigRequest & request, ConfigResponse::UP response) override; + uint64_t getTimeout() const override; + uint64_t getWaitTime() const override; + const ConfigState & getConfigState() const override; private: void handleUpdatedGeneration(const ConfigKey & key, const ConfigState & newState, const ConfigValue & configValue); void handleOKResponse(ConfigResponse::UP response); diff --git a/config/src/vespa/config/frt/frtconfigrequest.h b/config/src/vespa/config/frt/frtconfigrequest.h index ac7f66ffba9..a31ecbcbbb4 100644 --- a/config/src/vespa/config/frt/frtconfigrequest.h +++ b/config/src/vespa/config/frt/frtconfigrequest.h @@ -21,14 +21,14 @@ class FRTConfigRequest : public ConfigRequest { public: typedef std::unique_ptr<FRTConfigRequest> UP; FRTConfigRequest(Connection * connection, const ConfigKey & key); - virtual ~FRTConfigRequest(); + ~FRTConfigRequest(); virtual bool verifyKey(const ConfigKey & key) const = 0; virtual bool verifyState(const ConfigState & state) const = 0; - bool abort(); - bool isAborted() const; - void setError(int errorCode); - const ConfigKey & getKey() const; + bool abort() override; + bool isAborted() const override; + void setError(int errorCode) override; + const ConfigKey & getKey() const override; FRT_RPCRequest* getRequest() { return _request; } virtual ConfigResponse::UP createResponse(FRT_RPCRequest * request) const = 0; @@ -47,9 +47,9 @@ public: const vespalib::string & configMd5, int64_t generation, int64_t serverTimeout); - bool verifyKey(const ConfigKey & key) const; - bool verifyState(const ConfigState & state) const; - ConfigResponse::UP createResponse(FRT_RPCRequest * request) const; + bool verifyKey(const ConfigKey & key) const override; + bool verifyState(const ConfigState & state) const override; + ConfigResponse::UP createResponse(FRT_RPCRequest * request) const override; private: static const vespalib::string REQUEST_TYPES; }; diff --git a/config/src/vespa/config/frt/frtconfigrequestv2.h b/config/src/vespa/config/frt/frtconfigrequestv2.h index d3ed95a26c3..8301bb8b705 100644 --- a/config/src/vespa/config/frt/frtconfigrequestv2.h +++ b/config/src/vespa/config/frt/frtconfigrequestv2.h @@ -22,7 +22,7 @@ public: const vespalib::string & hostName, int64_t serverTimeout, const Trace & trace); - ConfigResponse::UP createResponse(FRT_RPCRequest * request) const; + ConfigResponse::UP createResponse(FRT_RPCRequest * request) const override; }; } diff --git a/config/src/vespa/config/frt/frtconfigrequestv3.h b/config/src/vespa/config/frt/frtconfigrequestv3.h index a8f9580f232..aa5f6778e23 100644 --- a/config/src/vespa/config/frt/frtconfigrequestv3.h +++ b/config/src/vespa/config/frt/frtconfigrequestv3.h @@ -25,7 +25,7 @@ public: const Trace & trace, const VespaVersion & vespaVersion, const CompressionType & compressionType); - ConfigResponse::UP createResponse(FRT_RPCRequest * request) const; + ConfigResponse::UP createResponse(FRT_RPCRequest * request) const override; }; } diff --git a/config/src/vespa/config/frt/frtconfigresponse.h b/config/src/vespa/config/frt/frtconfigresponse.h index 49a7bd8ba58..8e7044cee85 100644 --- a/config/src/vespa/config/frt/frtconfigresponse.h +++ b/config/src/vespa/config/frt/frtconfigresponse.h @@ -23,11 +23,11 @@ public: FRTConfigResponse(FRT_RPCRequest * request); virtual ~FRTConfigResponse(); - bool validateResponse(); - bool hasValidResponse() const; - vespalib::string errorMessage() const; - int errorCode() const; - bool isError() const; + bool validateResponse() override; + bool hasValidResponse() const override; + vespalib::string errorMessage() const override; + int errorCode() const override; + bool isError() const override; virtual const vespalib::string & getResponseTypes() const = 0; private: @@ -45,20 +45,20 @@ private: public: FRTConfigResponseV1(FRT_RPCRequest * request); - const ConfigKey & getKey() const { return _key; } - const ConfigValue & getValue() const { return _value; } - const Trace & getTrace() const { return _trace; } + const ConfigKey & getKey() const override { return _key; } + const ConfigValue & getValue() const override { return _value; } + const Trace & getTrace() const override { return _trace; } - const ConfigState & getConfigState() const { return _state; } + const ConfigState & getConfigState() const override { return _state; } - void fill(); + void fill() override; private: static const vespalib::string RESPONSE_TYPES; const std::vector<vespalib::string> getPayLoad() const; const ConfigKey readKey() const; - const vespalib::string & getResponseTypes() const; + const vespalib::string & getResponseTypes() const override; ConfigKey _key; ConfigValue _value; diff --git a/config/src/vespa/config/frt/frtconfigresponsev2.cpp b/config/src/vespa/config/frt/frtconfigresponsev2.cpp index 53392baa73a..dcd701e2fe9 100644 --- a/config/src/vespa/config/frt/frtconfigresponsev2.cpp +++ b/config/src/vespa/config/frt/frtconfigresponsev2.cpp @@ -1,8 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconfigresponsev2.h" -#include <vespa/config/common/misc.h> #include <vespa/fnet/frt/frt.h> -#include <vespa/vespalib/stllike/string.h> using namespace vespalib; using namespace vespalib::slime; @@ -16,8 +14,7 @@ public: V2Payload(const SlimePtr & data) : _data(data) {} - const Inspector & getSlimePayload() const - { + const Inspector & getSlimePayload() const override { return extractPayload(*_data); } private: diff --git a/config/src/vespa/config/frt/frtconfigresponsev2.h b/config/src/vespa/config/frt/frtconfigresponsev2.h index ce370b3880d..204f982d035 100644 --- a/config/src/vespa/config/frt/frtconfigresponsev2.h +++ b/config/src/vespa/config/frt/frtconfigresponsev2.h @@ -2,11 +2,7 @@ #pragma once #include "slimeconfigresponse.h" -#include <vespa/config/common/configkey.h> #include <vespa/config/common/configvalue.h> -#include <vespa/config/common/trace.h> -#include <vespa/vespalib/data/slime/slime.h> -#include "protocol.h" class FRT_RPCRequest; class FRT_Values; @@ -24,8 +20,8 @@ public: private: static const vespalib::string RESPONSE_TYPES; - const vespalib::string & getResponseTypes() const; - const ConfigValue readConfigValue() const; + const vespalib::string & getResponseTypes() const override; + const ConfigValue readConfigValue() const override; }; } // namespace config diff --git a/config/src/vespa/config/frt/frtconfigresponsev3.cpp b/config/src/vespa/config/frt/frtconfigresponsev3.cpp index 191b1932bf0..be37ad814ab 100644 --- a/config/src/vespa/config/frt/frtconfigresponsev3.cpp +++ b/config/src/vespa/config/frt/frtconfigresponsev3.cpp @@ -1,9 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "frtconfigresponsev3.h" #include "compressioninfo.h" -#include <vespa/config/common/misc.h> #include <vespa/fnet/frt/frt.h> -#include <vespa/vespalib/stllike/string.h> + #include <vespa/log/log.h> LOG_SETUP(".config.frt.frtconfigresponsev3"); @@ -30,8 +29,7 @@ public: { } - const Inspector & getSlimePayload() const - { + const Inspector & getSlimePayload() const override { return _data->get(); } private: diff --git a/config/src/vespa/config/frt/frtconfigresponsev3.h b/config/src/vespa/config/frt/frtconfigresponsev3.h index e2b9b9e5286..725d72f67d0 100644 --- a/config/src/vespa/config/frt/frtconfigresponsev3.h +++ b/config/src/vespa/config/frt/frtconfigresponsev3.h @@ -2,11 +2,8 @@ #pragma once #include "slimeconfigresponse.h" -#include <vespa/config/common/configkey.h> #include <vespa/config/common/configvalue.h> -#include <vespa/config/common/trace.h> -#include <vespa/vespalib/data/slime/slime.h> -#include "protocol.h" + class FRT_RPCRequest; class FRT_Values; @@ -24,8 +21,8 @@ public: private: static const vespalib::string RESPONSE_TYPES; - const vespalib::string & getResponseTypes() const; - const ConfigValue readConfigValue() const; + const vespalib::string & getResponseTypes() const override; + const ConfigValue readConfigValue() const override; }; } // namespace config diff --git a/config/src/vespa/config/frt/frtconnection.h b/config/src/vespa/config/frt/frtconnection.h index a8c0b03b288..d0a8163413c 100644 --- a/config/src/vespa/config/frt/frtconnection.h +++ b/config/src/vespa/config/frt/frtconnection.h @@ -35,20 +35,19 @@ public: FRTConnection(const vespalib::string & address, FRT_Supervisor & supervisor, const TimingValues & timingValues); ~FRTConnection(); - FRT_RPCRequest * allocRPCRequest() - { + FRT_RPCRequest * allocRPCRequest() override { return _supervisor.AllocRPCRequest(); } - void invoke(FRT_RPCRequest * req, double timeout, FRT_IRequestWait * waiter); - const vespalib::string & getAddress() const { return _address; } + void invoke(FRT_RPCRequest * req, double timeout, FRT_IRequestWait * waiter) override; + const vespalib::string & getAddress() const override { return _address; } int64_t getSuspendedUntil() { return _suspendedUntil; } - void setError(int errorCode); + void setError(int errorCode) override; void setSuccess(); void calculateSuspension(ErrorType type); int64_t getTransientDelay() { return _transientDelay; } int64_t getMaxTransientDelay() { return getTransientDelay() * 6; } - void setTransientDelay(int64_t delay) { _transientDelay = delay; } + void setTransientDelay(int64_t delay) override { _transientDelay = delay; } int64_t getFatalDelay() { return _fatalDelay; } int64_t getMaxFatalDelay() { return getFatalDelay() * 6; } void setFatalDelay(int64_t delay) { _fatalDelay = delay; } diff --git a/config/src/vespa/config/frt/frtconnectionpool.h b/config/src/vespa/config/frt/frtconnectionpool.h index 28f2ee83557..d5af64bba93 100644 --- a/config/src/vespa/config/frt/frtconnectionpool.h +++ b/config/src/vespa/config/frt/frtconnectionpool.h @@ -1,14 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "frtconnection.h" +#include "connectionfactory.h" +#include <vespa/config/subscription/sourcespec.h> +#include <vespa/fnet/frt/frt.h> #include <vector> #include <string> #include <map> -#include <vespa/fnet/frt/frt.h> -#include "frtconnection.h" -#include <vespa/config/subscription/sourcespec.h> -#include "connectionfactory.h" - namespace config { class FRTConnectionPool : public ConnectionFactory { @@ -43,7 +42,7 @@ public: FRTConnectionPool(const ServerSpec & spec, const TimingValues & timingValues); ~FRTConnectionPool(); - void syncTransport(); + void syncTransport() override; /** * Sets the hostname to the host where this program is running. @@ -57,7 +56,7 @@ public: */ void setHostname(const vespalib::string & hostname) { _hostname = hostname; } - FNET_Scheduler * getScheduler() { return _supervisor.GetScheduler(); } + FNET_Scheduler * getScheduler() override { return _supervisor.GetScheduler(); } /** * Gets the hostname. @@ -81,7 +80,7 @@ public: * * @return The next FRTConnection instance in the list. */ - Connection* getCurrent(); + Connection* getCurrent() override; /** * Returns the next FRTConnection instance from the list of error-free sources in a round robin diff --git a/config/src/vespa/config/frt/frtsource.cpp b/config/src/vespa/config/frt/frtsource.cpp index 7081cbc0e3a..85eda648dc8 100644 --- a/config/src/vespa/config/frt/frtsource.cpp +++ b/config/src/vespa/config/frt/frtsource.cpp @@ -2,9 +2,7 @@ #include "frtconfigrequest.h" #include "frtconfigresponse.h" #include "frtsource.h" -#include "connection.h" #include <vespa/vespalib/util/closuretask.h> -#include <vespa/fnet/frt/frt.h> #include <vespa/log/log.h> LOG_SETUP(".config.frt.frtsource"); @@ -21,12 +19,10 @@ public: _source(source) { } - ~GetConfigTask() - { + ~GetConfigTask() { Kill(); } - void PerformTask() - { + void PerformTask() override { _source->getConfig(); } private: diff --git a/config/src/vespa/config/frt/frtsource.h b/config/src/vespa/config/frt/frtsource.h index 2e20bbc4a1a..653d182707b 100644 --- a/config/src/vespa/config/frt/frtsource.h +++ b/config/src/vespa/config/frt/frtsource.h @@ -1,12 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/config/common/source.h> + #include "connectionfactory.h" #include "frtconfigagent.h" +#include "frtconfigrequestfactory.h" #include <vespa/config/common/configkey.h> #include <vespa/config/common/configrequest.h> -#include "frtconfigrequestfactory.h" +#include <vespa/config/common/source.h> #include <vespa/fnet/frt/frt.h> #include <vespa/vespalib/util/sync.h> @@ -23,10 +24,10 @@ public: FRTSource(const ConnectionFactory::SP & connectionFactory, const FRTConfigRequestFactory & requestFactory, ConfigAgent::UP agent, const ConfigKey & key); ~FRTSource(); - void RequestDone(FRT_RPCRequest * request); - void close(); - void reload(int64_t generation); - void getConfig(); + void RequestDone(FRT_RPCRequest * request) override; + void close() override; + void reload(int64_t generation) override; + void getConfig() override; const FRTConfigRequest & getCurrentRequest() const; diff --git a/config/src/vespa/config/frt/frtsourcefactory.h b/config/src/vespa/config/frt/frtsourcefactory.h index a16a628ee1f..fb95d259df7 100644 --- a/config/src/vespa/config/frt/frtsourcefactory.h +++ b/config/src/vespa/config/frt/frtsourcefactory.h @@ -1,10 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/config/common/sourcefactory.h> -#include <vespa/config/common/timingvalues.h> #include "connectionfactory.h" #include "frtconfigrequestfactory.h" +#include <vespa/config/common/sourcefactory.h> +#include <vespa/config/common/timingvalues.h> namespace config { @@ -19,7 +19,7 @@ public: /** * Create source handling config described by key. */ - Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const; + Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const override; private: ConnectionFactory::SP _connectionFactory; diff --git a/config/src/vespa/config/frt/slimeconfigrequest.h b/config/src/vespa/config/frt/slimeconfigrequest.h index af5272597be..878681cf441 100644 --- a/config/src/vespa/config/frt/slimeconfigrequest.h +++ b/config/src/vespa/config/frt/slimeconfigrequest.h @@ -29,10 +29,10 @@ public: int64_t protocolVersion, const CompressionType & compressionType, const vespalib::string & methodName); - virtual ~SlimeConfigRequest() {} - bool verifyKey(const ConfigKey & key) const; - bool verifyState(const ConfigState & state) const; - virtual ConfigResponse::UP createResponse(FRT_RPCRequest * request) const = 0; + ~SlimeConfigRequest() {} + bool verifyKey(const ConfigKey & key) const override; + bool verifyState(const ConfigState & state) const override; + virtual ConfigResponse::UP createResponse(FRT_RPCRequest * request) const override = 0; private: void populateSlimeRequest(const ConfigKey & key, const vespalib::string & configMd5, diff --git a/config/src/vespa/config/frt/slimeconfigresponse.h b/config/src/vespa/config/frt/slimeconfigresponse.h index 4f22f0726bc..5405a3325f3 100644 --- a/config/src/vespa/config/frt/slimeconfigresponse.h +++ b/config/src/vespa/config/frt/slimeconfigresponse.h @@ -22,17 +22,17 @@ private: SlimeConfigResponse& operator=(const SlimeConfigResponse&); public: SlimeConfigResponse(FRT_RPCRequest * request); - virtual ~SlimeConfigResponse() {} + ~SlimeConfigResponse() {} - const ConfigKey & getKey() const { return _key; } - const ConfigValue & getValue() const { return _value; } - const ConfigState & getConfigState() const { return _state; } - const Trace & getTrace() const { return _trace; } + const ConfigKey & getKey() const override { return _key; } + const ConfigValue & getValue() const override { return _value; } + const ConfigState & getConfigState() const override { return _state; } + const Trace & getTrace() const override { return _trace; } vespalib::string getHostName() const; vespalib::string getConfigMd5() const; - void fill(); + void fill() override; protected: virtual const ConfigValue readConfigValue() const = 0; diff --git a/config/src/vespa/config/print/asciiconfigsnapshotreader.h b/config/src/vespa/config/print/asciiconfigsnapshotreader.h index 28120b38b93..ec8d6bef709 100644 --- a/config/src/vespa/config/print/asciiconfigsnapshotreader.h +++ b/config/src/vespa/config/print/asciiconfigsnapshotreader.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vespalib/stllike/asciistream.h> #include "configsnapshotreader.h" +#include <vespa/vespalib/stllike/asciistream.h> namespace config { @@ -18,7 +18,7 @@ public: * * @return Snapshot containing the configs. */ - ConfigSnapshot read(); + ConfigSnapshot read() override; private: const vespalib::asciistream & _is; }; diff --git a/config/src/vespa/config/print/asciiconfigsnapshotwriter.h b/config/src/vespa/config/print/asciiconfigsnapshotwriter.h index f49da791477..88bf557a2d6 100644 --- a/config/src/vespa/config/print/asciiconfigsnapshotwriter.h +++ b/config/src/vespa/config/print/asciiconfigsnapshotwriter.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vespalib/stllike/asciistream.h> #include "configsnapshotwriter.h" +#include <vespa/vespalib/stllike/asciistream.h> namespace config { @@ -12,7 +12,7 @@ namespace config { class AsciiConfigSnapshotWriter : public ConfigSnapshotWriter { public: AsciiConfigSnapshotWriter(vespalib::asciistream & os); - bool write(const ConfigSnapshot & snapshot); + bool write(const ConfigSnapshot & snapshot) override; private: vespalib::asciistream & _os; }; diff --git a/config/src/vespa/config/print/asciiconfigwriter.h b/config/src/vespa/config/print/asciiconfigwriter.h index a22e3608855..61e6169e5b9 100644 --- a/config/src/vespa/config/print/asciiconfigwriter.h +++ b/config/src/vespa/config/print/asciiconfigwriter.h @@ -10,8 +10,8 @@ namespace config { class AsciiConfigWriter : public ConfigWriter { public: AsciiConfigWriter(vespalib::asciistream & os); - bool write(const ConfigInstance & config); - bool write(const ConfigInstance & config, const ConfigFormatter & formatter); + bool write(const ConfigInstance & config) override; + bool write(const ConfigInstance & config, const ConfigFormatter & formatter) override; private: vespalib::asciistream & _os; }; diff --git a/config/src/vespa/config/print/fileconfigformatter.cpp b/config/src/vespa/config/print/fileconfigformatter.cpp index c983572e04a..86cc7be5aa9 100644 --- a/config/src/vespa/config/print/fileconfigformatter.cpp +++ b/config/src/vespa/config/print/fileconfigformatter.cpp @@ -130,8 +130,8 @@ struct ConfigEncoder : public ArrayTraverser, } abort(); // should not be reached } - virtual void entry(size_t idx, const Inspector &inspector); - virtual void field(const Memory &symbol_name, const Inspector &inspector); + void entry(size_t idx, const Inspector &inspector) override; + void field(const Memory &symbol_name, const Inspector &inspector) override; static void encode(Inspector & root, OutputWriter &out) { ConfigEncoder encoder(out); diff --git a/config/src/vespa/config/print/fileconfigformatter.h b/config/src/vespa/config/print/fileconfigformatter.h index 68476bf95b5..8d94eb51a2e 100644 --- a/config/src/vespa/config/print/fileconfigformatter.h +++ b/config/src/vespa/config/print/fileconfigformatter.h @@ -12,9 +12,9 @@ namespace config { class FileConfigFormatter : public ConfigFormatter { public: // Inherits ConfigFormatter - void encode(ConfigDataBuffer & buffer) const; + void encode(ConfigDataBuffer & buffer) const override; // Inherits ConfigFormatter - size_t decode(ConfigDataBuffer & buffer) const; + size_t decode(ConfigDataBuffer & buffer) const override; }; } // namespace config diff --git a/config/src/vespa/config/print/fileconfigsnapshotreader.h b/config/src/vespa/config/print/fileconfigsnapshotreader.h index fdf3dbd303c..1c9e7ae5aea 100644 --- a/config/src/vespa/config/print/fileconfigsnapshotreader.h +++ b/config/src/vespa/config/print/fileconfigsnapshotreader.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vespalib/stllike/string.h> #include "configsnapshotreader.h" +#include <vespa/vespalib/stllike/string.h> namespace config { @@ -18,7 +18,7 @@ public: * * @return Snapshot containing the configs. */ - ConfigSnapshot read(); + ConfigSnapshot read() override; private: const vespalib::string _fileName; }; diff --git a/config/src/vespa/config/print/fileconfigsnapshotwriter.h b/config/src/vespa/config/print/fileconfigsnapshotwriter.h index 104966827be..5d5290073df 100644 --- a/config/src/vespa/config/print/fileconfigsnapshotwriter.h +++ b/config/src/vespa/config/print/fileconfigsnapshotwriter.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vespalib/stllike/string.h> #include "configsnapshotwriter.h" +#include <vespa/vespalib/stllike/string.h> namespace config { @@ -12,7 +12,7 @@ namespace config { class FileConfigSnapshotWriter : public ConfigSnapshotWriter { public: FileConfigSnapshotWriter(const vespalib::string & fileName); - bool write(const ConfigSnapshot & snapshot); + bool write(const ConfigSnapshot & snapshot) override; private: const vespalib::string _fileName; }; diff --git a/config/src/vespa/config/print/fileconfigwriter.h b/config/src/vespa/config/print/fileconfigwriter.h index b79f7456199..df00628ae28 100644 --- a/config/src/vespa/config/print/fileconfigwriter.h +++ b/config/src/vespa/config/print/fileconfigwriter.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vespalib/stllike/string.h> #include "configwriter.h" #include "configformatter.h" +#include <vespa/vespalib/stllike/string.h> namespace config { @@ -14,8 +14,8 @@ class FileConfigWriter : public ConfigWriter { public: FileConfigWriter(const vespalib::string & fileName); // Implements ConfigWriter - bool write(const ConfigInstance & config); - bool write(const ConfigInstance & config, const ConfigFormatter & formatter); + bool write(const ConfigInstance & config) override; + bool write(const ConfigInstance & config, const ConfigFormatter & formatter) override; private: const vespalib::string _fileName; }; diff --git a/config/src/vespa/config/print/jsonconfigformatter.h b/config/src/vespa/config/print/jsonconfigformatter.h index f1b981870b2..4b37f822c23 100644 --- a/config/src/vespa/config/print/jsonconfigformatter.h +++ b/config/src/vespa/config/print/jsonconfigformatter.h @@ -12,9 +12,9 @@ class JsonConfigFormatter : public ConfigFormatter { public: JsonConfigFormatter(bool compact = false); // Inherits ConfigFormatter - void encode(ConfigDataBuffer & buffer) const; + void encode(ConfigDataBuffer & buffer) const override; // Inherits ConfigFormatter - size_t decode(ConfigDataBuffer & buffer) const; + size_t decode(ConfigDataBuffer & buffer) const override; private: const bool _compact; }; diff --git a/config/src/vespa/config/print/ostreamconfigwriter.cpp b/config/src/vespa/config/print/ostreamconfigwriter.cpp index eda15d9e2c0..04f47fe169b 100644 --- a/config/src/vespa/config/print/ostreamconfigwriter.cpp +++ b/config/src/vespa/config/print/ostreamconfigwriter.cpp @@ -2,6 +2,7 @@ #include "ostreamconfigwriter.h" #include "fileconfigformatter.h" +#include <ostream> namespace config { diff --git a/config/src/vespa/config/print/ostreamconfigwriter.h b/config/src/vespa/config/print/ostreamconfigwriter.h index fa211f9085f..0ecd548dd15 100644 --- a/config/src/vespa/config/print/ostreamconfigwriter.h +++ b/config/src/vespa/config/print/ostreamconfigwriter.h @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <ostream> #include "configwriter.h" #include "configformatter.h" @@ -14,8 +13,8 @@ class OstreamConfigWriter : public ConfigWriter { public: OstreamConfigWriter(std::ostream & os); - bool write(const ConfigInstance & config); - bool write(const ConfigInstance & config, const ConfigFormatter & formatter); + bool write(const ConfigInstance & config) override; + bool write(const ConfigInstance & config, const ConfigFormatter & formatter) override; private: std::ostream & _os; }; diff --git a/config/src/vespa/config/raw/rawsource.h b/config/src/vespa/config/raw/rawsource.h index b93e58c2111..ec36dd2c47d 100644 --- a/config/src/vespa/config/raw/rawsource.h +++ b/config/src/vespa/config/raw/rawsource.h @@ -14,9 +14,9 @@ class RawSource : public Source { public: RawSource(const IConfigHolder::SP & holder, const vespalib::string & payload); - void getConfig(); - void reload(int64_t generation); - void close(); + void getConfig() override; + void reload(int64_t generation) override; + void close() override; private: IConfigHolder::SP _holder; std::vector<vespalib::string> readConfig(); diff --git a/config/src/vespa/config/raw/rawsourcefactory.h b/config/src/vespa/config/raw/rawsourcefactory.h index e994bb54ba8..62affc6b5d5 100644 --- a/config/src/vespa/config/raw/rawsourcefactory.h +++ b/config/src/vespa/config/raw/rawsourcefactory.h @@ -14,7 +14,7 @@ public: : _payload(payload) { } - Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const; + Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const override; private: const vespalib::string _payload; }; diff --git a/config/src/vespa/config/retriever/configsnapshot.cpp b/config/src/vespa/config/retriever/configsnapshot.cpp index b46b3f34898..b04f44bf600 100644 --- a/config/src/vespa/config/retriever/configsnapshot.cpp +++ b/config/src/vespa/config/retriever/configsnapshot.cpp @@ -232,14 +232,11 @@ namespace { class FixedPayload : public protocol::Payload { public: - const Inspector & getSlimePayload() const - { + const Inspector & getSlimePayload() const override { return _data.get(); } - Slime & getData() { - return _data; - } + Slime & getData() { return _data; } private: Slime _data; }; diff --git a/config/src/vespa/config/retriever/simpleconfigurer.h b/config/src/vespa/config/retriever/simpleconfigurer.h index 69d4eea545d..ade2731f4bb 100644 --- a/config/src/vespa/config/retriever/simpleconfigurer.h +++ b/config/src/vespa/config/retriever/simpleconfigurer.h @@ -39,7 +39,7 @@ public: */ void close(); - void run(); + void run() override; private: void runConfigure(); diff --git a/config/src/vespa/config/set/configinstancesourcefactory.cpp b/config/src/vespa/config/set/configinstancesourcefactory.cpp index fcf1b0f213b..4674546397d 100644 --- a/config/src/vespa/config/set/configinstancesourcefactory.cpp +++ b/config/src/vespa/config/set/configinstancesourcefactory.cpp @@ -1,8 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "configinstancesourcefactory.h" -#include <vespa/config/common/source.h> -#include <vespa/config/common/misc.h> namespace { @@ -13,14 +11,14 @@ public: _buffer(buffer), _generation(-1) { } - virtual void close() { } - virtual void getConfig() { + void close() override { } + void getConfig() override { std::vector<vespalib::string> lines(_buffer.getlines()); std::string currentMd5(config::calculateContentMd5(lines)); _holder->handle(config::ConfigUpdate::UP(new config::ConfigUpdate(config::ConfigValue(lines, currentMd5), true, _generation))); } - virtual void reload(int64_t generation) { _generation = generation; } + void reload(int64_t generation) override { _generation = generation; } private: config::IConfigHolder::SP _holder; vespalib::asciistream _buffer; diff --git a/config/src/vespa/config/set/configinstancesourcefactory.h b/config/src/vespa/config/set/configinstancesourcefactory.h index 8b1a4c68cbd..9a937d20ff0 100644 --- a/config/src/vespa/config/set/configinstancesourcefactory.h +++ b/config/src/vespa/config/set/configinstancesourcefactory.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/config/common/sourcefactory.h> #include "configsetsource.h" +#include <vespa/config/common/sourcefactory.h> #include <vespa/vespalib/stllike/asciistream.h> namespace config { @@ -22,7 +22,7 @@ public: /** * Create source handling config described by key. */ - Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const; + Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const override; private: const ConfigKey _key; vespalib::asciistream _buffer; diff --git a/config/src/vespa/config/set/configsetsource.h b/config/src/vespa/config/set/configsetsource.h index d2a3d9121ad..2fec684601c 100644 --- a/config/src/vespa/config/set/configsetsource.h +++ b/config/src/vespa/config/set/configsetsource.h @@ -21,9 +21,9 @@ public: ConfigSetSource(const IConfigHolder::SP & holder, const ConfigKey & key, const BuilderMapSP & builderMap); ~ConfigSetSource(); - void getConfig(); - void reload(int64_t generation); - void close(); + void getConfig() override; + void reload(int64_t generation) override; + void close() override; private: IConfigHolder::SP _holder; const ConfigKey _key; diff --git a/config/src/vespa/config/set/configsetsourcefactory.h b/config/src/vespa/config/set/configsetsourcefactory.h index e3bac385e07..9894bf5be16 100644 --- a/config/src/vespa/config/set/configsetsourcefactory.h +++ b/config/src/vespa/config/set/configsetsourcefactory.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/config/common/sourcefactory.h> #include "configsetsource.h" +#include <vespa/config/common/sourcefactory.h> namespace config { @@ -23,7 +23,7 @@ public: /** * Create source handling config described by key. */ - Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const; + Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const override; private: BuilderMapSP _builderMap; }; diff --git a/config/src/vespa/config/subscription/configinstancespec.h b/config/src/vespa/config/subscription/configinstancespec.h index a75f7eea3de..d5b9656d29b 100644 --- a/config/src/vespa/config/subscription/configinstancespec.h +++ b/config/src/vespa/config/subscription/configinstancespec.h @@ -15,7 +15,7 @@ class ConfigInstanceSpec : public SourceSpec { public: ConfigInstanceSpec(const ConfigInstance & instance); - std::unique_ptr<SourceFactory> createSourceFactory(const TimingValues & timingValues) const; + std::unique_ptr<SourceFactory> createSourceFactory(const TimingValues & timingValues) const override; private: const ConfigKey _key; vespalib::asciistream _buffer; diff --git a/config/src/vespa/config/subscription/sourcespec.h b/config/src/vespa/config/subscription/sourcespec.h index f4853928f71..f35e3a48379 100644 --- a/config/src/vespa/config/subscription/sourcespec.h +++ b/config/src/vespa/config/subscription/sourcespec.h @@ -2,8 +2,8 @@ #pragma once -#include <vespa/vespalib/stllike/string.h> #include <vespa/config/common/compressiontype.h> +#include <vespa/vespalib/stllike/string.h> #include <vector> namespace config { @@ -54,7 +54,7 @@ public: RawSpec(const vespalib::string & config); // Implements SourceSpec - SourceFactorySP createSourceFactory(const TimingValues & timingValues) const; + SourceFactorySP createSourceFactory(const TimingValues & timingValues) const override; /** * Returns the string representation of this config. @@ -89,7 +89,7 @@ public: const vespalib::string & getFileName() const { return _fileName; } // Implements SourceSpec - SourceFactorySP createSourceFactory(const TimingValues & timingValues) const; + SourceFactorySP createSourceFactory(const TimingValues & timingValues) const override; private: void verifyName(const vespalib::string & fileName); vespalib::string _fileName; @@ -117,7 +117,7 @@ public: const vespalib::string & getDirName() const { return _dirName; } // Implements SourceSpec - SourceFactorySP createSourceFactory(const TimingValues & timingValues) const; + SourceFactorySP createSourceFactory(const TimingValues & timingValues) const override; private: vespalib::string _dirName; }; @@ -154,7 +154,7 @@ public: ServerSpec(const vespalib::string & hostSpec); // Implements SourceSpec - virtual SourceFactorySP createSourceFactory(const TimingValues & timingValues) const; + virtual SourceFactorySP createSourceFactory(const TimingValues & timingValues) const override; /** * Add another host to this source spec, allowing failover. @@ -229,7 +229,7 @@ public: void addBuilder(const vespalib::string & configId, ConfigInstance * builder); // Implements SourceSpec - SourceFactorySP createSourceFactory(const TimingValues & timingValues) const; + SourceFactorySP createSourceFactory(const TimingValues & timingValues) const override; private: BuilderMapSP _builderMap; }; diff --git a/eval/src/vespa/eval/eval/basic_nodes.h b/eval/src/vespa/eval/eval/basic_nodes.h index 2887856a66d..f7bd5af3307 100644 --- a/eval/src/vespa/eval/eval/basic_nodes.h +++ b/eval/src/vespa/eval/eval/basic_nodes.h @@ -109,10 +109,10 @@ public: virtual bool is_const() const override { return true; } virtual double get_const_value() const override { return value(); } double value() const { return _value; } - virtual vespalib::string dump(DumpContext &) const { + vespalib::string dump(DumpContext &) const override { return make_string("%g", _value); } - virtual void accept(NodeVisitor &visitor) const override; + void accept(NodeVisitor &visitor) const override; }; class Symbol : public Leaf { @@ -122,10 +122,10 @@ public: static const int UNDEF = std::numeric_limits<int>::max(); explicit Symbol(int id_in) : _id(id_in) {} int id() const { return _id; } - virtual bool is_param() const override { + bool is_param() const override { return (_id >= 0); } - virtual vespalib::string dump(DumpContext &ctx) const { + vespalib::string dump(DumpContext &ctx) const override { if (_id >= 0) { // param value assert(size_t(_id) < ctx.param_names.size()); return ctx.param_names[_id]; @@ -135,7 +135,7 @@ public: return ctx.let_names[let_offset]; } } - virtual void accept(NodeVisitor &visitor) const override; + void accept(NodeVisitor &visitor) const override; }; class String : public Leaf { @@ -143,12 +143,12 @@ private: vespalib::string _value; public: String(const vespalib::string &value_in) : _value(value_in) {} - virtual bool is_const() const override { return true; } - virtual double get_const_value() const override { return hash(); } + bool is_const() const override { return true; } + double get_const_value() const override { return hash(); } const vespalib::string value() const { return _value; } uint32_t hash() const { return hash_code(_value.data(), _value.size()); } - virtual vespalib::string dump(DumpContext &ctx) const; - virtual void accept(NodeVisitor &visitor) const override; + vespalib::string dump(DumpContext &ctx) const override; + void accept(NodeVisitor &visitor) const override; }; class Array : public Node { @@ -157,12 +157,12 @@ private: bool _is_const; public: Array() : _nodes(), _is_const(false) {} - virtual bool is_const() const override { return _is_const; } + bool is_const() const override { return _is_const; } size_t size() const { return _nodes.size(); } const Node &get(size_t i) const { return *_nodes[i]; } - virtual size_t num_children() const override { return size(); } - virtual const Node &get_child(size_t idx) const override { return get(idx); } - virtual void detach_children(NodeHandler &handler) override { + size_t num_children() const override { return size(); } + const Node &get_child(size_t idx) const override { return get(idx); } + void detach_children(NodeHandler &handler) override { for (size_t i = 0; i < _nodes.size(); ++i) { handler.handle(std::move(_nodes[i])); } @@ -176,7 +176,7 @@ public: } _nodes.push_back(std::move(node)); } - virtual vespalib::string dump(DumpContext &ctx) const { + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "["; CommaTracker node_list; @@ -187,7 +187,7 @@ public: str += "]"; return str; } - virtual void accept(NodeVisitor &visitor) const override; + void accept(NodeVisitor &visitor) const override; }; class Neg : public Node { @@ -196,25 +196,25 @@ private: bool _is_const; public: Neg(Node_UP child_in) : _child(std::move(child_in)), _is_const(_child->is_const()) {} - virtual bool is_const() const override { return _is_const; } + bool is_const() const override { return _is_const; } const Node &child() const { return *_child; } - virtual size_t num_children() const override { return _child ? 1 : 0; } - virtual const Node &get_child(size_t idx) const override { + size_t num_children() const override { return _child ? 1 : 0; } + const Node &get_child(size_t idx) const override { (void) idx; assert(idx == 0); return child(); } - virtual void detach_children(NodeHandler &handler) override { + void detach_children(NodeHandler &handler) override { handler.handle(std::move(_child)); } - virtual vespalib::string dump(DumpContext &ctx) const { + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "(-"; str += _child->dump(ctx); str += ")"; return str; } - virtual void accept(NodeVisitor &visitor) const override; + void accept(NodeVisitor &visitor) const override; }; class Not : public Node { @@ -223,25 +223,25 @@ private: bool _is_const; public: Not(Node_UP child_in) : _child(std::move(child_in)), _is_const(_child->is_const()) {} - virtual bool is_const() const override { return _is_const; } + bool is_const() const override { return _is_const; } const Node &child() const { return *_child; } - virtual size_t num_children() const override { return _child ? 1 : 0; } - virtual const Node &get_child(size_t idx) const override { + size_t num_children() const override { return _child ? 1 : 0; } + const Node &get_child(size_t idx) const override { (void) idx; assert(idx == 0); return child(); } - virtual void detach_children(NodeHandler &handler) override { + void detach_children(NodeHandler &handler) override { handler.handle(std::move(_child)); } - virtual vespalib::string dump(DumpContext &ctx) const { + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "(!"; str += _child->dump(ctx); str += ")"; return str; } - virtual void accept(NodeVisitor &visitor) const override; + void accept(NodeVisitor &visitor) const override; }; class If : public Node { @@ -257,11 +257,11 @@ public: const Node &true_expr() const { return *_true_expr; } const Node &false_expr() const { return *_false_expr; } double p_true() const { return _p_true; } - virtual bool is_tree() const override { return _is_tree; } - virtual size_t num_children() const override { + bool is_tree() const override { return _is_tree; } + size_t num_children() const override { return (_cond && _true_expr && _false_expr) ? 3 : 0; } - virtual const Node &get_child(size_t idx) const override { + const Node &get_child(size_t idx) const override { assert(idx < 3); if (idx == 0) { return cond(); @@ -271,12 +271,12 @@ public: return false_expr(); } } - virtual void detach_children(NodeHandler &handler) override { + void detach_children(NodeHandler &handler) override { handler.handle(std::move(_cond)); handler.handle(std::move(_true_expr)); handler.handle(std::move(_false_expr)); } - virtual vespalib::string dump(DumpContext &ctx) const { + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "if("; str += _cond->dump(ctx); @@ -290,7 +290,7 @@ public: str += ")"; return str; } - virtual void accept(NodeVisitor &visitor) const override; + void accept(NodeVisitor &visitor) const override; }; class Let : public Node { @@ -304,16 +304,16 @@ public: const vespalib::string &name() const { return _name; } const Node &value() const { return *_value; } const Node &expr() const { return *_expr; } - virtual size_t num_children() const override { return (_value && _expr) ? 2 : 0; } - virtual const Node &get_child(size_t idx) const override { + size_t num_children() const override { return (_value && _expr) ? 2 : 0; } + const Node &get_child(size_t idx) const override { assert(idx < 2); return (idx == 0) ? value() : expr(); } - virtual void detach_children(NodeHandler &handler) override { + void detach_children(NodeHandler &handler) override { handler.handle(std::move(_value)); handler.handle(std::move(_expr)); } - virtual vespalib::string dump(DumpContext &ctx) const { + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "let("; str += _name; @@ -326,7 +326,7 @@ public: str += ")"; return str; } - virtual void accept(NodeVisitor &visitor) const override; + void accept(NodeVisitor &visitor) const override; }; class Error : public Leaf { @@ -335,8 +335,8 @@ private: public: Error(const vespalib::string &message_in) : _message(message_in) {} const vespalib::string &message() const { return _message; } - virtual vespalib::string dump(DumpContext &) const { return _message; } - virtual void accept(NodeVisitor &visitor) const override; + vespalib::string dump(DumpContext &) const override { return _message; } + void accept(NodeVisitor &visitor) const override; }; } // namespace vespalib::eval::nodes diff --git a/eval/src/vespa/eval/eval/call_nodes.h b/eval/src/vespa/eval/eval/call_nodes.h index 01283a00e42..87a9c6007cb 100644 --- a/eval/src/vespa/eval/eval/call_nodes.h +++ b/eval/src/vespa/eval/eval/call_nodes.h @@ -30,14 +30,14 @@ public: Call(const vespalib::string &name_in, size_t num_params_in) : _name(name_in), _num_params(num_params_in), _is_const(false) {} ~Call(); - virtual bool is_const() const override { return _is_const; } + bool is_const() const override { return _is_const; } const vespalib::string &name() const { return _name; } size_t num_params() const { return _num_params; } size_t num_args() const { return _args.size(); } const Node &arg(size_t i) const { return *_args[i]; } - virtual size_t num_children() const override { return num_args(); } - virtual const Node &get_child(size_t idx) const override { return arg(idx); } - virtual void detach_children(NodeHandler &handler) override { + size_t num_children() const override { return num_args(); } + const Node &get_child(size_t idx) const override { return arg(idx); } + void detach_children(NodeHandler &handler) override { for (size_t i = 0; i < _args.size(); ++i) { handler.handle(std::move(_args[i])); } @@ -51,7 +51,7 @@ public: } _args.push_back(std::move(arg_in)); } - virtual vespalib::string dump(DumpContext &ctx) const { + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += _name; str += "("; @@ -106,7 +106,7 @@ struct CallHelper : Call { typedef CallHelper<T> Helper; CallHelper(const vespalib::string &name_in, size_t num_params_in) : Call(name_in, num_params_in) {} - virtual void accept(NodeVisitor &visitor) const override; + void accept(NodeVisitor &visitor) const override; static Call_UP create() { return Call_UP(new T()); } }; diff --git a/eval/src/vespa/eval/eval/function.cpp b/eval/src/vespa/eval/eval/function.cpp index 5be5147fa3a..dd8d7743041 100644 --- a/eval/src/vespa/eval/eval/function.cpp +++ b/eval/src/vespa/eval/eval/function.cpp @@ -83,15 +83,15 @@ struct ExplicitParams : Params { lookup_add(param); } } - virtual bool implicit() const { return false; } - virtual size_t resolve(vespalib::stringref token) const override { + bool implicit() const override { return false; } + size_t resolve(vespalib::stringref token) const override { return lookup(token); } }; struct ImplicitParams : Params { - virtual bool implicit() const { return true; } - virtual size_t resolve(vespalib::stringref token) const override { + bool implicit() const override { return true; } + size_t resolve(vespalib::stringref token) const override { return const_cast<ImplicitParams*>(this)->lookup_add(token); } }; diff --git a/eval/src/vespa/eval/eval/interpreted_function.cpp b/eval/src/vespa/eval/eval/interpreted_function.cpp index b308de6b3c0..82d34e1017d 100644 --- a/eval/src/vespa/eval/eval/interpreted_function.cpp +++ b/eval/src/vespa/eval/eval/interpreted_function.cpp @@ -239,10 +239,10 @@ struct ProgramBuilder : public NodeVisitor, public NodeTraverser { //------------------------------------------------------------------------- - virtual void visit(const Number &node) { + void visit(const Number&node) override { program.emplace_back(op_load_const, wrap_param<Value>(stash.create<DoubleValue>(node.value()))); } - virtual void visit(const Symbol &node) { + void visit(const Symbol&node) override { if (node.id() >= 0) { // param value program.emplace_back(op_load_param, node.id()); } else { // let binding @@ -250,19 +250,19 @@ struct ProgramBuilder : public NodeVisitor, public NodeTraverser { program.emplace_back(op_load_let, let_offset); } } - virtual void visit(const String &node) { + void visit(const String&node) override { program.emplace_back(op_load_const, wrap_param<Value>(stash.create<DoubleValue>(node.hash()))); } - virtual void visit(const Array &node) { + void visit(const Array&node) override { program.emplace_back(op_load_const, wrap_param<Value>(stash.create<DoubleValue>(node.size()))); } - virtual void visit(const Neg &) { + void visit(const Neg &) override { program.emplace_back(op_unary<operation::Neg>); } - virtual void visit(const Not &) { + void visit(const Not &) override { program.emplace_back(op_unary<operation::Not>); } - virtual void visit(const If &node) { + void visit(const If&node) override { node.cond().traverse(*this); size_t after_cond = program.size(); program.emplace_back(op_skip_if_false); @@ -273,16 +273,16 @@ struct ProgramBuilder : public NodeVisitor, public NodeTraverser { program[after_cond].update_param(after_true - after_cond); program[after_true].update_param(program.size() - after_true - 1); } - virtual void visit(const Let &node) { + void visit(const Let&node) override { node.value().traverse(*this); program.emplace_back(op_store_let); node.expr().traverse(*this); program.emplace_back(op_evict_let); } - virtual void visit(const Error &) { + void visit(const Error &) override { program.emplace_back(op_load_const, wrap_param<Value>(stash.create<ErrorValue>())); } - virtual void visit(const TensorSum &node) { + void visit(const TensorSum&node) override { if (is_typed(node) && is_typed_tensor_product_of_params(node.get_child(0))) { assert(program.size() >= 3); // load,load,mul program.pop_back(); // mul @@ -307,23 +307,23 @@ struct ProgramBuilder : public NodeVisitor, public NodeTraverser { wrap_param<vespalib::string>(stash.create<vespalib::string>(node.dimension()))); } } - virtual void visit(const TensorMap &node) { + void visit(const TensorMap&node) override { const auto &token = stash.create<CompileCache::Token::UP>(CompileCache::compile(node.lambda(), PassParams::SEPARATE)); program.emplace_back(op_tensor_map, wrap_param<CompiledFunction>(token.get()->get())); } - virtual void visit(const TensorJoin &node) { + void visit(const TensorJoin&node) override { const auto &token = stash.create<CompileCache::Token::UP>(CompileCache::compile(node.lambda(), PassParams::SEPARATE)); program.emplace_back(op_tensor_join, wrap_param<CompiledFunction>(token.get()->get())); } - virtual void visit(const TensorReduce &node) { + void visit(const TensorReduce&node) override { ReduceParams ¶ms = stash.create<ReduceParams>(node.aggr(), node.dimensions()); program.emplace_back(op_tensor_reduce, wrap_param<ReduceParams>(params)); } - virtual void visit(const TensorRename &node) { + void visit(const TensorRename&node) override { RenameParams ¶ms = stash.create<RenameParams>(node.from(), node.to()); program.emplace_back(op_tensor_rename, wrap_param<RenameParams>(params)); } - virtual void visit(const TensorLambda &node) { + void visit(const TensorLambda&node) override { const auto &type = node.type(); TensorSpec spec(type.to_spec()); const auto &token = stash.create<CompileCache::Token::UP>(CompileCache::compile(node.lambda(), PassParams::ARRAY)); @@ -340,47 +340,47 @@ struct ProgramBuilder : public NodeVisitor, public NodeTraverser { auto tensor = tensor_engine.create(spec); program.emplace_back(op_load_const, wrap_param<Value>(stash.create<TensorValue>(std::move(tensor)))); } - virtual void visit(const TensorConcat &node) { + void visit(const TensorConcat&node) override { vespalib::string &dimension = stash.create<vespalib::string>(node.dimension()); program.emplace_back(op_tensor_concat, wrap_param<vespalib::string>(dimension)); } - virtual void visit(const Add &) { + void visit(const Add &) override { program.emplace_back(op_binary<operation::Add>); } - virtual void visit(const Sub &) { + void visit(const Sub &) override { program.emplace_back(op_binary<operation::Sub>); } - virtual void visit(const Mul &) { + void visit(const Mul &) override { program.emplace_back(op_binary<operation::Mul>); } - virtual void visit(const Div &) { + void visit(const Div &) override { program.emplace_back(op_binary<operation::Div>); } - virtual void visit(const Pow &) { + void visit(const Pow &) override { program.emplace_back(op_binary<operation::Pow>); } - virtual void visit(const Equal &) { + void visit(const Equal &) override { program.emplace_back(op_binary<operation::Equal>); } - virtual void visit(const NotEqual &) { + void visit(const NotEqual &) override { program.emplace_back(op_binary<operation::NotEqual>); } - virtual void visit(const Approx &) { + void visit(const Approx &) override { program.emplace_back(op_binary<operation::Approx>); } - virtual void visit(const Less &) { + void visit(const Less &) override { program.emplace_back(op_binary<operation::Less>); } - virtual void visit(const LessEqual &) { + void visit(const LessEqual &) override { program.emplace_back(op_binary<operation::LessEqual>); } - virtual void visit(const Greater &) { + void visit(const Greater &) override { program.emplace_back(op_binary<operation::Greater>); } - virtual void visit(const GreaterEqual &) { + void visit(const GreaterEqual &) override { program.emplace_back(op_binary<operation::GreaterEqual>); } - virtual void visit(const In &node) { + void visit(const In&node) override { std::vector<size_t> checks; node.lhs().traverse(*this); auto array = as<Array>(node.rhs()); @@ -400,91 +400,91 @@ struct ProgramBuilder : public NodeVisitor, public NodeTraverser { } program.emplace_back(op_not_member); } - virtual void visit(const And &) { + void visit(const And &) override { program.emplace_back(op_binary<operation::And>); } - virtual void visit(const Or &) { + void visit(const Or &) override { program.emplace_back(op_binary<operation::Or>); } - virtual void visit(const Cos &) { + void visit(const Cos &) override { program.emplace_back(op_unary<operation::Cos>); } - virtual void visit(const Sin &) { + void visit(const Sin &) override { program.emplace_back(op_unary<operation::Sin>); } - virtual void visit(const Tan &) { + void visit(const Tan &) override { program.emplace_back(op_unary<operation::Tan>); } - virtual void visit(const Cosh &) { + void visit(const Cosh &) override { program.emplace_back(op_unary<operation::Cosh>); } - virtual void visit(const Sinh &) { + void visit(const Sinh &) override { program.emplace_back(op_unary<operation::Sinh>); } - virtual void visit(const Tanh &) { + void visit(const Tanh &) override { program.emplace_back(op_unary<operation::Tanh>); } - virtual void visit(const Acos &) { + void visit(const Acos &) override { program.emplace_back(op_unary<operation::Acos>); } - virtual void visit(const Asin &) { + void visit(const Asin &) override { program.emplace_back(op_unary<operation::Asin>); } - virtual void visit(const Atan &) { + void visit(const Atan &) override { program.emplace_back(op_unary<operation::Atan>); } - virtual void visit(const Exp &) { + void visit(const Exp &) override { program.emplace_back(op_unary<operation::Exp>); } - virtual void visit(const Log10 &) { + void visit(const Log10 &) override { program.emplace_back(op_unary<operation::Log10>); } - virtual void visit(const Log &) { + void visit(const Log &) override { program.emplace_back(op_unary<operation::Log>); } - virtual void visit(const Sqrt &) { + void visit(const Sqrt &) override { program.emplace_back(op_unary<operation::Sqrt>); } - virtual void visit(const Ceil &) { + void visit(const Ceil &) override { program.emplace_back(op_unary<operation::Ceil>); } - virtual void visit(const Fabs &) { + void visit(const Fabs &) override { program.emplace_back(op_unary<operation::Fabs>); } - virtual void visit(const Floor &) { + void visit(const Floor &) override { program.emplace_back(op_unary<operation::Floor>); } - virtual void visit(const Atan2 &) { + void visit(const Atan2 &) override { program.emplace_back(op_binary<operation::Atan2>); } - virtual void visit(const Ldexp &) { + void visit(const Ldexp &) override { program.emplace_back(op_binary<operation::Ldexp>); } - virtual void visit(const Pow2 &) { + void visit(const Pow2 &) override { program.emplace_back(op_binary<operation::Pow>); } - virtual void visit(const Fmod &) { + void visit(const Fmod &) override { program.emplace_back(op_binary<operation::Fmod>); } - virtual void visit(const Min &) { + void visit(const Min &) override { program.emplace_back(op_binary<operation::Min>); } - virtual void visit(const Max &) { + void visit(const Max &) override { program.emplace_back(op_binary<operation::Max>); } - virtual void visit(const IsNan &) { + void visit(const IsNan &) override { program.emplace_back(op_unary<operation::IsNan>); } - virtual void visit(const Relu &) { + void visit(const Relu &) override { program.emplace_back(op_unary<operation::Relu>); } - virtual void visit(const Sigmoid &) { + void visit(const Sigmoid &) override { program.emplace_back(op_unary<operation::Sigmoid>); } //------------------------------------------------------------------------- - virtual bool open(const Node &node) { + bool open(const Node&node) override { if (check_type<Array, If, Let, In>(node)) { node.accept(*this); return false; @@ -492,7 +492,7 @@ struct ProgramBuilder : public NodeVisitor, public NodeTraverser { return true; } - virtual void close(const Node &node) { + void close(const Node&node) override { node.accept(*this); } }; diff --git a/eval/src/vespa/eval/eval/key_gen.cpp b/eval/src/vespa/eval/eval/key_gen.cpp index 861bcd9b904..6d78ec50049 100644 --- a/eval/src/vespa/eval/eval/key_gen.cpp +++ b/eval/src/vespa/eval/eval/key_gen.cpp @@ -1,10 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "key_gen.h" #include "node_visitor.h" #include "node_traverser.h" -#include "function.h" namespace vespalib { namespace eval { @@ -24,66 +22,66 @@ struct KeyGen : public NodeVisitor, public NodeTraverser { void add_byte(uint8_t value) { key.append(&value, sizeof(value)); } // visit - virtual void visit(const Number &node) { add_byte( 1); add_double(node.value()); } - virtual void visit(const Symbol &node) { add_byte( 2); add_int(node.id()); } - virtual void visit(const String &node) { add_byte( 3); add_hash(node.hash()); } - virtual void visit(const Array &node) { add_byte( 4); add_size(node.size()); } - virtual void visit(const Neg &) { add_byte( 5); } - virtual void visit(const Not &) { add_byte( 6); } - virtual void visit(const If &node) { add_byte( 7); add_double(node.p_true()); } - virtual void visit(const Let &) { add_byte( 8); } - virtual void visit(const Error &) { add_byte( 9); } - virtual void visit(const TensorSum &) { add_byte(10); } // dimensions should be part of key - virtual void visit(const TensorMap &) { add_byte(11); } // lambda should be part of key - virtual void visit(const TensorJoin &) { add_byte(12); } // lambda should be part of key - virtual void visit(const TensorReduce &) { add_byte(13); } // aggr/dimensions should be part of key - virtual void visit(const TensorRename &) { add_byte(14); } // dimensions should be part of key - virtual void visit(const TensorLambda &) { add_byte(15); } // type/lambda should be part of key - virtual void visit(const TensorConcat &) { add_byte(16); } // dimension should be part of key - virtual void visit(const Add &) { add_byte(20); } - virtual void visit(const Sub &) { add_byte(21); } - virtual void visit(const Mul &) { add_byte(22); } - virtual void visit(const Div &) { add_byte(23); } - virtual void visit(const Pow &) { add_byte(24); } - virtual void visit(const Equal &) { add_byte(25); } - virtual void visit(const NotEqual &) { add_byte(26); } - virtual void visit(const Approx &) { add_byte(27); } - virtual void visit(const Less &) { add_byte(28); } - virtual void visit(const LessEqual &) { add_byte(29); } - virtual void visit(const Greater &) { add_byte(30); } - virtual void visit(const GreaterEqual &) { add_byte(31); } - virtual void visit(const In &) { add_byte(32); } - virtual void visit(const And &) { add_byte(33); } - virtual void visit(const Or &) { add_byte(34); } - virtual void visit(const Cos &) { add_byte(35); } - virtual void visit(const Sin &) { add_byte(36); } - virtual void visit(const Tan &) { add_byte(37); } - virtual void visit(const Cosh &) { add_byte(38); } - virtual void visit(const Sinh &) { add_byte(39); } - virtual void visit(const Tanh &) { add_byte(40); } - virtual void visit(const Acos &) { add_byte(41); } - virtual void visit(const Asin &) { add_byte(42); } - virtual void visit(const Atan &) { add_byte(43); } - virtual void visit(const Exp &) { add_byte(44); } - virtual void visit(const Log10 &) { add_byte(45); } - virtual void visit(const Log &) { add_byte(46); } - virtual void visit(const Sqrt &) { add_byte(47); } - virtual void visit(const Ceil &) { add_byte(48); } - virtual void visit(const Fabs &) { add_byte(49); } - virtual void visit(const Floor &) { add_byte(50); } - virtual void visit(const Atan2 &) { add_byte(51); } - virtual void visit(const Ldexp &) { add_byte(52); } - virtual void visit(const Pow2 &) { add_byte(53); } - virtual void visit(const Fmod &) { add_byte(54); } - virtual void visit(const Min &) { add_byte(55); } - virtual void visit(const Max &) { add_byte(56); } - virtual void visit(const IsNan &) { add_byte(57); } - virtual void visit(const Relu &) { add_byte(58); } - virtual void visit(const Sigmoid &) { add_byte(59); } + void visit(const Number &node) override { add_byte( 1); add_double(node.value()); } + void visit(const Symbol &node) override { add_byte( 2); add_int(node.id()); } + void visit(const String &node) override { add_byte( 3); add_hash(node.hash()); } + void visit(const Array &node) override { add_byte( 4); add_size(node.size()); } + void visit(const Neg &) override { add_byte( 5); } + void visit(const Not &) override { add_byte( 6); } + void visit(const If &node) override { add_byte( 7); add_double(node.p_true()); } + void visit(const Let &) override { add_byte( 8); } + void visit(const Error &) override { add_byte( 9); } + void visit(const TensorSum &) override { add_byte(10); } // dimensions should be part of key + void visit(const TensorMap &) override { add_byte(11); } // lambda should be part of key + void visit(const TensorJoin &) override { add_byte(12); } // lambda should be part of key + void visit(const TensorReduce &) override { add_byte(13); } // aggr/dimensions should be part of key + void visit(const TensorRename &) override { add_byte(14); } // dimensions should be part of key + void visit(const TensorLambda &) override { add_byte(15); } // type/lambda should be part of key + void visit(const TensorConcat &) override { add_byte(16); } // dimension should be part of key + void visit(const Add &) override { add_byte(20); } + void visit(const Sub &) override { add_byte(21); } + void visit(const Mul &) override { add_byte(22); } + void visit(const Div &) override { add_byte(23); } + void visit(const Pow &) override { add_byte(24); } + void visit(const Equal &) override { add_byte(25); } + void visit(const NotEqual &) override { add_byte(26); } + void visit(const Approx &) override { add_byte(27); } + void visit(const Less &) override { add_byte(28); } + void visit(const LessEqual &) override { add_byte(29); } + void visit(const Greater &) override { add_byte(30); } + void visit(const GreaterEqual &) override { add_byte(31); } + void visit(const In &) override { add_byte(32); } + void visit(const And &) override { add_byte(33); } + void visit(const Or &) override { add_byte(34); } + void visit(const Cos &) override { add_byte(35); } + void visit(const Sin &) override { add_byte(36); } + void visit(const Tan &) override { add_byte(37); } + void visit(const Cosh &) override { add_byte(38); } + void visit(const Sinh &) override { add_byte(39); } + void visit(const Tanh &) override { add_byte(40); } + void visit(const Acos &) override { add_byte(41); } + void visit(const Asin &) override { add_byte(42); } + void visit(const Atan &) override { add_byte(43); } + void visit(const Exp &) override { add_byte(44); } + void visit(const Log10 &) override { add_byte(45); } + void visit(const Log &) override { add_byte(46); } + void visit(const Sqrt &) override { add_byte(47); } + void visit(const Ceil &) override { add_byte(48); } + void visit(const Fabs &) override { add_byte(49); } + void visit(const Floor &) override { add_byte(50); } + void visit(const Atan2 &) override { add_byte(51); } + void visit(const Ldexp &) override { add_byte(52); } + void visit(const Pow2 &) override { add_byte(53); } + void visit(const Fmod &) override { add_byte(54); } + void visit(const Min &) override { add_byte(55); } + void visit(const Max &) override { add_byte(56); } + void visit(const IsNan &) override { add_byte(57); } + void visit(const Relu &) override { add_byte(58); } + void visit(const Sigmoid &) override { add_byte(59); } // traverse - virtual bool open(const Node &node) { node.accept(*this); return true; } - virtual void close(const Node &) {} + bool open(const Node &node) override { node.accept(*this); return true; } + void close(const Node &) override {} }; } // namespace vespalib::eval::<unnamed> diff --git a/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp b/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp index 5b607280403..ac4c4e597ca 100644 --- a/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp +++ b/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp @@ -242,7 +242,7 @@ struct FunctionBuilder : public NodeVisitor, public NodeTraverser { //------------------------------------------------------------------------- - bool open(const Node &node) { + bool open(const Node &node) override { if (node.is_const()) { push_double(node.get_const_value()); return false; @@ -261,7 +261,7 @@ struct FunctionBuilder : public NodeVisitor, public NodeTraverser { return true; } - void close(const Node &node) { + void close(const Node &node) override { node.accept(*this); if (inside_forest && (forest_end == &node)) { inside_forest = false; @@ -348,10 +348,10 @@ struct FunctionBuilder : public NodeVisitor, public NodeTraverser { // basic nodes - virtual void visit(const Number &item) { + void visit(const Number &item) override { push_double(item.value()); } - virtual void visit(const Symbol &item) { + void visit(const Symbol &item) override { if (item.id() >= 0) { push(get_param(item.id())); } else { @@ -360,22 +360,22 @@ struct FunctionBuilder : public NodeVisitor, public NodeTraverser { push(let_values[let_offset]); } } - virtual void visit(const String &item) { + void visit(const String &item) override { push_double(item.hash()); } - virtual void visit(const Array &item) { + void visit(const Array &item) override { // NB: visit not open push_double(item.size()); } - virtual void visit(const Neg &) { + void visit(const Neg &) override { llvm::Value *child = pop_double(); push(builder.CreateFNeg(child, "neg_res")); } - virtual void visit(const Not &) { + void visit(const Not &) override { llvm::Value *child = pop_bool(); push(builder.CreateNot(child, "not_res")); } - virtual void visit(const If &item) { + void visit(const If &item) override { // NB: visit not open llvm::BasicBlock *true_block = llvm::BasicBlock::Create(context, "true_block", function); llvm::BasicBlock *false_block = llvm::BasicBlock::Create(context, "false_block", function); @@ -402,100 +402,100 @@ struct FunctionBuilder : public NodeVisitor, public NodeTraverser { phi->addIncoming(false_res, false_end); push(phi); } - virtual void visit(const Let &item) { + void visit(const Let &item) override { // NB: visit not open item.value().traverse(*this); // NB: recursion let_values.push_back(pop_double()); item.expr().traverse(*this); // NB: recursion let_values.pop_back(); } - virtual void visit(const Error &) { + void visit(const Error &) override { make_error(0); } // tensor nodes (not supported in compiled expressions) - virtual void visit(const TensorSum &node) { + void visit(const TensorSum &node) override { make_error(node.num_children()); } - virtual void visit(const TensorMap &node) { + void visit(const TensorMap &node) override { make_error(node.num_children()); } - virtual void visit(const TensorJoin &node) { + void visit(const TensorJoin &node) override { make_error(node.num_children()); } - virtual void visit(const TensorReduce &node) { + void visit(const TensorReduce &node) override { make_error(node.num_children()); } - virtual void visit(const TensorRename &node) { + void visit(const TensorRename &node) override { make_error(node.num_children()); } - virtual void visit(const TensorLambda &node) { + void visit(const TensorLambda &node) override { make_error(node.num_children()); } - virtual void visit(const TensorConcat &node) { + void visit(const TensorConcat &node) override { make_error(node.num_children()); } // operator nodes - virtual void visit(const Add &) { + void visit(const Add &) override { llvm::Value *b = pop_double(); llvm::Value *a = pop_double(); push(builder.CreateFAdd(a, b, "add_res")); } - virtual void visit(const Sub &) { + void visit(const Sub &) override { llvm::Value *b = pop_double(); llvm::Value *a = pop_double(); push(builder.CreateFSub(a, b, "sub_res")); } - virtual void visit(const Mul &) { + void visit(const Mul &) override { llvm::Value *b = pop_double(); llvm::Value *a = pop_double(); push(builder.CreateFMul(a, b, "mul_res")); } - virtual void visit(const Div &) { + void visit(const Div &) override { llvm::Value *b = pop_double(); llvm::Value *a = pop_double(); push(builder.CreateFDiv(a, b, "div_res")); } - virtual void visit(const Pow &) { + void visit(const Pow &) override { make_call_2(llvm::Intrinsic::pow); } - virtual void visit(const Equal &) { + void visit(const Equal &) override { llvm::Value *b = pop_double(); llvm::Value *a = pop_double(); push(builder.CreateFCmpOEQ(a, b, "cmp_eq_res")); } - virtual void visit(const NotEqual &) { + void visit(const NotEqual &) override { llvm::Value *b = pop_double(); llvm::Value *a = pop_double(); push(builder.CreateFCmpUNE(a, b, "cmp_ne_res")); } - virtual void visit(const Approx &) { + void visit(const Approx &) override { make_call_2("vespalib_eval_approx"); } - virtual void visit(const Less &) { + void visit(const Less &) override { llvm::Value *b = pop_double(); llvm::Value *a = pop_double(); push(builder.CreateFCmpOLT(a, b, "cmp_lt_res")); } - virtual void visit(const LessEqual &) { + void visit(const LessEqual &) override { llvm::Value *b = pop_double(); llvm::Value *a = pop_double(); push(builder.CreateFCmpOLE(a, b, "cmp_le_res")); } - virtual void visit(const Greater &) { + void visit(const Greater &) override { llvm::Value *b = pop_double(); llvm::Value *a = pop_double(); push(builder.CreateFCmpOGT(a, b, "cmp_gt_res")); } - virtual void visit(const GreaterEqual &) { + void visit(const GreaterEqual &) override { llvm::Value *b = pop_double(); llvm::Value *a = pop_double(); push(builder.CreateFCmpOGE(a, b, "cmp_ge_res")); } - virtual void visit(const In &item) { + void visit(const In &item) override { // NB: visit not open item.lhs().traverse(*this); // NB: recursion llvm::Value *lhs = pop_double(); @@ -527,12 +527,12 @@ struct FunctionBuilder : public NodeVisitor, public NodeTraverser { push(builder.CreateFCmpOEQ(lhs, rhs, "rhs_eq")); } } - virtual void visit(const And &) { + void visit(const And &) override { llvm::Value *b = pop_bool(); llvm::Value *a = pop_bool(); push(builder.CreateAnd(a, b, "and_res")); } - virtual void visit(const Or &) { + void visit(const Or &) override { llvm::Value *b = pop_bool(); llvm::Value *a = pop_bool(); push(builder.CreateOr(a, b, "or_res")); @@ -540,79 +540,79 @@ struct FunctionBuilder : public NodeVisitor, public NodeTraverser { // call nodes - virtual void visit(const Cos &) { + void visit(const Cos &) override { make_call_1(llvm::Intrinsic::cos); } - virtual void visit(const Sin &) { + void visit(const Sin &) override { make_call_1(llvm::Intrinsic::sin); } - virtual void visit(const Tan &) { + void visit(const Tan &) override { make_call_1("tan"); } - virtual void visit(const Cosh &) { + void visit(const Cosh &) override { make_call_1("cosh"); } - virtual void visit(const Sinh &) { + void visit(const Sinh &) override { make_call_1("sinh"); } - virtual void visit(const Tanh &) { + void visit(const Tanh &) override { make_call_1("tanh"); } - virtual void visit(const Acos &) { + void visit(const Acos &) override { make_call_1("acos"); } - virtual void visit(const Asin &) { + void visit(const Asin &) override { make_call_1("asin"); } - virtual void visit(const Atan &) { + void visit(const Atan &) override { make_call_1("atan"); } - virtual void visit(const Exp &) { + void visit(const Exp &) override { make_call_1(llvm::Intrinsic::exp); } - virtual void visit(const Log10 &) { + void visit(const Log10 &) override { make_call_1(llvm::Intrinsic::log10); } - virtual void visit(const Log &) { + void visit(const Log &) override { make_call_1(llvm::Intrinsic::log); } - virtual void visit(const Sqrt &) { + void visit(const Sqrt &) override { make_call_1(llvm::Intrinsic::sqrt); } - virtual void visit(const Ceil &) { + void visit(const Ceil &) override { make_call_1(llvm::Intrinsic::ceil); } - virtual void visit(const Fabs &) { + void visit(const Fabs &) override { make_call_1(llvm::Intrinsic::fabs); } - virtual void visit(const Floor &) { + void visit(const Floor &) override { make_call_1(llvm::Intrinsic::floor); } - virtual void visit(const Atan2 &) { + void visit(const Atan2 &) override { make_call_2("atan2"); } - virtual void visit(const Ldexp &) { + void visit(const Ldexp &) override { make_call_2("vespalib_eval_ldexp"); } - virtual void visit(const Pow2 &) { + void visit(const Pow2 &) override { make_call_2(llvm::Intrinsic::pow); } - virtual void visit(const Fmod &) { + void visit(const Fmod &) override { make_call_2("fmod"); } - virtual void visit(const Min &) { + void visit(const Min &) override { make_call_2("vespalib_eval_min"); } - virtual void visit(const Max &) { + void visit(const Max &) override { make_call_2("vespalib_eval_max"); } - virtual void visit(const IsNan &) { + void visit(const IsNan &) override { make_call_1("vespalib_eval_isnan"); } - virtual void visit(const Relu &) { + void visit(const Relu &) override { make_call_1("vespalib_eval_relu"); } - virtual void visit(const Sigmoid &) { + void visit(const Sigmoid &) override { make_call_1("vespalib_eval_sigmoid"); } }; diff --git a/eval/src/vespa/eval/eval/node_types.cpp b/eval/src/vespa/eval/eval/node_types.cpp index c02060a1060..645baa2e5a6 100644 --- a/eval/src/vespa/eval/eval/node_types.cpp +++ b/eval/src/vespa/eval/eval/node_types.cpp @@ -1,11 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "check_type.h" -#include "function.h" #include "node_traverser.h" #include "node_types.h" -#include "node_visitor.h" namespace vespalib { namespace eval { @@ -119,10 +116,10 @@ struct TypeResolver : public NodeVisitor, public NodeTraverser { //------------------------------------------------------------------------- - virtual void visit(const Number &node) { + void visit(const Number &node) override { bind_type(ValueType::double_type(), node); } - virtual void visit(const Symbol &node) { + void visit(const Symbol &node) override { if (node.id() >= 0) { // param value bind_type(state.param_type(node.id()), node); } else { // let binding @@ -130,15 +127,15 @@ struct TypeResolver : public NodeVisitor, public NodeTraverser { bind_type(state.let_type(let_offset), node); } } - virtual void visit(const String &node) { + void visit(const String &node) override { bind_type(ValueType::double_type(), node); } - virtual void visit(const Array &node) { + void visit(const Array &node) override { bind_type(ValueType::double_type(), node); } - virtual void visit(const Neg &node) { resolve_op1(node); } - virtual void visit(const Not &node) { resolve_op1(node); } - virtual void visit(const If &node) { + void visit(const Neg &node) override { resolve_op1(node); } + void visit(const Not &node) override { resolve_op1(node); } + void visit(const If &node) override { ValueType true_type = state.peek(1); ValueType false_type = state.peek(0); if (true_type == false_type) { @@ -149,13 +146,13 @@ struct TypeResolver : public NodeVisitor, public NodeTraverser { bind_type(ValueType::any_type(), node); } } - virtual void visit(const Let &node) { + void visit(const Let &node) override { bind_type(state.peek(0), node); } - virtual void visit(const Error &node) { + void visit(const Error &node) override { bind_type(ValueType::error_type(), node); } - virtual void visit(const TensorSum &node) { + void visit(const TensorSum &node) override { const ValueType &child = state.peek(0); if (node.dimension().empty()) { bind_type(child.reduce({}), node); @@ -163,69 +160,69 @@ struct TypeResolver : public NodeVisitor, public NodeTraverser { bind_type(child.reduce({node.dimension()}), node); } } - virtual void visit(const TensorMap &node) { resolve_op1(node); } - virtual void visit(const TensorJoin &node) { resolve_op2(node); } - virtual void visit(const TensorReduce &node) { + void visit(const TensorMap &node) override { resolve_op1(node); } + void visit(const TensorJoin &node) override { resolve_op2(node); } + void visit(const TensorReduce &node) override { const ValueType &child = state.peek(0); bind_type(child.reduce(node.dimensions()), node); } - virtual void visit(const TensorRename &node) { + void visit(const TensorRename &node) override { const ValueType &child = state.peek(0); bind_type(child.rename(node.from(), node.to()), node); } - virtual void visit(const TensorLambda &node) { + void visit(const TensorLambda &node) override { bind_type(node.type(), node); } - virtual void visit(const TensorConcat &node) { + void visit(const TensorConcat &node) override { bind_type(ValueType::concat(state.peek(1), state.peek(0), node.dimension()), node); } - virtual void visit(const Add &node) { resolve_op2(node); } - virtual void visit(const Sub &node) { resolve_op2(node); } - virtual void visit(const Mul &node) { resolve_op2(node); } - virtual void visit(const Div &node) { resolve_op2(node); } - virtual void visit(const Pow &node) { resolve_op2(node); } - virtual void visit(const Equal &node) { resolve_op2(node); } - virtual void visit(const NotEqual &node) { resolve_op2(node); } - virtual void visit(const Approx &node) { resolve_op2(node); } - virtual void visit(const Less &node) { resolve_op2(node); } - virtual void visit(const LessEqual &node) { resolve_op2(node); } - virtual void visit(const Greater &node) { resolve_op2(node); } - virtual void visit(const GreaterEqual &node) { resolve_op2(node); } - virtual void visit(const In &node) { + void visit(const Add &node) override { resolve_op2(node); } + void visit(const Sub &node) override { resolve_op2(node); } + void visit(const Mul &node) override { resolve_op2(node); } + void visit(const Div &node) override { resolve_op2(node); } + void visit(const Pow &node) override { resolve_op2(node); } + void visit(const Equal &node) override { resolve_op2(node); } + void visit(const NotEqual &node) override { resolve_op2(node); } + void visit(const Approx &node) override { resolve_op2(node); } + void visit(const Less &node) override { resolve_op2(node); } + void visit(const LessEqual &node) override { resolve_op2(node); } + void visit(const Greater &node) override { resolve_op2(node); } + void visit(const GreaterEqual &node) override { resolve_op2(node); } + void visit(const In &node) override { bind_type(ValueType::double_type(), node); } - virtual void visit(const And &node) { resolve_op2(node); } - virtual void visit(const Or &node) { resolve_op2(node); } - virtual void visit(const Cos &node) { resolve_op1(node); } - virtual void visit(const Sin &node) { resolve_op1(node); } - virtual void visit(const Tan &node) { resolve_op1(node); } - virtual void visit(const Cosh &node) { resolve_op1(node); } - virtual void visit(const Sinh &node) { resolve_op1(node); } - virtual void visit(const Tanh &node) { resolve_op1(node); } - virtual void visit(const Acos &node) { resolve_op1(node); } - virtual void visit(const Asin &node) { resolve_op1(node); } - virtual void visit(const Atan &node) { resolve_op1(node); } - virtual void visit(const Exp &node) { resolve_op1(node); } - virtual void visit(const Log10 &node) { resolve_op1(node); } - virtual void visit(const Log &node) { resolve_op1(node); } - virtual void visit(const Sqrt &node) { resolve_op1(node); } - virtual void visit(const Ceil &node) { resolve_op1(node); } - virtual void visit(const Fabs &node) { resolve_op1(node); } - virtual void visit(const Floor &node) { resolve_op1(node); } - virtual void visit(const Atan2 &node) { resolve_op2(node); } - virtual void visit(const Ldexp &node) { resolve_op2(node); } - virtual void visit(const Pow2 &node) { resolve_op2(node); } - virtual void visit(const Fmod &node) { resolve_op2(node); } - virtual void visit(const Min &node) { resolve_op2(node); } - virtual void visit(const Max &node) { resolve_op2(node); } - virtual void visit(const IsNan &node) { resolve_op1(node); } - virtual void visit(const Relu &node) { resolve_op1(node); } - virtual void visit(const Sigmoid &node) { resolve_op1(node); } + void visit(const And &node) override { resolve_op2(node); } + void visit(const Or &node) override { resolve_op2(node); } + void visit(const Cos &node) override { resolve_op1(node); } + void visit(const Sin &node) override { resolve_op1(node); } + void visit(const Tan &node) override { resolve_op1(node); } + void visit(const Cosh &node) override { resolve_op1(node); } + void visit(const Sinh &node) override { resolve_op1(node); } + void visit(const Tanh &node) override { resolve_op1(node); } + void visit(const Acos &node) override { resolve_op1(node); } + void visit(const Asin &node) override { resolve_op1(node); } + void visit(const Atan &node) override { resolve_op1(node); } + void visit(const Exp &node) override { resolve_op1(node); } + void visit(const Log10 &node) override { resolve_op1(node); } + void visit(const Log &node) override { resolve_op1(node); } + void visit(const Sqrt &node) override { resolve_op1(node); } + void visit(const Ceil &node) override { resolve_op1(node); } + void visit(const Fabs &node) override { resolve_op1(node); } + void visit(const Floor &node) override { resolve_op1(node); } + void visit(const Atan2 &node) override { resolve_op2(node); } + void visit(const Ldexp &node) override { resolve_op2(node); } + void visit(const Pow2 &node) override { resolve_op2(node); } + void visit(const Fmod &node) override { resolve_op2(node); } + void visit(const Min &node) override { resolve_op2(node); } + void visit(const Max &node) override { resolve_op2(node); } + void visit(const IsNan &node) override { resolve_op1(node); } + void visit(const Relu &node) override { resolve_op1(node); } + void visit(const Sigmoid &node) override { resolve_op1(node); } //------------------------------------------------------------------------- - virtual bool open(const Node &node) { + bool open(const Node &node) override { auto let = as<Let>(node); if (let) { add_action(let->expr(), action_unbind_let); @@ -234,7 +231,7 @@ struct TypeResolver : public NodeVisitor, public NodeTraverser { return true; } - virtual void close(const Node &node) { + void close(const Node &node) override { if (!check_error(node)) { node.accept(*this); } diff --git a/eval/src/vespa/eval/eval/node_visitor.h b/eval/src/vespa/eval/eval/node_visitor.h index 3196a00820e..128533c0410 100644 --- a/eval/src/vespa/eval/eval/node_visitor.h +++ b/eval/src/vespa/eval/eval/node_visitor.h @@ -90,62 +90,62 @@ struct NodeVisitor { * of all types not specifically handled. **/ struct EmptyNodeVisitor : NodeVisitor { - virtual void visit(const nodes::Number &) {} - virtual void visit(const nodes::Symbol &) {} - virtual void visit(const nodes::String &) {} - virtual void visit(const nodes::Array &) {} - virtual void visit(const nodes::Neg &) {} - virtual void visit(const nodes::Not &) {} - virtual void visit(const nodes::If &) {} - virtual void visit(const nodes::Let &) {} - virtual void visit(const nodes::Error &) {} - virtual void visit(const nodes::TensorSum &) {} - virtual void visit(const nodes::TensorMap &) {} - virtual void visit(const nodes::TensorJoin &) {} - virtual void visit(const nodes::TensorReduce &) {} - virtual void visit(const nodes::TensorRename &) {} - virtual void visit(const nodes::TensorLambda &) {} - virtual void visit(const nodes::TensorConcat &) {} - virtual void visit(const nodes::Add &) {} - virtual void visit(const nodes::Sub &) {} - virtual void visit(const nodes::Mul &) {} - virtual void visit(const nodes::Div &) {} - virtual void visit(const nodes::Pow &) {} - virtual void visit(const nodes::Equal &) {} - virtual void visit(const nodes::NotEqual &) {} - virtual void visit(const nodes::Approx &) {} - virtual void visit(const nodes::Less &) {} - virtual void visit(const nodes::LessEqual &) {} - virtual void visit(const nodes::Greater &) {} - virtual void visit(const nodes::GreaterEqual &) {} - virtual void visit(const nodes::In &) {} - virtual void visit(const nodes::And &) {} - virtual void visit(const nodes::Or &) {} - virtual void visit(const nodes::Cos &) {} - virtual void visit(const nodes::Sin &) {} - virtual void visit(const nodes::Tan &) {} - virtual void visit(const nodes::Cosh &) {} - virtual void visit(const nodes::Sinh &) {} - virtual void visit(const nodes::Tanh &) {} - virtual void visit(const nodes::Acos &) {} - virtual void visit(const nodes::Asin &) {} - virtual void visit(const nodes::Atan &) {} - virtual void visit(const nodes::Exp &) {} - virtual void visit(const nodes::Log10 &) {} - virtual void visit(const nodes::Log &) {} - virtual void visit(const nodes::Sqrt &) {} - virtual void visit(const nodes::Ceil &) {} - virtual void visit(const nodes::Fabs &) {} - virtual void visit(const nodes::Floor &) {} - virtual void visit(const nodes::Atan2 &) {} - virtual void visit(const nodes::Ldexp &) {} - virtual void visit(const nodes::Pow2 &) {} - virtual void visit(const nodes::Fmod &) {} - virtual void visit(const nodes::Min &) {} - virtual void visit(const nodes::Max &) {} - virtual void visit(const nodes::IsNan &) {} - virtual void visit(const nodes::Relu &) {} - virtual void visit(const nodes::Sigmoid &) {} + virtual void visit(const nodes::Number &) override {} + virtual void visit(const nodes::Symbol &) override {} + virtual void visit(const nodes::String &) override {} + virtual void visit(const nodes::Array &) override {} + virtual void visit(const nodes::Neg &) override {} + virtual void visit(const nodes::Not &) override {} + virtual void visit(const nodes::If &) override {} + virtual void visit(const nodes::Let &) override {} + void visit(const nodes::Error &) override {} + void visit(const nodes::TensorSum &) override {} + void visit(const nodes::TensorMap &) override {} + void visit(const nodes::TensorJoin &) override {} + void visit(const nodes::TensorReduce &) override {} + void visit(const nodes::TensorRename &) override {} + void visit(const nodes::TensorLambda &) override {} + void visit(const nodes::TensorConcat &) override {} + void visit(const nodes::Add &) override {} + void visit(const nodes::Sub &) override {} + void visit(const nodes::Mul &) override {} + void visit(const nodes::Div &) override {} + void visit(const nodes::Pow &) override {} + void visit(const nodes::Equal &) override {} + void visit(const nodes::NotEqual &) override {} + void visit(const nodes::Approx &) override {} + void visit(const nodes::Less &) override {} + void visit(const nodes::LessEqual &) override {} + void visit(const nodes::Greater &) override {} + void visit(const nodes::GreaterEqual &) override {} + void visit(const nodes::In &) override {} + void visit(const nodes::And &) override {} + void visit(const nodes::Or &) override {} + void visit(const nodes::Cos &) override {} + void visit(const nodes::Sin &) override {} + void visit(const nodes::Tan &) override {} + void visit(const nodes::Cosh &) override {} + void visit(const nodes::Sinh &) override {} + void visit(const nodes::Tanh &) override {} + void visit(const nodes::Acos &) override {} + void visit(const nodes::Asin &) override {} + void visit(const nodes::Atan &) override {} + void visit(const nodes::Exp &) override {} + void visit(const nodes::Log10 &) override {} + void visit(const nodes::Log &) override {} + void visit(const nodes::Sqrt &) override {} + void visit(const nodes::Ceil &) override {} + void visit(const nodes::Fabs &) override {} + void visit(const nodes::Floor &) override {} + void visit(const nodes::Atan2 &) override {} + void visit(const nodes::Ldexp &) override {} + void visit(const nodes::Pow2 &) override {} + void visit(const nodes::Fmod &) override {} + void visit(const nodes::Min &) override {} + void visit(const nodes::Max &) override {} + void visit(const nodes::IsNan &) override {} + void visit(const nodes::Relu &) override {} + void visit(const nodes::Sigmoid &) override {} }; } // namespace vespalib::eval diff --git a/eval/src/vespa/eval/eval/operator_nodes.h b/eval/src/vespa/eval/eval/operator_nodes.h index a0726137015..93b30d7695b 100644 --- a/eval/src/vespa/eval/eval/operator_nodes.h +++ b/eval/src/vespa/eval/eval/operator_nodes.h @@ -42,13 +42,13 @@ public: Order order() const { return _order; } const Node &lhs() const { return *_lhs; } const Node &rhs() const { return *_rhs; } - virtual bool is_const() const override { return _is_const; } - virtual size_t num_children() const override { return (_lhs && _rhs) ? 2 : 0; } - virtual const Node &get_child(size_t idx) const override { + bool is_const() const override { return _is_const; } + size_t num_children() const override { return (_lhs && _rhs) ? 2 : 0; } + const Node &get_child(size_t idx) const override { assert(idx < 2); return (idx == 0) ? lhs() : rhs(); } - virtual void detach_children(NodeHandler &handler) override { + void detach_children(NodeHandler &handler) override { handler.handle(std::move(_lhs)); handler.handle(std::move(_rhs)); } @@ -70,7 +70,7 @@ public: _is_const = (_lhs->is_const() && _rhs->is_const()); } - virtual vespalib::string dump(DumpContext &ctx) const { + vespalib::string dump(DumpContext &ctx) const override { vespalib::string str; str += "("; str += _lhs->dump(ctx); @@ -129,7 +129,7 @@ struct OperatorHelper : Operator { using Helper = OperatorHelper<T>; OperatorHelper(const vespalib::string &op_str_in, int priority_in, Operator::Order order_in) : Operator(op_str_in, priority_in, order_in) {} - virtual void accept(NodeVisitor &visitor) const override; + void accept(NodeVisitor &visitor) const override; static Operator_UP create() { return Operator_UP(new T()); } }; @@ -140,13 +140,13 @@ private: bool _is_forest; public: Add() : Helper("+", 101, LEFT), _is_forest(false) {} - virtual bool is_forest() const override { return _is_forest; } + bool is_forest() const override { return _is_forest; } bool check_forest() const { bool lhs_ok = (lhs().is_tree() || lhs().is_forest()); bool rhs_ok = (rhs().is_tree() || rhs().is_forest()); return (lhs_ok && rhs_ok); } - virtual void bind(Node_UP lhs_in, Node_UP rhs_in) override { + void bind(Node_UP lhs_in, Node_UP rhs_in) override { OperatorHelper<Add>::bind(std::move(lhs_in), std::move(rhs_in)); _is_forest = check_forest(); } diff --git a/eval/src/vespa/eval/eval/test/tensor_conformance.cpp b/eval/src/vespa/eval/eval/test/tensor_conformance.cpp index 93b0cde7363..40366f39db9 100644 --- a/eval/src/vespa/eval/eval/test/tensor_conformance.cpp +++ b/eval/src/vespa/eval/eval/test/tensor_conformance.cpp @@ -515,7 +515,7 @@ struct Input : TensorFunction::Input { ASSERT_GREATER(tensors.size(), offset); return tensors[offset]; } - const UnaryOperation &get_map_operation(size_t id) const { + const UnaryOperation &get_map_operation(size_t id) const override { ASSERT_TRUE(map_op != nullptr); ASSERT_EQUAL(id, map_operation_id); return *map_op; diff --git a/eval/src/vespa/eval/eval/value.h b/eval/src/vespa/eval/eval/value.h index e8b682e84b5..3b2f7eca62c 100644 --- a/eval/src/vespa/eval/eval/value.h +++ b/eval/src/vespa/eval/eval/value.h @@ -39,9 +39,9 @@ struct Value { }; struct ErrorValue : public Value { - virtual bool is_error() const override { return true; } - virtual double as_double() const { return error_value; } - virtual bool equal(const Value &) const override { return false; } + bool is_error() const override { return true; } + double as_double() const override { return error_value; } + bool equal(const Value &) const override { return false; } ValueType type() const override { return ValueType::error_type(); } }; diff --git a/fastlib/src/vespa/fastlib/io/bufferedoutputstream.h b/fastlib/src/vespa/fastlib/io/bufferedoutputstream.h index 1795d69ae14..789f7074f51 100644 --- a/fastlib/src/vespa/fastlib/io/bufferedoutputstream.h +++ b/fastlib/src/vespa/fastlib/io/bufferedoutputstream.h @@ -1,27 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** -******************************************************************************* -* -* @author Markus Bjartveit Kr�ger -* @date Creation date: 2001-10-30 -* @version $Id$ -* -* @file -* -* Generic buffered output stream -* -* Copyright (c) : 2001 Fast Search & Transfer ASA -* ALL RIGHTS RESERVED -* -******************************************************************************/ + #pragma once #include <vespa/fastlib/io/filteroutputstream.h> - - - - class Fast_BufferedOutputStream : public Fast_FilterOutputStream { private: @@ -47,15 +29,10 @@ class Fast_BufferedOutputStream : public Fast_FilterOutputStream Fast_BufferedOutputStream(Fast_OutputStream &out, size_t bufferSize = 1024); // Destructor - virtual ~Fast_BufferedOutputStream(void); + ~Fast_BufferedOutputStream(); // Methods - virtual bool Close(void); - virtual ssize_t Write(const void *sourceBuffer, size_t length); - virtual void Flush(void); - + bool Close() override; + ssize_t Write(const void *sourceBuffer, size_t length) override; + void Flush() override; }; - - - - diff --git a/fastlib/src/vespa/fastlib/net/httpchunkedinputstream.h b/fastlib/src/vespa/fastlib/net/httpchunkedinputstream.h index 2505ae42d4e..122d1bb1eca 100644 --- a/fastlib/src/vespa/fastlib/net/httpchunkedinputstream.h +++ b/fastlib/src/vespa/fastlib/net/httpchunkedinputstream.h @@ -1,29 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** -******************************************************************************* -* -* @author Markus Bjartveit Kr�ger -* @date Creation date: 2000-11-22 -* @version $Id$ -* -* @file -* -* HTTP chunked input stream. -* -* Copyright (c) : 2001 Fast Search & Transfer ASA -* ALL RIGHTS RESERVED -* -******************************************************************************/ - #pragma once #include <vespa/fastlib/io/filterinputstream.h> - - - - class Fast_HTTPChunkedInputStream : public Fast_FilterInputStream { private: @@ -38,14 +18,14 @@ class Fast_HTTPChunkedInputStream : public Fast_FilterInputStream bool ReadChunkHeader(void); public: Fast_HTTPChunkedInputStream(Fast_InputStream &in); - virtual ~Fast_HTTPChunkedInputStream(void); + ~Fast_HTTPChunkedInputStream(); // Methods - virtual ssize_t Available(void); - virtual bool Close(void); - virtual ssize_t Read(void *targetBuffer, size_t length); - virtual ssize_t Skip(size_t skipNBytes); + ssize_t Available() override; + bool Close() override; + ssize_t Read(void *targetBuffer, size_t length) override; + ssize_t Skip(size_t skipNBytes) override; }; diff --git a/fastlib/src/vespa/fastlib/net/httpchunkedoutputstream.h b/fastlib/src/vespa/fastlib/net/httpchunkedoutputstream.h index b845f3402a7..bc34d6f4dc7 100644 --- a/fastlib/src/vespa/fastlib/net/httpchunkedoutputstream.h +++ b/fastlib/src/vespa/fastlib/net/httpchunkedoutputstream.h @@ -1,29 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** -******************************************************************************* -* -* @author Markus Bjartveit Kr�ger -* @date Creation date: 2000-11-21 -* @version $Id$ -* -* @file -* -* HTTP chunked output stream. -* -* Copyright (c) : 2001 Fast Search & Transfer ASA -* ALL RIGHTS RESERVED -* -******************************************************************************/ - #pragma once #include <vespa/fastlib/io/filteroutputstream.h> - - - - class Fast_HTTPChunkedOutputStream : public Fast_FilterOutputStream { private: @@ -39,13 +19,13 @@ class Fast_HTTPChunkedOutputStream : public Fast_FilterOutputStream bool WriteChunk(void); public: Fast_HTTPChunkedOutputStream(Fast_OutputStream &out, size_t chunkSize = 1024); - virtual ~Fast_HTTPChunkedOutputStream(void); + ~Fast_HTTPChunkedOutputStream(); // Methods - virtual bool Close(void); - virtual ssize_t Write(const void *sourceBuffer, size_t length); - virtual void Flush(void); + bool Close() override; + ssize_t Write(const void *sourceBuffer, size_t length) override; + void Flush() override; }; diff --git a/fastlib/src/vespa/fastlib/net/httpserver.cpp b/fastlib/src/vespa/fastlib/net/httpserver.cpp index 44e4dc6a8bc..92e95cede03 100644 --- a/fastlib/src/vespa/fastlib/net/httpserver.cpp +++ b/fastlib/src/vespa/fastlib/net/httpserver.cpp @@ -1,30 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** -******************************************************************************* -* -* @author Stein Hardy Danielsen -* @date Creation date: 2000-1-7 -* @version $Id$ -* -* @file -* -* Generic http server and connection classes implementation -* -* Copyright (c) : 1997-1999 Fast Search & Transfer ASA -* ALL RIGHTS RESERVED -* -******************************************************************************/ - -#include <vespa/fastos/fastos.h> + +#include "url.h" +#include "httpchunkedinputstream.h" +#include "httpchunkedoutputstream.h" +#include "httpheaderparser.h" +#include "httpserver.h" #include <vespa/fastlib/io/bufferedinputstream.h> #include <vespa/fastlib/io/bufferedoutputstream.h> -#include <vespa/fastlib/net/url.h> -#include <vespa/fastlib/net/httpchunkedinputstream.h> -#include <vespa/fastlib/net/httpchunkedoutputstream.h> -#include <vespa/fastlib/net/httpheaderparser.h> -#include <vespa/fastlib/net/httpserver.h> #include <vespa/fastlib/util/base64.h> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/fastos/file.h> /** * Helper class for hiding the details of HTTP entity encodings and @@ -58,24 +43,22 @@ class Fast_HTTPPersistentInputFilter : public Fast_FilterInputStream _remainingBytes(0) { } - virtual ~Fast_HTTPPersistentInputFilter(void) { + ~Fast_HTTPPersistentInputFilter() { delete _chunkedInput; } // Methods - virtual ssize_t Available(void); - virtual bool Close(void); - virtual ssize_t Read(void *sourceBuffer, size_t length); - virtual ssize_t Skip(size_t skipNBytes); + ssize_t Available() override; + bool Close() override; + ssize_t Read(void *sourceBuffer, size_t length) override; + ssize_t Skip(size_t skipNBytes) override; void SetEntityLength(size_t entityLength); - void SetChunkedEncoding(void); + void SetChunkedEncoding(); }; - - -ssize_t Fast_HTTPPersistentInputFilter::Available(void) +ssize_t Fast_HTTPPersistentInputFilter::Available() { if (_useChunkedInput) { return _chunkedInput->Available(); @@ -92,7 +75,7 @@ ssize_t Fast_HTTPPersistentInputFilter::Available(void) -bool Fast_HTTPPersistentInputFilter::Close(void) +bool Fast_HTTPPersistentInputFilter::Close() { // Do nothing. return true; @@ -143,7 +126,7 @@ void Fast_HTTPPersistentInputFilter::SetEntityLength(size_t entityLength) -void Fast_HTTPPersistentInputFilter::SetChunkedEncoding(void) +void Fast_HTTPPersistentInputFilter::SetChunkedEncoding() { _useChunkedInput = true; // TODO: If input stream interface is expanded to enable resetting @@ -190,19 +173,19 @@ class Fast_HTTPPersistentOutputFilter : public Fast_FilterOutputStream _linePos(0) { } - virtual ~Fast_HTTPPersistentOutputFilter(void) { + ~Fast_HTTPPersistentOutputFilter() { delete _chunkedOutput; } // Methods - virtual bool Close(void); - virtual ssize_t Write(const void *sourceBuffer, size_t length); - virtual void Flush(void); + bool Close() override; + ssize_t Write(const void *sourceBuffer, size_t length) override; + void Flush() override; }; -bool Fast_HTTPPersistentOutputFilter::FlushHeader(void) +bool Fast_HTTPPersistentOutputFilter::FlushHeader() { assert(_inHeaderRegion); size_t i = 0; @@ -220,7 +203,7 @@ bool Fast_HTTPPersistentOutputFilter::FlushHeader(void) -bool Fast_HTTPPersistentOutputFilter::Close(void) +bool Fast_HTTPPersistentOutputFilter::Close() { bool retVal = true; if (_inHeaderRegion) { diff --git a/fastlib/src/vespa/fastlib/net/httpserver.h b/fastlib/src/vespa/fastlib/net/httpserver.h index c644f5ef57c..f23650d434f 100644 --- a/fastlib/src/vespa/fastlib/net/httpserver.h +++ b/fastlib/src/vespa/fastlib/net/httpserver.h @@ -92,7 +92,7 @@ private: virtual ~Fast_HTTPConnection(void); - void Run (FastOS_ThreadInterface *thisThread, void *params); + void Run (FastOS_ThreadInterface *thisThread, void *params) override; void Output(const char *outputString); void OutputData(const void *data, size_t len); void OutputFile(FastOS_FileInterface *file); @@ -132,8 +132,7 @@ class Fast_HTTPServerSocketFactory : public FastOS_SocketFactory /** * Create a streaming socket object */ - virtual FastOS_SocketInterface *CreateSocket() - { + FastOS_SocketInterface *CreateSocket() override { return new Fast_Socket(_readTimeout); } }; @@ -239,7 +238,7 @@ protected: void SetKeepAlive(bool keepAlive = true) { _keepAlive = keepAlive; } bool GetKeepAlive() { return _keepAlive; } - virtual void Run (FastOS_ThreadInterface *thisThread, void *params); + void Run (FastOS_ThreadInterface *thisThread, void *params) override; virtual int Start(void); virtual void Stop(void); diff --git a/fastlib/src/vespa/fastlib/net/socket.h b/fastlib/src/vespa/fastlib/net/socket.h index ccd3a0dff23..f7fa9c9457c 100644 --- a/fastlib/src/vespa/fastlib/net/socket.h +++ b/fastlib/src/vespa/fastlib/net/socket.h @@ -27,31 +27,31 @@ private: * before timeout. -1 means wait forever. */ Fast_Socket(int msReadTimeout = -1 /* no timeout */) - : _event(), - _readTimeout(msReadTimeout), - _lastReadTimedOut(false), - _eof(false) + : _event(), + _readTimeout(msReadTimeout), + _lastReadTimedOut(false), + _eof(false) { } ~Fast_Socket(); - ssize_t Write(const void *sourceBuffer, size_t bufferSize); - ssize_t Read(void *targetBuffer, size_t bufferSize); - bool Close(void); + ssize_t Write(const void *sourceBuffer, size_t bufferSize) override; + ssize_t Read(void *targetBuffer, size_t bufferSize) override; + bool Close() override; bool LastReadTimedOut() { return _lastReadTimedOut; } bool SeenEOF() { return _eof; } - Fast_InputStream &GetInputStream(void) { return *this; } - Fast_OutputStream &GetOutputStream(void) { return *this; } + Fast_InputStream &GetInputStream() { return *this; } + Fast_OutputStream &GetOutputStream() { return *this; } // Implementation of Fast_InputStream and Fast_OutputStream interfaces - void Flush(void) { } - ssize_t Available (void) { return 0; } - ssize_t Skip (size_t skipNBytes) { (void) skipNBytes; return -1; } + void Flush() override { } + ssize_t Available () override { return 0; } + ssize_t Skip (size_t skipNBytes) override { (void) skipNBytes; return -1; } void Interrupt(); }; diff --git a/fnet/src/vespa/fnet/connection.cpp b/fnet/src/vespa/fnet/connection.cpp index beb7a16abbb..82f757a6027 100644 --- a/fnet/src/vespa/fnet/connection.cpp +++ b/fnet/src/vespa/fnet/connection.cpp @@ -26,7 +26,7 @@ public: _done(false), _waiting(false) {} - virtual ~SyncPacket() {} + ~SyncPacket() {} void WaitFree() { _cond.Lock(); @@ -37,7 +37,7 @@ public: _cond.Unlock(); } - virtual void Free(); + void Free() override; }; diff --git a/fnet/src/vespa/fnet/connection.h b/fnet/src/vespa/fnet/connection.h index 12b3c85b672..b84797624bf 100644 --- a/fnet/src/vespa/fnet/connection.h +++ b/fnet/src/vespa/fnet/connection.h @@ -442,14 +442,14 @@ public: * destructed. Will invoke the Cleanup method on the cleanup handler * for this connection, if present. **/ - void CleanupHook(); + void CleanupHook() override; /** * Close this connection immidiately. NOTE: this method should only * be called by the transport thread. **/ - void Close(); + void Close() override; /** @@ -457,7 +457,7 @@ public: * * @return false if connection broken, true otherwise. **/ - bool HandleReadEvent(); + bool HandleReadEvent() override; /** @@ -465,7 +465,7 @@ public: * * @return false is connection broken, true otherwise. **/ - bool HandleWriteEvent(); + bool HandleWriteEvent() override; /** * @return Returns the size of this connection's output buffer. diff --git a/fnet/src/vespa/fnet/connector.h b/fnet/src/vespa/fnet/connector.h index 130e15cd318..7463397afa4 100644 --- a/fnet/src/vespa/fnet/connector.h +++ b/fnet/src/vespa/fnet/connector.h @@ -68,7 +68,7 @@ public: * thread in order to avoid race conditions related to socket event * registration, deregistration and triggering. **/ - void Close(); + void Close() override; /** * Called by the transport layer when a read event has occurred. If @@ -77,7 +77,7 @@ public: * * @return false if connector is broken, true otherwise. **/ - bool HandleReadEvent(); + bool HandleReadEvent() override; /** * Called by the transport layer when a write event has @@ -87,6 +87,6 @@ public: * * @return true. **/ - bool HandleWriteEvent(); + bool HandleWriteEvent() override; }; diff --git a/fnet/src/vespa/fnet/controlpacket.h b/fnet/src/vespa/fnet/controlpacket.h index 2ecbef8fcbf..f48bcaabfc2 100644 --- a/fnet/src/vespa/fnet/controlpacket.h +++ b/fnet/src/vespa/fnet/controlpacket.h @@ -62,42 +62,42 @@ public: /** * This method is empty. **/ - virtual void Free(); + void Free() override; /** * @return false **/ - virtual bool IsRegularPacket(); + bool IsRegularPacket() override; /** * @return true **/ - virtual bool IsControlPacket(); + bool IsControlPacket() override; - virtual uint32_t GetCommand(); - virtual bool IsChannelLostCMD(); - virtual bool IsTimeoutCMD(); - virtual bool IsBadPacketCMD(); + uint32_t GetCommand() override; + bool IsChannelLostCMD() override; + bool IsTimeoutCMD() override; + bool IsBadPacketCMD() override; /** * @return FNET_NOID **/ - virtual uint32_t GetPCODE(); + uint32_t GetPCODE() override; /** * @return 0 **/ - virtual uint32_t GetLength(); + uint32_t GetLength() override; /** * This method should never be called and will abort the program. **/ - virtual void Encode(FNET_DataBuffer *); + void Encode(FNET_DataBuffer *) override; /** * This method should never be called and will abort the program. **/ - virtual bool Decode(FNET_DataBuffer *, uint32_t); - virtual vespalib::string Print(uint32_t indent = 0); + bool Decode(FNET_DataBuffer *, uint32_t) override; + vespalib::string Print(uint32_t indent = 0) override; }; diff --git a/fnet/src/vespa/fnet/dummypacket.h b/fnet/src/vespa/fnet/dummypacket.h index 87af112901c..be0a932e77d 100644 --- a/fnet/src/vespa/fnet/dummypacket.h +++ b/fnet/src/vespa/fnet/dummypacket.h @@ -23,36 +23,36 @@ public: /** * @return false **/ - virtual bool IsRegularPacket(); + bool IsRegularPacket() override; /** * @return false **/ - virtual bool IsControlPacket(); + bool IsControlPacket() override; /** * @return FNET_NOID **/ - virtual uint32_t GetPCODE(); + uint32_t GetPCODE() override; /** * @return 0 **/ - virtual uint32_t GetLength(); + uint32_t GetLength() override; /** * This method should never be called and will abort the program. **/ - virtual void Encode(FNET_DataBuffer *); + void Encode(FNET_DataBuffer *) override; /** * This method should never be called and will abort the program. **/ - virtual bool Decode(FNET_DataBuffer *, uint32_t); + bool Decode(FNET_DataBuffer *, uint32_t) override; /** * Identify as dummy packet. **/ - virtual vespalib::string Print(uint32_t indent = 0); + vespalib::string Print(uint32_t indent = 0) override; }; diff --git a/fnet/src/vespa/fnet/fdselector.h b/fnet/src/vespa/fnet/fdselector.h index f7468039f0b..7dee084fae4 100644 --- a/fnet/src/vespa/fnet/fdselector.h +++ b/fnet/src/vespa/fnet/fdselector.h @@ -204,18 +204,18 @@ protected: * io component. This method performs internal cleanup related to * the io component framework used in FNET. **/ - void Close(); + void Close() override; /** * This method is called by the transport thread when the * underlying file descriptor is ready for reading. **/ - bool HandleReadEvent(); + bool HandleReadEvent() override; /** * This method is called by the transport layer when the * underlying file descriptor is ready for writing. **/ - bool HandleWriteEvent(); + bool HandleWriteEvent() override; }; diff --git a/fnet/src/vespa/fnet/frt/invoker.h b/fnet/src/vespa/fnet/frt/invoker.h index 60bc30312e3..9955ca12240 100644 --- a/fnet/src/vespa/fnet/frt/invoker.h +++ b/fnet/src/vespa/fnet/frt/invoker.h @@ -38,7 +38,7 @@ public: virtual ~FRT_SingleReqWait(); void WaitReq(); - virtual void RequestDone(FRT_RPCRequest *req); + void RequestDone(FRT_RPCRequest *req) override; }; //----------------------------------------------------------------------------- @@ -50,7 +50,7 @@ public: /** * Destructor. No cleanup needed for base class. */ - virtual ~FRT_ITimeoutHandler(void) {} + virtual ~FRT_ITimeoutHandler() {} virtual void HandleTimeout() = 0; }; @@ -80,9 +80,9 @@ public: void HandleDone(bool freeChannel); bool Invoke(bool freeChannel); - virtual void HandleReturn(); - virtual FNET_Connection *GetConnection(); - virtual void Run(FastOS_ThreadInterface *, void *); + void HandleReturn() override; + FNET_Connection *GetConnection() override; + void Run(FastOS_ThreadInterface *, void *) override; }; //----------------------------------------------------------------------------- @@ -109,8 +109,8 @@ public: } void Invoke(); - virtual void HandleReturn(); - virtual FNET_Connection *GetConnection(); + void HandleReturn() override; + FNET_Connection *GetConnection() override; }; //----------------------------------------------------------------------------- @@ -136,9 +136,9 @@ public: void HandleDone(); - virtual bool HandleAbort(); - virtual void PerformTask(); - virtual HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context); + bool HandleAbort() override; + void PerformTask() override; + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; }; //----------------------------------------------------------------------------- diff --git a/fnet/src/vespa/fnet/frt/packets.h b/fnet/src/vespa/fnet/frt/packets.h index 149da0746bf..58b1e1f30e3 100644 --- a/fnet/src/vespa/fnet/frt/packets.h +++ b/fnet/src/vespa/fnet/frt/packets.h @@ -44,8 +44,8 @@ public: bool LittleEndian() { return (_flags & FLAG_FRT_RPC_LITTLE_ENDIAN) != 0; } bool NoReply() { return (_flags & FLAG_FRT_RPC_NOREPLY) != 0; } - virtual ~FRT_RPCPacket(); - virtual void Free(); + ~FRT_RPCPacket(); + void Free() override; }; @@ -57,11 +57,11 @@ public: bool ownsRef) : FRT_RPCPacket(req, flags, ownsRef) {} - virtual uint32_t GetPCODE(); - virtual uint32_t GetLength(); - virtual void Encode(FNET_DataBuffer *dst); - virtual bool Decode(FNET_DataBuffer *src, uint32_t len); - virtual vespalib::string Print(uint32_t indent = 0); + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *dst) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; + vespalib::string Print(uint32_t indent = 0) override; }; @@ -73,11 +73,11 @@ public: bool ownsRef) : FRT_RPCPacket(req, flags, ownsRef) {} - virtual uint32_t GetPCODE(); - virtual uint32_t GetLength(); - virtual void Encode(FNET_DataBuffer *dst); - virtual bool Decode(FNET_DataBuffer *src, uint32_t len); - virtual vespalib::string Print(uint32_t indent = 0); + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *dst) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; + vespalib::string Print(uint32_t indent = 0) override; }; @@ -89,18 +89,18 @@ public: bool ownsRef) : FRT_RPCPacket(req, flags, ownsRef) {} - virtual uint32_t GetPCODE(); - virtual uint32_t GetLength(); - virtual void Encode(FNET_DataBuffer *dst); - virtual bool Decode(FNET_DataBuffer *src, uint32_t len); - virtual vespalib::string Print(uint32_t indent = 0); + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *dst) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; + vespalib::string Print(uint32_t indent = 0) override; }; class FRT_PacketFactory : public FNET_IPacketFactory { public: - FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context context); + FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context context) override; }; VESPA_CAN_SKIP_DESTRUCTION(FRT_RPCRequestPacket) diff --git a/fnet/src/vespa/fnet/frt/supervisor.h b/fnet/src/vespa/fnet/frt/supervisor.h index f58f4c7ae68..dab0e236a35 100644 --- a/fnet/src/vespa/fnet/frt/supervisor.h +++ b/fnet/src/vespa/fnet/frt/supervisor.h @@ -54,15 +54,15 @@ public: public: ConnHooks(FRT_Supervisor &parent); - virtual ~ConnHooks(); + ~ConnHooks(); void SetSessionInitHook(FRT_METHOD_PT method, FRT_Invokable *handler); void SetSessionDownHook(FRT_METHOD_PT method, FRT_Invokable *handler); void SetSessionFiniHook(FRT_METHOD_PT method, FRT_Invokable *handler); void InvokeHook(FRT_Method *hook, FNET_Connection *conn); bool InitAdminChannel(FNET_Channel *channel); - HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context); - void Cleanup(FNET_Connection *conn); + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; + void Cleanup(FNET_Connection *conn) override; }; private: @@ -134,11 +134,11 @@ public: double timeout); // FNET ServerAdapter Interface - bool InitAdminChannel(FNET_Channel *channel); - bool InitChannel(FNET_Channel *channel, uint32_t pcode); + bool InitAdminChannel(FNET_Channel *channel) override; + bool InitChannel(FNET_Channel *channel, uint32_t pcode) override; // Packet Handling - HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context); + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; // Methods for controlling transport object in standalone mode bool Start(); diff --git a/fnet/src/vespa/fnet/packetqueue.h b/fnet/src/vespa/fnet/packetqueue.h index 47182494f0c..3e2623540fb 100644 --- a/fnet/src/vespa/fnet/packetqueue.h +++ b/fnet/src/vespa/fnet/packetqueue.h @@ -88,8 +88,7 @@ public: * @param packet the packet to handle. * @param context the packet context. **/ - virtual HP_RetCode HandlePacket(FNET_Packet *packet, - FNET_Context context); + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; /** @@ -189,7 +188,7 @@ public: * as a packet handler. Default is FNET_KEEP_CHANNEL. **/ FNET_PacketQueue(uint32_t len = 64, HP_RetCode hpRetCode = FNET_KEEP_CHANNEL); - virtual ~FNET_PacketQueue(); + ~FNET_PacketQueue(); /** @@ -235,8 +234,7 @@ public: * @param packet the packet to handle. * @param context the packet context. **/ - virtual HP_RetCode HandlePacket(FNET_Packet *packet, - FNET_Context context); + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; /** diff --git a/fnet/src/vespa/fnet/transport_thread.cpp b/fnet/src/vespa/fnet/transport_thread.cpp index e8da525dbb9..e1a6d31a03e 100644 --- a/fnet/src/vespa/fnet/transport_thread.cpp +++ b/fnet/src/vespa/fnet/transport_thread.cpp @@ -18,7 +18,7 @@ namespace { struct Sync : public FNET_IExecutable { vespalib::Gate gate; - virtual void execute() { + void execute() override { gate.countDown(); } }; diff --git a/fnet/src/vespa/fnet/transport_thread.h b/fnet/src/vespa/fnet/transport_thread.h index 0f587a2fc6a..a9e1f056d17 100644 --- a/fnet/src/vespa/fnet/transport_thread.h +++ b/fnet/src/vespa/fnet/transport_thread.h @@ -41,7 +41,7 @@ public: StatsTask(FNET_Scheduler *scheduler, FNET_TransportThread *transport) : FNET_Task(scheduler), _transport(transport) {} - virtual void PerformTask(); + void PerformTask() override; }; friend class FNET_TransportThread::StatsTask; #endif // DOXYGEN @@ -624,5 +624,5 @@ public: * to combine the FNET event loop with your own, you may use the * @ref InitEventLoop and @ref EventLoopIteration methods directly. **/ - void Run(FastOS_ThreadInterface *thisThread, void *args); + void Run(FastOS_ThreadInterface *thisThread, void *args) override; }; diff --git a/juniper/src/vespa/juniper/Matcher.h b/juniper/src/vespa/juniper/Matcher.h index dbfa99fb7a4..233e1beeb3d 100644 --- a/juniper/src/vespa/juniper/Matcher.h +++ b/juniper/src/vespa/juniper/Matcher.h @@ -68,8 +68,8 @@ public: void set_log(unsigned long log_mask); /** Token handlers to be called by tokenization step */ - virtual void handle_token(Token& token); - virtual void handle_end(Token& token); + void handle_token(Token& token) override; + void handle_end(Token& token) override; /** Utilities for dump to standard output */ void dump_matches(int printcount = 10, bool best = false); diff --git a/juniper/src/vespa/juniper/keyocc.h b/juniper/src/vespa/juniper/keyocc.h index aa8e9cf3e17..4e63f3f249a 100644 --- a/juniper/src/vespa/juniper/keyocc.h +++ b/juniper/src/vespa/juniper/keyocc.h @@ -2,26 +2,24 @@ #pragma once #include "multiset.h" -#include <vector> #include "matchelem.h" #include "querynode.h" typedef key_occ* key_occ_ptr; typedef std::vector<key_occ_ptr> key_occ_vector; - class key_occ : public MatchElement { public: - virtual void set_valid(); - virtual void add_to_keylist(keylist& kl); - virtual void dump(std::string& s); - virtual size_t length() const { return tokenlen; } - inline const char* term() { return _term; } - inline size_t word_length() const { return 1; } - inline bool complete() { return true; } - virtual inline off_t endpos() const { return _startpos + tokenlen; } - virtual inline off_t endtoken() const { return _starttoken + 1; } + void set_valid() override; + void add_to_keylist(keylist& kl) override; + void dump(std::string& s) override; + size_t length() const override { return tokenlen; } + const char* term() { return _term; } + size_t word_length() const override { return 1; } + bool complete() override { return true; } + off_t endpos() const override { return _startpos + tokenlen; } + off_t endtoken() const override { return _starttoken + 1; } int tokenlen; key_occ(const char* term, off_t posi, off_t tpos, int len); diff --git a/juniper/src/vespa/juniper/matchobject.cpp b/juniper/src/vespa/juniper/matchobject.cpp index dee70362545..86e7bd01bb0 100644 --- a/juniper/src/vespa/juniper/matchobject.cpp +++ b/juniper/src/vespa/juniper/matchobject.cpp @@ -4,11 +4,8 @@ #include "matchobject.h" #include "juniperdebug.h" #include "result.h" -#include "querynode.h" #include "charutil.h" #include <vespa/fastlib/util/wildcard_match.h> -#include "querymodifier.h" -#include "queryhandle.h" #include <stack> #include <vespa/log/log.h> LOG_SETUP(".juniper.matchobject"); @@ -18,19 +15,18 @@ class traverser : public IQueryExprVisitor public: traverser(MatchObject& mo) : _mo(mo) {} - virtual void VisitQueryNode(QueryNode*) - { + void VisitQueryNode(QueryNode*) override { // We must not add this node to nonterminals before all children has been added! // Matcher::flush_candidates() depend on this order to avoid having to loop // until no more candidates... } - virtual void RevisitQueryNode(QueryNode* n) + void RevisitQueryNode(QueryNode* n) override { _mo.add_nonterm(n); } - virtual void VisitQueryTerm(QueryTerm* t) + void VisitQueryTerm(QueryTerm* t) override { if (t->rewriter && t->rewriter->ForDocument()) _mo.add_reduction_term(t, t->rewriter); @@ -48,7 +44,7 @@ public: query_expander(MatchObject& mo, uint32_t langid) : _caller(), _mo(mo), _langid(langid) {} - virtual void VisitQueryTerm(QueryTerm* orig) + void VisitQueryTerm(QueryTerm* orig) override { const char* nt = NULL; size_t length; @@ -114,8 +110,7 @@ public: // Visit on descent: - void VisitQueryNode(QueryNode* n) - { + void VisitQueryNode(QueryNode* n) override { QueryNode* qn = new QueryNode(n); update(qn); _caller.push(qn); @@ -123,15 +118,13 @@ public: // revisit on return: - void RevisitQueryNode(QueryNode* n) - { + void RevisitQueryNode(QueryNode* n) override { QueryNode* qn = _caller.top(); if (n->_parent) _caller.pop(); _mo.add_nonterm(qn); } - QueryExpr* NewQuery() - { + QueryExpr* NewQuery() { if (_caller.empty()) return NULL; return _caller.top(); } @@ -147,9 +140,6 @@ private: uint32_t _langid; }; // class query_expander - - - MatchObject::MatchObject(QueryExpr* query, bool has_reductions) : _query(query), _qt(), diff --git a/juniper/src/vespa/juniper/mcand.h b/juniper/src/vespa/juniper/mcand.h index 84967391b01..60fb5de542a 100644 --- a/juniper/src/vespa/juniper/mcand.h +++ b/juniper/src/vespa/juniper/mcand.h @@ -4,7 +4,6 @@ #pragma once #include "keyocc.h" -#include <string> #include "querynode.h" class Matcher; @@ -54,33 +53,33 @@ public: keylist _klist; MatchCandidate(QueryExpr* query, MatchElement** elms, off_t ctxt_start); - virtual ~MatchCandidate(); + ~MatchCandidate(); void ref() { ++_refcnt; } uint32_t deref() { --_refcnt; return _refcnt; } - virtual void set_valid(); - virtual void dump(std::string& s); - - inline int elems() const { return _nelems; } - inline int elem_store_sz() const { return _elems; } - inline int word_distance() const { return _elems ? _endtoken - _starttoken - (_elems - 1) : 0; } - inline off_t ctxt_startpos() const { return _ctxt_start; } - virtual inline off_t endtoken() const { return _endtoken; } - virtual inline off_t endpos() const { return _endpos; } - inline ssize_t size() const { return _endpos - _startpos; } - inline bool order() const { return _options & X_ORDERED; } - inline bool partial_ok() const { return !(_options & X_COMPLETE); } - inline QueryExpr* match() { return _match; } - inline int weight() const { return _elem_weight; } - inline size_t word_length() const { return _endtoken - _starttoken; } - - virtual bool complete(); + void set_valid() override; + void dump(std::string& s) override; + + int elems() const { return _nelems; } + int elem_store_sz() const { return _elems; } + int word_distance() const { return _elems ? _endtoken - _starttoken - (_elems - 1) : 0; } + off_t ctxt_startpos() const { return _ctxt_start; } + off_t endtoken() const override { return _endtoken; } + off_t endpos() const override { return _endpos; } + ssize_t size() const { return _endpos - _startpos; } + bool order() const { return _options & X_ORDERED; } + bool partial_ok() const { return !(_options & X_COMPLETE); } + QueryExpr* match() { return _match; } + int weight() const { return _elem_weight; } + size_t word_length() const override { return _endtoken - _starttoken; } + + bool complete() override; int weight(MatchElement* me, QueryExpr* mexp); - virtual size_t length() const { return _endpos - _startpos; } + size_t length() const override { return _endpos - _startpos; } - virtual MatchCandidate* Complex() { return this; } + MatchCandidate* Complex() override { return this; } - virtual void add_to_keylist(keylist& kl); + void add_to_keylist(keylist& kl) override; void make_keylist(); // A simple ranking function for now: Make sure those matches with diff --git a/juniper/src/vespa/juniper/propreader.h b/juniper/src/vespa/juniper/propreader.h index dfc0a92e31f..33ba08bcef9 100644 --- a/juniper/src/vespa/juniper/propreader.h +++ b/juniper/src/vespa/juniper/propreader.h @@ -11,9 +11,9 @@ class PropReader : public IJuniperProperties { public: PropReader(const char* filename); - virtual const char* GetProperty(const char* name, const char* def = NULL); + const char* GetProperty(const char* name, const char* def = NULL) override; void UpdateProperty(const char* name, const char* value); - virtual ~PropReader() {} + ~PropReader() {} protected: void Process(const char* filename); private: diff --git a/juniper/src/vespa/juniper/querynode.h b/juniper/src/vespa/juniper/querynode.h index 84e7e800c8e..63db1802624 100644 --- a/juniper/src/vespa/juniper/querynode.h +++ b/juniper/src/vespa/juniper/querynode.h @@ -107,19 +107,19 @@ public: // Create a copy of the node n wrt. arity etc, but without adding any children.. explicit QueryNode(QueryNode* n); - virtual ~QueryNode(); - virtual QueryNode* AddChild(QueryExpr* child); - virtual int Limit(); - inline bool Complete() { return _arity == _nchild; } - virtual void Dump(std::string&); - virtual bool StackComplete(); - virtual void ComputeThreshold(); - virtual QueryNode* AsNode(); - virtual QueryTerm* AsTerm(); - virtual bool Complex(); - virtual int MaxArity(); - - virtual void Accept(IQueryExprVisitor& v); + ~QueryNode(); + QueryNode* AddChild(QueryExpr* child) override; + int Limit() override; + bool Complete() const { return _arity == _nchild; } + void Dump(std::string&) override; + bool StackComplete() override; + void ComputeThreshold() override; + QueryNode* AsNode() override; + QueryTerm* AsTerm() override; + bool Complex() override; + int MaxArity() override; + + void Accept(IQueryExprVisitor& v) override; // return true if a match for n should lead to creation of a new candidate node // corresponding to this query tree node: @@ -147,16 +147,16 @@ class QueryTerm : public QueryExpr public: QueryTerm(const char* t, int length, int ix, int weight = 100); explicit QueryTerm(QueryTerm* const); - virtual ~QueryTerm(); - virtual int Limit(); - virtual QueryNode* AddChild(QueryExpr* child); - virtual void Dump(std::string&); - virtual bool StackComplete(); - virtual QueryNode* AsNode(); - virtual QueryTerm* AsTerm(); - virtual bool Complex(); - - virtual void Accept(IQueryExprVisitor& v); + ~QueryTerm(); + int Limit() override; + QueryNode* AddChild(QueryExpr* child) override; + void Dump(std::string&) override; + bool StackComplete() override; + QueryNode* AsNode() override; + QueryTerm* AsTerm() override; + bool Complex() override; + + void Accept(IQueryExprVisitor& v) override; inline const char* term() { return _rep; } inline const ucs4_t* ucs4_term() { return _ucs4_term; } inline bool is_prefix() { return _options & X_PREFIX; } @@ -183,4 +183,3 @@ private: * with arity 1 or non-terms with arity 0 */ void SimplifyStack(QueryExpr*& orig_stack); - diff --git a/juniper/src/vespa/juniper/queryparser.h b/juniper/src/vespa/juniper/queryparser.h index 19de984a893..b9cd7ea0352 100644 --- a/juniper/src/vespa/juniper/queryparser.h +++ b/juniper/src/vespa/juniper/queryparser.h @@ -32,13 +32,13 @@ public: QueryParser(const char* query_string); virtual ~QueryParser(); - virtual bool Traverse(IQueryVisitor* v) const; - virtual int Weight(const QueryItem* item) const; - virtual ItemCreator Creator(const QueryItem* item) const; - virtual const char* Index(const QueryItem* item, size_t* length) const; - virtual bool UsefulIndex(const QueryItem* item) const; + bool Traverse(IQueryVisitor* v) const override; + int Weight(const QueryItem* item) const override; + ItemCreator Creator(const QueryItem* item) const override; + const char* Index(const QueryItem* item, size_t* length) const override; + bool UsefulIndex(const QueryItem* item) const override; - inline int ParseError() { return _parse_errno; } + int ParseError() { return _parse_errno; } protected: QueryItem* ParseExpr(); QueryItem* ParseKeyword(); diff --git a/juniper/src/vespa/juniper/queryvisitor.h b/juniper/src/vespa/juniper/queryvisitor.h index 28b9047dc72..caedf31e3ef 100644 --- a/juniper/src/vespa/juniper/queryvisitor.h +++ b/juniper/src/vespa/juniper/queryvisitor.h @@ -1,11 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -/* $Id$ */ - #include "rpinterface.h" #include "querynode.h" -#include <vector> // Juniper internal implementation of the IQueryVisitor interface as used by // query providers (this is the initial 1.0.x structure implementation) @@ -26,20 +23,20 @@ class QueryVisitor : public juniper::IQueryVisitor { public: QueryVisitor(const IQuery& query, QueryHandle* qhandle, juniper::QueryModifier & queryModifier); - virtual ~QueryVisitor(); + ~QueryVisitor(); - virtual bool VisitAND(const QueryItem* item, int arity); - virtual bool VisitOR(const QueryItem* item, int arity); - virtual bool VisitANY(const QueryItem* item, int arity); - virtual bool VisitNEAR(const QueryItem* item, int arity, int limit); - virtual bool VisitWITHIN(const QueryItem* item, int arity, int limit); - virtual bool VisitRANK(const QueryItem* item, int arity); - virtual bool VisitPHRASE(const QueryItem* item, int arity); - virtual bool VisitANDNOT(const QueryItem* item, int arity); - virtual bool VisitTHRESHOLD(const QueryItem* item, int arity, int threshold); - virtual bool VisitOther(const QueryItem* item, int arity); - virtual void VisitKeyword(const QueryItem* item, const char* keyword, - const size_t length = 0, bool prefix = false, bool specialToken = false); + bool VisitAND(const QueryItem* item, int arity) override; + bool VisitOR(const QueryItem* item, int arity) override; + bool VisitANY(const QueryItem* item, int arity) override; + bool VisitNEAR(const QueryItem* item, int arity, int limit) override; + bool VisitWITHIN(const QueryItem* item, int arity, int limit) override; + bool VisitRANK(const QueryItem* item, int arity) override; + bool VisitPHRASE(const QueryItem* item, int arity) override; + bool VisitANDNOT(const QueryItem* item, int arity) override; + bool VisitTHRESHOLD(const QueryItem* item, int arity, int threshold) override; + bool VisitOther(const QueryItem* item, int arity) override; + void VisitKeyword(const QueryItem* item, const char* keyword, + const size_t length = 0, bool prefix = false, bool specialToken = false) override; /** Grab pointer to (and ownership of) the query structure generated by this visitor. * The call releases the query structure from this visitor. diff --git a/juniper/src/vespa/juniper/result.cpp b/juniper/src/vespa/juniper/result.cpp index 786e9aa15d1..7604de88ec4 100644 --- a/juniper/src/vespa/juniper/result.cpp +++ b/juniper/src/vespa/juniper/result.cpp @@ -6,7 +6,6 @@ #include "result.h" #include "juniperparams.h" #include "Matcher.h" -#include "tokenizer.h" #include "config.h" #include "appender.h" @@ -21,9 +20,9 @@ class SummaryImpl : public Summary public: explicit SummaryImpl() : _text("") {} explicit SummaryImpl(const std::string& t) : _text(t) {} - virtual ~SummaryImpl() {} - virtual const char* Text() const { return _text.c_str(); } - virtual size_t Length() const { return _text.size(); } + ~SummaryImpl() {} + const char* Text() const override { return _text.c_str(); } + size_t Length() const override { return _text.size(); } std::string _text; }; diff --git a/juniper/src/vespa/juniper/specialtokenregistry.cpp b/juniper/src/vespa/juniper/specialtokenregistry.cpp index 92a9b719751..ecec7d90d29 100644 --- a/juniper/src/vespa/juniper/specialtokenregistry.cpp +++ b/juniper/src/vespa/juniper/specialtokenregistry.cpp @@ -10,9 +10,9 @@ private: public: QueryVisitor(juniper::SpecialTokenRegistry & registry) : _registry(registry) {} - virtual void VisitQueryNode(QueryNode *) { } - virtual void RevisitQueryNode(QueryNode *) { } - virtual void VisitQueryTerm(QueryTerm * t) { + void VisitQueryNode(QueryNode *) override { } + void RevisitQueryNode(QueryNode *) override { } + void VisitQueryTerm(QueryTerm * t) override { if (t->isSpecialToken()) { _registry.addSpecialToken(t); } diff --git a/metrics/src/vespa/metrics/countmetric.h b/metrics/src/vespa/metrics/countmetric.h index 76eb166ef9a..a72a229b8b8 100644 --- a/metrics/src/vespa/metrics/countmetric.h +++ b/metrics/src/vespa/metrics/countmetric.h @@ -13,13 +13,13 @@ #pragma once -#include <vespa/metrics/metric.h> #include "countmetricvalues.h" +#include <vespa/metrics/metric.h> namespace metrics { struct AbstractCountMetric : public Metric { - virtual bool visit(MetricVisitor& visitor, bool tagAsAutoGenerated = false) const + bool visit(MetricVisitor& visitor, bool tagAsAutoGenerated = false) const override { return visitor.visitCountMetric(*this, tagAsAutoGenerated); } @@ -70,8 +70,9 @@ public: ~CountMetric(); - virtual MetricValueClass::UP getValues() const - { return MetricValueClass::UP(new Values(_values.getValues())); } + MetricValueClass::UP getValues() const override { + return MetricValueClass::UP(new Values(_values.getValues())); + } void logOnlyIfSet() { _values.removeFlag(LOG_IF_UNSET); } void set(T value); @@ -92,40 +93,42 @@ public: CountMetric t(a); t -= b; return t; } - virtual CountMetric * clone( - std::vector<Metric::UP> &, CopyType type, MetricSet* owner, - bool /*includeUnused*/) const - { return new CountMetric<T, SumOnAdd>(*this, type, owner); } - T getValue() const { return _values.getValues()._value; } - void reset() { - _values.reset(); + CountMetric * clone(std::vector<Metric::UP> &, CopyType type, MetricSet* owner, + bool /*includeUnused*/) const override { + return new CountMetric<T, SumOnAdd>(*this, type, owner); } - virtual bool logFromTotalMetrics() const { return true; } - virtual bool logEvent(const String& fullName) const; + T getValue() const { return _values.getValues()._value; } - virtual void print(std::ostream&, bool verbose, - const std::string& indent, uint64_t secondsPassed) const; + void reset() override { _values.reset(); } - // Only one metric in valuemetric, so return it on any id. - virtual int64_t getLongValue(const stringref & id) const - { (void) id; return static_cast<int64_t>(getValue()); } - virtual double getDoubleValue(const stringref & id) const - { (void) id; return static_cast<double>(getValue()); } + bool logFromTotalMetrics() const override { return true; } + bool logEvent(const String& fullName) const override; - virtual bool inUse(const MetricValueClass& v) const - { return static_cast<const Values&>(v).inUse(); } - virtual bool used() const { return _values.getValues().inUse(); } - virtual bool sumOnAdd() const { return SumOnAdd; } + void print(std::ostream&, bool verbose, + const std::string& indent, uint64_t secondsPassed) const override; - virtual void addMemoryUsage(MemoryConsumption&) const; - - virtual void printDebug(std::ostream&, const std::string& indent) const; + // Only one metric in valuemetric, so return it on any id. + int64_t getLongValue(const stringref & id) const override { + (void) id; + return static_cast<int64_t>(getValue()); + } + double getDoubleValue(const stringref & id) const override { + (void) id; + return static_cast<double>(getValue()); + } - virtual void addToPart(Metric&) const; - virtual void addToSnapshot(Metric&, std::vector<Metric::UP> &) const; + bool inUse(const MetricValueClass& v) const override { + return static_cast<const Values&>(v).inUse(); + } + bool used() const override { return _values.getValues().inUse(); } + bool sumOnAdd() const override { return SumOnAdd; } + void addMemoryUsage(MemoryConsumption&) const override; + void printDebug(std::ostream&, const std::string& indent) const override; + void addToPart(Metric&) const override; + void addToSnapshot(Metric&, std::vector<Metric::UP> &) const override; }; typedef CountMetric<uint64_t, true> LongCountMetric; diff --git a/metrics/src/vespa/metrics/jsonwriter.h b/metrics/src/vespa/metrics/jsonwriter.h index 37de3c0c0b1..43f19ffd268 100644 --- a/metrics/src/vespa/metrics/jsonwriter.h +++ b/metrics/src/vespa/metrics/jsonwriter.h @@ -21,15 +21,13 @@ public: JsonWriter(vespalib::JsonStream&); private: - virtual bool visitSnapshot(const MetricSnapshot&); - virtual void doneVisitingSnapshot(const MetricSnapshot&); - virtual bool visitMetricSet(const MetricSet&, bool autoGenerated); - virtual void doneVisitingMetricSet(const MetricSet&); - virtual bool visitCountMetric(const AbstractCountMetric&, - bool autoGenerated); - virtual bool visitValueMetric(const AbstractValueMetric&, - bool autoGenerated); - virtual void doneVisiting(); + bool visitSnapshot(const MetricSnapshot&) override; + void doneVisitingSnapshot(const MetricSnapshot&) override; + bool visitMetricSet(const MetricSet&, bool autoGenerated) override; + void doneVisitingMetricSet(const MetricSet&) override; + bool visitCountMetric(const AbstractCountMetric&, bool autoGenerated) override; + bool visitValueMetric(const AbstractValueMetric&, bool autoGenerated) override; + void doneVisiting() override; void checkIfArrayNeedsToBeStarted(); void writeCommonPrefix(const Metric& m); diff --git a/metrics/src/vespa/metrics/memoryconsumption.h b/metrics/src/vespa/metrics/memoryconsumption.h index e964a7c0ca2..a456e9ae8e0 100644 --- a/metrics/src/vespa/metrics/memoryconsumption.h +++ b/metrics/src/vespa/metrics/memoryconsumption.h @@ -90,7 +90,7 @@ public: void addSnapShotUsage(const std::string& name, uint32_t usage); uint32_t getTotalMemoryUsage() const; - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; static std::string bval(uint32_t bytes); private: diff --git a/metrics/src/vespa/metrics/metric.h b/metrics/src/vespa/metrics/metric.h index c45920cfda4..a494b65127c 100644 --- a/metrics/src/vespa/metrics/metric.h +++ b/metrics/src/vespa/metrics/metric.h @@ -160,8 +160,8 @@ public: /** Implement to make metric able to log event. */ virtual bool logEvent(const String& fullName) const = 0; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const { + void print(std::ostream& out, bool verbose, + const std::string& indent) const override { print(out, verbose, indent, 0); } virtual void print(std::ostream&, bool verbose, const std::string& indent, diff --git a/metrics/src/vespa/metrics/metricmanager.cpp b/metrics/src/vespa/metrics/metricmanager.cpp index 13d7443d2bb..572779be855 100644 --- a/metrics/src/vespa/metrics/metricmanager.cpp +++ b/metrics/src/vespa/metrics/metricmanager.cpp @@ -269,8 +269,8 @@ namespace { return false; } - virtual bool visitMetricSet(const MetricSet& metricSet, - bool autoGenerated) + bool visitMetricSet(const MetricSet& metricSet, + bool autoGenerated) override { (void) autoGenerated; result.push_back(Result()); @@ -290,14 +290,14 @@ namespace { } return true; } - virtual void doneVisitingMetricSet(const MetricSet& metricSet) { + void doneVisitingMetricSet(const MetricSet& metricSet) override { if (result.back().metricCount > 0 && result.size() != 1) { LOG(spam, "Adding metricset %s", metricSet.getPath().c_str()); _matchedMetrics.includedMetrics.insert(metricSet.getPath()); } result.pop_back(); } - bool visitMetric(const Metric& metric, bool autoGenerated) { + bool visitMetric(const Metric& metric, bool autoGenerated) override { (void) autoGenerated; if (result.back().nameRemoved || nameRemoved(metric)) return true; bool nAdded = (result.back().nameAdded || nameAdded(metric)); @@ -520,14 +520,14 @@ namespace { MetricVisitor& clientVisitor) : _metricsToMatch(spec), _client(clientVisitor) {} - virtual bool visitMetricSet(const MetricSet& metricSet, - bool autoGenerated) + bool visitMetricSet(const MetricSet& metricSet, + bool autoGenerated) override { if (metricSet.isTopSet()) return true; return (_metricsToMatch.contains(metricSet) && _client.visitMetricSet(metricSet, autoGenerated)); } - virtual void doneVisitingMetricSet(const MetricSet& metricSet) { + void doneVisitingMetricSet(const MetricSet& metricSet) override { if (!metricSet.isTopSet()) { #ifdef VERIFY_ALL_METRICS_VISITED _visitedMetrics.insert(metricSet.getPath()); @@ -535,8 +535,8 @@ namespace { _client.doneVisitingMetricSet(metricSet); } } - virtual bool visitCountMetric(const AbstractCountMetric& metric, - bool autoGenerated) + bool visitCountMetric(const AbstractCountMetric& metric, + bool autoGenerated) override { if (_metricsToMatch.contains(metric)) { #ifdef VERIFY_ALL_METRICS_VISITED @@ -546,8 +546,8 @@ namespace { } return true; } - virtual bool visitValueMetric(const AbstractValueMetric& metric, - bool autoGenerated) + bool visitValueMetric(const AbstractValueMetric& metric, + bool autoGenerated) override { if (_metricsToMatch.contains(metric)) { #ifdef VERIFY_ALL_METRICS_VISITED @@ -746,7 +746,7 @@ namespace { LogMetricVisitor(bool totalVals) : _total(totalVals) {} - bool visitMetric(const Metric& metric, bool autoGenerated) { + bool visitMetric(const Metric& metric, bool autoGenerated) override { (void) autoGenerated; if (metric.logFromTotalMetrics() ^ _total) return true; Metric::String logName = metric.getPath(); diff --git a/metrics/src/vespa/metrics/metricmanager.h b/metrics/src/vespa/metrics/metricmanager.h index 138a4b0c06f..58a8fd4c45a 100644 --- a/metrics/src/vespa/metrics/metricmanager.h +++ b/metrics/src/vespa/metrics/metricmanager.h @@ -92,7 +92,7 @@ public: } void print(std::ostream& out, bool verbose, - const std::string& indent) const; + const std::string& indent) const override; void addMemoryUsage(MemoryConsumption&) const; }; diff --git a/metrics/src/vespa/metrics/metricset.cpp b/metrics/src/vespa/metrics/metricset.cpp index 201b7c296e2..15ee22ba1f2 100644 --- a/metrics/src/vespa/metrics/metricset.cpp +++ b/metrics/src/vespa/metrics/metricset.cpp @@ -99,14 +99,12 @@ namespace { struct MetricSetFinder : public MetricVisitor { std::list<MetricSet*> _metricSets; - virtual bool visitMetricSet(const MetricSet& set, bool autoGenerated) - { + bool visitMetricSet(const MetricSet& set, bool autoGenerated) override { if (autoGenerated) return false; _metricSets.push_back(const_cast<MetricSet*>(&set)); return true; } - virtual bool visitMetric(const Metric&, bool autoGenerated) - { + bool visitMetric(const Metric&, bool autoGenerated) override { (void) autoGenerated; return true; } diff --git a/metrics/src/vespa/metrics/metricset.h b/metrics/src/vespa/metrics/metricset.h index b7c012af277..f96ba5085b0 100644 --- a/metrics/src/vespa/metrics/metricset.h +++ b/metrics/src/vespa/metrics/metricset.h @@ -56,7 +56,7 @@ public: MetricSet* clone(std::vector<Metric::UP> &ownerList, CopyType type, MetricSet* owner, bool includeUnused = false) const override; - void reset(); + void reset() override; bool visit(MetricVisitor&, bool tagAsAutoGenerated = false) const override; @@ -65,9 +65,9 @@ public: void print(std::ostream&, bool verbose, const std::string& indent, uint64_t secondsPassed) const override; // These should never be called on metrics set. - virtual int64_t getLongValue(const stringref & id) const + int64_t getLongValue(const stringref & id) const override { (void) id; assert(false); return 0; } - virtual double getDoubleValue(const stringref & id) const + double getDoubleValue(const stringref & id) const override { (void) id; assert(false); return 0; } const Metric* getMetric(const String& name) const; @@ -76,25 +76,18 @@ public: const_cast<const MetricSet*>(this)->getMetric(name)); } - virtual void addToSnapshot(Metric& m, std::vector<Metric::UP> &o) const - { addTo(m, &o); } + void addToSnapshot(Metric& m, std::vector<Metric::UP> &o) const override { addTo(m, &o); } - const std::vector<Metric*>& getRegisteredMetrics() const - { return _metricOrder; } + const std::vector<Metric*>& getRegisteredMetrics() const { return _metricOrder; } - virtual bool used() const; - - virtual void addMemoryUsage(MemoryConsumption&) const; + bool used() const override; + void addMemoryUsage(MemoryConsumption&) const override; /** Update names using the given name hash, to utilize ref counting. */ - virtual void updateNames(NameHash&) const; - - virtual void printDebug(std::ostream&, const std::string& indent="") const; - - virtual bool isMetricSet() const { return true; } - - virtual void addToPart(Metric& m) const - { addTo(m, 0); } + void updateNames(NameHash&) const override; + void printDebug(std::ostream&, const std::string& indent="") const override; + bool isMetricSet() const override { return true; } + void addToPart(Metric& m) const override { addTo(m, 0); } /** * Returns the key of the dimension this metric is part of (if any). diff --git a/metrics/src/vespa/metrics/printutils.h b/metrics/src/vespa/metrics/printutils.h index 17562e7e064..93f7264c245 100644 --- a/metrics/src/vespa/metrics/printutils.h +++ b/metrics/src/vespa/metrics/printutils.h @@ -49,9 +49,9 @@ struct MetricSource { void checkForPrefixMatch(const Metric& metric); - bool visitMetricSet(const MetricSet& set, bool); - void doneVisitingMetricSet(const MetricSet&) { --_pathIndex; } - bool visitMetric(const Metric& metric, bool); + bool visitMetricSet(const MetricSet& set, bool) override; + void doneVisitingMetricSet(const MetricSet&) override { --_pathIndex; } + bool visitMetric(const Metric& metric, bool) override; }; const Metric* getMetric(const String& name); diff --git a/metrics/src/vespa/metrics/summetric.h b/metrics/src/vespa/metrics/summetric.h index 32444b3a75d..04ae1454a50 100644 --- a/metrics/src/vespa/metrics/summetric.h +++ b/metrics/src/vespa/metrics/summetric.h @@ -59,25 +59,17 @@ public: void addMetricToSum(const AddendMetric&); void removeMetricFromSum(const AddendMetric&); - virtual bool logEvent(const String& fullName) const; - - virtual void print(std::ostream&, bool verbose, const std::string& indent, uint64_t secondsPassed) const; - - virtual int64_t getLongValue(const stringref & id) const; - virtual double getDoubleValue(const stringref & id) const; - - virtual void reset() {} - - virtual bool visit(MetricVisitor& visitor, bool tagAsAutoGenerated = false) const; - - virtual bool used() const; - - virtual void addMemoryUsage(MemoryConsumption&) const; - - virtual void printDebug(std::ostream&, const std::string& indent="") const; - - virtual void addToPart(Metric&) const; - virtual void addToSnapshot(Metric&, std::vector<Metric::UP> &) const; + bool logEvent(const String& fullName) const override; + void print(std::ostream&, bool verbose, const std::string& indent, uint64_t secondsPassed) const override; + int64_t getLongValue(const stringref & id) const override; + double getDoubleValue(const stringref & id) const override; + void reset() override {} + bool visit(MetricVisitor& visitor, bool tagAsAutoGenerated = false) const override; + bool used() const override; + void addMemoryUsage(MemoryConsumption&) const override; + void printDebug(std::ostream&, const std::string& indent="") const override; + void addToPart(Metric&) const override; + void addToSnapshot(Metric&, std::vector<Metric::UP> &) const override; private: friend class MetricManagerTest; diff --git a/metrics/src/vespa/metrics/valuemetric.h b/metrics/src/vespa/metrics/valuemetric.h index 8c02857bcd7..56bed68c6f3 100644 --- a/metrics/src/vespa/metrics/valuemetric.h +++ b/metrics/src/vespa/metrics/valuemetric.h @@ -20,9 +20,7 @@ namespace metrics { struct AbstractValueMetric : public Metric { - virtual bool visit(MetricVisitor& visitor, - bool tagAsAutoGenerated = false) const - { + bool visit(MetricVisitor& visitor, bool tagAsAutoGenerated = false) const override { return visitor.visitValueMetric(*this, tagAsAutoGenerated); } virtual MetricValueClass::UP getValues() const = 0; @@ -47,23 +45,25 @@ protected: }; template<typename AvgVal, typename TotVal, bool SumOnAdd> -class ValueMetric : public AbstractValueMetric -{ +class ValueMetric : public AbstractValueMetric { using String = Metric::String; // Redefine so template finds it easy using Values = ValueMetricValues<AvgVal, TotVal>; MetricValueSet<Values> _values; - enum Flag { SUMMED_AVERAGE = 2, UNSET_ON_ZERO_VALUE = 4, LOG_IF_UNSET = 8 }; + enum Flag { + SUMMED_AVERAGE = 2, UNSET_ON_ZERO_VALUE = 4, LOG_IF_UNSET = 8 + }; + + bool summedAverage() const override { return _values.hasFlag(SUMMED_AVERAGE); } + + bool unsetOnZeroValue() const { return _values.hasFlag(UNSET_ON_ZERO_VALUE); } - virtual bool summedAverage() const - { return _values.hasFlag(SUMMED_AVERAGE); } - bool unsetOnZeroValue() const - { return _values.hasFlag(UNSET_ON_ZERO_VALUE); } bool logIfUnset() const { return _values.hasFlag(LOG_IF_UNSET); } - void add(const Values& values, bool sumOnAdd); - void dec(const Values& values); + void add(const Values &values, bool sumOnAdd); + + void dec(const Values &values); void addValueWithCount(AvgVal avg, TotVal tot, uint32_t count); @@ -76,30 +76,33 @@ class ValueMetric : public AbstractValueMetric } return true; } + bool checkFinite(AvgVal, std::false_type) { return true; } public: - ValueMetric(const String& name, const String& tags, - const String& description, MetricSet* owner = 0); + ValueMetric(const String &name, const String &tags, + const String &description, MetricSet *owner = 0); - ValueMetric(const ValueMetric<AvgVal, TotVal, SumOnAdd>&, - CopyType, MetricSet* owner); + ValueMetric(const ValueMetric<AvgVal, TotVal, SumOnAdd> &, + CopyType, MetricSet *owner); - ValueMetric(const String& name, Tags dimensions, - const String& description, MetricSet* owner = 0); + ValueMetric(const String &name, Tags dimensions, + const String &description, MetricSet *owner = 0); ~ValueMetric(); - virtual MetricValueClass::UP getValues() const - { return MetricValueClass::UP(new Values(_values.getValues())); } + MetricValueClass::UP getValues() const override { + return MetricValueClass::UP(new Values(_values.getValues())); + } void unsetOnZeroValue() { _values.setFlag(UNSET_ON_ZERO_VALUE); } + void logOnlyIfSet() { _values.removeFlag(LOG_IF_UNSET); } - virtual ValueMetric * clone( - std::vector<Metric::UP> &, CopyType type, MetricSet* owner, - bool /*includeUnused*/) const - { return new ValueMetric<AvgVal,TotVal,SumOnAdd>(*this, type, owner); } + ValueMetric *clone(std::vector<Metric::UP> &, CopyType type, MetricSet *owner, + bool /*includeUnused*/) const override { + return new ValueMetric<AvgVal,TotVal,SumOnAdd>(*this, type, owner); + } ValueMetric & operator+=(const ValueMetric &); @@ -125,32 +128,25 @@ public: AvgVal getCount() const { return _values.getValues()._count; } AvgVal getLast() const { return _values.getValues()._last; } - void reset() { _values.reset(); } + void reset() override { _values.reset(); } + bool logEvent(const String& fullName) const override; - virtual bool logEvent(const String& fullName) const; + void print(std::ostream&, bool verbose, + const std::string& indent, uint64_t secondsPassed) const override; - virtual void print(std::ostream&, bool verbose, - const std::string& indent, uint64_t secondsPassed) const; + int64_t getLongValue(const stringref & id) const override; + double getDoubleValue(const stringref & id) const override; - virtual int64_t getLongValue(const stringref & id) const; - virtual double getDoubleValue(const stringref & id) const; - - - virtual bool inUse(const MetricValueClass& v) const { + bool inUse(const MetricValueClass& v) const override { const Values& values(static_cast<const Values&>(v)); return (values._total != 0 || (values._count != 0 && !unsetOnZeroValue())); } - virtual bool used() const { - return inUse(_values.getValues()); - } - - virtual void addMemoryUsage(MemoryConsumption&) const; - - virtual void printDebug(std::ostream&, const std::string& indent) const; - - virtual void addToPart(Metric&) const; - virtual void addToSnapshot(Metric&, std::vector<Metric::UP> &) const; + bool used() const override { return inUse(_values.getValues()); } + void addMemoryUsage(MemoryConsumption&) const override; + void printDebug(std::ostream&, const std::string& indent) const override; + void addToPart(Metric&) const override; + void addToSnapshot(Metric&, std::vector<Metric::UP> &) const override; }; typedef ValueMetric<double, double, true> DoubleValueMetric; diff --git a/metrics/src/vespa/metrics/xmlwriter.h b/metrics/src/vespa/metrics/xmlwriter.h index c55ed82f093..c937d36ccf1 100644 --- a/metrics/src/vespa/metrics/xmlwriter.h +++ b/metrics/src/vespa/metrics/xmlwriter.h @@ -16,14 +16,12 @@ public: XmlWriter(vespalib::xml::XmlOutputStream& xos, uint32_t period, int verbosity); - virtual bool visitSnapshot(const MetricSnapshot&); - virtual void doneVisitingSnapshot(const MetricSnapshot&); - virtual bool visitMetricSet(const MetricSet& set, bool); - virtual void doneVisitingMetricSet(const MetricSet&); - virtual bool visitCountMetric(const AbstractCountMetric&, - bool autoGenerated); - virtual bool visitValueMetric(const AbstractValueMetric&, - bool autoGenerated); + bool visitSnapshot(const MetricSnapshot&) override; + void doneVisitingSnapshot(const MetricSnapshot&) override; + bool visitMetricSet(const MetricSet& set, bool) override; + void doneVisitingMetricSet(const MetricSet&) override; + bool visitCountMetric(const AbstractCountMetric&, bool autoGenerated) override; + bool visitValueMetric(const AbstractValueMetric&, bool autoGenerated) override; private: void printCommonXmlParts(const Metric& metric) const; diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h index f40fb3d12ac..c721b5e2a01 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.h +++ b/searchcommon/src/vespa/searchcommon/common/schema.h @@ -98,9 +98,9 @@ public: IndexField &setAvgElemLen(uint32_t avgElemLen) { _avgElemLen = avgElemLen; return *this; } - virtual void + void write(vespalib::asciistream &os, - const vespalib::stringref &prefix) const; + const vespalib::stringref &prefix) const override; bool hasPrefix() const { return _prefix; } bool hasPhrases() const { return _phrases; } diff --git a/slobrok/src/vespa/slobrok/cfg.h b/slobrok/src/vespa/slobrok/cfg.h index cb660cd0222..e0fa8927d31 100644 --- a/slobrok/src/vespa/slobrok/cfg.h +++ b/slobrok/src/vespa/slobrok/cfg.h @@ -1,9 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <string> -#include <vector> -#include <memory> #include <vespa/vespalib/util/ptrholder.h> #include <vespa/config-slobroks.h> #include <vespa/config/config.h> diff --git a/slobrok/src/vespa/slobrok/sblist.h b/slobrok/src/vespa/slobrok/sblist.h index 4265c2a1d57..53962363609 100644 --- a/slobrok/src/vespa/slobrok/sblist.h +++ b/slobrok/src/vespa/slobrok/sblist.h @@ -1,10 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <string> -#include <vector> -#include <vespa/vespalib/util/sync.h> #include "cfg.h" +#include <vespa/vespalib/util/sync.h> namespace slobrok { namespace api { @@ -24,7 +22,7 @@ public: * should be called at least once. * @param specList should not be an empty list. **/ - virtual void setup(const std::vector<std::string> &specList); + void setup(const std::vector<std::string> &specList) override; /** * retrieve the spec for next slobrok server to try. diff --git a/slobrok/src/vespa/slobrok/sbmirror.h b/slobrok/src/vespa/slobrok/sbmirror.h index 2193fee487f..c9bca70885f 100644 --- a/slobrok/src/vespa/slobrok/sbmirror.h +++ b/slobrok/src/vespa/slobrok/sbmirror.h @@ -72,10 +72,10 @@ private: MirrorAPI &operator=(const MirrorAPI &); /** from FNET_Task, polls slobrok **/ - void PerformTask(); + void PerformTask() override; /** from FRT_IRequestWait **/ - void RequestDone(FRT_RPCRequest *req); + void RequestDone(FRT_RPCRequest *req) override; void updateTo(SpecList& newSpecs, uint32_t newGen); diff --git a/slobrok/src/vespa/slobrok/sbregister.h b/slobrok/src/vespa/slobrok/sbregister.h index 6810a4d506b..7a71db8d480 100644 --- a/slobrok/src/vespa/slobrok/sbregister.h +++ b/slobrok/src/vespa/slobrok/sbregister.h @@ -75,13 +75,13 @@ private: bool match(const char *name, const char *pattern); /** from FNET_Task, poll slobrok **/ - void PerformTask(); + void PerformTask() override; void handleReqDone(); // implementation detail of PerformTask void handleReconnect(); // implementation detail of PerformTask void handlePending(); // implementation detail of PerformTask /** from FRT_IRequestWait **/ - void RequestDone(FRT_RPCRequest *req); + void RequestDone(FRT_RPCRequest *req) override; FRT_Supervisor &_orb; RPCHooks _hooks; diff --git a/slobrok/src/vespa/slobrok/server/exchange_manager.h b/slobrok/src/vespa/slobrok/server/exchange_manager.h index b13d64e64f0..20cf03e921a 100644 --- a/slobrok/src/vespa/slobrok/server/exchange_manager.h +++ b/slobrok/src/vespa/slobrok/server/exchange_manager.h @@ -64,7 +64,7 @@ private: WorkItem& operator= (const WorkItem&); // not used public: void expedite(); - virtual void RequestDone(FRT_RPCRequest *req); + void RequestDone(FRT_RPCRequest *req) override; WorkItem(WorkPackage &pkg, RemoteSlobrok *rem, FRT_RPCRequest *req); diff --git a/slobrok/src/vespa/slobrok/server/managed_rpc_server.h b/slobrok/src/vespa/slobrok/server/managed_rpc_server.h index 07e0bdaf947..4ade368e623 100644 --- a/slobrok/src/vespa/slobrok/server/managed_rpc_server.h +++ b/slobrok/src/vespa/slobrok/server/managed_rpc_server.h @@ -36,7 +36,7 @@ public: ManagedRpcServer(const char *name, const char *spec, IRpcServerManager &manager); - virtual ~ManagedRpcServer(); + ~ManagedRpcServer(); void healthCheck(); @@ -50,8 +50,8 @@ private: bool validateRpcServer(uint32_t numstrings, FRT_StringValue *strings); public: - virtual void RequestDone(FRT_RPCRequest *req); - virtual void notifyDisconnected(); // lost connection to service + void RequestDone(FRT_RPCRequest *req) override; + void notifyDisconnected() override; // lost connection to service }; //----------------------------------------------------------------------------- diff --git a/slobrok/src/vespa/slobrok/server/metrics_producer.cpp b/slobrok/src/vespa/slobrok/server/metrics_producer.cpp index 7ac04e1b142..09af3eca194 100644 --- a/slobrok/src/vespa/slobrok/server/metrics_producer.cpp +++ b/slobrok/src/vespa/slobrok/server/metrics_producer.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "metrics_producer.h" - -#include <vespa/fnet/frt/frt.h> #include <vespa/vespalib/data/slime/slime.h> namespace slobrok { @@ -13,7 +10,7 @@ class MetricsSnapshotter : public FNET_Task { MetricsProducer &_owner; - void PerformTask() { + void PerformTask() override { _owner.snapshot(); Schedule(60.0); } @@ -25,7 +22,7 @@ public: Schedule(60.0); } - virtual ~MetricsSnapshotter() { Kill(); } + ~MetricsSnapshotter() { Kill(); } }; class MetricSnapshot diff --git a/slobrok/src/vespa/slobrok/server/monitor.h b/slobrok/src/vespa/slobrok/server/monitor.h index 990684df9fc..a71c6b69821 100644 --- a/slobrok/src/vespa/slobrok/server/monitor.h +++ b/slobrok/src/vespa/slobrok/server/monitor.h @@ -28,14 +28,14 @@ private: public: explicit Monitor(IMonitoredServer& owner, FRT_Supervisor &supervisor); - virtual ~Monitor(); + ~Monitor(); void enable(FRT_Target *monitorTarget); void disable(); private: void disconnect(); - virtual HP_RetCode HandlePacket(FNET_Packet *packet, - FNET_Context context); - virtual void PerformTask(); + HP_RetCode HandlePacket(FNET_Packet *packet, + FNET_Context context) override; + void PerformTask() override; }; //----------------------------------------------------------------------------- diff --git a/slobrok/src/vespa/slobrok/server/remote_check.h b/slobrok/src/vespa/slobrok/server/remote_check.h index eaba4041883..aa0326c5fbf 100644 --- a/slobrok/src/vespa/slobrok/server/remote_check.h +++ b/slobrok/src/vespa/slobrok/server/remote_check.h @@ -32,9 +32,9 @@ public: RpcServerMap& rpcsrvmap, RpcServerManager& rpcsrvman, ExchangeManager& exchanger); - virtual ~RemoteCheck(); + ~RemoteCheck(); private: - virtual void PerformTask(); + void PerformTask() override; }; } // namespace slobrok diff --git a/slobrok/src/vespa/slobrok/server/remote_slobrok.cpp b/slobrok/src/vespa/slobrok/server/remote_slobrok.cpp index 42bdbd6373e..23b8fc75e50 100644 --- a/slobrok/src/vespa/slobrok/server/remote_slobrok.cpp +++ b/slobrok/src/vespa/slobrok/server/remote_slobrok.cpp @@ -1,27 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> - -#include <vespa/log/log.h> -LOG_SETUP(".rpcserver"); - -#include <vector> -#include <deque> -#include <stdlib.h> #include "remote_slobrok.h" -#include "ok_state.h" -#include "named_service.h" #include "rpc_server_map.h" -#include "rpc_server_manager.h" #include "sbenv.h" -#include "cmd.h" + +#include <vespa/log/log.h> +LOG_SETUP(".rpcserver"); namespace slobrok { namespace { class IgnoreReqDone: public FRT_IRequestWait { - void RequestDone(FRT_RPCRequest *req) { + void RequestDone(FRT_RPCRequest *req) override { req->SubRef(); } }; diff --git a/slobrok/src/vespa/slobrok/server/remote_slobrok.h b/slobrok/src/vespa/slobrok/server/remote_slobrok.h index a8bd5ca908c..fdc4c6e492b 100644 --- a/slobrok/src/vespa/slobrok/server/remote_slobrok.h +++ b/slobrok/src/vespa/slobrok/server/remote_slobrok.h @@ -48,10 +48,10 @@ private: Reconnecter &operator=(const Reconnecter &); // not used public: explicit Reconnecter(FNET_Scheduler *sched, RemoteSlobrok &owner); - virtual ~Reconnecter(); + ~Reconnecter(); void scheduleTryConnect(); void disable(); - virtual void PerformTask(); + void PerformTask() override; }; private: @@ -74,7 +74,7 @@ private: public: RemoteSlobrok(const char *name, const char *spec, ExchangeManager &manager); - virtual ~RemoteSlobrok(); + ~RemoteSlobrok(); void fail(); bool isConnected() const { return (_remote != NULL); } @@ -87,13 +87,12 @@ public: const char *getSpec() const { return _rpcserver.getSpec(); } // interfaces implemented: - virtual void notifyFailedRpcSrv(ManagedRpcServer *rpcsrv, std::string errmsg); - virtual void notifyOkRpcSrv(ManagedRpcServer *rpcsrv); - virtual void RequestDone(FRT_RPCRequest *req); - virtual FRT_Supervisor *getSupervisor(); + void notifyFailedRpcSrv(ManagedRpcServer *rpcsrv, std::string errmsg) override; + void notifyOkRpcSrv(ManagedRpcServer *rpcsrv) override; + void RequestDone(FRT_RPCRequest *req) override; + FRT_Supervisor *getSupervisor() override; }; //----------------------------------------------------------------------------- } // namespace slobrok - diff --git a/slobrok/src/vespa/slobrok/server/rpc_server_manager.h b/slobrok/src/vespa/slobrok/server/rpc_server_manager.h index e9157cba269..b355c39c77b 100644 --- a/slobrok/src/vespa/slobrok/server/rpc_server_manager.h +++ b/slobrok/src/vespa/slobrok/server/rpc_server_manager.h @@ -99,12 +99,12 @@ public: const char *spec); RpcServerManager(SBEnv &sbenv); - virtual ~RpcServerManager(); + ~RpcServerManager(); - virtual void PerformTask(); - virtual void notifyFailedRpcSrv(ManagedRpcServer *rpcsrv, std::string errmsg); - virtual void notifyOkRpcSrv(ManagedRpcServer *rpcsrv); - virtual FRT_Supervisor *getSupervisor(); + void PerformTask() override; + void notifyFailedRpcSrv(ManagedRpcServer *rpcsrv, std::string errmsg) override; + void notifyOkRpcSrv(ManagedRpcServer *rpcsrv) override; + FRT_Supervisor *getSupervisor() override; }; //----------------------------------------------------------------------------- diff --git a/slobrok/src/vespa/slobrok/server/rpchooks.cpp b/slobrok/src/vespa/slobrok/server/rpchooks.cpp index a67ea45812b..2eeafe7bbda 100644 --- a/slobrok/src/vespa/slobrok/server/rpchooks.cpp +++ b/slobrok/src/vespa/slobrok/server/rpchooks.cpp @@ -1,7 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/vespalib/component/vtag.h> -#include <vespa/fnet/frt/frt.h> + #include "rpchooks.h" #include "ok_state.h" #include "named_service.h" @@ -9,11 +7,9 @@ #include "rpc_server_manager.h" #include "remote_slobrok.h" #include "sbenv.h" -#include "visible_map.h" #include "rpcmirror.h" #include <vespa/log/log.h> - LOG_SETUP(".rpchooks"); namespace slobrok { @@ -26,7 +22,7 @@ class MetricsReport : public FNET_Task { RPCHooks &_owner; - void PerformTask() { + void PerformTask() override { _owner.reportMetrics(); Schedule(300.0); } diff --git a/slobrok/src/vespa/slobrok/server/sbenv.cpp b/slobrok/src/vespa/slobrok/server/sbenv.cpp index 2217b976aa1..a766c6cfdf8 100644 --- a/slobrok/src/vespa/slobrok/server/sbenv.cpp +++ b/slobrok/src/vespa/slobrok/server/sbenv.cpp @@ -48,8 +48,8 @@ private: public: ConfigTask(FNET_Scheduler *sched, Configurator& configurator); - virtual ~ConfigTask(); - virtual void PerformTask(); + ~ConfigTask(); + void PerformTask() override; }; diff --git a/slobrok/src/vespa/slobrok/server/sbenv.h b/slobrok/src/vespa/slobrok/server/sbenv.h index e77ff1504aa..009fa6c6fa7 100644 --- a/slobrok/src/vespa/slobrok/server/sbenv.h +++ b/slobrok/src/vespa/slobrok/server/sbenv.h @@ -48,7 +48,7 @@ private: SBEnv(const SBEnv &); // Not used SBEnv &operator=(const SBEnv &); // Not used - void setup(const std::vector<std::string> &cfg); + void setup(const std::vector<std::string> &cfg) override; std::vector<std::string> _partnerList; std::unique_ptr<ManagedRpcServer> _me; @@ -61,7 +61,7 @@ private: public: explicit SBEnv(const ConfigShim &shim); - virtual ~SBEnv(); + ~SBEnv(); FNET_Transport *getTransport() { return _transport.get(); } FNET_Scheduler *getScheduler() { return _transport->GetScheduler(); } diff --git a/slobrok/src/vespa/slobrok/server/selfcheck.h b/slobrok/src/vespa/slobrok/server/selfcheck.h index f8274b44767..4631b929352 100644 --- a/slobrok/src/vespa/slobrok/server/selfcheck.h +++ b/slobrok/src/vespa/slobrok/server/selfcheck.h @@ -1,8 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/fnet/fnet.h> -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/task.h> namespace slobrok { @@ -30,9 +29,9 @@ public: explicit SelfCheck(FNET_Scheduler *sched, RpcServerMap& rpcsrvmap, RpcServerManager& rpcsrvman); - virtual ~SelfCheck(); + ~SelfCheck(); private: - virtual void PerformTask(); + void PerformTask() override; }; } // namespace slobrok diff --git a/slobrok/src/vespa/slobrok/server/slobrokserver.h b/slobrok/src/vespa/slobrok/server/slobrokserver.h index 500ff315fa3..a87902d0aa1 100644 --- a/slobrok/src/vespa/slobrok/server/slobrokserver.h +++ b/slobrok/src/vespa/slobrok/server/slobrokserver.h @@ -22,7 +22,7 @@ public: SlobrokServer(uint32_t port); ~SlobrokServer(); - virtual void run(); + void run() override; void stop() { _env.shutdown(); } }; diff --git a/staging_vespalib/src/vespa/vespalib/data/fileheader.h b/staging_vespalib/src/vespa/vespalib/data/fileheader.h index 5c8b63bbd93..50d5a8d1105 100644 --- a/staging_vespalib/src/vespa/vespalib/data/fileheader.h +++ b/staging_vespalib/src/vespa/vespalib/data/fileheader.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <map> #include "databuffer.h" #include <vespa/vespalib/util/exception.h> +#include <map> class FastOS_FileInterface; @@ -110,7 +110,7 @@ public: public: BufferReader(DataBuffer &buf); - size_t getData(char *buf, size_t len); + size_t getData(char *buf, size_t len) override; }; /** @@ -123,7 +123,7 @@ public: public: BufferWriter(DataBuffer &buf); - size_t putData(const char *buf, size_t len); + size_t putData(const char *buf, size_t len) override; }; class MMapReader : public IDataReader @@ -134,7 +134,7 @@ public: public: MMapReader(const char *buf, size_t sz); - size_t getData(char *buf, size_t len); + size_t getData(char *buf, size_t len) override; }; private: @@ -259,7 +259,7 @@ public: public: FileReader(FastOS_FileInterface &file); - size_t getData(char *buf, size_t len); + size_t getData(char *buf, size_t len) override; }; /** @@ -272,7 +272,7 @@ public: public: FileWriter(FastOS_FileInterface &file); - size_t putData(const char *buf, size_t len); + size_t putData(const char *buf, size_t len) override; }; private: @@ -296,7 +296,7 @@ public: * * @return The number of bytes required to hold the content of this. */ - size_t getSize() const; + size_t getSize() const override; /** * Deserializes header content from the given file into this. This requires that the file is open in read diff --git a/staging_vespalib/src/vespa/vespalib/net/simple_component_config_producer.h b/staging_vespalib/src/vespa/vespalib/net/simple_component_config_producer.h index 8561b6fb008..c31c8b41c73 100644 --- a/staging_vespalib/src/vespa/vespalib/net/simple_component_config_producer.h +++ b/staging_vespalib/src/vespa/vespalib/net/simple_component_config_producer.h @@ -18,7 +18,7 @@ public: SimpleComponentConfigProducer(); void addConfig(const Config &config); void removeConfig(const vespalib::string &name); - virtual void getComponentConfig(Consumer &consumer); + void getComponentConfig(Consumer &consumer) override; }; } // namespace vespalib diff --git a/staging_vespalib/src/vespa/vespalib/net/simple_health_producer.h b/staging_vespalib/src/vespa/vespalib/net/simple_health_producer.h index 254b4ce29b7..fa219c33f48 100644 --- a/staging_vespalib/src/vespa/vespalib/net/simple_health_producer.h +++ b/staging_vespalib/src/vespa/vespalib/net/simple_health_producer.h @@ -17,7 +17,7 @@ public: SimpleHealthProducer(); void setOk(); void setFailed(const vespalib::string &msg); - virtual Health getHealth() const; + Health getHealth() const override; }; } // namespace vespalib diff --git a/staging_vespalib/src/vespa/vespalib/net/slime_explorer.cpp b/staging_vespalib/src/vespa/vespalib/net/slime_explorer.cpp index d6945064eb6..d0ca194c97d 100644 --- a/staging_vespalib/src/vespa/vespalib/net/slime_explorer.cpp +++ b/staging_vespalib/src/vespa/vespalib/net/slime_explorer.cpp @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "slime_explorer.h" -#include <vespa/vespalib/data/slime/inject.h> namespace vespalib { @@ -10,7 +9,7 @@ namespace { struct SelfState : slime::ObjectTraverser { Slime result; SelfState() : result() { result.setObject(); } - virtual void field(const Memory &key, const slime::Inspector &value) { + void field(const Memory &key, const slime::Inspector &value) override { if (value.type().getId() != slime::OBJECT::ID) { slime::inject(value, slime::ObjectInserter(result.get(), key)); } @@ -19,7 +18,7 @@ struct SelfState : slime::ObjectTraverser { struct ChildrenNames : slime::ObjectTraverser { std::vector<vespalib::string> result; - virtual void field(const Memory &key, const slime::Inspector &value) { + void field(const Memory &key, const slime::Inspector &value) override { if (value.type().getId() == slime::OBJECT::ID) { result.push_back(key.make_string()); } diff --git a/staging_vespalib/src/vespa/vespalib/net/state_api.cpp b/staging_vespalib/src/vespa/vespalib/net/state_api.cpp index 2c2dc55060d..f211ee90425 100644 --- a/staging_vespalib/src/vespa/vespalib/net/state_api.cpp +++ b/staging_vespalib/src/vespa/vespalib/net/state_api.cpp @@ -10,7 +10,7 @@ namespace { struct ConfigRenderer : ComponentConfigProducer::Consumer { JSONStringer &json; ConfigRenderer(JSONStringer &j) : json(j) {} - virtual void add(const ComponentConfigProducer::Config &config) { + void add(const ComponentConfigProducer::Config &config) override { json.appendKey(config.name); json.beginObject(); json.appendKey("generation"); @@ -27,7 +27,7 @@ struct ConfigGenerationObserver : ComponentConfigProducer::Consumer { size_t maxGen; bool seenSome; ConfigGenerationObserver() : maxGen(0), seenSome(false) {} - virtual void add(const ComponentConfigProducer::Config &config) { + void add(const ComponentConfigProducer::Config &config) override { if (seenSome) { maxGen = std::max(maxGen, config.gen); } else { diff --git a/staging_vespalib/src/vespa/vespalib/objects/identifiable.h b/staging_vespalib/src/vespa/vespalib/objects/identifiable.h index 6d320bbd864..5d68c781046 100644 --- a/staging_vespalib/src/vespa/vespalib/objects/identifiable.h +++ b/staging_vespalib/src/vespa/vespalib/objects/identifiable.h @@ -168,7 +168,7 @@ public: bool equal(unsigned cid) const { return id() == cid; } int compare(const RuntimeClass& other) const { return (id() - other.id()); } private: - virtual stringref getName() const { return stringref(_rt->_name); } + stringref getName() const override { return stringref(_rt->_name); } RuntimeInfo * _rt; }; DECLARE_IDENTIFIABLE(Identifiable); diff --git a/staging_vespalib/src/vespa/vespalib/objects/objectdumper.h b/staging_vespalib/src/vespa/vespalib/objects/objectdumper.h index b630246328c..ebae4bc6eeb 100644 --- a/staging_vespalib/src/vespa/vespalib/objects/objectdumper.h +++ b/staging_vespalib/src/vespa/vespalib/objects/objectdumper.h @@ -60,22 +60,14 @@ public: **/ vespalib::string toString() const { return _str; } - // inherit doc - virtual void openStruct(const vespalib::string &name, const vespalib::string &type); - // inherit doc - virtual void closeStruct(); - // inherit doc - virtual void visitBool(const vespalib::string &name, bool value); - // inherit doc - virtual void visitInt(const vespalib::string &name, int64_t value); - // inherit doc - virtual void visitFloat(const vespalib::string &name, double value); - // inherit doc - virtual void visitString(const vespalib::string &name, const vespalib::string &value); - // inherit doc - virtual void visitNull(const vespalib::string &name); - // inherit doc - virtual void visitNotImplemented(); + virtual void openStruct(const vespalib::string &name, const vespalib::string &type) override; + virtual void closeStruct() override; + virtual void visitBool(const vespalib::string &name, bool value) override; + virtual void visitInt(const vespalib::string &name, int64_t value) override; + virtual void visitFloat(const vespalib::string &name, double value) override; + virtual void visitString(const vespalib::string &name, const vespalib::string &value) override; + virtual void visitNull(const vespalib::string &name) override; + virtual void visitNotImplemented() override; }; } // namespace vespalib diff --git a/staging_vespalib/src/vespa/vespalib/util/clock.h b/staging_vespalib/src/vespa/vespalib/util/clock.h index 02311367fbb..4a5611bbe5a 100644 --- a/staging_vespalib/src/vespa/vespalib/util/clock.h +++ b/staging_vespalib/src/vespa/vespalib/util/clock.h @@ -27,7 +27,7 @@ private: void setTime() const; - virtual void Run(FastOS_ThreadInterface *thisThread, void *arguments); + void Run(FastOS_ThreadInterface *thisThread, void *arguments) override; public: Clock(double timePeriod=0.100); diff --git a/staging_vespalib/src/vespa/vespalib/util/document_runnable.h b/staging_vespalib/src/vespa/vespalib/util/document_runnable.h index 67ca8a67d78..3ea4b79f8a6 100644 --- a/staging_vespalib/src/vespa/vespalib/util/document_runnable.h +++ b/staging_vespalib/src/vespa/vespalib/util/document_runnable.h @@ -32,7 +32,7 @@ private: mutable vespalib::Monitor _stateLock; State _state; - void Run(FastOS_ThreadInterface*, void*); + void Run(FastOS_ThreadInterface*, void*) override; Runnable(const Runnable&); Runnable& operator=(const Runnable&); diff --git a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h index 50f5695902a..02181094607 100644 --- a/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h +++ b/staging_vespalib/src/vespa/vespalib/util/shutdownguard.h @@ -26,7 +26,7 @@ class ShutdownGuard : public FastOS_Runnable FastOS_ThreadPool _pool; volatile uint64_t _dieAtTime; - virtual void Run(FastOS_ThreadInterface *, void *); + void Run(FastOS_ThreadInterface *, void *) override; public: /** diff --git a/staging_vespalib/src/vespa/vespalib/util/timer.cpp b/staging_vespalib/src/vespa/vespalib/util/timer.cpp index 4a719e69665..4e2fc3d54c6 100644 --- a/staging_vespalib/src/vespa/vespalib/util/timer.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/timer.cpp @@ -1,6 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "timer.h" -#include <vespa/fnet/fnet.h> +#include <vespa/fnet/scheduler.h> +#include <vespa/fnet/task.h> +#include <vespa/fnet/transport.h> namespace vespalib { @@ -22,13 +24,11 @@ public: _interval(interval) { } - ~TimerTask(void) - { + ~TimerTask() { Kill(); } - void PerformTask() - { + void PerformTask() override { _task->run(); Schedule(_interval); } diff --git a/vespalib/src/vespa/vespalib/trace/slime_trace_serializer.cpp b/vespalib/src/vespa/vespalib/trace/slime_trace_serializer.cpp index 4332d6bf045..e323904226c 100644 --- a/vespalib/src/vespa/vespalib/trace/slime_trace_serializer.cpp +++ b/vespalib/src/vespa/vespalib/trace/slime_trace_serializer.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/trace/slime_trace_serializer.h> -#include <vespa/vespalib/trace/trace.h> +#include "slime_trace_serializer.h" +#include "trace.h" +#include <cassert> using namespace vespalib::slime; diff --git a/vespalib/src/vespa/vespalib/trace/slime_trace_serializer.h b/vespalib/src/vespa/vespalib/trace/slime_trace_serializer.h index 802f0ab5fe9..976a8d1904a 100644 --- a/vespalib/src/vespa/vespalib/trace/slime_trace_serializer.h +++ b/vespalib/src/vespa/vespalib/trace/slime_trace_serializer.h @@ -2,7 +2,7 @@ #pragma once #include <vespa/vespalib/trace/tracevisitor.h> -#include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/data/slime/cursor.h> #include <stack> namespace vespalib { @@ -17,7 +17,7 @@ class SlimeTraceSerializer : public TraceVisitor { public: SlimeTraceSerializer(slime::Cursor & cursor); - void visit(const TraceNode & node); + void visit(const TraceNode & node) override; static const Memory TIMESTAMP; static const Memory PAYLOAD; static const Memory CHILDREN; diff --git a/vespalib/src/vespa/vespalib/util/closuretask.h b/vespalib/src/vespa/vespalib/util/closuretask.h index 0bba289817e..8152897d447 100644 --- a/vespalib/src/vespa/vespalib/util/closuretask.h +++ b/vespalib/src/vespa/vespalib/util/closuretask.h @@ -15,7 +15,7 @@ class ClosureTask : public Executor::Task { public: ClosureTask(std::unique_ptr<Closure> closure) : _closure(std::move(closure)) {} - virtual void run() { _closure->call(); } + void run() override { _closure->call(); } }; /** diff --git a/vespalib/src/vespa/vespalib/util/exception.h b/vespalib/src/vespa/vespalib/util/exception.h index a9abf6146b2..af2f1bc225a 100644 --- a/vespalib/src/vespa/vespalib/util/exception.h +++ b/vespalib/src/vespa/vespalib/util/exception.h @@ -206,7 +206,7 @@ public: const stringref &location = "", int skipStack = 0); /** @brief Returns a string describing the current exception, including cause if any */ - const char *what() const throw(); // should not be overridden + const char *what() const throw() override; // should not be overridden /** @brief Returns a pointer to underlying cause (or NULL if no cause) */ const Exception *getCause() const { return _cause.get(); } |