1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

chore(codestyle): mark virtual methods as override

This commit is contained in:
Aleksei Antipovskii
2024-09-12 12:27:02 +02:00
committed by Leonid Fedorov
parent 6001db44ab
commit 5556d818f8
303 changed files with 4091 additions and 4894 deletions

View File

@ -81,7 +81,7 @@ class ByteStream : public Serializeable
/**
* ctor with a uint8_t array and len initializer
*/
inline ByteStream(const uint8_t* bp, const BSSizeType len);
inline ByteStream(const uint8_t* bp, BSSizeType len);
/**
* copy ctor
*/
@ -98,40 +98,40 @@ class ByteStream : public Serializeable
/**
* dtor
*/
inline virtual ~ByteStream();
inline ~ByteStream() override;
/**
* push a int8_t onto the end of the stream
*/
EXPORT ByteStream& operator<<(const int8_t b);
EXPORT ByteStream& operator<<(int8_t b);
/**
* push a uint8_t onto the end of the stream
*/
EXPORT ByteStream& operator<<(const uint8_t b);
EXPORT ByteStream& operator<<(uint8_t b);
/**
* push a int16_t onto the end of the stream. The byte order is whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const int16_t d);
EXPORT ByteStream& operator<<(int16_t d);
/**
* push a uint16_t onto the end of the stream. The byte order is whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const uint16_t d);
EXPORT ByteStream& operator<<(uint16_t d);
/**
* push a int32_t onto the end of the stream. The byte order is whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const int32_t q);
EXPORT ByteStream& operator<<(int32_t q);
/**
* push a uint32_t onto the end of the stream. The byte order is whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const uint32_t q);
EXPORT ByteStream& operator<<(uint32_t q);
/**
* push an int64_t onto the end of the stream. The byte order is whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const int64_t o);
EXPORT ByteStream& operator<<(int64_t o);
/**
* push an uint64_t onto the end of the stream. The byte order is whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const uint64_t o);
EXPORT ByteStream& operator<<(uint64_t o);
/**
* push an int128_t onto the end of the stream. The byte order is whatever the native byte order is.
*/
@ -145,17 +145,17 @@ class ByteStream : public Serializeable
* push a float onto the end of the stream. The byte order is
* whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const float f);
EXPORT ByteStream& operator<<(float f);
/**
* push a double onto the end of the stream. The byte order is
* whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const double d);
EXPORT ByteStream& operator<<(double d);
/**
* push a long double onto the end of the stream. The byte
* order is whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const long double d);
EXPORT ByteStream& operator<<(long double d);
/**
* push a std::string onto the end of the stream.
*/
@ -428,12 +428,12 @@ class ByteStream : public Serializeable
/**
* Serializeable interface
*/
EXPORT void serialize(ByteStream& bs) const;
EXPORT void serialize(ByteStream& bs) const override;
/**
* Serializeable interface
*/
EXPORT void deserialize(ByteStream& bs);
EXPORT void deserialize(ByteStream& bs) override;
/**
* memory allocation chunk size
@ -455,7 +455,7 @@ class ByteStream : public Serializeable
/**
* pushes one uint8_t onto the end of the stream
*/
void add(const uint8_t b);
void add(uint8_t b);
/**
* adds another BlockSize bytes to the internal buffer
*/
@ -527,7 +527,7 @@ static const uint8_t BS_BLOB = 9;
static const uint8_t BS_SERIALIZABLE = 10;
static const uint8_t BS_UUID = 11;
inline ByteStream::ByteStream(const uint8_t* bp, const BSSizeType len) : fBuf(0), fMaxLen(0)
inline ByteStream::ByteStream(const uint8_t* bp, BSSizeType len) : fBuf(nullptr), fMaxLen(0)
{
load(bp, len);
}
@ -560,7 +560,7 @@ inline void ByteStream::reset()
{
delete[] fBuf;
fMaxLen = 0;
fCurInPtr = fCurOutPtr = fBuf = 0;
fCurInPtr = fCurOutPtr = fBuf = nullptr;
}
inline void ByteStream::restart()
{
@ -669,7 +669,6 @@ void deserializeVector(ByteStream& bs, std::vector<T>& v)
}
}
template <typename T>
void serializeInlineVector(ByteStream& bs, const std::vector<T>& v)
{
@ -703,7 +702,6 @@ void deserializeInlineVector(ByteStream& bs, std::vector<T>& v)
}
}
inline void deserializeVector(ByteStream& bs, std::vector<int64_t>& v)
{
deserializeInlineVector<int64_t>(bs, v);

View File

@ -39,16 +39,16 @@ class CompressedInetStreamSocket : public InetStreamSocket
public:
CompressedInetStreamSocket();
CompressedInetStreamSocket(const CompressedInetStreamSocket&) = default;
virtual ~CompressedInetStreamSocket(){};
~CompressedInetStreamSocket() override = default;
using InetStreamSocket::operator=;
virtual Socket* clone() const;
virtual const SBS read(const struct timespec* timeout = 0, bool* isTimeOut = NULL,
Stats* stats = NULL) const;
virtual void write(const ByteStream& msg, Stats* stats = NULL);
virtual void write(SBS msg, Stats* stats = NULL);
virtual const IOSocket accept(const struct timespec* timeout);
virtual void connect(const sockaddr* addr);
Socket* clone() const override;
const SBS read(const struct timespec* timeout = nullptr, bool* isTimeOut = nullptr,
Stats* stats = nullptr) const override;
void write(const ByteStream& msg, Stats* stats = nullptr) override;
void write(SBS msg, Stats* stats = nullptr) override;
const IOSocket accept(const struct timespec* timeout) override;
void connect(const sockaddr* addr) override;
private:
std::shared_ptr<compress::CompressInterface> alg;

View File

@ -73,8 +73,6 @@ using namespace std;
#include <boost/scoped_array.hpp>
using boost::scoped_array;
#define INETSTREAMSOCKET_DLLEXPORT
#include "inetstreamsocket.h"
#undef INETSTREAMSOCKET_DLLEXPORT
@ -97,7 +95,6 @@ namespace
// read(), so adding logic to retry after ERESTARTSYS the way we do for EINTR.
// const int KERR_ERESTARTSYS = 512;
int in_cksum(unsigned short* buf, int sz)
{
int nleft = sz;
@ -135,9 +132,7 @@ InetStreamSocket::InetStreamSocket(size_t blocksize)
fConnectionTimeout.tv_nsec = 0;
}
InetStreamSocket::~InetStreamSocket()
{
}
InetStreamSocket::~InetStreamSocket() = default;
void InetStreamSocket::open()
{
@ -172,7 +167,6 @@ void InetStreamSocket::open()
throw runtime_error(msg);
}
/* XXXPAT: If we have latency problems again, try these...
bufferSizeSize = 4;
bufferSize = 512000;
@ -379,9 +373,8 @@ bool InetStreamSocket::readToMagic(long msecs, bool* isTimeOut, Stats* stats) co
}
ostringstream oss;
oss << "InetStreamSocket::readToMagic(): I/O error2.1: "
<< "err = " << err << " e = " << e <<
": " << strerror(e);
oss << "InetStreamSocket::readToMagic(): I/O error2.1: " << "err = " << err << " e = " << e << ": "
<< strerror(e);
throw runtime_error(oss.str());
}
@ -402,7 +395,7 @@ bool InetStreamSocket::readToMagic(long msecs, bool* isTimeOut, Stats* stats) co
return true;
}
bool InetStreamSocket::readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, const size_t numberOfBytes,
bool InetStreamSocket::readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, size_t numberOfBytes,
const struct ::timespec* timeout, bool* isTimeOut, Stats* stats,
int64_t msecs) const
{
@ -412,7 +405,7 @@ bool InetStreamSocket::readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, co
ssize_t currentBytesRead;
int err;
if (timeout != NULL)
if (timeout != nullptr)
{
pfd[0].revents = 0;
err = poll(pfd, 1, msecs);
@ -438,7 +431,7 @@ bool InetStreamSocket::readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, co
if (currentBytesRead == 0)
{
if (timeout == NULL)
if (timeout == nullptr)
{
logIoError("InetStreamSocket::read: timeout during first read", 0);
return false;
@ -482,7 +475,7 @@ const SBS InetStreamSocket::read(const struct ::timespec* timeout, bool* isTimeO
pfd[0].fd = fSocketParms.sd();
pfd[0].events = POLLIN;
if (timeout != 0)
if (timeout != nullptr)
msecs = timeout->tv_sec * 1000 + timeout->tv_nsec / 1000000;
if (readToMagic(msecs, isTimeOut, stats) == false) // indicates a timeout or EOF
@ -707,7 +700,7 @@ const IOSocket InetStreamSocket::accept(const struct timespec* timeout)
pfd[0].fd = socketParms().sd();
pfd[0].events = POLLIN;
if (timeout != 0)
if (timeout != nullptr)
{
msecs = timeout->tv_sec * 1000 + timeout->tv_nsec / 1000000;
@ -771,7 +764,7 @@ const IOSocket InetStreamSocket::accept(const struct timespec* timeout)
#if STRERROR_R_CHAR_P
const char* p;
if ((p = strerror_r(e, blah, 80)) != 0)
if ((p = strerror_r(e, blah, 80)) != nullptr)
os << "InetStreamSocket::accept sync: " << p;
#else
@ -862,7 +855,7 @@ void InetStreamSocket::connect(const sockaddr* serv_addr)
#if STRERROR_R_CHAR_P
const char* p;
if ((p = strerror_r(e, blah, 80)) != 0)
if ((p = strerror_r(e, blah, 80)) != nullptr)
os << "InetStreamSocket::connect: " << p;
#else
@ -883,9 +876,9 @@ const string InetStreamSocket::toString() const
ostringstream oss;
char buf[INET_ADDRSTRLEN];
const SocketParms& sp = fSocketParms;
oss << "InetStreamSocket: sd: " << sp.sd() <<
" inet: " << inet_ntop(AF_INET, &fSa.sin_addr, buf, INET_ADDRSTRLEN) <<
" port: " << ntohs(fSa.sin_port);
oss << "InetStreamSocket: sd: " << sp.sd()
<< " inet: " << inet_ntop(AF_INET, &fSa.sin_addr, buf, INET_ADDRSTRLEN)
<< " port: " << ntohs(fSa.sin_port);
return oss.str();
}
@ -1030,7 +1023,7 @@ int InetStreamSocket::ping(const std::string& ipaddr, const struct timespec* tim
return -1;
}
len = ::recvfrom(pingsock, pkt, pktlen, 0, 0, 0);
len = ::recvfrom(pingsock, pkt, pktlen, 0, nullptr, nullptr);
if (len < 76)
{
@ -1050,7 +1043,6 @@ int InetStreamSocket::ping(const std::string& ipaddr, const struct timespec* tim
::close(pingsock);
return 0;
}

View File

@ -58,7 +58,7 @@ class InetStreamSocket : public Socket
/** dtor
*
*/
virtual ~InetStreamSocket();
~InetStreamSocket() override;
/** copy ctor
*
@ -68,37 +68,37 @@ class InetStreamSocket : public Socket
/** assign op
*
*/
virtual InetStreamSocket& operator=(const InetStreamSocket& rhs);
InetStreamSocket& operator=(const InetStreamSocket& rhs);
/** fSocket mutator
*
*/
inline virtual void socketParms(const SocketParms& socket);
inline void socketParms(const SocketParms& socket) override;
/** fSocket accessor
*
*/
inline virtual const SocketParms socketParms() const;
inline const SocketParms socketParms() const override;
/** sockaddr mutator
*
*/
inline virtual void sa(const sockaddr* sa);
inline void sa(const sockaddr* sa) override;
/** call socket() to get a sd
*
*/
virtual void open();
void open() override;
/** close the sd
*
*/
virtual void close();
void close() override;
/** test if this socket is open
*
*/
inline virtual bool isOpen() const;
inline bool isOpen() const override;
/** read a message from the socket
*
@ -114,44 +114,44 @@ class InetStreamSocket : public Socket
* The behavior will be unpredictable and possibly fatal.
* @note A fix is being reviewed but this is low-priority.
*/
virtual const SBS read(const struct timespec* timeout = 0, bool* isTimeOut = NULL,
Stats* stats = NULL) const;
const SBS read(const struct timespec* timeout = nullptr, bool* isTimeOut = nullptr,
Stats* stats = nullptr) const override;
/** write a message to the socket
*
* write a message to the socket
*/
virtual void write(const ByteStream& msg, Stats* stats = NULL);
virtual void write_raw(const ByteStream& msg, Stats* stats = NULL) const;
void write(const ByteStream& msg, Stats* stats = nullptr) override;
void write_raw(const ByteStream& msg, Stats* stats = nullptr) const override;
/** this version of write takes ownership of the bytestream
*/
virtual void write(SBS msg, Stats* stats = NULL);
void write(SBS msg, Stats* stats = nullptr) override;
/** bind to a port
*
*/
virtual void bind(const sockaddr* serv_addr);
void bind(const sockaddr* serv_addr) override;
/** listen for connections
*
*/
virtual void listen(int backlog = 5);
void listen(int backlog = 5) override;
/** return an (accepted) IOSocket ready for I/O
*
*/
virtual const IOSocket accept(const struct timespec* timeout = 0);
const IOSocket accept(const struct timespec* timeout = nullptr) override;
/** connect to a server socket
*
*/
virtual void connect(const sockaddr* serv_addr);
void connect(const sockaddr* serv_addr) override;
/** dynamically allocate a copy of this object
*
*/
virtual Socket* clone() const;
Socket* clone() const override;
/** get a string rep of the object
*
@ -161,7 +161,7 @@ class InetStreamSocket : public Socket
/** set the connection timeout (in ms)
*
*/
virtual void connectionTimeout(const struct ::timespec* timeout)
void connectionTimeout(const struct ::timespec* timeout) override
{
if (timeout)
fConnectionTimeout = *timeout;
@ -170,12 +170,12 @@ class InetStreamSocket : public Socket
/** set the connection protocol to be synchronous
*
*/
virtual void syncProto(bool use)
void syncProto(bool use) override
{
fSyncProto = use;
}
int getConnectionNum() const
int getConnectionNum() const override
{
return fSocketParms.sd();
}
@ -189,25 +189,25 @@ class InetStreamSocket : public Socket
/** return the address as a string
*
*/
virtual const std::string addr2String() const;
const std::string addr2String() const override;
/** compare 2 addresses
*
*/
virtual bool isSameAddr(const Socket* rhs) const;
virtual bool isSameAddr(const struct in_addr& ipv4Addr) const;
bool isSameAddr(const Socket* rhs) const override;
bool isSameAddr(const struct in_addr& ipv4Addr) const override;
/** ping an ip address
*
*/
EXPORT static int ping(const std::string& ipaddr, const struct timespec* timeout = 0);
EXPORT static int ping(const std::string& ipaddr, const struct timespec* timeout = nullptr);
// Check if we are still connected
virtual bool isConnected() const;
bool isConnected() const override;
// Check if the socket still has data pending
virtual bool hasData() const;
bool hasData() const override;
/*
* allow test suite access to private data for OOB test
@ -231,9 +231,9 @@ class InetStreamSocket : public Socket
*/
virtual bool readToMagic(long msecs, bool* isTimeOut, Stats* stats) const;
void do_write(const ByteStream& msg, uint32_t magic, Stats* stats = NULL) const;
void do_write(const ByteStream& msg, uint32_t magic, Stats* stats = nullptr) const;
ssize_t written(int fd, const uint8_t* ptr, size_t nbytes) const;
bool readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, const size_t numberOfBytes,
bool readFixedSizeData(struct pollfd* pfd, uint8_t* buffer, size_t numberOfBytes,
const struct ::timespec* timeout, bool* isTimeOut, Stats* stats, int64_t msec) const;
SocketParms fSocketParms; /// The socket parms

View File

@ -76,7 +76,7 @@ class MessageQueueServer
*
* construct a server queue for thisEnd. Optionally specify a Config object to use.
*/
EXPORT explicit MessageQueueServer(const std::string& thisEnd, config::Config* config = 0,
EXPORT explicit MessageQueueServer(const std::string& thisEnd, config::Config* config = nullptr,
size_t blocksize = ByteStream::BlockSize, int backlog = 5,
bool syncProto = true);
@ -101,7 +101,7 @@ class MessageQueueServer
* is then free to wait again for another connection. The IOSocket is already open and ready for
* read() and/or write(). The caller is responsible for calling close() when it is done.
*/
EXPORT const IOSocket accept(const struct timespec* timeout = 0) const;
EXPORT const IOSocket accept(const struct timespec* timeout = nullptr) const;
/**
* @brief get a mutable pointer to the client IOSocket
@ -165,7 +165,7 @@ class MessageQueueClient
*
* construct a queue from this process to otherEnd. Optionally specify a Config object to use.
*/
EXPORT explicit MessageQueueClient(const std::string& otherEnd, config::Config* config = 0,
EXPORT explicit MessageQueueClient(const std::string& otherEnd, config::Config* config = nullptr,
bool syncProto = true);
/**
@ -196,8 +196,8 @@ class MessageQueueClient
* wait for and return a message from otherEnd. The deafult timeout waits forever. Note that
* eventhough struct timespec has nanosecond resolution, this method only has milisecond resolution.
*/
EXPORT const SBS read(const struct timespec* timeout = 0, bool* isTimeOut = NULL,
Stats* stats = NULL) const;
EXPORT const SBS read(const struct timespec* timeout = nullptr, bool* isTimeOut = nullptr,
Stats* stats = nullptr) const;
/**
* @brief write a message to the queue
@ -205,7 +205,8 @@ class MessageQueueClient
* write a message to otherEnd. If the socket is not open, the timeout parm (in ms) will be used
* to establish a sync connection w/ the server
*/
EXPORT void write(const ByteStream& msg, const struct timespec* timeout = 0, Stats* stats = NULL) const;
EXPORT void write(const ByteStream& msg, const struct timespec* timeout = nullptr,
Stats* stats = nullptr) const;
/**
* @brief shutdown the connection to the server

View File

@ -33,56 +33,56 @@ class SameNodePseudoSocket : public Socket
{
public:
explicit SameNodePseudoSocket(joblist::DistributedEngineComm* exeMgrDecPtr);
virtual ~SameNodePseudoSocket();
virtual void write(SBS msg, Stats* stats = NULL);
~SameNodePseudoSocket() override;
void write(SBS msg, Stats* stats = nullptr) override;
private:
virtual void bind(const sockaddr* serv_addr);
void bind(const sockaddr* serv_addr) override;
SameNodePseudoSocket(const SameNodePseudoSocket& rhs);
virtual SameNodePseudoSocket& operator=(const SameNodePseudoSocket& rhs);
virtual void connectionTimeout(const struct ::timespec* timeout)
void connectionTimeout(const struct ::timespec* timeout) override
{
}
virtual void syncProto(bool use)
void syncProto(bool use) override
{
}
int getConnectionNum() const
int getConnectionNum() const override
{
return 1;
}
inline virtual void socketParms(const SocketParms& socket)
inline void socketParms(const SocketParms& socket) override
{
}
inline virtual const SocketParms socketParms() const
inline const SocketParms socketParms() const override
{
return SocketParms();
}
// all these virtual methods are to stay inaccessable.
inline virtual void sa(const sockaddr* sa);
virtual void open();
virtual void close();
inline virtual bool isOpen() const;
virtual const SBS read(const struct timespec* timeout = 0, bool* isTimeOut = NULL,
Stats* stats = NULL) const;
virtual void write(const ByteStream& msg, Stats* stats = NULL);
virtual void write_raw(const ByteStream& msg, Stats* stats = NULL) const;
virtual void listen(int backlog = 5);
virtual const IOSocket accept(const struct timespec* timeout = 0);
virtual void connect(const sockaddr* serv_addr);
virtual Socket* clone() const;
inline void sa(const sockaddr* sa) override;
void open() override;
void close() override;
inline bool isOpen() const override;
const SBS read(const struct timespec* timeout = nullptr, bool* isTimeOut = nullptr,
Stats* stats = nullptr) const override;
void write(const ByteStream& msg, Stats* stats = nullptr) override;
void write_raw(const ByteStream& msg, Stats* stats = nullptr) const override;
void listen(int backlog = 5) override;
const IOSocket accept(const struct timespec* timeout = nullptr) override;
void connect(const sockaddr* serv_addr) override;
Socket* clone() const override;
virtual const std::string toString() const;
virtual const std::string addr2String() const;
virtual bool isSameAddr(const Socket* rhs) const;
virtual bool isSameAddr(const struct in_addr& ipv4Addr) const;
static int ping(const std::string& ipaddr, const struct timespec* timeout = 0);
virtual bool isConnected() const;
virtual bool hasData() const;
const std::string addr2String() const override;
bool isSameAddr(const Socket* rhs) const override;
bool isSameAddr(const struct in_addr& ipv4Addr) const override;
static int ping(const std::string& ipaddr, const struct timespec* timeout = nullptr);
bool isConnected() const override;
bool hasData() const override;
joblist::DistributedEngineComm* dec_ = nullptr;
};

View File

@ -24,6 +24,7 @@
#include <exception>
#include <string>
#include <utility>
#pragma once
@ -35,23 +36,21 @@ namespace messageqcpp
*/
class SocketClosed : public std::exception
{
std::string _M_msg;
std::string M_msg;
public:
/** Takes a character string describing the error. */
explicit SocketClosed(const std::string& __arg) : _M_msg(__arg)
explicit SocketClosed(std::string _arg) : M_msg(std::move(_arg))
{
}
virtual ~SocketClosed() throw()
{
}
~SocketClosed() noexcept override = default;
/** Returns a C-style character string describing the general cause of
* the current error (the same string passed to the ctor). */
virtual const char* what() const throw()
const char* what() const noexcept override
{
return _M_msg.c_str();
return M_msg.c_str();
}
};