Skip to content

Commit

Permalink
More pass-by-value
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed Jan 10, 2025
1 parent b254aa0 commit 04c6767
Show file tree
Hide file tree
Showing 219 changed files with 878 additions and 754 deletions.
6 changes: 1 addition & 5 deletions cpp/include/Ice/InputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -836,11 +836,7 @@ namespace Ice
virtual void readPendingValues() {}

protected:
EncapsDecoder(
InputStream* stream,
Encaps* encaps,
size_t classGraphDepthMax,
Ice::ValueFactoryManagerPtr f)
EncapsDecoder(InputStream* stream, Encaps* encaps, size_t classGraphDepthMax, Ice::ValueFactoryManagerPtr f)
: _stream(stream),
_encaps(encaps),
_classGraphDepthMax(classGraphDepthMax),
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/LoggerUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace Ice
template<class L, class LPtr, void (L::*output)(const std::string&)> class LoggerOutput : public LoggerOutputBase
{
public:
inline LoggerOutput(LPtr lptr) : _logger(std::move(lptr)) {}
inline LoggerOutput(LPtr lptr) : _logger(std::move(lptr)) {}

inline ~LoggerOutput() { flush(); }

Expand Down
13 changes: 7 additions & 6 deletions cpp/include/Ice/MetricsAdminI.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <list>
#include <mutex>
#include <regex>
#include <utility>

namespace IceMX
{
Expand All @@ -35,7 +36,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 +116,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 +506,7 @@ namespace IceInternal
class MetricsViewI
{
public:
MetricsViewI(const std::string&);
MetricsViewI(std::string);

void destroy();

Expand Down Expand Up @@ -533,7 +534,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
4 changes: 2 additions & 2 deletions cpp/include/Ice/MetricsObserverI.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace IceMX
class Resolver
{
public:
Resolver(std::string name) : _name(std::move(name)) {}
Resolver(std::string name) : _name(std::move(name)) {}

virtual ~Resolver() {}

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

ObserverFactoryT(IceInternal::MetricsAdminIPtr metrics, const std::string& name)
ObserverFactoryT(IceInternal::MetricsAdminIPtr metrics, const std::string& name)
: _metrics(std::move(metrics)),
_name(name),
_enabled(0)
Expand Down
6 changes: 4 additions & 2 deletions cpp/src/Glacier2/Blobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
//

#include "Blobject.h"

#include "Instrumentation.h"
#include "SessionRouterI.h"
#include <utility>

using namespace std;
using namespace Ice;
Expand All @@ -19,7 +21,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 +30,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
6 changes: 4 additions & 2 deletions cpp/src/Glacier2/InstrumentationI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
//

#include "InstrumentationI.h"

#include "../Ice/InstrumentationI.h"
#include <utility>

#include "Ice/Communicator.h"
#include "Ice/LocalExceptions.h"
Expand Down Expand Up @@ -146,9 +148,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
2 changes: 1 addition & 1 deletion cpp/src/Glacier2/InstrumentationI.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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
9 changes: 5 additions & 4 deletions cpp/src/Glacier2/RouterI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "RoutingTable.h"

#include <random>
#include <utility>

using namespace std;
using namespace Ice;
Expand All @@ -16,18 +17,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
14 changes: 8 additions & 6 deletions cpp/src/Glacier2/SessionRouterI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "Ice/Ice.h"
#include "RouterI.h"

#include <utility>

using namespace std;
using namespace Ice;
using namespace Glacier2;
Expand Down Expand Up @@ -80,13 +82,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 +181,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 +275,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
2 changes: 1 addition & 1 deletion cpp/src/Glacier2/SessionRouterI.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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
9 changes: 4 additions & 5 deletions cpp/src/Ice/CommunicatorFlushBatchAsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
//

#include "CommunicatorFlushBatchAsync.h"

#include "BatchRequestQueue.h"
#include "ConnectionFactory.h"
#include "ConnectionI.h"
#include "Instance.h"
#include "ObjectAdapterFactory.h"
#include <utility>

using namespace std;
using namespace Ice;
Expand All @@ -34,12 +36,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
19 changes: 10 additions & 9 deletions cpp/src/Ice/ConnectionFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <chrono>
#include <iterator>
#include <utility>

#if TARGET_OS_IPHONE != 0
namespace IceInternal
Expand Down Expand Up @@ -72,9 +73,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 +320,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 +793,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
8 changes: 4 additions & 4 deletions cpp/src/Ice/ConnectionFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ namespace IceInternal
void setDefaultObjectAdapter(Ice::ObjectAdapterPtr adapter) noexcept;
[[nodiscard]] Ice::ObjectAdapterPtr getDefaultObjectAdapter() const noexcept;

OutgoingConnectionFactory(const Ice::CommunicatorPtr&, const InstancePtr&);
OutgoingConnectionFactory(Ice::CommunicatorPtr, const InstancePtr&);
~OutgoingConnectionFactory();
friend class Instance;

private:
struct ConnectorInfo
{
ConnectorInfo(ConnectorPtr c, EndpointIPtr e) : connector(std::move(c)), endpoint(std::move(e)) {}
ConnectorInfo(ConnectorPtr c, EndpointIPtr e) : connector(std::move(c)), endpoint(std::move(e)) {}

bool operator==(const ConnectorInfo& other) const;

Expand All @@ -85,8 +85,8 @@ namespace IceInternal
{
public:
ConnectCallback(
const InstancePtr&,
const OutgoingConnectionFactoryPtr&,
InstancePtr,
OutgoingConnectionFactoryPtr,
const std::vector<EndpointIPtr>&,
bool,
std::function<void(Ice::ConnectionIPtr, bool)>,
Expand Down
Loading

0 comments on commit 04c6767

Please sign in to comment.