Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply modernize pass by value #3340

Merged
merged 4 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cpp/include/Ice/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <cassert>
#include <cstddef>
#include <utility>
#include <vector>

namespace IceInternal
Expand Down
8 changes: 2 additions & 6 deletions cpp/include/Ice/InputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -835,16 +835,12 @@ namespace Ice
virtual void readPendingValues() {}

protected:
EncapsDecoder(
InputStream* stream,
Encaps* encaps,
size_t classGraphDepthMax,
const Ice::ValueFactoryManagerPtr& f)
EncapsDecoder(InputStream* stream, Encaps* encaps, size_t classGraphDepthMax, Ice::ValueFactoryManagerPtr f)
: _stream(stream),
_encaps(encaps),
_classGraphDepthMax(classGraphDepthMax),
_classGraphDepth(0),
_valueFactoryManager(f),
_valueFactoryManager(std::move(f)),
_typeIdIndex(0)
{
}
Expand Down
3 changes: 2 additions & 1 deletion cpp/include/Ice/LoggerUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Proxy.h"

#include <sstream>
#include <utility>

namespace Ice
{
Expand Down Expand Up @@ -94,7 +95,7 @@ namespace Ice
template<class L, class LPtr, void (L::*output)(const std::string&)> class LoggerOutput : public LoggerOutputBase
{
public:
inline LoggerOutput(const LPtr& lptr) : _logger(lptr) {}
inline LoggerOutput(LPtr lptr) : _logger(std::move(lptr)) {}

inline ~LoggerOutput() { flush(); }

Expand Down
12 changes: 6 additions & 6 deletions cpp/include/Ice/MetricsAdminI.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace IceInternal
class ICE_API RegExp
{
public:
RegExp(const std::string&, const std::string&);
RegExp(std::string, const std::string&);

template<typename T> bool match(const IceMX::MetricsHelperT<T>& helper, bool reject)
{
Expand Down Expand Up @@ -115,9 +115,9 @@ namespace IceInternal
class EntryT : public std::enable_shared_from_this<EntryT>
{
public:
EntryT(MetricsMapTPtr map, const TPtr& object, const typename std::list<EntryTPtr>::iterator& p)
: _map(map),
_object(object),
EntryT(MetricsMapTPtr map, TPtr object, const typename std::list<EntryTPtr>::iterator& p)
: _map(std::move(map)),
_object(std::move(object)),
_detachedPos(p)
{
}
Expand Down Expand Up @@ -505,7 +505,7 @@ namespace IceInternal
class MetricsViewI
{
public:
MetricsViewI(const std::string&);
MetricsViewI(std::string);

void destroy();

Expand Down Expand Up @@ -533,7 +533,7 @@ namespace IceInternal
class ICE_API MetricsAdminI : public IceMX::MetricsAdmin
{
public:
MetricsAdminI(const Ice::PropertiesPtr&, const Ice::LoggerPtr&);
MetricsAdminI(Ice::PropertiesPtr, Ice::LoggerPtr);
~MetricsAdminI() override;

void destroy();
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/Ice/MetricsObserverI.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace IceMX
class Resolver
{
public:
Resolver(const std::string& name) : _name(name) {}
Resolver(std::string name) : _name(std::move(name)) {}

virtual ~Resolver() {}

Expand Down Expand Up @@ -440,8 +440,8 @@ namespace IceMX
using MetricsType = typename ObserverImplType::MetricsType;
using MetricsMapSeqType = std::vector<std::shared_ptr<IceInternal::MetricsMapT<MetricsType>>>;

ObserverFactoryT(const IceInternal::MetricsAdminIPtr& metrics, const std::string& name)
: _metrics(metrics),
ObserverFactoryT(IceInternal::MetricsAdminIPtr metrics, const std::string& name)
: _metrics(std::move(metrics)),
_name(name),
_enabled(0)
{
Expand Down
1 change: 0 additions & 1 deletion cpp/src/DataStorm/NodeI.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "DataStorm/Contract.h"
#include "DataStorm/InternalI.h"
#include "ForwarderManager.h"

#include "Ice/Ice.h"

#include <set>
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Glacier2/Blobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace
constexpr string_view clientTraceRequest = "Glacier2.Client.Trace.Request";
}

Glacier2::Blobject::Blobject(shared_ptr<Instance> instance, ConnectionPtr reverseConnection, const Context& context)
Glacier2::Blobject::Blobject(shared_ptr<Instance> instance, ConnectionPtr reverseConnection, Context context)
: _instance(std::move(instance)),
_reverseConnection(std::move(reverseConnection)),
_forwardContext(
Expand All @@ -28,7 +28,7 @@ Glacier2::Blobject::Blobject(shared_ptr<Instance> instance, ConnectionPtr revers
_requestTraceLevel(
_reverseConnection ? _instance->properties()->getIcePropertyAsInt(serverTraceRequest)
: _instance->properties()->getIcePropertyAsInt(clientTraceRequest)),
_context(context)
_context(std::move(context))
{
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/Glacier2/Blobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Glacier2
class Blobject : public Ice::BlobjectArrayAsync, public std::enable_shared_from_this<Blobject>
{
public:
Blobject(std::shared_ptr<Instance>, Ice::ConnectionPtr, const Ice::Context&);
Blobject(std::shared_ptr<Instance>, Ice::ConnectionPtr, Ice::Context);
void invokeException(std::exception_ptr, std::function<void(std::exception_ptr)>&&);

protected:
Expand Down
3 changes: 1 addition & 2 deletions cpp/src/Glacier2/ClientBlobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// Copyright (c) ZeroC, Inc. All rights reserved.
//

#include "../Ice/CheckIdentity.h"

#include "ClientBlobject.h"
#include "../Ice/CheckIdentity.h"
#include "FilterManager.h"
#include "FilterT.h"
#include "RoutingTable.h"
Expand Down
1 change: 0 additions & 1 deletion cpp/src/Glacier2/FilterT.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#define FILTER_I_H

#include "Glacier2/Session.h"

#include "Ice/Identity.h"

#include <list>
Expand Down
1 change: 0 additions & 1 deletion cpp/src/Glacier2/Instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "Ice/CommunicatorF.h"
#include "Ice/ObjectAdapterF.h"
#include "Ice/PropertiesF.h"

#include "Instrumentation.h"
#include "ProxyVerifier.h"
#include "SessionRouterI.h"
Expand Down
5 changes: 2 additions & 3 deletions cpp/src/Glacier2/InstrumentationI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "InstrumentationI.h"
#include "../Ice/InstrumentationI.h"

#include "Ice/Communicator.h"
#include "Ice/LocalExceptions.h"
#include "Ice/LoggerUtil.h"
Expand Down Expand Up @@ -146,9 +145,9 @@ SessionObserverI::routingTableSize(int delta)
forEach(add(&SessionMetrics::routingTableSize, delta));
}

RouterObserverI::RouterObserverI(shared_ptr<IceInternal::MetricsAdminI> metrics, const string& instanceName)
RouterObserverI::RouterObserverI(shared_ptr<IceInternal::MetricsAdminI> metrics, string instanceName)
: _metrics(std::move(metrics)),
_instanceName(instanceName),
_instanceName(std::move(instanceName)),
_sessions(_metrics, "Session")
{
}
Expand Down
5 changes: 2 additions & 3 deletions cpp/src/Glacier2/InstrumentationI.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
#ifndef INSTRUMENTATION_I_H
#define INSTRUMENTATION_I_H

#include "Ice/MetricsObserverI.h"

#include "Glacier2/Metrics.h"
#include "Ice/MetricsObserverI.h"
#include "Instrumentation.h"

namespace Glacier2
Expand All @@ -25,7 +24,7 @@ namespace Glacier2
class RouterObserverI final : public Glacier2::Instrumentation::RouterObserver
{
public:
RouterObserverI(std::shared_ptr<IceInternal::MetricsAdminI>, const std::string&);
RouterObserverI(std::shared_ptr<IceInternal::MetricsAdminI>, std::string);

void setObserverUpdater(const std::shared_ptr<Glacier2::Instrumentation::ObserverUpdater>&) override;

Expand Down
8 changes: 4 additions & 4 deletions cpp/src/Glacier2/RouterI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ using namespace Glacier2;
Glacier2::RouterI::RouterI(
shared_ptr<Instance> instance,
ConnectionPtr connection,
const string& userId,
string userId,
optional<SessionPrx> session,
const Identity& controlId,
Identity controlId,
shared_ptr<FilterManager> filters,
const Context& context)
: _instance(std::move(instance)),
_routingTable(make_shared<RoutingTable>(_instance->communicator(), _instance->proxyVerifier())),
_clientBlobject(make_shared<ClientBlobject>(_instance, std::move(filters), context, _routingTable)),
_connection(std::move(connection)),
_userId(userId),
_userId(std::move(userId)),
_session(std::move(session)),
_controlId(controlId),
_controlId(std::move(controlId)),
_context(context)
{
if (_instance->serverObjectAdapter())
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Glacier2/RouterI.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ namespace Glacier2
RouterI(
std::shared_ptr<Instance>,
Ice::ConnectionPtr,
const std::string&,
std::string,
std::optional<SessionPrx>,
const Ice::Identity&,
Ice::Identity,
std::shared_ptr<FilterManager>,
const Ice::Context&);

Expand Down
1 change: 0 additions & 1 deletion cpp/src/Glacier2/RoutingTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "Ice/Ice.h"
#include "Ice/ObserverHelper.h"

#include "Instrumentation.h"
#include "ProxyVerifier.h"

Expand Down
12 changes: 6 additions & 6 deletions cpp/src/Glacier2/SessionRouterI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ namespace Glacier2
function<void(const optional<SessionPrx>&)> response,
function<void(exception_ptr)> exception,
const string& user,
const string& password,
string password,
const Ice::Current& current,
const shared_ptr<SessionRouterI>& sessionRouter)
: CreateSession(sessionRouter, user, current),
_response(std::move(response)),
_exception(std::move(exception)),
_password(password)
_password(std::move(password))
{
}

Expand Down Expand Up @@ -179,13 +179,13 @@ namespace Glacier2
function<void(const optional<SessionPrx>& returnValue)> response,
function<void(exception_ptr)> exception,
const string& user,
const SSLInfo& sslInfo,
SSLInfo sslInfo,
const Ice::Current& current,
const shared_ptr<SessionRouterI>& sessionRouter)
: CreateSession(sessionRouter, user, current),
_response(std::move(response)),
_exception(std::move(exception)),
_sslInfo(sslInfo)
_sslInfo(std::move(sslInfo))
{
}

Expand Down Expand Up @@ -273,10 +273,10 @@ namespace Glacier2
};
}

CreateSession::CreateSession(shared_ptr<SessionRouterI> sessionRouter, const string& user, const Ice::Current& current)
CreateSession::CreateSession(shared_ptr<SessionRouterI> sessionRouter, string user, const Ice::Current& current)
: _instance(sessionRouter->_instance),
_sessionRouter(std::move(sessionRouter)),
_user(user),
_user(std::move(user)),
_current(current)
{
// Clear reserved contexts potentially set by client
Expand Down
5 changes: 2 additions & 3 deletions cpp/src/Glacier2/SessionRouterI.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
#ifndef GLACIER2_SESSION_ROUTER_I_H
#define GLACIER2_SESSION_ROUTER_I_H

#include "Ice/Ice.h"

#include "Glacier2/PermissionsVerifier.h"
#include "Glacier2/Router.h"
#include "Ice/Ice.h"
#include "Instrumentation.h"

#include <set>
Expand All @@ -25,7 +24,7 @@ namespace Glacier2
class CreateSession : public std::enable_shared_from_this<CreateSession>
{
public:
CreateSession(std::shared_ptr<SessionRouterI>, const std::string&, const Ice::Current&);
CreateSession(std::shared_ptr<SessionRouterI>, std::string, const Ice::Current&);

void create();
void addPendingCallback(std::shared_ptr<CreateSession>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
// Copyright (c) ZeroC, Inc. All rights reserved.
//

#include "../Ice/FileUtil.h"
#include "Glacier2/PermissionsVerifier.h"
#include "Ice/Ice.h"

#include "../Ice/FileUtil.h"
#include "Ice/StringUtil.h"

#include <fstream>
Expand Down
7 changes: 2 additions & 5 deletions cpp/src/Ice/CommunicatorFlushBatchAsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ CommunicatorFlushBatchAsync::flushConnection(const ConnectionIPtr& con, Ice::Com
class FlushBatch final : public OutgoingAsyncBase
{
public:
FlushBatch(
const CommunicatorFlushBatchAsyncPtr& outAsync,
const InstancePtr& instance,
InvocationObserver& observer)
FlushBatch(CommunicatorFlushBatchAsyncPtr outAsync, const InstancePtr& instance, InvocationObserver& observer)
: OutgoingAsyncBase(instance),
_outAsync(outAsync),
_outAsync(std::move(outAsync)),
_parentObserver(observer)
{
}
Expand Down
18 changes: 9 additions & 9 deletions cpp/src/Ice/ConnectionFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ namespace
class StartAcceptor : public TimerTask, public std::enable_shared_from_this<StartAcceptor>
{
public:
StartAcceptor(const IncomingConnectionFactoryPtr& factory, const InstancePtr& instance)
: _factory(factory),
_instance(instance)
StartAcceptor(IncomingConnectionFactoryPtr factory, InstancePtr instance)
: _factory(std::move(factory)),
_instance(std::move(instance))
{
}

Expand Down Expand Up @@ -319,9 +319,9 @@ IceInternal::OutgoingConnectionFactory::removeConnection(const ConnectionIPtr& c
}

IceInternal::OutgoingConnectionFactory::OutgoingConnectionFactory(
const CommunicatorPtr& communicator,
CommunicatorPtr communicator,
const InstancePtr& instance)
: _communicator(communicator),
: _communicator(std::move(communicator)),
_instance(instance),
_connectionOptions(instance->clientConnectionOptions()),
_destroyed(false),
Expand Down Expand Up @@ -792,15 +792,15 @@ IceInternal::OutgoingConnectionFactory::handleConnectionException(exception_ptr
}

IceInternal::OutgoingConnectionFactory::ConnectCallback::ConnectCallback(
const InstancePtr& instance,
const OutgoingConnectionFactoryPtr& factory,
InstancePtr instance,
OutgoingConnectionFactoryPtr factory,
const vector<EndpointIPtr>& endpoints,
bool hasMore,
std::function<void(Ice::ConnectionIPtr, bool)> createConnectionResponse,
std::function<void(std::exception_ptr)> createConnectionException,
Ice::EndpointSelectionType selType)
: _instance(instance),
_factory(factory),
: _instance(std::move(instance)),
_factory(std::move(factory)),
_endpoints(endpoints),
_hasMore(hasMore),
_createConnectionResponse(std::move(createConnectionResponse)),
Expand Down
Loading
Loading