diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-26 22:01:24 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-26 22:01:24 +0200 |
commit | a7363640b51c476e90e47044ca7a7cef4af0371b (patch) | |
tree | 3ba64a0e94d564a815182e0fe11d509eb57588c9 /fnet | |
parent | 46dd4350fd595b42ef213981773487f62c86417b (diff) |
No virtual on override.
Optimize includes.
Diffstat (limited to 'fnet')
22 files changed, 96 insertions, 125 deletions
diff --git a/fnet/src/examples/frt/rpc/echo_client.cpp b/fnet/src/examples/frt/rpc/echo_client.cpp index b5fabb32363..9a5cf7cbd64 100644 --- a/fnet/src/examples/frt/rpc/echo_client.cpp +++ b/fnet/src/examples/frt/rpc/echo_client.cpp @@ -1,13 +1,12 @@ // 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("echo_client"); + #include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class EchoClient : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_callback_client.cpp b/fnet/src/examples/frt/rpc/rpc_callback_client.cpp index 3dd936f7fea..2bf740f7b1e 100644 --- a/fnet/src/examples/frt/rpc/rpc_callback_client.cpp +++ b/fnet/src/examples/frt/rpc/rpc_callback_client.cpp @@ -1,9 +1,7 @@ // 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("rpc_callback_client"); -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> struct RPC : public FRT_Invokable { @@ -34,7 +32,7 @@ RPC::Init(FRT_Supervisor *s) class MyApp : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_callback_server.cpp b/fnet/src/examples/frt/rpc/rpc_callback_server.cpp index 419b1266d23..67eac0743d6 100644 --- a/fnet/src/examples/frt/rpc/rpc_callback_server.cpp +++ b/fnet/src/examples/frt/rpc/rpc_callback_server.cpp @@ -1,9 +1,7 @@ // 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("rpc_callback_server"); -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> struct RPC : public FRT_Invokable { @@ -40,7 +38,7 @@ RPC::Init(FRT_Supervisor *s) class MyApp : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_client.cpp b/fnet/src/examples/frt/rpc/rpc_client.cpp index f5e5a9fe1e2..435bfb6f08c 100644 --- a/fnet/src/examples/frt/rpc/rpc_client.cpp +++ b/fnet/src/examples/frt/rpc/rpc_client.cpp @@ -1,14 +1,12 @@ // 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("rpc_client"); -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class RPCClient : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_info.cpp b/fnet/src/examples/frt/rpc/rpc_info.cpp index 5b7aebd6bdd..ae9eafa210d 100644 --- a/fnet/src/examples/frt/rpc/rpc_info.cpp +++ b/fnet/src/examples/frt/rpc/rpc_info.cpp @@ -1,8 +1,7 @@ // 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("rpc_info"); + #include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class RPCInfo : public FastOS_Application { @@ -64,7 +63,7 @@ public: printf("\n"); } - virtual int Main() override; + int Main() override; }; diff --git a/fnet/src/examples/frt/rpc/rpc_invoke.cpp b/fnet/src/examples/frt/rpc/rpc_invoke.cpp index 0f64ef9b539..1bb572a6025 100644 --- a/fnet/src/examples/frt/rpc/rpc_invoke.cpp +++ b/fnet/src/examples/frt/rpc/rpc_invoke.cpp @@ -1,8 +1,7 @@ // 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("rpc_invoke"); + #include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class RPCClient : public FastOS_Application { @@ -43,7 +42,7 @@ private: int run(); public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_proxy.cpp b/fnet/src/examples/frt/rpc/rpc_proxy.cpp index 6c805d6a173..e73f556b9d8 100644 --- a/fnet/src/examples/frt/rpc/rpc_proxy.cpp +++ b/fnet/src/examples/frt/rpc/rpc_proxy.cpp @@ -1,9 +1,7 @@ // 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("rpc_proxy"); -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> //----------------------------------------------------------------------------- struct Session @@ -68,7 +66,7 @@ private: public: ReqDone(RPCProxy &proxy) : _proxy(proxy) {} - virtual void RequestDone(FRT_RPCRequest *req) override; + void RequestDone(FRT_RPCRequest *req) override; }; void @@ -209,7 +207,7 @@ RPCProxy::HOOK_Fini(FRT_RPCRequest *req) class App : public FastOS_Application { public: - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_server.cpp b/fnet/src/examples/frt/rpc/rpc_server.cpp index 823d3c893b1..2b7e16b91b6 100644 --- a/fnet/src/examples/frt/rpc/rpc_server.cpp +++ b/fnet/src/examples/frt/rpc/rpc_server.cpp @@ -1,9 +1,7 @@ // 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("rpc_server"); -#include <vespa/fnet/frt/frt.h> +#include <vespa/fnet/frt/frt.h> +#include <vespa/fastos/app.h> class RPCServer : public FRT_Invokable { @@ -107,7 +105,7 @@ private: public: App() : _server() {} - virtual int Main() override; + int Main() override; }; int diff --git a/fnet/src/examples/ping/packets.cpp b/fnet/src/examples/ping/packets.cpp index f7b50f5d898..e9f5121c99a 100644 --- a/fnet/src/examples/ping/packets.cpp +++ b/fnet/src/examples/ping/packets.cpp @@ -1,6 +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/fnet/fnet.h> #include "packets.h" diff --git a/fnet/src/examples/ping/packets.h b/fnet/src/examples/ping/packets.h index 68cc27ccb5b..27a06bdaab3 100644 --- a/fnet/src/examples/ping/packets.h +++ b/fnet/src/examples/ping/packets.h @@ -1,36 +1,36 @@ // 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/packet.h> +#include <vespa/fnet/ipacketfactory.h> enum { PCODE_PING_REQUEST = 1, PCODE_PING_REPLY = 2 }; - class PingRequest : public FNET_Packet { public: - virtual uint32_t GetPCODE() override; - virtual uint32_t GetLength() override; - virtual void Encode(FNET_DataBuffer *) override; - virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; - class PingReply : public FNET_Packet { public: - virtual uint32_t GetPCODE() override; - virtual uint32_t GetLength() override; - virtual void Encode(FNET_DataBuffer *) override; - virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; class PingPacketFactory : public FNET_IPacketFactory { public: - virtual FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context) override; + FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context) override; }; diff --git a/fnet/src/examples/ping/pingclient.cpp b/fnet/src/examples/ping/pingclient.cpp index fb834b9108b..0b28f118685 100644 --- a/fnet/src/examples/ping/pingclient.cpp +++ b/fnet/src/examples/ping/pingclient.cpp @@ -1,15 +1,13 @@ // 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("pingclient"); + #include <vespa/fnet/fnet.h> #include <examples/ping/packets.h> - +#include <vespa/fastos/app.h> class PingClient : public FastOS_Application { public: - int Main() override; + int Main() override; }; diff --git a/fnet/src/examples/ping/pingserver.cpp b/fnet/src/examples/ping/pingserver.cpp index 173e627ac23..3c76bc951ec 100644 --- a/fnet/src/examples/ping/pingserver.cpp +++ b/fnet/src/examples/ping/pingserver.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 <vespa/log/log.h> -LOG_SETUP("pingserver"); + #include <vespa/fnet/fnet.h> #include <examples/ping/packets.h> - +#include <vespa/fastos/app.h> class PingServer : public FNET_IServerAdapter, public FNET_IPacketHandler, @@ -12,15 +10,13 @@ class PingServer : public FNET_IServerAdapter, { public: bool InitAdminChannel(FNET_Channel *) override { return false; } - bool InitChannel(FNET_Channel *channel, uint32_t) override - { + bool InitChannel(FNET_Channel *channel, uint32_t) override { channel->SetContext(FNET_Context(channel)); channel->SetHandler(this); return true; } - - HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override - { + + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override { if (packet->GetPCODE() == PCODE_PING_REQUEST) { fprintf(stderr, "Got ping request, sending ping reply\n"); context._value.CHANNEL->Send(new PingReply()); @@ -28,8 +24,8 @@ public: packet->Free(); return FNET_FREE_CHANNEL; } - - int Main() override; + + int Main() override; }; diff --git a/fnet/src/examples/proxy/proxy.cpp b/fnet/src/examples/proxy/proxy.cpp index 40d7a44c7f6..2d1d44174a4 100644 --- a/fnet/src/examples/proxy/proxy.cpp +++ b/fnet/src/examples/proxy/proxy.cpp @@ -1,9 +1,10 @@ // 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("proxy"); + #include <vespa/fnet/fnet.h> +#include <vespa/fastos/app.h> +#include <vespa/log/log.h> +LOG_SETUP("proxy"); class RawPacket : public FNET_Packet { @@ -12,10 +13,10 @@ private: public: RawPacket() : _data() {} - virtual uint32_t GetPCODE() override; - virtual uint32_t GetLength() override; - virtual void Encode(FNET_DataBuffer *) override; - virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; + uint32_t GetPCODE() override; + uint32_t GetLength() override; + void Encode(FNET_DataBuffer *) override; + bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; uint32_t @@ -69,7 +70,7 @@ public: _server = server; } - virtual HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; }; @@ -139,14 +140,14 @@ private: public: Proxy() : _transport() {} - virtual bool GetPacketInfo(FNET_DataBuffer *src, uint32_t *plen, uint32_t *pcode, uint32_t *chid, bool *) override; - virtual FNET_Packet *Decode(FNET_DataBuffer *src, uint32_t plen, uint32_t pcode, FNET_Context) override; - virtual void Encode(FNET_Packet *packet, uint32_t chid, FNET_DataBuffer *dst) override; + bool GetPacketInfo(FNET_DataBuffer *src, uint32_t *plen, uint32_t *pcode, uint32_t *chid, bool *) override; + FNET_Packet *Decode(FNET_DataBuffer *src, uint32_t plen, uint32_t pcode, FNET_Context) override; + void Encode(FNET_Packet *packet, uint32_t chid, FNET_DataBuffer *dst) override; // --------------------------------------------- - virtual bool InitAdminChannel(FNET_Channel *channel) override; - virtual bool InitChannel(FNET_Channel *, uint32_t) override; + bool InitAdminChannel(FNET_Channel *channel) override; + bool InitChannel(FNET_Channel *, uint32_t) override; // --------------------------------------------- - virtual int Main() override; + int Main() override; }; diff --git a/fnet/src/examples/timeout/timeout.cpp b/fnet/src/examples/timeout/timeout.cpp index 8a52d769282..7edfbe4fb1c 100644 --- a/fnet/src/examples/timeout/timeout.cpp +++ b/fnet/src/examples/timeout/timeout.cpp @@ -1,9 +1,7 @@ // 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("timeout"); -#include <vespa/fnet/fnet.h> +#include <vespa/fnet/fnet.h> +#include <vespa/fastos/app.h> class Timeout : public FNET_Task { @@ -20,7 +18,7 @@ public: _queue(queue) {} - virtual void PerformTask() override; + void PerformTask() override; }; diff --git a/fnet/src/tests/frt/method_pt/method_pt.cpp b/fnet/src/tests/frt/method_pt/method_pt.cpp index 4b869f6ba9f..98ab9d228a1 100644 --- a/fnet/src/tests/frt/method_pt/method_pt.cpp +++ b/fnet/src/tests/frt/method_pt/method_pt.cpp @@ -112,9 +112,9 @@ class MediumHandler1 : public FRT_Invokable, public MediumB { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; @@ -123,9 +123,9 @@ class MediumHandler2 : public MediumA, public MediumB { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; @@ -134,9 +134,9 @@ class MediumHandler3 : public MediumA, public FRT_Invokable { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; //------------------------------------------------------------- @@ -146,9 +146,9 @@ class ComplexHandler1 : public FRT_Invokable, public ComplexB { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; @@ -157,9 +157,9 @@ class ComplexHandler2 : public ComplexA, public ComplexB { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; @@ -168,9 +168,9 @@ class ComplexHandler3 : public ComplexA, public FRT_Invokable { public: - virtual void foo() override {} - virtual void bar() override {} - void RPC_Method(FRT_RPCRequest *req); + void foo() override {} + void bar() override {} + void RPC_Method(FRT_RPCRequest *req); }; //------------------------------------------------------------- diff --git a/fnet/src/tests/frt/rpc/invoke.cpp b/fnet/src/tests/frt/rpc/invoke.cpp index 7853c473f5e..d51557e9cfd 100644 --- a/fnet/src/tests/frt/rpc/invoke.cpp +++ b/fnet/src/tests/frt/rpc/invoke.cpp @@ -48,8 +48,7 @@ struct LockedReqWait : public FRT_IRequestWait return ret; } - virtual void RequestDone(FRT_RPCRequest *) override - { + void RequestDone(FRT_RPCRequest *) override { _wasLocked = isLocked(); _cond.Lock(); _done = true; @@ -57,8 +56,7 @@ struct LockedReqWait : public FRT_IRequestWait _cond.Unlock(); } - void waitReq() - { + void waitReq() { _cond.Lock(); while(!_done) { _cond.Wait(); @@ -78,9 +76,7 @@ private: DelayedReturn &operator=(const DelayedReturn &); public: - DelayedReturn(FNET_Scheduler *sched, - FRT_RPCRequest *req, - double delay) + DelayedReturn(FNET_Scheduler *sched, FRT_RPCRequest *req, double delay) : FNET_Task(sched), _req(req) { diff --git a/fnet/src/tests/frt/rpc/sharedblob.cpp b/fnet/src/tests/frt/rpc/sharedblob.cpp index a086584b36a..363a7891cbd 100644 --- a/fnet/src/tests/frt/rpc/sharedblob.cpp +++ b/fnet/src/tests/frt/rpc/sharedblob.cpp @@ -10,10 +10,10 @@ struct MyBlob : FRT_ISharedBlob { int refcnt; MyBlob() : refcnt(1) {} - virtual uint32_t getLen() override { return (strlen("blob_test") + 1); } - virtual const char *getData() override { return "blob_test"; } - virtual void addRef() override { ++refcnt; } - virtual void subRef() override { --refcnt; } + uint32_t getLen() override { return (strlen("blob_test") + 1); } + const char *getData() override { return "blob_test"; } + void addRef() override { ++refcnt; } + void subRef() override { --refcnt; } }; struct Data diff --git a/fnet/src/tests/locking/castspeed.cpp b/fnet/src/tests/locking/castspeed.cpp index 1f57bc4757c..859ec08ec69 100644 --- a/fnet/src/tests/locking/castspeed.cpp +++ b/fnet/src/tests/locking/castspeed.cpp @@ -18,14 +18,14 @@ class C: public A { public: B *otherB; - virtual B* asB() override { return otherB; } + B* asB() override { return otherB; } C() : otherB(nullptr) {} }; class B: public C { public: - virtual B* asB() override { return this; } + B* asB() override { return this; } }; diff --git a/fnet/src/tests/locking/drainpackets.cpp b/fnet/src/tests/locking/drainpackets.cpp index fb86371c9ec..b453793843f 100644 --- a/fnet/src/tests/locking/drainpackets.cpp +++ b/fnet/src/tests/locking/drainpackets.cpp @@ -2,15 +2,13 @@ #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/fnet/fnet.h> - class MyPacket : public FNET_Packet { public: - uint32_t GetPCODE() override { return 0; } + uint32_t GetPCODE() override { return 0; } uint32_t GetLength() override { return 0; } void Encode(FNET_DataBuffer *) override {} - bool Decode(FNET_DataBuffer *, uint32_t) override - { return true; } + bool Decode(FNET_DataBuffer *, uint32_t) override { return true; } }; diff --git a/fnet/src/tests/locking/dummy.cpp b/fnet/src/tests/locking/dummy.cpp index bab18ef3db9..af4a7fc2916 100644 --- a/fnet/src/tests/locking/dummy.cpp +++ b/fnet/src/tests/locking/dummy.cpp @@ -1,5 +1,4 @@ // 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 "dummy.h" DummyObj::DummyObj() {} diff --git a/fnet/src/tests/scheduling/sloweventloop.cpp b/fnet/src/tests/scheduling/sloweventloop.cpp index a4b57cfd218..a13205f4b0e 100644 --- a/fnet/src/tests/scheduling/sloweventloop.cpp +++ b/fnet/src/tests/scheduling/sloweventloop.cpp @@ -2,7 +2,6 @@ #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/fnet/fnet.h> - class MyTask : public FNET_Task { public: diff --git a/fnet/src/tests/sync_execute/sync_execute.cpp b/fnet/src/tests/sync_execute/sync_execute.cpp index c832ef0330d..ca77ab6f73b 100644 --- a/fnet/src/tests/sync_execute/sync_execute.cpp +++ b/fnet/src/tests/sync_execute/sync_execute.cpp @@ -1,11 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/fnet/fnet.h> -#include <vespa/vespalib/util/sync.h> +#include <vespa/fnet/transport.h> +#include <vespa/fnet/iexecutable.h> struct DoIt : public FNET_IExecutable { vespalib::Gate gate; - virtual void execute() override { + void execute() override { gate.countDown(); } }; |