summaryrefslogtreecommitdiff
path: root/cpp/include
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/include')
-rw-r--r--cpp/include/Freeze/.gitignore17
-rw-r--r--cpp/include/Freeze/Index.h61
-rw-r--r--cpp/include/Freeze/Initialize.h122
-rw-r--r--cpp/include/Freeze/Makefile26
-rw-r--r--cpp/include/Freeze/Makefile.mak21
-rw-r--r--cpp/include/Freeze/Map.h1329
-rw-r--r--cpp/include/Freeze/TransactionHolder.h48
-rw-r--r--cpp/include/Glacier2/.gitignore10
-rw-r--r--cpp/include/Glacier2/.headers13
-rw-r--r--cpp/include/Glacier2/Application.h19
-rw-r--r--cpp/include/Glacier2/Config.h18
-rw-r--r--cpp/include/Glacier2/Glacier2.h4
-rw-r--r--cpp/include/Glacier2/Makefile26
-rw-r--r--cpp/include/Glacier2/Makefile.mak40
-rw-r--r--cpp/include/Glacier2/NullPermissionsVerifier.h6
-rw-r--r--cpp/include/Glacier2/SessionHelper.h31
-rw-r--r--cpp/include/Ice/.gitignore42
-rw-r--r--cpp/include/Ice/.headers106
-rw-r--r--cpp/include/Ice/ACMF.h30
-rw-r--r--cpp/include/Ice/Application.h81
-rw-r--r--cpp/include/Ice/AsyncResult.h350
-rw-r--r--cpp/include/Ice/AsyncResultF.h4
-rw-r--r--cpp/include/Ice/BasicStream.h1326
-rw-r--r--cpp/include/Ice/BatchRequestInterceptor.h13
-rw-r--r--cpp/include/Ice/Buffer.h18
-rw-r--r--cpp/include/Ice/CommunicatorAsync.h23
-rw-r--r--cpp/include/Ice/Comparable.h130
-rw-r--r--cpp/include/Ice/Config.h41
-rw-r--r--cpp/include/Ice/ConnectionAsync.h116
-rw-r--r--cpp/include/Ice/ConnectionFactoryF.h30
-rw-r--r--cpp/include/Ice/ConnectionIF.h4
-rw-r--r--cpp/include/Ice/ConsoleUtil.h28
-rw-r--r--cpp/include/Ice/DefaultValueFactory.h (renamed from cpp/include/Ice/DefaultObjectFactory.h)42
-rw-r--r--cpp/include/Ice/DeprecatedStringConverter.h62
-rw-r--r--cpp/include/Ice/DispatchInterceptor.h8
-rw-r--r--cpp/include/Ice/Dispatcher.h25
-rw-r--r--cpp/include/Ice/DynamicLibrary.h10
-rw-r--r--cpp/include/Ice/Exception.h117
-rw-r--r--cpp/include/Ice/ExceptionHelpers.h69
-rw-r--r--cpp/include/Ice/FactoryTable.h21
-rw-r--r--cpp/include/Ice/FactoryTableInit.h49
-rw-r--r--cpp/include/Ice/Format.h5
-rw-r--r--cpp/include/Ice/Functional.h64
-rw-r--r--cpp/include/Ice/GCObject.h12
-rw-r--r--cpp/include/Ice/Handle.h5
-rw-r--r--cpp/include/Ice/Ice.h12
-rw-r--r--cpp/include/Ice/IconvStringConverter.h (renamed from cpp/include/IceUtil/IconvStringConverter.h)170
-rw-r--r--cpp/include/Ice/Incoming.h119
-rw-r--r--cpp/include/Ice/IncomingAsync.h85
-rw-r--r--cpp/include/Ice/IncomingAsyncF.h6
-rw-r--r--cpp/include/Ice/Initialize.h96
-rw-r--r--cpp/include/Ice/InputStream.h982
-rw-r--r--cpp/include/Ice/InstanceF.h1
-rw-r--r--cpp/include/Ice/InterfaceByValue.h46
-rw-r--r--cpp/include/Ice/LocalObject.h16
-rw-r--r--cpp/include/Ice/LoggerUtil.h32
-rw-r--r--cpp/include/Ice/Makefile26
-rw-r--r--cpp/include/Ice/Makefile.mak34
-rw-r--r--cpp/include/Ice/MetricsAdminI.h175
-rw-r--r--cpp/include/Ice/MetricsFunctional.h22
-rw-r--r--cpp/include/Ice/MetricsObserverI.h122
-rw-r--r--cpp/include/Ice/NativePropertiesAdmin.h19
-rw-r--r--cpp/include/Ice/Object.h157
-rw-r--r--cpp/include/Ice/ObjectAdapterFactoryF.h26
-rw-r--r--cpp/include/Ice/ObjectF.h9
-rw-r--r--cpp/include/Ice/ObjectFactoryManagerF.h26
-rw-r--r--cpp/include/Ice/ObserverHelper.h24
-rw-r--r--cpp/include/Ice/Optional.h1107
-rw-r--r--cpp/include/Ice/Outgoing.h225
-rw-r--r--cpp/include/Ice/OutgoingAsync.h737
-rw-r--r--cpp/include/Ice/OutgoingAsyncF.h16
-rw-r--r--cpp/include/Ice/OutputStream.h753
-rw-r--r--cpp/include/Ice/Protocol.h13
-rw-r--r--cpp/include/Ice/Proxy.h1895
-rw-r--r--cpp/include/Ice/ProxyF.h42
-rw-r--r--cpp/include/Ice/ProxyHandle.h82
-rw-r--r--cpp/include/Ice/RegisterPlugins.h21
-rw-r--r--cpp/include/Ice/RequestHandlerF.h12
-rw-r--r--cpp/include/Ice/ResponseHandlerF.h5
-rw-r--r--cpp/include/Ice/SHA1.h (renamed from cpp/include/IceUtil/SHA1.h)20
-rw-r--r--cpp/include/Ice/Service.h4
-rw-r--r--cpp/include/Ice/SlicedData.h56
-rw-r--r--cpp/include/Ice/SlicedDataF.h18
-rw-r--r--cpp/include/Ice/Stream.h447
-rw-r--r--cpp/include/Ice/StreamF.h30
-rw-r--r--cpp/include/Ice/StreamHelpers.h201
-rw-r--r--cpp/include/Ice/StringConverter.h52
-rw-r--r--cpp/include/Ice/UUID.h23
-rw-r--r--cpp/include/Ice/UniquePtr.h (renamed from cpp/include/IceUtil/UniquePtr.h)41
-rw-r--r--cpp/include/Ice/UniqueRef.h90
-rw-r--r--cpp/include/Ice/UserExceptionFactory.h39
-rw-r--r--cpp/include/Ice/Value.h102
-rw-r--r--cpp/include/Ice/ValueF.h24
-rw-r--r--cpp/include/IceBT/Makefile (renamed from cpp/include/Slice/Makefile)12
-rw-r--r--cpp/include/IceBT/Plugin.h84
-rw-r--r--cpp/include/IceBox/.gitignore4
-rw-r--r--cpp/include/IceBox/Config.h20
-rw-r--r--cpp/include/IceBox/Makefile26
-rw-r--r--cpp/include/IceBox/Makefile.mak21
-rw-r--r--cpp/include/IceGrid/.gitignore14
-rw-r--r--cpp/include/IceGrid/.headers14
-rw-r--r--cpp/include/IceGrid/Config.h14
-rw-r--r--cpp/include/IceGrid/IceGrid.h5
-rw-r--r--cpp/include/IceGrid/Makefile26
-rw-r--r--cpp/include/IceGrid/Makefile.mak34
-rw-r--r--cpp/include/IceIAP/IceIAP.h (renamed from cpp/include/Freeze/Freeze.h)14
-rw-r--r--cpp/include/IcePatch2/.gitignore5
-rw-r--r--cpp/include/IcePatch2/ClientUtil.h11
-rw-r--r--cpp/include/IcePatch2/Config.h15
-rw-r--r--cpp/include/IcePatch2/Makefile26
-rw-r--r--cpp/include/IcePatch2/Makefile.mak21
-rw-r--r--cpp/include/IceSSL/.gitignore5
-rw-r--r--cpp/include/IceSSL/.headers6
-rw-r--r--cpp/include/IceSSL/Config.h24
-rw-r--r--cpp/include/IceSSL/IceSSL.h6
-rw-r--r--cpp/include/IceSSL/Makefile26
-rw-r--r--cpp/include/IceSSL/Makefile.mak34
-rw-r--r--cpp/include/IceSSL/Plugin.h246
-rw-r--r--cpp/include/IceStorm/.gitignore5
-rw-r--r--cpp/include/IceStorm/.headers4
-rw-r--r--cpp/include/IceStorm/Config.h16
-rw-r--r--cpp/include/IceStorm/Makefile26
-rw-r--r--cpp/include/IceStorm/Makefile.mak34
-rw-r--r--cpp/include/IceUtil/.headers42
-rw-r--r--cpp/include/IceUtil/AbstractMutex.h119
-rw-r--r--cpp/include/IceUtil/Atomic.h12
-rw-r--r--cpp/include/IceUtil/Cache.h362
-rw-r--r--cpp/include/IceUtil/Cond.h4
-rw-r--r--cpp/include/IceUtil/Config.h177
-rw-r--r--cpp/include/IceUtil/ConsoleUtil.h98
-rw-r--r--cpp/include/IceUtil/CountDownLatch.h2
-rw-r--r--cpp/include/IceUtil/CtrlCHandler.h10
-rw-r--r--cpp/include/IceUtil/Exception.h225
-rw-r--r--cpp/include/IceUtil/FileUtil.h148
-rw-r--r--cpp/include/IceUtil/IceUtil.h10
-rw-r--r--cpp/include/IceUtil/InputUtil.h4
-rw-r--r--cpp/include/IceUtil/Makefile26
-rw-r--r--cpp/include/IceUtil/Makefile.mak33
-rw-r--r--cpp/include/IceUtil/Mutex.h4
-rw-r--r--cpp/include/IceUtil/MutexProtocol.h2
-rw-r--r--cpp/include/IceUtil/Optional.h26
-rw-r--r--cpp/include/IceUtil/Options.h33
-rw-r--r--cpp/include/IceUtil/OutputUtil.h82
-rw-r--r--cpp/include/IceUtil/PopDisableWarnings.h8
-rw-r--r--cpp/include/IceUtil/PushDisableWarnings.h15
-rw-r--r--cpp/include/IceUtil/Random.h4
-rw-r--r--cpp/include/IceUtil/RecMutex.h2
-rw-r--r--cpp/include/IceUtil/ResourceConfig.h58
-rw-r--r--cpp/include/IceUtil/ScopedArray.h7
-rw-r--r--cpp/include/IceUtil/Shared.h8
-rw-r--r--cpp/include/IceUtil/StopWatch.h54
-rw-r--r--cpp/include/IceUtil/StringConverter.h147
-rw-r--r--cpp/include/IceUtil/StringUtil.h51
-rw-r--r--cpp/include/IceUtil/Thread.h15
-rw-r--r--cpp/include/IceUtil/ThreadException.h70
-rw-r--r--cpp/include/IceUtil/Time.h4
-rw-r--r--cpp/include/IceUtil/Timer.h11
-rw-r--r--cpp/include/IceUtil/UUID.h2
-rw-r--r--cpp/include/Makefile35
-rw-r--r--cpp/include/Makefile.mak43
-rw-r--r--cpp/include/Slice/CPlusPlusUtil.h65
-rw-r--r--cpp/include/Slice/Checksum.h26
-rw-r--r--cpp/include/Slice/CsUtil.h92
-rw-r--r--cpp/include/Slice/DotNetNames.h34
-rw-r--r--cpp/include/Slice/FileTracker.h71
-rw-r--r--cpp/include/Slice/JavaUtil.h279
-rw-r--r--cpp/include/Slice/Makefile.mak21
-rw-r--r--cpp/include/Slice/ObjCUtil.h127
-rw-r--r--cpp/include/Slice/PHPUtil.h50
-rw-r--r--cpp/include/Slice/Parser.h1122
-rw-r--r--cpp/include/Slice/Preprocessor.h70
-rw-r--r--cpp/include/Slice/PythonUtil.h64
-rw-r--r--cpp/include/Slice/RubyUtil.h54
-rw-r--r--cpp/include/Slice/Util.h56
174 files changed, 8126 insertions, 9638 deletions
diff --git a/cpp/include/Freeze/.gitignore b/cpp/include/Freeze/.gitignore
deleted file mode 100644
index a7fae586955..00000000000
--- a/cpp/include/Freeze/.gitignore
+++ /dev/null
@@ -1,17 +0,0 @@
-// Generated by makegitignore.py
-
-// IMPORTANT: Do not edit this file -- any edits made here will be lost!
-BackgroundSaveEvictor.h
-CatalogData.h
-Connection.h
-ConnectionF.h
-DB.h
-Evictor.h
-EvictorF.h
-EvictorStorage.h
-Exception.h
-Transaction.h
-TransactionalEvictor.h
-PingObject.h
-Catalog.h
-CatalogIndexList.h
diff --git a/cpp/include/Freeze/Index.h b/cpp/include/Freeze/Index.h
deleted file mode 100644
index 1f4128b462e..00000000000
--- a/cpp/include/Freeze/Index.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef FREEZE_INDEX_H
-#define FREEZE_INDEX_H
-
-#include <Ice/Ice.h>
-#include <Freeze/DB.h>
-#include <vector>
-
-namespace Freeze
-{
-
-class IndexI;
-class ObjectStoreBase;
-
-class FREEZE_API Index : public IceUtil::Shared
-{
-public:
-
- virtual ~Index();
-
- const std::string& name() const;
- const std::string& facet() const;
-
-protected:
-
- Index(const std::string&, const std::string&);
-
- virtual bool marshalKey(const Ice::ObjectPtr&, Freeze::Key&) const = 0;
-
- std::vector<Ice::Identity> untypedFindFirst(const Freeze::Key&, Ice::Int) const;
-
- std::vector<Ice::Identity> untypedFind(const Freeze::Key&) const;
-
- Ice::Int untypedCount(const Freeze::Key&) const;
-
- Ice::CommunicatorPtr _communicator;
- Ice::EncodingVersion _encoding;
-
-private:
-
- friend class IndexI;
- friend class ObjectStoreBase;
-
- std::string _name;
- std::string _facet;
- IndexI* _impl;
-};
-
-typedef IceUtil::Handle<Index> IndexPtr;
-}
-
-#endif
-
diff --git a/cpp/include/Freeze/Initialize.h b/cpp/include/Freeze/Initialize.h
deleted file mode 100644
index ea82de94cc2..00000000000
--- a/cpp/include/Freeze/Initialize.h
+++ /dev/null
@@ -1,122 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef FREEZE_INITIALIZE_H
-#define FREEZE_INITIALIZE_H
-
-#include <Ice/Ice.h>
-#include <Freeze/EvictorF.h>
-#include <Freeze/ConnectionF.h>
-#include <Freeze/Index.h>
-#include <Freeze/Transaction.h>
-
-//
-// Automatically link Freeze[D].lib with Visual C++
-//
-#if !defined(ICE_BUILDING_FREEZE) && defined(FREEZE_API_EXPORTS)
-# define ICE_BUILDING_FREEZE
-#endif
-
-#ifdef _MSC_VER
-# if !defined(ICE_BUILDING_FREEZE)
-# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
-# pragma comment(lib, "FreezeD.lib")
-# else
-# pragma comment(lib, "Freeze.lib")
-# endif
-# endif
-#endif
-
-
-//
-// Berkeley DB's DbEnv and DbTxn
-//
-class DbEnv;
-class DbTxn;
-
-namespace Freeze
-{
-
-typedef std::map<std::string, std::string> FacetTypeMap;
-
-FREEZE_API Freeze::BackgroundSaveEvictorPtr
-createBackgroundSaveEvictor(const Ice::ObjectAdapterPtr& adapter,
- const std::string& envName,
- const std::string& filename,
- const ServantInitializerPtr& initializer = 0,
- const std::vector<IndexPtr>& indices = std::vector<IndexPtr>(),
- bool createDb = true);
-
-FREEZE_API BackgroundSaveEvictorPtr
-createBackgroundSaveEvictor(const Ice::ObjectAdapterPtr& adapter,
- const std::string& envName,
- DbEnv& dbEnv,
- const std::string& filename,
- const ServantInitializerPtr& initializer = 0,
- const std::vector<IndexPtr>& indices = std::vector<IndexPtr>(),
- bool createDb = true);
-
-FREEZE_API TransactionalEvictorPtr
-createTransactionalEvictor(const Ice::ObjectAdapterPtr& adapter,
- const std::string& envName,
- const std::string& filename,
- const FacetTypeMap& facetTypes = FacetTypeMap(),
- const ServantInitializerPtr& initializer = 0,
- const std::vector<IndexPtr>& indices = std::vector<IndexPtr>(),
- bool createDb = true);
-
-FREEZE_API TransactionalEvictorPtr
-createTransactionalEvictor(const Ice::ObjectAdapterPtr& adapter,
- const std::string& envName,
- DbEnv& dbEnv,
- const std::string& filename,
- const FacetTypeMap& facetTypes = FacetTypeMap(),
- const ServantInitializerPtr& initializer = 0,
- const std::vector<IndexPtr>& indices = std::vector<IndexPtr>(),
- bool createDb = true);
-
-//
-// TransactionalEvictorDeadlockException propagates through collocation-optimized calls
-// The TransactionalEvictor catches and retries on this exception
-//
-class FREEZE_API TransactionalEvictorDeadlockException : public Ice::SystemException
-{
-public:
-
- TransactionalEvictorDeadlockException(const char*, int, const TransactionPtr& = 0);
-
- virtual ~TransactionalEvictorDeadlockException() throw();
-
- virtual std::string ice_name() const;
- virtual TransactionalEvictorDeadlockException* ice_clone() const;
- virtual void ice_throw() const;
-
- TransactionPtr tx;
-};
-
-
-FREEZE_API ConnectionPtr createConnection(const Ice::CommunicatorPtr& communicator,
- const std::string& envName);
-
-FREEZE_API ConnectionPtr createConnection(const Ice::CommunicatorPtr& communicator,
- const std::string& envName,
- DbEnv& dbEnv);
-
-FREEZE_API const std::string& catalogName();
-FREEZE_API const std::string& catalogIndexListName();
-
-FREEZE_API DbTxn* getTxn(const TransactionPtr&);
-
-
-typedef void (*FatalErrorCallback)(const BackgroundSaveEvictorPtr&, const Ice::CommunicatorPtr&);
-FREEZE_API FatalErrorCallback registerFatalErrorCallback(FatalErrorCallback);
-
-}
-
-#endif
diff --git a/cpp/include/Freeze/Makefile b/cpp/include/Freeze/Makefile
deleted file mode 100644
index e464e00e2bd..00000000000
--- a/cpp/include/Freeze/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ../..
-
-include $(top_srcdir)/config/Make.rules
-
-install::
- @if test ! -d $(DESTDIR)$(install_includedir)/Freeze ; \
- then \
- echo "Creating $(DESTDIR)$(install_includedir)/Freeze..." ; \
- $(call mkdir,$(DESTDIR)$(install_includedir)/Freeze) ; \
- fi
-
- @for i in *.h ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/Freeze/$$i ; \
- chmod a+r $(DESTDIR)$(install_includedir)/Freeze/$$i ; \
- done
diff --git a/cpp/include/Freeze/Makefile.mak b/cpp/include/Freeze/Makefile.mak
deleted file mode 100644
index c7af4ed3393..00000000000
--- a/cpp/include/Freeze/Makefile.mak
+++ /dev/null
@@ -1,21 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..\..
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-install::
- @if not exist "$(install_includedir)\Freeze" \
- @echo "Creating $(install_includedir)\Freeze..." && \
- $(MKDIR) "$(install_includedir)\Freeze"
-
- @for %i in ( *.h ) do \
- @echo Installing %i && \
- copy %i "$(install_includedir)\Freeze"
diff --git a/cpp/include/Freeze/Map.h b/cpp/include/Freeze/Map.h
deleted file mode 100644
index 5200eaa7084..00000000000
--- a/cpp/include/Freeze/Map.h
+++ /dev/null
@@ -1,1329 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef FREEZE_MAP_H
-#define FREEZE_MAP_H
-
-#include <Ice/Ice.h>
-#include <iterator>
-#include <Freeze/DB.h>
-#include <Freeze/Exception.h>
-#include <Freeze/Connection.h>
-
-//
-// Berkeley DB's DbEnv
-//
-class DbEnv;
-class Dbt;
-
-namespace Freeze
-{
-
-class IteratorHelper;
-class MapHelper;
-
-class MapIndexI;
-class MapHelperI;
-class IteratorHelperI;
-class SharedDb;
-
-class FREEZE_API KeyCompareBase : public IceUtil::Shared
-{
-public:
-
- KeyCompareBase(bool);
-
- bool compareEnabled() const;
-
- virtual int compare(const Key&, const Key&) = 0;
-
-private:
-
- const bool _enabled;
-};
-typedef IceUtil::Handle<KeyCompareBase> KeyCompareBasePtr;
-
-class FREEZE_API MapIndexBase : public KeyCompareBase
-{
-public:
-
- virtual ~MapIndexBase();
-
- const std::string& name() const;
-
- IteratorHelper* begin(bool) const;
- IteratorHelper* untypedFind(const Key&, bool, bool) const;
- IteratorHelper* untypedLowerBound(const Key&, bool) const;
- IteratorHelper* untypedUpperBound(const Key&, bool) const;
-
- int untypedCount(const Key&) const;
-
- //
- // Implemented by the generated code
- //
- virtual void marshalKey(const Value&, Key&) const = 0;
-
-protected:
-
- MapIndexBase(const std::string&, bool);
-
- Ice::CommunicatorPtr _communicator;
- Ice::EncodingVersion _encoding;
-
-private:
-
- friend class MapHelperI;
- friend class IteratorHelperI;
- friend class SharedDb;
- friend class MapDb;
-
- std::string _name;
- MapIndexI* _impl;
- const MapHelperI* _map;
-};
-typedef IceUtil::Handle<MapIndexBase> MapIndexBasePtr;
-
-class FREEZE_API MapHelper
-{
-public:
-
- static MapHelper*
- create(const ConnectionPtr& connection,
- const std::string& dbName,
- const std::string& key,
- const std::string& value,
- const KeyCompareBasePtr&,
- const std::vector<MapIndexBasePtr>&,
- bool createDb);
-
- static void
- recreate(const ConnectionPtr& connection,
- const std::string& dbName,
- const std::string& key,
- const std::string& value,
- const KeyCompareBasePtr&,
- const std::vector<MapIndexBasePtr>&);
-
- virtual ~MapHelper() = 0;
-
- virtual IteratorHelper*
- find(const Key&, bool) const = 0;
-
- virtual IteratorHelper*
- find(const Dbt&, bool) const = 0;
-
- virtual IteratorHelper*
- lowerBound(const Key&, bool) const = 0;
-
- virtual IteratorHelper*
- upperBound(const Key&, bool) const = 0;
-
- virtual void
- put(const Key&, const Value&) = 0;
-
- virtual void
- put(const Dbt&, const Dbt&) = 0;
-
- virtual size_t
- erase(const Key&) = 0;
-
- virtual size_t
- erase(const Dbt&) = 0;
-
- virtual size_t
- count(const Key&) const = 0;
-
- virtual size_t
- count(const Dbt&) const = 0;
-
- virtual void
- clear() = 0;
-
- virtual void
- destroy() = 0;
-
- virtual size_t
- size() const = 0;
-
- virtual void
- closeAllIterators() = 0;
-
- virtual const MapIndexBasePtr&
- index(const std::string&) const = 0;
-
- virtual void
- closeDb() = 0;
-
- virtual ConnectionPtr
- getConnection() const = 0;
-};
-
-class FREEZE_API IteratorHelper
-{
-public:
-
- static IteratorHelper*
- create(const MapHelper& m, bool readOnly);
-
- virtual
- ~IteratorHelper() ICE_NOEXCEPT_FALSE = 0;
-
- virtual IteratorHelper*
- clone() const = 0;
-
- virtual const Key*
- get() const = 0;
-
- virtual void
- get(const Key*&, const Value*&) const = 0;
-
- virtual void
- set(const Value&) = 0;
-
- virtual void
- set(const Dbt&) = 0;
-
- virtual void
- erase() = 0;
-
- virtual bool
- next() const = 0;
-};
-
-//
-// Forward declaration
-//
-template <typename key_type, typename mapped_type, typename KeyCodec, typename ValueCodec, typename Compare>
-class Map;
-template <typename key_type, typename mapped_type, typename KeyCodec, typename ValueCodec, typename Compare>
-class ConstIterator;
-
-//
-// This is necessary for MSVC support.
-//
-struct IteratorBase
-{
- typedef std::forward_iterator_tag iterator_category;
-};
-
-//
-// Database iterator. This implements a forward iterator with the
-// restriction that it's only possible to explicitly write back into
-// the database.
-//
-// Two iterators are equal if they use the same database and their
-// current records have the same key.
-//
-// TODO: It's possible to implement bidirectional iterators, if
-// necessary.
-//
-template<typename key_type, typename mapped_type, typename KeyCodec, typename ValueCodec, typename Compare>
-class Iterator : public IteratorBase
-{
-public:
-
- typedef ptrdiff_t difference_type;
-
- typedef std::pair<const key_type, const mapped_type> value_type;
-
- typedef value_type* pointer;
-
- typedef value_type& reference;
-
- Iterator(IteratorHelper* helper, const Ice::CommunicatorPtr& communicator, const Ice::EncodingVersion& encoding) :
- _helper(helper),
- _communicator(communicator),
- _encoding(encoding),
- _refValid(false)
- {
- }
-
- Iterator() :
- _encoding(Ice::Encoding_1_0),
- _refValid(false)
- {
- }
-
- Iterator(const Iterator& rhs) :
- _communicator(rhs._communicator),
- _encoding(rhs._encoding),
- _refValid(false)
- {
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
- }
-
- Iterator& operator=(const Iterator& rhs)
- {
- if(this != &rhs)
- {
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
- else
- {
- _helper.reset();
- }
- _communicator = rhs._communicator;
- _encoding = rhs._encoding;
- _refValid = false;
- }
-
- return *this;
- }
-
- ~Iterator() ICE_NOEXCEPT_FALSE
- {
- }
-
- bool operator==(const Iterator& rhs) const
- {
- if(_helper.get() == rhs._helper.get())
- {
- return true;
- }
-
- if(_helper.get() != 0 && rhs._helper.get() != 0)
- {
- const Key* lhsKey = _helper->get();
- const Key* rhsKey = rhs._helper->get();
-
- if(lhsKey != 0 && rhsKey != 0)
- {
- return *lhsKey == *rhsKey;
- }
- }
- return false;
- }
-
- bool operator!=(const Iterator& rhs) const
- {
- return !(*this == rhs);
- }
-
- Iterator& operator++()
- {
- incr();
- return *this;
- }
-
- Iterator operator++(int)
- {
- Iterator tmp = *this;
- incr();
- return tmp;
- }
-
- //
- // Note that this doesn't follow the regular iterator mapping:
- //
- // value_type& operator*(), value_type operator*() const
- //
- value_type& operator*() const
- {
- if(!_refValid)
- {
- key_type key;
- mapped_type value;
-
- getCurrentValue(key, value);
-
- //
- // !IMPORTANT!
- //
- // This method has to cache the returned value to implement
- // operator->().
- //
- const_cast<key_type&>(_ref.first) = key;
- const_cast<mapped_type&>(_ref.second) = value;
- _refValid = true;
- }
-
- return _ref;
- }
-
- value_type* operator->() { return &(operator*()); }
-
- //
- // This special method allows writing back into the database.
- //
- void set(const mapped_type& value)
- {
- assert(_helper.get());
-
- ValueCodec v(value, _communicator, _encoding);
- _helper->set(v.dbt());
- _refValid = false;
- }
-
-private:
-
- void incr()
- {
- assert(_helper.get() != 0);
- if(!_helper->next())
- {
- //
- // The iterator has been moved past the end, and is now
- // invalid.
- //
- _helper.reset();
- }
- _refValid = false;
- }
-
- void getCurrentValue(key_type& key, mapped_type& value) const
- {
- assert(_helper.get() != 0);
-
- const Key* k = 0;
- const Value* v = 0;
- _helper->get(k, v);
- assert(k != 0);
- assert(v != 0);
-
- KeyCodec::read(key, *k, _communicator, _encoding);
- ValueCodec::read(value, *v, _communicator, _encoding);
- }
-
- friend class ConstIterator<key_type, mapped_type, KeyCodec, ValueCodec, Compare>;
- friend class Map<key_type, mapped_type, KeyCodec, ValueCodec, Compare>;
-
- IceUtil::UniquePtr<IteratorHelper> _helper;
- Ice::CommunicatorPtr _communicator;
- Ice::EncodingVersion _encoding;
-
- //
- // Cached last return value. This is so that operator->() can
- // actually return a pointer. The cached value is reused across
- // multiple calls to operator->() if _refValid is true, which
- // avoids problems in certain situations. For example, if
- // _ref.second is an STL container and you use an STL algorithm
- // such as transform, STLport (debug build) asserts that the
- // addresses of the containers are the same. This would fail if
- // the same value was not returned on subsequent calls to
- // operator->().
- //
- mutable value_type _ref;
- mutable bool _refValid;
-};
-
-//
-// See Iterator comments for design notes
-//
-template <typename key_type, typename mapped_type, typename KeyCodec, typename ValueCodec, typename Compare>
-class ConstIterator : public IteratorBase
-{
-public:
-
- typedef ptrdiff_t difference_type;
-
- typedef std::pair<const key_type, const mapped_type> value_type;
-
- typedef value_type* pointer;
-
- typedef value_type& reference;
-
- ConstIterator(IteratorHelper* helper,
- const Ice::CommunicatorPtr& communicator,
- const Ice::EncodingVersion& encoding) :
- _helper(helper),
- _communicator(communicator),
- _encoding(encoding),
- _refValid(false)
- {
- }
-
- ConstIterator() :
- _encoding(Ice::Encoding_1_0),
- _refValid(false)
- {
- }
-
- ConstIterator(const ConstIterator& rhs) :
- _communicator(rhs._communicator),
- _encoding(rhs._encoding),
- _refValid(false)
- {
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
- }
-
- //
- // A Iterator can be converted to a ConstIterator (but not
- // vice versa) - same for operator=.
- //
- ConstIterator(const Iterator<key_type, mapped_type, KeyCodec, ValueCodec, Compare>& rhs) :
- _communicator(rhs._communicator),
- _encoding(rhs._encoding),
- _refValid(false)
- {
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
- }
-
- ConstIterator& operator=(const ConstIterator& rhs)
- {
- if(this != &rhs)
- {
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
- else
- {
- _helper.reset();
- }
- _communicator = rhs._communicator;
- _encoding = rhs._encoding;
- _refValid = false;
- }
-
- return *this;
- }
-
- //
- // Create const_iterator from iterator.
- //
- ConstIterator& operator=(const Iterator<key_type, mapped_type, KeyCodec, ValueCodec, Compare>& rhs)
- {
- if(rhs._helper.get() != 0)
- {
- _helper.reset(rhs._helper->clone());
- }
- else
- {
- _helper.reset();
- }
- _communicator = rhs._communicator;
- _encoding = rhs._encoding;
- _refValid = false;
-
- return *this;
- }
-
- ~ConstIterator()
- {
- }
-
- bool operator==(const ConstIterator& rhs)
- {
- if(_helper.get() == rhs._helper.get())
- {
- return true;
- }
-
- if(_helper.get() != 0 && rhs._helper.get() != 0)
- {
- const Key* lhsKey = _helper->get();
- const Key* rhsKey = rhs._helper->get();
-
- if(lhsKey != 0 && rhsKey != 0)
- {
- return *lhsKey == *rhsKey;
- }
- }
- return false;
- }
-
- bool operator!=(const ConstIterator& rhs)
- {
- return !(*this == rhs);
- }
-
- ConstIterator& operator++()
- {
- incr();
- return *this;
- }
-
- ConstIterator operator++(int)
- {
- ConstIterator tmp = *this;
- incr();
- return tmp;
- }
-
- //
- // Note that this doesn't follow the regular iterator mapping:
- //
- // value_type operator*() const
- //
- value_type& operator*() const
- {
- if(!_refValid)
- {
- key_type key;
- mapped_type value;
-
- getCurrentValue(key, value);
-
- //
- // !IMPORTANT!
- //
- // This method has to cache the returned value to implement
- // operator->().
- //
- const_cast<key_type&>(_ref.first) = key;
- const_cast<mapped_type&>(_ref.second) = value;
- _refValid = true;
- }
-
- return _ref;
- }
-
- pointer operator->() const { return &(operator*()); }
-
-private:
-
- void incr()
- {
- assert(_helper.get() != 0);
- if(!_helper->next())
- {
- //
- // The iterator has been moved past the end, and is now
- // invalid.
- //
- _helper.reset();
- }
- _refValid = false;
- }
-
- void getCurrentValue(key_type& key, mapped_type& value) const
- {
- assert(_helper.get() != 0);
-
- const Key* k = 0;
- const Value* v = 0;
- _helper->get(k, v);
- assert(k != 0);
- assert(v != 0);
-
- KeyCodec::read(key, *k, _communicator, _encoding);
- ValueCodec::read(value, *v, _communicator, _encoding);
- }
-
- friend class Map<key_type, mapped_type, KeyCodec, ValueCodec, Compare>;
-
- IceUtil::UniquePtr<IteratorHelper> _helper;
- Ice::CommunicatorPtr _communicator;
- Ice::EncodingVersion _encoding;
-
- //
- // Cached last return value. This is so that operator->() can
- // actually return a pointer. The cached value is reused across
- // multiple calls to operator->() if _refValid is true, which
- // avoids problems in certain situations. For example, if
- // _ref.second is an STL container and you use an STL algorithm
- // such as transform, STLport (debug build) asserts that the
- // addresses of the containers are the same. This would fail
- // if the same value was not returned on subsequent calls
- // to operator->().
- //
- mutable value_type _ref;
- mutable bool _refValid;
-};
-
-struct IceEncodingCompare {};
-
-template<typename key_type, typename KeyCodec, typename Compare>
-class KeyCompare : public KeyCompareBase
-{
-public:
-
- KeyCompare(const Compare& mapCompare,
- const Ice::CommunicatorPtr& communicator,
- const Ice::EncodingVersion& encoding) :
- KeyCompareBase(true),
- _compare(mapCompare),
- _communicator(communicator),
- _encoding(encoding)
- {}
-
- virtual int compare(const Key& dbKey1, const Key& dbKey2)
- {
- key_type key1;
- KeyCodec::read(key1, dbKey1, _communicator, _encoding);
- key_type key2;
- KeyCodec::read(key2, dbKey2, _communicator, _encoding);
-
- if(_compare(key1, key2))
- {
- return -1;
- }
- else if(_compare(key2, key1))
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
-
-private:
-
- Compare _compare;
- const Ice::CommunicatorPtr _communicator;
- const Ice::EncodingVersion _encoding;
-};
-
-//
-// Partial template specialization:
-// do nothing for the IceEncodingCompare comparator
-//
-template<typename key_type, typename KeyCodec>
-class KeyCompare<key_type, KeyCodec, IceEncodingCompare> : public KeyCompareBase
-{
-public:
-
- KeyCompare(const IceEncodingCompare&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&):
- KeyCompareBase(false)
- {}
-
- virtual int compare(const Key&, const Key&)
- {
- assert(0);
- return 0;
- }
-};
-
-//
-// Need to separate MapIndex template class because _communicator is
-// set later
-//
-template<typename key_type, typename KeyCodec, typename Compare>
-class MapIndex : public MapIndexBase
-{
-public:
-
- virtual int compare(const Key& dbKey1, const Key& dbKey2)
- {
- key_type key1;
- KeyCodec::read(key1, dbKey1, _communicator, _encoding);
- key_type key2;
- KeyCodec::read(key2, dbKey2, _communicator, _encoding);
-
- if(_compare(key1, key2))
- {
- return -1;
- }
- else if(_compare(key2, key1))
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
-
-protected:
-
- MapIndex(const std::string& mapName, const Compare& mapCompare) :
- MapIndexBase(mapName, true),
- _compare(mapCompare)
- {}
-
-private:
-
- Compare _compare;
-};
-
-//
-// Partial template specialization:
-// do nothing for the IceEncodingCompare comparator
-//
-template<typename key_type, typename KeyCodec>
-class MapIndex<key_type, KeyCodec, IceEncodingCompare> : public MapIndexBase
-{
-public:
-
- virtual int compare(const Key&, const Key&)
- {
- assert(0);
- return 0;
- }
-
-protected:
-
- MapIndex(const std::string& mapName, const IceEncodingCompare&):
- MapIndexBase(mapName, false)
- {}
-};
-
-class FREEZE_API MapCodecBase
-{
-public:
-
- const Dbt& dbt() const { return *_dbt; }
-
-protected:
-
- MapCodecBase(const Ice::CommunicatorPtr&, const Ice::EncodingVersion&);
- ~MapCodecBase();
-
- void init();
-
- IceInternal::BasicStream _stream;
- Dbt* _dbt;
-};
-
-//
-// Codec template for all key types. Marshaled keys are NOT encapsulated.
-//
-template<typename T>
-class MapKeyCodec : public MapCodecBase
-{
-public:
-
- //
- // Use the constructor to marshal a value while avoiding unnecessary copies of the
- // marshaled data. The inherited dbt() accessor provides a Dbt value initialized with
- // the marshaled bytes.
- //
- MapKeyCodec(const T& v, const Ice::CommunicatorPtr& communicator, const Ice::EncodingVersion& encoding) :
- MapCodecBase(communicator, encoding)
- {
- _stream.write(v);
- init();
- }
-
- template<typename U> static void write(const U& v, std::vector<Ice::Byte>& bytes,
- const Ice::CommunicatorPtr& communicator,
- const Ice::EncodingVersion& encoding)
- {
- IceInternal::BasicStream stream(IceInternal::getInstance(communicator).get(), encoding);
- stream.write(v);
- std::vector<Ice::Byte>(stream.b.begin(), stream.b.end()).swap(bytes);
- }
-
- template<typename U> static void read(U& v, const std::vector<Ice::Byte>& bytes,
- const Ice::CommunicatorPtr& communicator,
- const Ice::EncodingVersion& encoding)
- {
- IceInternal::BasicStream stream(IceInternal::getInstance(communicator).get(), encoding, &bytes[0],
- &bytes[0] + bytes.size());
- stream.read(v);
- }
-};
-
-//
-// Codec template for all value types except those that use classes. Marshaled values are encapsulated.
-//
-template<typename T>
-class MapValueCodec : public MapCodecBase
-{
-public:
-
- //
- // Use the constructor to marshal a value while avoiding unnecessary copies of the
- // marshaled data. The inherited dbt() accessor provides a Dbt value initialized with
- // the marshaled bytes.
- //
- MapValueCodec(const T& v, const Ice::CommunicatorPtr& communicator, const Ice::EncodingVersion& encoding) :
- MapCodecBase(communicator, encoding)
- {
- _stream.startWriteEncaps();
- _stream.write(v);
- _stream.endWriteEncaps();
- init();
- }
-
- template<typename U> static void write(const U& v, std::vector<Ice::Byte>& bytes,
- const Ice::CommunicatorPtr& communicator,
- const Ice::EncodingVersion& encoding)
- {
- IceInternal::BasicStream stream(IceInternal::getInstance(communicator).get(), encoding);
- stream.startWriteEncaps();
- stream.write(v);
- stream.endWriteEncaps();
- std::vector<Ice::Byte>(stream.b.begin(), stream.b.end()).swap(bytes);
- }
-
- template<typename U> static void read(U& v, const std::vector<Ice::Byte>& bytes,
- const Ice::CommunicatorPtr& communicator,
- const Ice::EncodingVersion& encoding)
- {
- IceInternal::BasicStream stream(IceInternal::getInstance(communicator).get(), encoding, &bytes[0],
- &bytes[0] + bytes.size());
- stream.startReadEncaps();
- stream.read(v);
- stream.endReadEncaps();
- }
-};
-
-//
-// Codec template for all value types that use classes. Marshaled values are encapsulated.
-//
-template<typename T>
-class MapObjectValueCodec : public MapCodecBase
-{
-public:
-
- //
- // Use the constructor to marshal a value while avoiding unnecessary copies of the
- // marshaled data. The inherited dbt() accessor provides a Dbt value initialized with
- // the marshaled bytes.
- //
- MapObjectValueCodec(const T& v, const Ice::CommunicatorPtr& communicator, const Ice::EncodingVersion& encoding) :
- MapCodecBase(communicator, encoding)
- {
- _stream.startWriteEncaps();
- _stream.write(v);
- _stream.writePendingObjects();
- _stream.endWriteEncaps();
- init();
- }
-
- template<typename U> static void write(const U& v, std::vector<Ice::Byte>& bytes,
- const Ice::CommunicatorPtr& communicator,
- const Ice::EncodingVersion& encoding)
- {
- IceInternal::BasicStream stream(IceInternal::getInstance(communicator).get(), encoding);
- stream.startWriteEncaps();
- stream.write(v);
- stream.writePendingObjects();
- stream.endWriteEncaps();
- std::vector<Ice::Byte>(stream.b.begin(), stream.b.end()).swap(bytes);
- }
-
- template<typename U> static void read(U& v, const std::vector<Ice::Byte>& bytes,
- const Ice::CommunicatorPtr& communicator,
- const Ice::EncodingVersion& encoding)
- {
- IceInternal::BasicStream stream(IceInternal::getInstance(communicator).get(), encoding, &bytes[0],
- &bytes[0] + bytes.size());
- stream.sliceObjects(false);
- stream.startReadEncaps();
- stream.read(v);
- stream.readPendingObjects();
- stream.endReadEncaps();
- }
-};
-
-//
-// A sorted map, similar to a std::map, with one notable difference:
-// operator[] is not provided.
-//
-//
-// TODO: implement bidirectional iterators.
-//
-template<typename key_type, typename mapped_type,
- typename KeyCodec, typename ValueCodec,
- typename Compare = IceEncodingCompare>
-class Map
-{
-public:
-
- typedef std::pair<const key_type, const mapped_type> value_type;
-
- typedef Iterator<key_type, mapped_type, KeyCodec, ValueCodec, Compare> iterator;
- typedef ConstIterator<key_type, mapped_type, KeyCodec, ValueCodec, Compare> const_iterator;
-
- //
- // No definition for reference, const_reference, pointer or
- // const_pointer.
- //
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
-
- //
- // Allocators are not supported.
- //
- // allocator_type
- //
-
- //
- // Constructors
- //
- Map(const Freeze::ConnectionPtr& connection,
- const std::string& dbName,
- const std::string& keyTypeId,
- const std::string& valueTypeId,
- bool createDb = true,
- const Compare& compare = Compare()) :
- _communicator(connection->getCommunicator()),
- _encoding(connection->getEncoding())
- {
- KeyCompareBasePtr keyCompare = new KeyCompare<key_type, KeyCodec, Compare>(compare, _communicator, _encoding);
- std::vector<MapIndexBasePtr> indices;
-
- _helper.reset(MapHelper::create(connection, dbName, keyTypeId, valueTypeId, keyCompare, indices, createDb));
- }
-
- template<class _InputIterator>
- Map(const Freeze::ConnectionPtr& connection,
- const std::string& dbName,
- const std::string& keyTypeId,
- const std::string& valueTypeId,
- bool createDb,
- _InputIterator first, _InputIterator last,
- const Compare& compare = Compare()) :
- _communicator(connection->getCommunicator()),
- _encoding(connection->getEncoding())
- {
- KeyCompareBasePtr keyCompare = new KeyCompare<key_type, KeyCodec, Compare>(compare, _communicator, _encoding);
-
- std::vector<MapIndexBasePtr> indices;
-
- _helper.reset(MapHelper::create(connection, dbName, keyTypeId, valueTypeId, keyCompare, indices, createDb));
-
- while(first != last)
- {
- put(*first);
- ++first;
- }
- }
-
- ~Map()
- {
- }
-
- // static void recreate(const Freeze::ConnectionPtr& connection,
- // const std::string& dbName,
- // const Compare& compare = Compare())
- // {
- // KeyCompareBasePtr keyCompare = new KeyCompare<key_type, KeyCodec, Compare>(compare,
- // connection->getCommunicator(),
- // connection->getEncoding());
-
- // std::vector<MapIndexBasePtr> indices;
- // MapHelper::recreate(connection, dbName, KeyCodec::typeId(), ValueCodec::typeId(), keyCompare, indices);
- // }
-
-
- bool operator==(const Map& rhs) const
- {
- //
- // This does a memberwise equality for the entire contents of
- // the database. While slow this is always correct. Database
- // equality is not necessarily correct in the context of a
- // transaction.
- //
- if(size() != rhs.size())
- {
- return false;
- }
-
- for(const_iterator p = rhs.begin() ; p != rhs.end() ; ++p)
- {
- const_iterator q = rhs.find(p->first);
- if(q == rhs.end())
- {
- return false;
- }
- if(p->second != q->second)
- {
- return false;
- }
- }
- return true;
- }
-
- bool operator!=(const Map& rhs) const
- {
- return !(*this == rhs);
- }
-
- void swap(Map& rhs)
- {
- MapHelper* tmp = _helper.release();
- _helper.reset(rhs._helper.release());
- rhs._helper.reset(tmp);
-
- Ice::CommunicatorPtr tmpCom = _communicator;
- Ice::EncodingVersion tmpEnc = _encoding;
- _communicator = rhs._communicator;
- _encoding = rhs._encoding;
- rhs._communicator = tmpCom;
- rhs._encoding = tmpEnc;
- }
-
- iterator begin()
- {
- try
- {
- return iterator(IteratorHelper::create(*_helper.get(), false), _communicator, _encoding);
- }
- catch(const NotFoundException&)
- {
- return iterator();
- }
- }
- const_iterator begin() const
- {
- try
- {
- return const_iterator(IteratorHelper::create(*_helper.get(), true), _communicator, _encoding);
- }
- catch(const NotFoundException&)
- {
- return const_iterator();
- }
- }
-
- iterator end()
- {
- return iterator();
- }
-
- const_iterator end() const
- {
- return const_iterator();
- }
-
- bool empty() const
- {
- return size() == 0;
- }
-
- size_type size() const
- {
- return _helper->size();
- }
-
- size_type max_size() const
- {
- return 0xffffffff; // TODO: is this the max?
- }
-
- //
- // This method isn't implemented.
- //
- // mapped_type& operator[](const key_type& key)
- //
-
- //
- // This method isn't in the STLport library - but it's referenced
- // in "STL Tutorial and Reference Guide, Second Edition". It's not
- // currently implemented.
- //
- // const mapped_type& operator[](const key_type& key) const;
- //
-
- //
- // No allocators.
- //
- //allocator_type get_allocator() const;
- //
-
- iterator insert(iterator /*position*/, const value_type& key)
- {
- //
- // position is ignored.
- //
- KeyCodec k(key.first, _communicator, _encoding);
-
- iterator r = iterator(_helper->find(k.dbt(), false), _communicator, _encoding);
-
- if(r == end())
- {
- ValueCodec v(key.second, _communicator, _encoding);
-
- _helper->put(k.dbt(), v.dbt());
- r = iterator(_helper->find(k.dbt(), false), _communicator, _encoding);
- }
-
- return r;
- }
-
- std::pair<iterator, bool> insert(const value_type& key)
- {
- KeyCodec k(key.first, _communicator, _encoding);
-
- iterator r = iterator(_helper->find(k.dbt(), false), _communicator, _encoding);
- bool inserted = false;
-
- if(r == end())
- {
- ValueCodec v(key.second, _communicator, _encoding);
-
- _helper->put(k.dbt(), v.dbt());
- inserted = true;
- r = iterator(_helper->find(k.dbt(), false), _communicator, _encoding);
- }
-
- return std::pair<iterator, bool>(r, inserted);
- }
-
- template <typename InputIterator>
- void insert(InputIterator first, InputIterator last)
- {
- while(first != last)
- {
- insert(*first);
- ++first;
- }
- }
-
- void put(const value_type& key)
- {
- //
- // insert or replace
- //
- KeyCodec k(key.first, _communicator, _encoding);
- ValueCodec v(key.second, _communicator, _encoding);
-
- _helper->put(k.dbt(), v.dbt());
- }
-
- template <typename InputIterator>
- void put(InputIterator first, InputIterator last)
- {
- while(first != last)
- {
- put(*first);
- ++first;
- }
- }
-
- void erase(iterator position)
- {
- assert(position._helper.get() != 0);
- position._helper->erase();
- }
-
- size_type erase(const key_type& key)
- {
- KeyCodec k(key, _communicator, _encoding);
-
- return _helper->erase(k.dbt());
- }
-
- void erase(iterator first, iterator last)
- {
- while(first != last)
- {
- first._helper->erase();
- ++first;
- }
- }
-
- void clear()
- {
- _helper->clear();
- }
-
- //
- // destroy is not a standard function
- //
- void destroy()
- {
- _helper->destroy();
- }
-
- //
- // closeDb closes the underlying Berkeley DB database
- //
- void closeDb()
- {
- _helper->closeDb();
- }
-
- iterator find(const key_type& key)
- {
- KeyCodec k(key, _communicator, _encoding);
-
- return iterator(_helper->find(k.dbt(), false), _communicator, _encoding);
- }
-
- const_iterator find(const key_type& key) const
- {
- KeyCodec k(key, _communicator, _encoding);
-
- return const_iterator(_helper->find(k.dbt(), true), _communicator, _encoding);
- }
-
- size_type count(const key_type& key) const
- {
- KeyCodec k(key, _communicator, _encoding);
-
- return _helper->count(k.dbt());
- }
-
- iterator lower_bound(const key_type& key)
- {
- Key k;
- KeyCodec::write(key, k, _communicator, _encoding);
-
- return iterator(_helper->lowerBound(k, false), _communicator, _encoding);
- }
-
- const_iterator lower_bound(const key_type& key) const
- {
- Key k;
- KeyCodec::write(key, k, _communicator, _encoding);
-
- return iterator(_helper->lowerBound(k, true), _communicator, _encoding);
- }
-
- iterator upper_bound(const key_type& key)
- {
- Key k;
- KeyCodec::write(key, k, _communicator, _encoding);
-
- return iterator(_helper->upperBound(k, false), _communicator, _encoding);
- }
-
- const_iterator upper_bound(const key_type& key) const
- {
- Key k;
- KeyCodec::write(key, k, _communicator, _encoding);
-
- return iterator(_helper->upperBound(k, true), _communicator, _encoding);
- }
-
- std::pair<iterator, iterator> equal_range(const key_type& key)
- {
- return std::make_pair(lower_bound(key), upper_bound(key));
- }
-
- std::pair<const_iterator, const_iterator> equal_range(const key_type& key) const
- {
- return std::make_pair(lower_bound(key), upper_bound(key));
- }
-
- const Ice::CommunicatorPtr& communicator() const
- {
- return _communicator;
- }
-
- //
- // getConnection returns the associated connection
- //
- ConnectionPtr getConnection() const
- {
- return _helper->getConnection();
- }
-
-protected:
-
- Map(const Ice::CommunicatorPtr& mapCommunicator, const Ice::EncodingVersion& encoding) :
- _communicator(mapCommunicator),
- _encoding(encoding)
- {
- }
-
- IceUtil::UniquePtr<MapHelper> _helper;
- Ice::CommunicatorPtr _communicator;
- Ice::EncodingVersion _encoding;
-};
-
-}
-
-#endif
diff --git a/cpp/include/Freeze/TransactionHolder.h b/cpp/include/Freeze/TransactionHolder.h
deleted file mode 100644
index d61b86d7226..00000000000
--- a/cpp/include/Freeze/TransactionHolder.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef FREEZE_TRANSACTION_HOLDER_H
-#define FREEZE_TRANSACTION_HOLDER_H
-
-#include <Freeze/Connection.h>
-#include <Freeze/Transaction.h>
-
-namespace Freeze
-{
-
-class FREEZE_API TransactionHolder
-{
-public:
-
- TransactionHolder(const ConnectionPtr&);
-
- ~TransactionHolder();
-
- void
- commit();
-
- void
- rollback();
-
-private:
-
- //
- // Not implemented
- //
- TransactionHolder(const TransactionHolder&);
-
- TransactionHolder&
- operator=(const TransactionHolder&);
-
- TransactionPtr _transaction;
-};
-
-}
-
-#endif
diff --git a/cpp/include/Glacier2/.gitignore b/cpp/include/Glacier2/.gitignore
deleted file mode 100644
index 382c7a11d64..00000000000
--- a/cpp/include/Glacier2/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-// Generated by makegitignore.py
-
-// IMPORTANT: Do not edit this file -- any edits made here will be lost!
-Metrics.h
-PermissionsVerifierF.h
-PermissionsVerifier.h
-Router.h
-RouterF.h
-Session.h
-SSLInfo.h
diff --git a/cpp/include/Glacier2/.headers b/cpp/include/Glacier2/.headers
deleted file mode 100644
index 05f3ad31278..00000000000
--- a/cpp/include/Glacier2/.headers
+++ /dev/null
@@ -1,13 +0,0 @@
-SDK_HEADERS = \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Application.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Config.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Glacier2.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Metrics.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\NullPermissionsVerifier.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PermissionsVerifier.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PermissionsVerifierF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Router.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\RouterF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Session.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SessionHelper.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SSLInfo.h \
diff --git a/cpp/include/Glacier2/Application.h b/cpp/include/Glacier2/Application.h
index 97e454b6c98..96c06e6c07b 100644
--- a/cpp/include/Glacier2/Application.h
+++ b/cpp/include/Glacier2/Application.h
@@ -23,13 +23,14 @@ namespace Glacier2
* This exception is raised if the session should be restarted.
*
**/
-class GLACIER2_API RestartSessionException : public IceUtil::Exception
+class GLACIER2_API RestartSessionException : public IceUtil::ExceptionHelper<RestartSessionException>
{
public:
- virtual std::string ice_name() const;
+ virtual std::string ice_id() const;
+#ifndef ICE_CPP11_MAPPING
virtual RestartSessionException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
};
/**
@@ -118,7 +119,7 @@ public:
* @return The Glacier2 session.
**/
- virtual Glacier2::SessionPrx createSession() = 0;
+ virtual Glacier2::SessionPrxPtr createSession() = 0;
/**
* Called to restart the application's Glacier2 session. This
@@ -148,7 +149,7 @@ public:
* Returns the Glacier2 router proxy
* @return The router proxy.
**/
- static Glacier2::RouterPrx router()
+ static Glacier2::RouterPrxPtr router()
{
return _router;
}
@@ -157,7 +158,7 @@ public:
* Returns the Glacier2 session proxy
* @return The session proxy.
**/
- static Glacier2::SessionPrx session()
+ static Glacier2::SessionPrxPtr session()
{
return _session;
}
@@ -183,7 +184,7 @@ public:
* @param servant The servant to add.
* @return The proxy for the servant.
**/
- Ice::ObjectPrx addWithUUID(const Ice::ObjectPtr& servant);
+ Ice::ObjectPrxPtr addWithUUID(const Ice::ObjectPtr& servant);
/**
* Creates an object adapter for callback objects.
@@ -211,8 +212,8 @@ private:
}
static Ice::ObjectAdapterPtr _adapter;
- static Glacier2::RouterPrx _router;
- static Glacier2::SessionPrx _session;
+ static Glacier2::RouterPrxPtr _router;
+ static Glacier2::SessionPrxPtr _session;
static bool _createdSession;
static std::string _category;
};
diff --git a/cpp/include/Glacier2/Config.h b/cpp/include/Glacier2/Config.h
index cf53d71c908..79a4144cf95 100644
--- a/cpp/include/Glacier2/Config.h
+++ b/cpp/include/Glacier2/Config.h
@@ -11,28 +11,22 @@
#define GLACIER2_CONFIG_H
//
-// Automatically link with Glacier2[D].lib
+// Automatically link with Glacier2[D|++11|++11D].lib
//
#if !defined(ICE_BUILDING_GLACIER2) && defined(GLACIER2_API_EXPORTS)
# define ICE_BUILDING_GLACIER2
#endif
-#ifdef _MSC_VER
-# if !defined(ICE_BUILDING_GLACIER2)
-# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
-# pragma comment(lib, "Glacier2D.lib")
-# else
-# pragma comment(lib, "Glacier2.lib")
-# endif
-# endif
+#if defined(_MSC_VER) && !defined(ICE_BUILDING_GLACIER2)
+# pragma comment(lib, ICE_LIBNAME("Glacier2"))
#endif
#ifndef GLACIER2_API
-# ifdef GLACIER2_API_EXPORTS
-# define GLACIER2_API ICE_DECLSPEC_EXPORT
-# elif defined(ICE_STATIC_LIBS)
+# if defined(ICE_STATIC_LIBS)
# define GLACIER2_API /**/
+# elif defined(GLACIER2_API_EXPORTS)
+# define GLACIER2_API ICE_DECLSPEC_EXPORT
# else
# define GLACIER2_API ICE_DECLSPEC_IMPORT
# endif
diff --git a/cpp/include/Glacier2/Glacier2.h b/cpp/include/Glacier2/Glacier2.h
index 08fddebda7b..760187ce073 100644
--- a/cpp/include/Glacier2/Glacier2.h
+++ b/cpp/include/Glacier2/Glacier2.h
@@ -11,12 +11,12 @@
#define GLACIER2_H
#include <IceUtil/PushDisableWarnings.h>
-#include <IceUtil/Config.h>
+#include <Ice/Config.h>
#include <Glacier2/Router.h>
#include <Glacier2/Session.h>
#include <Glacier2/PermissionsVerifier.h>
#include <Glacier2/Metrics.h>
-#if (!defined(__APPLE__) || TARGET_OS_IPHONE == 0) && !defined(ICE_OS_WINRT)
+#if (!defined(__APPLE__) || TARGET_OS_IPHONE == 0) && !defined(ICE_OS_UWP)
# include <Glacier2/Application.h>
#endif
#include <Glacier2/SessionHelper.h>
diff --git a/cpp/include/Glacier2/Makefile b/cpp/include/Glacier2/Makefile
deleted file mode 100644
index 8b492de255c..00000000000
--- a/cpp/include/Glacier2/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ../..
-
-include $(top_srcdir)/config/Make.rules
-
-install::
- @if test ! -d $(DESTDIR)$(install_includedir)/Glacier2 ; \
- then \
- echo "Creating $(DESTDIR)$(install_includedir)/Glacier2..." ; \
- $(call mkdir,$(DESTDIR)$(install_includedir)/Glacier2) ; \
- fi
-
- @for i in *.h ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/Glacier2/$$i ; \
- chmod a+r $(DESTDIR)$(install_includedir)/Glacier2/$$i ; \
- done
diff --git a/cpp/include/Glacier2/Makefile.mak b/cpp/include/Glacier2/Makefile.mak
deleted file mode 100644
index 1a3980832cb..00000000000
--- a/cpp/include/Glacier2/Makefile.mak
+++ /dev/null
@@ -1,40 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..\..
-INCLUDE_DIR = Glacier2
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-!if "$(WINRT)" != "yes"
-
-install::
- @if not exist "$(install_includedir)\Glacier2" \
- @echo "Creating $(install_includedir)\Glacier2..." && \
- $(MKDIR) "$(install_includedir)\Glacier2"
-
- @for %i in ( *.h ) do \
- @echo Installing %i && \
- copy %i "$(install_includedir)\Glacier2"
-
-!else
-
-all::
- @echo SDK_HEADERS = \> .headers
- @for /f %i in ('dir /b *.h') do \
- @echo ^ $$(SDK_INCLUDE_PATH)\$$(INCLUDE_DIR)\%i \>> .headers
-
-
-!include .headers
-
-all:: $(SDK_HEADERS)
-
-install:: all
-
-!endif
diff --git a/cpp/include/Glacier2/NullPermissionsVerifier.h b/cpp/include/Glacier2/NullPermissionsVerifier.h
index 5a8ad0545f8..6007ff89e4b 100644
--- a/cpp/include/Glacier2/NullPermissionsVerifier.h
+++ b/cpp/include/Glacier2/NullPermissionsVerifier.h
@@ -16,10 +16,10 @@
#include <vector>
#ifndef GLACIER2_API
-# ifdef GLACIER2_API_EXPORTS
-# define GLACIER2_API ICE_DECLSPEC_EXPORT
-# elif defined(ICE_STATIC_LIBS)
+# if defined(ICE_STATIC_LIBS)
# define GLACIER2_API /**/
+# elif defined(GLACIER2_API_EXPORTS)
+# define GLACIER2_API ICE_DECLSPEC_EXPORT
# else
# define GLACIER2_API ICE_DECLSPEC_IMPORT
# endif
diff --git a/cpp/include/Glacier2/SessionHelper.h b/cpp/include/Glacier2/SessionHelper.h
index d591b073399..f2d26d3779a 100644
--- a/cpp/include/Glacier2/SessionHelper.h
+++ b/cpp/include/Glacier2/SessionHelper.h
@@ -33,39 +33,50 @@ namespace Glacier2
const int GLACIER2_SSL_PORT = 4064;
const int GLACIER2_TCP_PORT = 4063;
-class GLACIER2_API SessionHelper : public IceUtil::Shared
+class GLACIER2_API SessionHelper
+#ifndef ICE_CPP11_MAPPING
+ : public virtual IceUtil::Shared
+#endif
{
-
public:
+ virtual ~SessionHelper();
virtual void destroy() = 0;
virtual Ice::CommunicatorPtr communicator() const = 0;
virtual std::string categoryForClient() const = 0;
- virtual Ice::ObjectPrx addWithUUID(const Ice::ObjectPtr&) = 0;
- virtual Glacier2::SessionPrx session() const = 0;
+ virtual Ice::ObjectPrxPtr addWithUUID(const Ice::ObjectPtr&) = 0;
+ virtual Glacier2::SessionPrxPtr session() const = 0;
virtual bool isConnected() const = 0;
virtual Ice::ObjectAdapterPtr objectAdapter() = 0;
bool operator==(const Glacier2::SessionHelper&) const;
bool operator!=(const Glacier2::SessionHelper&) const;
};
-typedef IceUtil::Handle<SessionHelper> SessionHelperPtr;
+ICE_DEFINE_PTR(SessionHelperPtr, SessionHelper);
-class GLACIER2_API SessionCallback : virtual public IceUtil::Shared
+class GLACIER2_API SessionCallback
+#ifndef ICE_CPP11_MAPPING
+ : public virtual IceUtil::Shared
+#endif
{
-
public:
+ virtual ~SessionCallback();
virtual void createdCommunicator(const SessionHelperPtr& session) = 0;
virtual void connected(const SessionHelperPtr&) = 0;
virtual void disconnected(const SessionHelperPtr&) = 0;
virtual void connectFailed(const SessionHelperPtr&, const Ice::Exception&) = 0;
};
-typedef IceUtil::Handle<SessionCallback> SessionCallbackPtr;
+ICE_DEFINE_PTR(SessionCallbackPtr, SessionCallback);
class SessionThreadCallback;
-class GLACIER2_API SessionFactoryHelper : public IceUtil::Shared
+class GLACIER2_API SessionFactoryHelper
+#ifdef ICE_CPP11_MAPPING
+ : public std::enable_shared_from_this<SessionFactoryHelper>
+#else
+ : public virtual IceUtil::Shared
+#endif
{
friend class SessionThreadCallback; // To access thread functions
@@ -131,7 +142,7 @@ private:
bool _useCallbacks;
std::map<const SessionHelper*, IceUtil::ThreadPtr> _threads;
};
-typedef IceUtil::Handle<SessionFactoryHelper> SessionFactoryHelperPtr;
+ICE_DEFINE_PTR(SessionFactoryHelperPtr, SessionFactoryHelper);
}
diff --git a/cpp/include/Ice/.gitignore b/cpp/include/Ice/.gitignore
deleted file mode 100644
index a8a61279201..00000000000
--- a/cpp/include/Ice/.gitignore
+++ /dev/null
@@ -1,42 +0,0 @@
-// Generated by makegitignore.py
-
-// IMPORTANT: Do not edit this file -- any edits made here will be lost!
-BuiltinSequences.h
-Communicator.h
-CommunicatorF.h
-Connection.h
-ConnectionF.h
-Current.h
-Endpoint.h
-EndpointF.h
-EndpointTypes.h
-FacetMap.h
-Identity.h
-ImplicitContext.h
-ImplicitContextF.h
-Instrumentation.h
-InstrumentationF.h
-LocalException.h
-Locator.h
-LocatorF.h
-Logger.h
-LoggerF.h
-Metrics.h
-ObjectAdapter.h
-ObjectAdapterF.h
-ObjectFactory.h
-ObjectFactoryF.h
-Plugin.h
-PluginF.h
-Process.h
-ProcessF.h
-Properties.h
-PropertiesAdmin.h
-PropertiesF.h
-RemoteLogger.h
-Router.h
-RouterF.h
-ServantLocator.h
-ServantLocatorF.h
-SliceChecksumDict.h
-Version.h
diff --git a/cpp/include/Ice/.headers b/cpp/include/Ice/.headers
deleted file mode 100644
index b75f9b51670..00000000000
--- a/cpp/include/Ice/.headers
+++ /dev/null
@@ -1,106 +0,0 @@
-SDK_HEADERS = \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ACMF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Application.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\AsyncResult.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\AsyncResultF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\BasicStream.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\BatchRequestInterceptor.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\BatchRequestQueueF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Buffer.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\BuiltinSequences.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Communicator.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\CommunicatorAsync.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\CommunicatorF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Config.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Connection.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionAsync.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionFactoryF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionIF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Current.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\DefaultObjectFactory.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\DeprecatedStringConverter.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Dispatcher.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\DispatchInterceptor.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\DynamicLibrary.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\DynamicLibraryF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Endpoint.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\EndpointF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\EndpointTypes.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Exception.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\FacetMap.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\FactoryTable.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\FactoryTableInit.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Format.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Functional.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\GCObject.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Handle.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Ice.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Identity.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ImplicitContext.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ImplicitContextF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Incoming.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IncomingAsync.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IncomingAsyncF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Initialize.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\InstanceF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Instrumentation.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\InstrumentationF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LocalException.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LocalObject.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LocalObjectF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Locator.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LocatorF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Logger.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LoggerF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\LoggerUtil.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Metrics.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MetricsAdminI.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MetricsFunctional.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MetricsObserverI.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\NativePropertiesAdmin.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Object.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectAdapter.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectAdapterF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectAdapterFactoryF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectFactory.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectFactoryF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObjectFactoryManagerF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ObserverHelper.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Outgoing.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\OutgoingAsync.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\OutgoingAsyncF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Plugin.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PluginF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Process.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ProcessF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Properties.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PropertiesAdmin.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PropertiesF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Protocol.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Proxy.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ProxyF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ProxyFactoryF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ProxyHandle.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ReferenceF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\RegisterPlugins.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\RemoteLogger.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\RequestHandlerF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ResponseHandlerF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Router.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\RouterF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ServantLocator.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ServantLocatorF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ServantManagerF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Service.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SliceChecksumDict.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SliceChecksums.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SlicedData.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SlicedDataF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Stream.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\StreamF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\StreamHelpers.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ThreadPoolF.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\UserExceptionFactory.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Version.h \
diff --git a/cpp/include/Ice/ACMF.h b/cpp/include/Ice/ACMF.h
deleted file mode 100644
index 435b76a10e1..00000000000
--- a/cpp/include/Ice/ACMF.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_ACM_F_H
-#define ICE_ACM_F_H
-
-#include <IceUtil/Shared.h>
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class ACMMonitor;
-ICE_API IceUtil::Shared* upCast(ACMMonitor*);
-typedef IceInternal::Handle<ACMMonitor> ACMMonitorPtr;
-
-class FactoryACMMonitor;
-ICE_API IceUtil::Shared* upCast(FactoryACMMonitor*);
-typedef IceInternal::Handle<FactoryACMMonitor> FactoryACMMonitorPtr;
-
-}
-
-#endif
diff --git a/cpp/include/Ice/Application.h b/cpp/include/Ice/Application.h
index d1670960191..379542896d3 100644
--- a/cpp/include/Ice/Application.h
+++ b/cpp/include/Ice/Application.h
@@ -10,52 +10,25 @@
#ifndef ICE_APPLICATION_H
#define ICE_APPLICATION_H
-#include <Ice/Ice.h>
-
+#include <Ice/Initialize.h>
#include <IceUtil/Mutex.h>
+#include <IceUtil/Cond.h>
namespace Ice
{
- enum SignalPolicy { HandleSignals, NoSignalHandling } ;
- class Application;
-}
-
-namespace IceInternal
-{
-
-namespace Application
-{
- extern ICE_API IceUtil::Mutex* mutex;
- extern ICE_API IceUtil::Cond* _condVar;
-
- //
- // Variables than can change while run() and communicator->destroy() are running!
- //
- extern ICE_API bool _callbackInProgress;
- extern ICE_API bool _destroyed;
- extern ICE_API bool _interrupted;
-
- //
- // Variables that are immutable during run() and until communicator->destroy() has returned;
- // before and after run(), and once communicator->destroy() has returned, we assume that
- // only the main thread and CtrlCHandler threads are running.
- //
- extern ICE_API std::string _appName;
- extern ICE_API Ice::CommunicatorPtr _communicator;
- extern ICE_API Ice::SignalPolicy _signalPolicy;
- extern ICE_API Ice::Application* _application;
-}
-}
-
-namespace Ice
-{
+#ifdef ICE_CPP11_MAPPING
+enum class SignalPolicy : unsigned char
+#else
+enum SignalPolicy
+#endif
+{ HandleSignals, NoSignalHandling };
class ICE_API Application : private IceUtil::noncopyable
{
public:
- Application(SignalPolicy = HandleSignals);
+ Application(SignalPolicy = ICE_ENUM(SignalPolicy, HandleSignals));
virtual ~Application();
//
@@ -143,12 +116,36 @@ protected:
virtual int doMain(int, char*[], const Ice::InitializationData&);
-#if defined(__SUNPRO_CC)
-//
-// Sun C++ 5.x does not like classes with no data members
-//
- char _dummy;
-#endif
+ //
+ // _mutex and _condVar are used to synchronize the main thread and
+ // the CtrlCHandler thread
+ //
+ static IceUtil::Mutex _mutex;
+ static IceUtil::Cond _condVar;
+
+ //
+ // Variables than can change while run() and communicator->destroy() are running!
+ //
+ static bool _callbackInProgress;
+ static bool _destroyed;
+ static bool _interrupted;
+
+ //
+ // Variables that are immutable during run() and until communicator->destroy() has returned;
+ // before and after run(), and once communicator->destroy() has returned, we assume that
+ // only the main thread and CtrlCHandler threads are running.
+ //
+ static std::string _appName;
+ static Ice::CommunicatorPtr _communicator;
+ static Ice::SignalPolicy _signalPolicy;
+ static Ice::Application* _application;
+
+private:
+
+ static void holdInterruptCallback(int);
+ static void destroyOnInterruptCallback(int);
+ static void shutdownOnInterruptCallback(int);
+ static void callbackOnInterruptCallback(int);
};
}
diff --git a/cpp/include/Ice/AsyncResult.h b/cpp/include/Ice/AsyncResult.h
index bc328f9cd6f..c16e6341e03 100644
--- a/cpp/include/Ice/AsyncResult.h
+++ b/cpp/include/Ice/AsyncResult.h
@@ -10,359 +10,75 @@
#ifndef ICE_ASYNC_RESULT_H
#define ICE_ASYNC_RESULT_H
+#ifndef ICE_CPP11_MAPPING
+
#include <IceUtil/Monitor.h>
#include <IceUtil/Mutex.h>
-#include <IceUtil/UniquePtr.h>
#include <Ice/LocalObject.h>
#include <Ice/CommunicatorF.h>
#include <Ice/ConnectionF.h>
#include <Ice/ProxyF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/RequestHandlerF.h>
#include <Ice/AsyncResultF.h>
-#include <Ice/ObserverHelper.h>
-#include <Ice/BasicStream.h>
-
-#ifdef ICE_CPP11
-# include <functional> // for std::function
-#endif
-
-namespace IceInternal
-{
-
-class CallbackBase;
-typedef IceUtil::Handle<CallbackBase> CallbackBasePtr;
-
-}
namespace Ice
{
-class ICE_API AsyncResult : public Ice::LocalObject, private IceUtil::noncopyable
+class ICE_API AsyncResult : private IceUtil::noncopyable, public Ice::LocalObject
{
public:
- void cancel();
-
- Int getHash() const;
-
- CommunicatorPtr getCommunicator() const;
- virtual ConnectionPtr getConnection() const;
- virtual ObjectPrx getProxy() const;
-
- bool isCompleted() const;
- void waitForCompleted();
-
- bool isSent() const;
- void waitForSent();
-
- void throwLocalException() const;
-
- bool sentSynchronously() const;
- LocalObjectPtr getCookie() const;
- const std::string& getOperation() const;
-
- ::IceInternal::BasicStream* __startReadParams()
- {
- _is.startReadEncaps();
- return &_is;
- }
- void __endReadParams()
- {
- _is.endReadEncaps();
- }
- void __readEmptyParams()
- {
- _is.skipEmptyEncaps();
- }
- void __readParamEncaps(const ::Ice::Byte*& encaps, ::Ice::Int& sz)
- {
- _is.readEncaps(encaps, sz);
- }
- void __throwUserException();
-
- bool __wait();
-
- static void __check(const AsyncResultPtr&, const ::IceProxy::Ice::Object*, const ::std::string&);
- static void __check(const AsyncResultPtr&, const Connection*, const ::std::string&);
- static void __check(const AsyncResultPtr&, const Communicator*, const ::std::string&);
-
-protected:
-
- static void __check(const AsyncResultPtr&, const ::std::string&);
-
- AsyncResult(const CommunicatorPtr&, const IceInternal::InstancePtr&, const std::string&,
- const IceInternal::CallbackBasePtr&, const LocalObjectPtr&);
- virtual ~AsyncResult(); // Must be heap-allocated
-
- bool sent(bool);
- bool finished(bool);
- bool finished(const Exception&);
-
- void invokeSentAsync();
- void invokeCompletedAsync();
-
- void invokeSent();
- void invokeCompleted();
-
- void cancel(const LocalException&);
- virtual void cancelable(const IceInternal::CancellationHandlerPtr&);
- void checkCanceled();
-
- void warning(const std::exception&) const;
- void warning() const;
-
- //
- // This virtual method is necessary for the communicator flush
- // batch requests implementation.
- //
- virtual IceInternal::InvocationObserver& getObserver()
- {
- return _observer;
- }
-
- const IceInternal::InstancePtr _instance;
- IceInternal::InvocationObserver _observer;
- Ice::ConnectionPtr _cachedConnection;
- bool _sentSynchronously;
-
- IceInternal::BasicStream _is;
-
- IceUtil::Monitor<IceUtil::Mutex> _monitor;
-
-private:
-
- const CommunicatorPtr _communicator;
- const std::string& _operation;
- const IceInternal::CallbackBasePtr _callback;
- const LocalObjectPtr _cookie;
- IceUtil::UniquePtr<Exception> _exception;
-
- IceInternal::CancellationHandlerPtr _cancellationHandler;
- IceUtil::UniquePtr<Ice::LocalException> _cancellationException;
-
- static const unsigned char OK;
- static const unsigned char Done;
- static const unsigned char Sent;
- static const unsigned char EndCalled;
- static const unsigned char Canceled;
- unsigned char _state;
-};
-
-}
-
-namespace IceInternal
-{
+ virtual ~AsyncResult();
-//
-// Base class for all callbacks.
-//
-class ICE_API CallbackBase : public IceUtil::Shared
-{
-public:
+ virtual void cancel() = 0;
- void checkCallback(bool, bool);
+ virtual Int getHash() const = 0;
- virtual void completed(const ::Ice::AsyncResultPtr&) const = 0;
- virtual CallbackBasePtr verify(const ::Ice::LocalObjectPtr&) = 0;
- virtual void sent(const ::Ice::AsyncResultPtr&) const = 0;
- virtual bool hasSentCallback() const = 0;
-};
+ virtual CommunicatorPtr getCommunicator() const = 0;
+ virtual ConnectionPtr getConnection() const = 0;
+ virtual ObjectPrxPtr getProxy() const = 0;
-//
-// Base class for generic callbacks.
-//
-class ICE_API GenericCallbackBase : virtual public CallbackBase
-{
-};
+ virtual bool isCompleted() const = 0;
+ virtual void waitForCompleted() = 0;
-//
-// See comments in OutgoingAsync.cpp
-//
-extern ICE_API CallbackBasePtr __dummyCallback;
+ virtual bool isSent() const = 0;
+ virtual void waitForSent() = 0;
-//
-// Generic callback template that requires the caller to down-cast the
-// proxy and the cookie that are obtained from the AsyncResult.
-//
-template<class T>
-class AsyncCallback : public GenericCallbackBase
-{
-public:
+ virtual void throwLocalException() const = 0;
- typedef T callback_type;
- typedef IceUtil::Handle<T> TPtr;
+ virtual bool sentSynchronously() const = 0;
- typedef void (T::*Callback)(const ::Ice::AsyncResultPtr&);
+ virtual LocalObjectPtr getCookie() const = 0;
- AsyncCallback(const TPtr& instance, Callback cb, Callback sentcb = 0) :
- _callback(instance), _completed(cb), _sent(sentcb)
- {
- checkCallback(instance, cb != 0);
- }
+ virtual const std::string& getOperation() const = 0;
- virtual void completed(const ::Ice::AsyncResultPtr& result) const
- {
- (_callback.get()->*_completed)(result);
- }
+ virtual bool waitForResponse() = 0;
+ virtual Ice::InputStream* startReadParams() = 0;
+ virtual void endReadParams() = 0;
+ virtual void readEmptyParams() = 0;
+ virtual void readParamEncaps(const ::Ice::Byte*&, ::Ice::Int&) = 0;
+ virtual void throwUserException() = 0;
- virtual CallbackBasePtr verify(const ::Ice::LocalObjectPtr&)
- {
- return this; // Nothing to do, the cookie is not type-safe.
- }
-
- virtual void sent(const ::Ice::AsyncResultPtr& result) const
- {
- if(_sent)
- {
- (_callback.get()->*_sent)(result);
- }
- }
+ static void check(const AsyncResultPtr&, const ::IceProxy::Ice::Object*, const ::std::string&);
+ static void check(const AsyncResultPtr&, const Connection*, const ::std::string&);
+ static void check(const AsyncResultPtr&, const Communicator*, const ::std::string&);
- virtual bool hasSentCallback() const
+ class Callback : public IceUtil::Shared
{
- return _sent != 0;
- }
-
-private:
-
- TPtr _callback;
- Callback _completed;
- Callback _sent;
-};
-
-#ifdef ICE_CPP11
-
-template<typename T> struct callback_type
-{
- static const int value = 1;
-};
-
-template<> struct callback_type<void(const ::Ice::AsyncResultPtr&)>
-{
- static const int value = 2;
-};
+ public:
-template<> struct callback_type<void(const ::Ice::Exception&)>
-{
- static const int value = 3;
-};
-
-template<typename Callable, typename = void> struct callable_type
-{
- static const int value = 1;
-};
-
-template<class Callable> struct callable_type<Callable, typename ::std::enable_if<
- ::std::is_class<Callable>::value &&
- !::std::is_bind_expression<Callable>::value>::type>
-{
- template<typename T, T> struct TypeCheck;
- template<typename T> struct AsyncResultCallback
- {
- typedef void (T::*ok)(const ::Ice::AsyncResultPtr&) const;
+ virtual void run() = 0;
};
- template<typename T> struct ExceptionCallback
- {
- typedef void (T::*ok)(const ::Ice::Exception&) const;
- };
-
- typedef char (&other)[1];
- typedef char (&asyncResult)[2];
- typedef char (&exception)[3];
-
- template<typename T> static other check(...);
- template<typename T> static asyncResult check(TypeCheck<typename AsyncResultCallback<T>::ok, &T::operator()>*);
- template<typename T> static exception check(TypeCheck<typename ExceptionCallback<T>::ok, &T::operator()>*);
-
- enum { value = sizeof(check<Callable>(0)) };
-};
-
-template<> struct callable_type<void(*)(const ::Ice::AsyncResultPtr&)>
-{
- static const int value = 2;
-};
-
-template<> struct callable_type<void(*)(const ::Ice::Exception&)>
-{
- static const int value = 3;
-};
-
-template<typename Callable, typename Callback> struct is_callable
-{
- static const bool value = callable_type<Callable>::value == callback_type<Callback>::value;
-};
-
-//
-// COMPILERFIX: we have to use this function specialization to workaround an issue where
-// VS2012 and GCC 4.6 can't resolve the begin_xxx overloads if we just use std::function.
-// We use some SNIFAE here to help the compiler with the overload resolution.
-//
-template<class S> class Function : public std::function<S>
-{
-
-public:
-
- template<typename T> Function(T f, typename ::std::enable_if<is_callable<T, S>::value>::type* = 0)
- : std::function<S>(f)
- {
- }
-
- Function()
- {
- }
+ typedef IceUtil::Handle<Callback> CallbackPtr;
- Function(::std::nullptr_t) : ::std::function<S>(nullptr)
- {
- }
-};
+ virtual void scheduleCallback(const CallbackPtr&) = 0;
-#else
+protected:
-template<class S> class Function
-{
-public:
- Function()
- {
- }
+ static void check(const AsyncResultPtr&, const ::std::string&);
};
-#endif
-
-}
-
-namespace Ice
-{
-
-typedef IceUtil::Handle< ::IceInternal::GenericCallbackBase> CallbackPtr;
-
-template<class T> CallbackPtr
-newCallback(const IceUtil::Handle<T>& instance,
- void (T::*cb)(const AsyncResultPtr&),
- void (T::*sentcb)(const AsyncResultPtr&) = 0)
-{
- return new ::IceInternal::AsyncCallback<T>(instance, cb, sentcb);
-}
-
-template<class T> CallbackPtr
-newCallback(T* instance,
- void (T::*cb)(const AsyncResultPtr&),
- void (T::*sentcb)(const AsyncResultPtr&) = 0)
-{
- return new ::IceInternal::AsyncCallback<T>(instance, cb, sentcb);
}
-#ifdef ICE_CPP11
-
-ICE_API CallbackPtr
-newCallback(const ::IceInternal::Function<void (const AsyncResultPtr&)>&,
- const ::IceInternal::Function<void (const AsyncResultPtr&)>& =
- ::IceInternal::Function<void (const AsyncResultPtr&)>());
#endif
-//
-// Operation callbacks are specified in Proxy.h
-//
-}
-
#endif
diff --git a/cpp/include/Ice/AsyncResultF.h b/cpp/include/Ice/AsyncResultF.h
index 0deb3a1b043..157db2fb672 100644
--- a/cpp/include/Ice/AsyncResultF.h
+++ b/cpp/include/Ice/AsyncResultF.h
@@ -10,8 +10,9 @@
#ifndef ICE_ASYNC_RESULT_F_H
#define ICE_ASYNC_RESULT_F_H
-#include <IceUtil/Shared.h>
+#ifndef ICE_CPP11_MAPPING
+#include <IceUtil/Shared.h>
#include <Ice/Handle.h>
namespace Ice
@@ -24,3 +25,4 @@ typedef IceInternal::Handle<AsyncResult> AsyncResultPtr;
}
#endif
+#endif
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h
deleted file mode 100644
index e414061b447..00000000000
--- a/cpp/include/Ice/BasicStream.h
+++ /dev/null
@@ -1,1326 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_BASIC_STREAM_H
-#define ICE_BASIC_STREAM_H
-
-#include <IceUtil/StringConverter.h>
-#include <Ice/InstanceF.h>
-#include <Ice/Object.h>
-#include <Ice/ProxyF.h>
-#include <Ice/ObjectFactoryF.h>
-#include <Ice/ObjectFactoryManagerF.h>
-#include <Ice/Buffer.h>
-#include <Ice/Protocol.h>
-#include <Ice/SlicedDataF.h>
-#include <Ice/UserExceptionFactory.h>
-#include <Ice/StreamHelpers.h>
-#include <Ice/FactoryTable.h>
-
-namespace Ice
-{
-
-class UserException;
-
-}
-
-namespace IceInternal
-{
-
-template<typename T> inline void
-patchHandle(void* addr, const Ice::ObjectPtr& v)
-{
- IceInternal::Handle<T>* p = static_cast<IceInternal::Handle<T>*>(addr);
- __patch(*p, v); // Generated __patch method, necessary for forward declarations.
-}
-
-class ICE_API BasicStream : public Buffer
-{
-public:
-
- typedef size_t size_type;
- typedef void (*PatchFunc)(void*, const Ice::ObjectPtr&);
-
- BasicStream(Instance*, const Ice::EncodingVersion&);
- BasicStream(Instance*, const Ice::EncodingVersion&, const Ice::Byte*, const Ice::Byte*);
- ~BasicStream()
- {
- // Inlined for performance reasons.
-
- if(_currentReadEncaps != &_preAllocatedReadEncaps || _currentWriteEncaps != &_preAllocatedWriteEncaps)
- {
- clear(); // Not inlined.
- }
- }
-
- void clear();
-
- //
- // Must return Instance*, because we don't hold an InstancePtr for
- // optimization reasons (see comments below).
- //
- Instance* instance() const { return _instance; } // Inlined for performance reasons.
-
- void* closure() const;
- void* closure(void*);
-
- void swap(BasicStream&);
- void resetEncaps();
-
- void resize(Container::size_type sz)
- {
- b.resize(sz);
- i = b.end();
- }
-
- void startWriteObject(const Ice::SlicedDataPtr& data)
- {
- assert(_currentWriteEncaps && _currentWriteEncaps->encoder);
- _currentWriteEncaps->encoder->startInstance(ObjectSlice, data);
- }
- void endWriteObject()
- {
- assert(_currentWriteEncaps && _currentWriteEncaps->encoder);
- _currentWriteEncaps->encoder->endInstance();
- }
-
- void startReadObject()
- {
- assert(_currentReadEncaps && _currentReadEncaps->decoder);
- _currentReadEncaps->decoder->startInstance(ObjectSlice);
- }
- Ice::SlicedDataPtr endReadObject(bool preserve)
- {
- assert(_currentReadEncaps && _currentReadEncaps->decoder);
- return _currentReadEncaps->decoder->endInstance(preserve);
- }
-
- void startWriteException(const Ice::SlicedDataPtr& data)
- {
- assert(_currentWriteEncaps && _currentWriteEncaps->encoder);
- _currentWriteEncaps->encoder->startInstance(ExceptionSlice, data);
- }
- void endWriteException()
- {
- assert(_currentWriteEncaps && _currentWriteEncaps->encoder);
- _currentWriteEncaps->encoder->endInstance();
- }
-
- void startReadException()
- {
- assert(_currentReadEncaps && _currentReadEncaps->decoder);
- _currentReadEncaps->decoder->startInstance(ExceptionSlice);
- }
- Ice::SlicedDataPtr endReadException(bool preserve)
- {
- assert(_currentReadEncaps && _currentReadEncaps->decoder);
- return _currentReadEncaps->decoder->endInstance(preserve);
- }
-
- void startWriteEncaps();
-
- void startWriteEncaps(const Ice::EncodingVersion& encoding, Ice::FormatType format)
- {
- checkSupportedEncoding(encoding);
-
- WriteEncaps* oldEncaps = _currentWriteEncaps;
- if(!oldEncaps) // First allocated encaps?
- {
- _currentWriteEncaps = &_preAllocatedWriteEncaps;
- }
- else
- {
- _currentWriteEncaps = new WriteEncaps();
- _currentWriteEncaps->previous = oldEncaps;
- }
- _currentWriteEncaps->format = format;
- _currentWriteEncaps->encoding = encoding;
- _currentWriteEncaps->start = b.size();
-
- write(Ice::Int(0)); // Placeholder for the encapsulation length.
- write(_currentWriteEncaps->encoding);
- }
- void endWriteEncaps()
- {
- assert(_currentWriteEncaps);
-
- // Size includes size and version.
- const Ice::Int sz = static_cast<Ice::Int>(b.size() - _currentWriteEncaps->start);
- write(sz, &(*(b.begin() + _currentWriteEncaps->start)));
-
- WriteEncaps* oldEncaps = _currentWriteEncaps;
- _currentWriteEncaps = _currentWriteEncaps->previous;
- if(oldEncaps == &_preAllocatedWriteEncaps)
- {
- oldEncaps->reset();
- }
- else
- {
- delete oldEncaps;
- }
- }
- void endWriteEncapsChecked(); // Used by public stream API.
- void writeEmptyEncaps(const Ice::EncodingVersion& encoding)
- {
- checkSupportedEncoding(encoding);
- write(Ice::Int(6)); // Size
- write(encoding);
- }
- void writeEncaps(const Ice::Byte* v, Ice::Int sz)
- {
- if(sz < 6)
- {
- throwEncapsulationException(__FILE__, __LINE__);
- }
-
- Container::size_type position = b.size();
- resize(position + sz);
- memcpy(&b[position], &v[0], sz);
- }
-
- const Ice::EncodingVersion& getWriteEncoding() const
- {
- return _currentWriteEncaps ? _currentWriteEncaps->encoding : _encoding;
- }
-
- const Ice::EncodingVersion& startReadEncaps()
- {
- ReadEncaps* oldEncaps = _currentReadEncaps;
- if(!oldEncaps) // First allocated encaps?
- {
- _currentReadEncaps = &_preAllocatedReadEncaps;
- }
- else
- {
- _currentReadEncaps = new ReadEncaps();
- _currentReadEncaps->previous = oldEncaps;
- }
- _currentReadEncaps->start = i - b.begin();
-
- //
- // I don't use readSize() and writeSize() for encapsulations,
- // because when creating an encapsulation, I must know in advance
- // how many bytes the size information will require in the data
- // stream. If I use an Int, it is always 4 bytes. For
- // readSize()/writeSize(), it could be 1 or 5 bytes.
- //
- Ice::Int sz;
- read(sz);
- if(sz < 6)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- if(i - sizeof(Ice::Int) + sz > b.end())
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- _currentReadEncaps->sz = sz;
-
- read(_currentReadEncaps->encoding);
- checkSupportedEncoding(_currentReadEncaps->encoding); // Make sure the encoding is supported
-
- return _currentReadEncaps->encoding;
- }
-
- void endReadEncaps()
- {
- assert(_currentReadEncaps);
-
- if(_currentReadEncaps->encoding != Ice::Encoding_1_0)
- {
- skipOpts();
- if(i != b.begin() + _currentReadEncaps->start + _currentReadEncaps->sz)
- {
- throwEncapsulationException(__FILE__, __LINE__);
- }
- }
- else if(i != b.begin() + _currentReadEncaps->start + _currentReadEncaps->sz)
- {
- if(i + 1 != b.begin() + _currentReadEncaps->start + _currentReadEncaps->sz)
- {
- throwEncapsulationException(__FILE__, __LINE__);
- }
-
- //
- // Ice version < 3.3 had a bug where user exceptions with
- // class members could be encoded with a trailing byte
- // when dispatched with AMD. So we tolerate an extra byte
- // in the encapsulation.
- //
- ++i;
- }
-
- ReadEncaps* oldEncaps = _currentReadEncaps;
- _currentReadEncaps = _currentReadEncaps->previous;
- if(oldEncaps == &_preAllocatedReadEncaps)
- {
- oldEncaps->reset();
- }
- else
- {
- delete oldEncaps;
- }
- }
- Ice::EncodingVersion skipEmptyEncaps()
- {
- Ice::Int sz;
- read(sz);
- if(sz < 6)
- {
- throwEncapsulationException(__FILE__, __LINE__);
- }
- if(i - sizeof(Ice::Int) + sz > b.end())
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- Ice::EncodingVersion encoding;
- read(encoding);
- if(encoding == Ice::Encoding_1_0)
- {
- if(sz != static_cast<Ice::Int>(sizeof(Ice::Int)) + 2)
- {
- throwEncapsulationException(__FILE__, __LINE__);
- }
- }
- else
- {
- // Skip the optional content of the encapsulation if we are expecting an
- // empty encapsulation.
- i += sz - sizeof(Ice::Int) - 2;
- }
- return encoding;
- }
- void endReadEncapsChecked(); // Used by public stream API.
- Ice::EncodingVersion readEncaps(const Ice::Byte*& v, Ice::Int& sz)
- {
- Ice::EncodingVersion encoding;
- v = i;
- read(sz);
- if(sz < 6)
- {
- throwEncapsulationException(__FILE__, __LINE__);
- }
- if(i - sizeof(Ice::Int) + sz > b.end())
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
-
- read(encoding);
- i += sz - sizeof(Ice::Int) - 2;
- return encoding;
- }
-
- const Ice::EncodingVersion& getReadEncoding() const
- {
- return _currentReadEncaps ? _currentReadEncaps->encoding : _encoding;
- }
-
- Ice::Int getReadEncapsSize();
- Ice::EncodingVersion skipEncaps();
-
- void startWriteSlice(const std::string& typeId, int compactId, bool last)
- {
- assert(_currentWriteEncaps && _currentWriteEncaps->encoder);
- _currentWriteEncaps->encoder->startSlice(typeId, compactId, last);
- }
- void endWriteSlice()
- {
- assert(_currentWriteEncaps && _currentWriteEncaps->encoder);
- _currentWriteEncaps->encoder->endSlice();
- }
-
- std::string startReadSlice()
- {
- assert(_currentReadEncaps && _currentReadEncaps->decoder);
- return _currentReadEncaps->decoder->startSlice();
- }
- void endReadSlice()
- {
- assert(_currentReadEncaps && _currentReadEncaps->decoder);
- _currentReadEncaps->decoder->endSlice();
- }
- void skipSlice()
- {
- assert(_currentReadEncaps && _currentReadEncaps->decoder);
- _currentReadEncaps->decoder->skipSlice();
- }
-
- void readPendingObjects();
- void writePendingObjects();
-
- void writeSize(Ice::Int v) // Inlined for performance reasons.
- {
- assert(v >= 0);
- if(v > 254)
- {
- write(Ice::Byte(255));
- write(v);
- }
- else
- {
- write(static_cast<Ice::Byte>(v));
- }
- }
- void rewriteSize(Ice::Int v, Container::iterator dest)
- {
- assert(v >= 0);
- if(v > 254)
- {
- *dest++ = Ice::Byte(255);
- write(v, dest);
- }
- else
- {
- *dest = static_cast<Ice::Byte>(v);
- }
- }
- Ice::Int readSize() // Inlined for performance reasons.
- {
- Ice::Byte byte;
- read(byte);
- unsigned char val = static_cast<unsigned char>(byte);
- if(val == 255)
- {
- Ice::Int v;
- read(v);
- if(v < 0)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- return v;
- }
- else
- {
- return static_cast<Ice::Int>(static_cast<unsigned char>(byte));
- }
- }
-
- Ice::Int readAndCheckSeqSize(int);
-
- size_type startSize()
- {
- size_type position = b.size();
- write(Ice::Int(0));
- return position;
- }
-
- void endSize(size_type position)
- {
- rewrite(static_cast<Ice::Int>(b.size() - position) - 4, position);
- }
-
- void writeBlob(const std::vector<Ice::Byte>&);
- void readBlob(std::vector<Ice::Byte>&, Ice::Int);
-
- void writeBlob(const Ice::Byte* v, Container::size_type sz)
- {
- if(sz > 0)
- {
- Container::size_type position = b.size();
- resize(position + sz);
- memcpy(&b[position], &v[0], sz);
- }
- }
-
- void readBlob(const Ice::Byte*& v, Container::size_type sz)
- {
- if(sz > 0)
- {
- v = i;
- if(static_cast<Container::size_type>(b.end() - i) < sz)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- i += sz;
- }
- else
- {
- v = i;
- }
- }
-
- template<typename T> void write(const T& v)
- {
- Ice::StreamHelper<T, Ice::StreamableTraits<T>::helper>::write(this, v);
- }
- template<typename T> void read(T& v)
- {
- Ice::StreamHelper<T, Ice::StreamableTraits<T>::helper>::read(this, v);
- }
-
- template<typename T> void write(Ice::Int tag, const IceUtil::Optional<T>& v)
- {
- if(!v)
- {
- return; // Optional not set
- }
-
- if(writeOpt(tag, Ice::StreamOptionalHelper<T,
- Ice::StreamableTraits<T>::helper,
- Ice::StreamableTraits<T>::fixedLength>::optionalFormat))
- {
- Ice::StreamOptionalHelper<T,
- Ice::StreamableTraits<T>::helper,
- Ice::StreamableTraits<T>::fixedLength>::write(this, *v);
- }
- }
- template<typename T> void read(Ice::Int tag, IceUtil::Optional<T>& v)
- {
- if(readOpt(tag, Ice::StreamOptionalHelper<T,
- Ice::StreamableTraits<T>::helper,
- Ice::StreamableTraits<T>::fixedLength>::optionalFormat))
- {
- v.__setIsSet();
- Ice::StreamOptionalHelper<T,
- Ice::StreamableTraits<T>::helper,
- Ice::StreamableTraits<T>::fixedLength>::read(this, *v);
- }
- else
- {
- v = IceUtil::None;
- }
- }
-
- //
- // Template functions for sequences and custom sequences
- //
- template<typename T> void write(const std::vector<T>& v)
- {
- if(v.empty())
- {
- writeSize(0);
- }
- else
- {
- write(&v[0], &v[0] + v.size());
- }
- }
- template<typename T> void write(const T* begin, const T* end)
- {
- writeSize(static_cast<Ice::Int>(end - begin));
- for(const T* p = begin; p != end; ++p)
- {
- write(*p);
- }
- }
-
- // Read/write type and tag for optionals
- bool writeOpt(Ice::Int tag, Ice::OptionalFormat format)
- {
- assert(_currentWriteEncaps);
- if(_currentWriteEncaps->encoder)
- {
- return _currentWriteEncaps->encoder->writeOpt(tag, format);
- }
- else
- {
- return writeOptImpl(tag, format);
- }
- }
- bool readOpt(Ice::Int tag, Ice::OptionalFormat expectedFormat)
- {
- assert(_currentReadEncaps);
- if(_currentReadEncaps->decoder)
- {
- return _currentReadEncaps->decoder->readOpt(tag, expectedFormat);
- }
- else
- {
- return readOptImpl(tag, expectedFormat);
- }
- }
-
- // Byte
- void write(Ice::Byte v)
- {
- b.push_back(v);
- }
- void write(const Ice::Byte*, const Ice::Byte*);
- void read(Ice::Byte& v)
- {
- if(i >= b.end())
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- v = *i++;
- }
- void read(std::vector<Ice::Byte>&);
- void read(std::pair<const Ice::Byte*, const Ice::Byte*>&);
-
- // This method is useful for generic stream helpers
- void read(std::pair<const Ice::Byte*, const Ice::Byte*>& p, ::IceUtil::ScopedArray<Ice::Byte>& result)
- {
- result.reset();
- read(p);
- }
-
- // Bool
- void write(bool v)
- {
- b.push_back(static_cast<Ice::Byte>(v));
- }
- void write(const std::vector<bool>&);
- void write(const bool*, const bool*);
- void read(bool& v)
- {
- if(i >= b.end())
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- v = (0 != *i++);
- }
- void read(std::vector<bool>&);
- void read(std::pair<const bool*, const bool*>&, ::IceUtil::ScopedArray<bool>&);
-
- // Short
- void write(Ice::Short);
- void write(const Ice::Short*, const Ice::Short*);
- void read(Ice::Short&);
- void read(std::vector<Ice::Short>&);
- void read(std::pair<const Ice::Short*, const Ice::Short*>&, ::IceUtil::ScopedArray<Ice::Short>&);
-
- // Int
- void write(Ice::Int v) // Inlined for performance reasons.
- {
- Container::size_type position = b.size();
- resize(position + sizeof(Ice::Int));
- write(v, &b[position]);
- }
- void write(Ice::Int v, Container::iterator dest)
- {
-#ifdef ICE_BIG_ENDIAN
- const Ice::Byte* src = reinterpret_cast<const Ice::Byte*>(&v) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
-#else
- const Ice::Byte* src = reinterpret_cast<const Ice::Byte*>(&v);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
-#endif
- }
-
- void read(Ice::Int& v) // Inlined for performance reasons.
- {
- if(b.end() - i < static_cast<int>(sizeof(Ice::Int)))
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- const Ice::Byte* src = &(*i);
- i += sizeof(Ice::Int);
-#ifdef ICE_BIG_ENDIAN
- Ice::Byte* dest = reinterpret_cast<Ice::Byte*>(&v) + sizeof(Ice::Int) - 1;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest = *src;
-#else
- Ice::Byte* dest = reinterpret_cast<Ice::Byte*>(&v);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
-#endif
- }
-
- void write(const Ice::Int*, const Ice::Int*);
- void read(std::vector<Ice::Int>&);
- void read(std::pair<const Ice::Int*, const Ice::Int*>&, ::IceUtil::ScopedArray<Ice::Int>&);
-
- // Long
- void write(Ice::Long);
- void write(const Ice::Long*, const Ice::Long*);
- void read(Ice::Long&);
- void read(std::vector<Ice::Long>&);
- void read(std::pair<const Ice::Long*, const Ice::Long*>&, ::IceUtil::ScopedArray<Ice::Long>&);
-
- // Float
- void write(Ice::Float);
- void write(const Ice::Float*, const Ice::Float*);
- void read(Ice::Float&);
- void read(std::vector<Ice::Float>&);
- void read(std::pair<const Ice::Float*, const Ice::Float*>&, ::IceUtil::ScopedArray<Ice::Float>&);
-
- // Double
- void write(Ice::Double);
- void write(const Ice::Double*, const Ice::Double*);
- void read(Ice::Double&);
- void read(std::vector<Ice::Double>&);
- void read(std::pair<const Ice::Double*, const Ice::Double*>&, ::IceUtil::ScopedArray<Ice::Double>&);
-
- // String
- void write(const std::string& v, bool convert = true)
- {
- Ice::Int sz = static_cast<Ice::Int>(v.size());
- if(convert && sz > 0 && _stringConverter != 0)
- {
- writeConverted(v.data(), static_cast<size_t>(sz));
- }
- else
- {
- writeSize(sz);
- if(sz > 0)
- {
- Container::size_type position = b.size();
- resize(position + sz);
- memcpy(&b[position], v.data(), sz);
- }
- }
- }
-
- // for custom strings
- void write(const char* vdata, size_t vsize, bool convert = true)
- {
- Ice::Int sz = static_cast<Ice::Int>(vsize);
- if(convert && sz > 0 && _stringConverter != 0)
- {
- writeConverted(vdata, vsize);
- }
- else
- {
- writeSize(sz);
- if(sz > 0)
- {
- Container::size_type position = b.size();
- resize(position + sz);
- memcpy(&b[position], vdata, vsize);
- }
- }
- }
-
- // Null-terminated C string
- void write(const char* vdata, bool convert = true)
- {
- write(vdata, strlen(vdata), convert);
- }
-
- void write(const std::string*, const std::string*, bool = true);
-
- void read(std::string& v, bool convert = true)
- {
- Ice::Int sz = readSize();
- if(sz > 0)
- {
- if(b.end() - i < sz)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- if(convert && _stringConverter != 0)
- {
- readConverted(v, sz);
- }
- else
- {
- std::string(reinterpret_cast<const char*>(&*i), reinterpret_cast<const char*>(&*i) + sz).swap(v);
- }
- i += sz;
- }
- else
- {
- v.clear();
- }
- }
-
- // For custom strings, convert = false
- void read(const char*& vdata, size_t& vsize)
- {
- Ice::Int sz = readSize();
- if(sz > 0)
- {
- if(b.end() - i < sz)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
-
- vdata = reinterpret_cast<const char*>(&*i);
- vsize = static_cast<size_t>(sz);
- i += sz;
- }
- else
- {
- vdata = 0;
- vsize = 0;
- }
- }
-
- // For custom strings, convert = true
- void read(const char*& vdata, size_t& vsize, std::string& holder)
- {
- if(_stringConverter == 0)
- {
- holder.clear();
- read(vdata, vsize);
- }
- else
- {
- Ice::Int sz = readSize();
- if(sz > 0)
- {
- if(b.end() - i < sz)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
-
- readConverted(holder, sz);
- vdata = holder.data();
- vsize = holder.size();
- }
- else
- {
- holder.clear();
- vdata = 0;
- vsize = 0;
- }
- }
- }
-
- void read(std::vector<std::string>&, bool = true);
-
- void write(const std::wstring& v);
- void write(const std::wstring*, const std::wstring*);
- void read(std::wstring&);
- void read(std::vector<std::wstring>&);
-
- // Proxy
- void write(const Ice::ObjectPrx&);
- template<typename T> void write(const IceInternal::ProxyHandle<T>& v)
- {
- write(Ice::ObjectPrx(upCast(v.get())));
- }
- void read(Ice::ObjectPrx&);
- template<typename T> void read(IceInternal::ProxyHandle<T>& v)
- {
- __read(this, v); // Generated __read method, necessary for forward declarations.
- }
-
- // Class
- void write(const Ice::ObjectPtr& v)
- {
- initWriteEncaps();
- _currentWriteEncaps->encoder->write(v);
- }
- template<typename T> void write(const IceInternal::Handle<T>& v)
- {
- write(Ice::ObjectPtr(upCast(v.get())));
- }
- void read(PatchFunc patchFunc, void* patchAddr)
- {
- initReadEncaps();
- _currentReadEncaps->decoder->read(patchFunc, patchAddr);
- }
- template<typename T> void read(IceInternal::Handle<T>& v)
- {
- read(&patchHandle<T>, &v);
- }
-
- // Enum
- Ice::Int readEnum(Ice::Int);
- void writeEnum(Ice::Int, Ice::Int);
-
- // Exception
- void writeException(const Ice::UserException&);
- void throwException(const UserExceptionFactoryPtr& = 0);
-
- void sliceObjects(bool);
-
- // Read/write/skip optionals
- bool readOptImpl(Ice::Int, Ice::OptionalFormat);
- bool writeOptImpl(Ice::Int, Ice::OptionalFormat);
- void skipOpt(Ice::OptionalFormat);
- void skipOpts();
-
- // Skip bytes from the stream
- void skip(size_type size)
- {
- if(i + size > b.end())
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- i += size;
- }
- void skipSize()
- {
- Ice::Byte bt;
- read(bt);
- if(static_cast<unsigned char>(bt) == 255)
- {
- skip(4);
- }
- }
-
- size_type pos()
- {
- return i - b.begin();
- }
-
- void rewrite(Ice::Int value, size_type p)
- {
- write(value, b.begin() + p);
- }
-
-private:
-
- //
- // String
- //
- void writeConverted(const char*, size_t);
- void readConverted(std::string&, Ice::Int);
-
- //
- // I can't throw these exception from inline functions from within
- // this file, because I cannot include the header with the
- // exceptions. Doing so would screw up the whole include file
- // ordering.
- //
- void throwUnmarshalOutOfBoundsException(const char*, int);
- void throwEncapsulationException(const char*, int);
-
- //
- // Optimization. The instance may not be deleted while a
- // stack-allocated BasicStream still holds it.
- //
- Instance* _instance;
-
- //
- // The public stream API needs to attach data to a stream.
- //
- void* _closure;
-
- class ReadEncaps;
- class WriteEncaps;
- enum SliceType { NoSlice, ObjectSlice, ExceptionSlice };
-
- typedef std::vector<Ice::ObjectPtr> ObjectList;
-
- class ICE_API EncapsDecoder : private ::IceUtil::noncopyable
- {
- public:
-
- virtual ~EncapsDecoder() { }
-
- virtual void read(PatchFunc, void*) = 0;
- virtual void throwException(const UserExceptionFactoryPtr&) = 0;
-
- virtual void startInstance(SliceType) = 0;
- virtual Ice::SlicedDataPtr endInstance(bool) = 0;
- virtual const std::string& startSlice() = 0;
- virtual void endSlice() = 0;
- virtual void skipSlice() = 0;
-
- virtual bool readOpt(Ice::Int, Ice::OptionalFormat)
- {
- return false;
- }
-
- virtual void readPendingObjects()
- {
- }
-
- protected:
-
- EncapsDecoder(BasicStream* stream, ReadEncaps* encaps, bool sliceObjects, const ObjectFactoryManagerPtr& f) :
- _stream(stream), _encaps(encaps), _sliceObjects(sliceObjects), _servantFactoryManager(f), _typeIdIndex(0)
- {
- }
-
- std::string readTypeId(bool);
- Ice::ObjectPtr newInstance(const std::string&);
-
- void addPatchEntry(Ice::Int, PatchFunc, void*);
- void unmarshal(Ice::Int, const Ice::ObjectPtr&);
-
- typedef std::map<Ice::Int, Ice::ObjectPtr> IndexToPtrMap;
- typedef std::map<Ice::Int, std::string> TypeIdReadMap;
-
- struct PatchEntry
- {
- PatchFunc patchFunc;
- void* patchAddr;
- };
- typedef std::vector<PatchEntry> PatchList;
- typedef std::map<Ice::Int, PatchList> PatchMap;
-
- BasicStream* _stream;
- ReadEncaps* _encaps;
- const bool _sliceObjects;
- ObjectFactoryManagerPtr _servantFactoryManager;
-
- // Encapsulation attributes for object un-marshalling
- PatchMap _patchMap;
-
- private:
-
- // Encapsulation attributes for object un-marshalling
- IndexToPtrMap _unmarshaledMap;
- TypeIdReadMap _typeIdMap;
- Ice::Int _typeIdIndex;
- ObjectList _objectList;
- };
-
- class ICE_API EncapsDecoder10 : public EncapsDecoder
- {
- public:
-
- EncapsDecoder10(BasicStream* stream, ReadEncaps* encaps, bool sliceObjects, const ObjectFactoryManagerPtr& f) :
- EncapsDecoder(stream, encaps, sliceObjects, f), _sliceType(NoSlice)
- {
- }
-
- virtual void read(PatchFunc, void*);
- virtual void throwException(const UserExceptionFactoryPtr&);
-
- virtual void startInstance(SliceType);
- virtual Ice::SlicedDataPtr endInstance(bool);
- virtual const std::string& startSlice();
- virtual void endSlice();
- virtual void skipSlice();
-
- virtual void readPendingObjects();
-
- private:
-
- void readInstance();
-
- // Instance attributes
- SliceType _sliceType;
- bool _skipFirstSlice;
-
- // Slice attributes
- Ice::Int _sliceSize;
- std::string _typeId;
- };
-
- class ICE_API EncapsDecoder11 : public EncapsDecoder
- {
- public:
-
- EncapsDecoder11(BasicStream* stream, ReadEncaps* encaps, bool sliceObjects, const ObjectFactoryManagerPtr& f) :
- EncapsDecoder(stream, encaps, sliceObjects, f), _preAllocatedInstanceData(0), _current(0), _objectIdIndex(1)
- {
- }
-
- virtual void read(PatchFunc, void*);
- virtual void throwException(const UserExceptionFactoryPtr&);
-
- virtual void startInstance(SliceType);
- virtual Ice::SlicedDataPtr endInstance(bool);
- virtual const std::string& startSlice();
- virtual void endSlice();
- virtual void skipSlice();
-
- virtual bool readOpt(Ice::Int, Ice::OptionalFormat);
-
- private:
-
- Ice::Int readInstance(Ice::Int, PatchFunc, void*);
- Ice::SlicedDataPtr readSlicedData();
-
- struct IndirectPatchEntry
- {
- Ice::Int index;
- PatchFunc patchFunc;
- void* patchAddr;
- };
- typedef std::vector<IndirectPatchEntry> IndirectPatchList;
-
- typedef std::vector<Ice::Int> IndexList;
- typedef std::vector<IndexList> IndexListList;
-
- struct InstanceData
- {
- InstanceData(InstanceData* p) : previous(p), next(0)
- {
- if(previous)
- {
- previous->next = this;
- }
- }
-
- ~InstanceData()
- {
- if(next)
- {
- delete next;
- }
- }
-
- // Instance attributes
- SliceType sliceType;
- bool skipFirstSlice;
- Ice::SliceInfoSeq slices; // Preserved slices.
- IndexListList indirectionTables;
-
- // Slice attributes
- Ice::Byte sliceFlags;
- Ice::Int sliceSize;
- std::string typeId;
- int compactId;
- IndirectPatchList indirectPatchList;
-
- InstanceData* previous;
- InstanceData* next;
- };
- InstanceData _preAllocatedInstanceData;
- InstanceData* _current;
-
- void push(SliceType sliceType)
- {
- if(!_current)
- {
- _current = &_preAllocatedInstanceData;
- }
- else
- {
- _current = _current->next ? _current->next : new InstanceData(_current);
- }
- _current->sliceType = sliceType;
- _current->skipFirstSlice = false;
- }
-
- Ice::Int _objectIdIndex; // The ID of the next object to un-marshal.
- };
-
- class ICE_API EncapsEncoder : private ::IceUtil::noncopyable
- {
- public:
-
- virtual ~EncapsEncoder() { }
-
- virtual void write(const Ice::ObjectPtr&) = 0;
- virtual void write(const Ice::UserException&) = 0;
-
- virtual void startInstance(SliceType, const Ice::SlicedDataPtr&) = 0;
- virtual void endInstance() = 0;
- virtual void startSlice(const std::string&, int, bool) = 0;
- virtual void endSlice() = 0;
-
- virtual bool writeOpt(Ice::Int, Ice::OptionalFormat)
- {
- return false;
- }
-
- virtual void writePendingObjects()
- {
- }
-
- protected:
-
- EncapsEncoder(BasicStream* stream, WriteEncaps* encaps) : _stream(stream), _encaps(encaps), _typeIdIndex(0)
- {
- }
-
- Ice::Int registerTypeId(const std::string&);
-
- BasicStream* _stream;
- WriteEncaps* _encaps;
-
- typedef std::map<Ice::ObjectPtr, Ice::Int> PtrToIndexMap;
- typedef std::map<std::string, Ice::Int> TypeIdWriteMap;
-
- // Encapsulation attributes for object marshalling.
- PtrToIndexMap _marshaledMap;
-
- private:
-
- // Encapsulation attributes for object marshalling.
- TypeIdWriteMap _typeIdMap;
- Ice::Int _typeIdIndex;
- };
-
- class ICE_API EncapsEncoder10 : public EncapsEncoder
- {
- public:
-
- EncapsEncoder10(BasicStream* stream, WriteEncaps* encaps) :
- EncapsEncoder(stream, encaps), _sliceType(NoSlice), _objectIdIndex(0)
- {
- }
-
- virtual void write(const Ice::ObjectPtr&);
- virtual void write(const Ice::UserException&);
-
- virtual void startInstance(SliceType, const Ice::SlicedDataPtr&);
- virtual void endInstance();
- virtual void startSlice(const std::string&, int, bool);
- virtual void endSlice();
-
- virtual void writePendingObjects();
-
- private:
-
- Ice::Int registerObject(const Ice::ObjectPtr&);
-
- // Instance attributes
- SliceType _sliceType;
-
- // Slice attributes
- Container::size_type _writeSlice; // Position of the slice data members
-
- // Encapsulation attributes for object marshalling.
- Ice::Int _objectIdIndex;
- PtrToIndexMap _toBeMarshaledMap;
- };
-
- class ICE_API EncapsEncoder11 : public EncapsEncoder
- {
- public:
-
- EncapsEncoder11(BasicStream* stream, WriteEncaps* encaps) :
- EncapsEncoder(stream, encaps), _preAllocatedInstanceData(0), _current(0), _objectIdIndex(1)
- {
- }
-
- virtual void write(const Ice::ObjectPtr&);
- virtual void write(const Ice::UserException&);
-
- virtual void startInstance(SliceType, const Ice::SlicedDataPtr&);
- virtual void endInstance();
- virtual void startSlice(const std::string&, int, bool);
- virtual void endSlice();
-
- virtual bool writeOpt(Ice::Int, Ice::OptionalFormat);
-
- private:
-
- void writeSlicedData(const Ice::SlicedDataPtr&);
- void writeInstance(const Ice::ObjectPtr&);
-
- struct InstanceData
- {
- InstanceData(InstanceData* p) : previous(p), next(0)
- {
- if(previous)
- {
- previous->next = this;
- }
- }
-
- ~InstanceData()
- {
- if(next)
- {
- delete next;
- }
- }
-
- // Instance attributes
- SliceType sliceType;
- bool firstSlice;
-
- // Slice attributes
- Ice::Byte sliceFlags;
- Container::size_type writeSlice; // Position of the slice data members
- Container::size_type sliceFlagsPos; // Position of the slice flags
- PtrToIndexMap indirectionMap;
- ObjectList indirectionTable;
-
- InstanceData* previous;
- InstanceData* next;
- };
- InstanceData _preAllocatedInstanceData;
- InstanceData* _current;
-
- Ice::Int _objectIdIndex; // The ID of the next object to marhsal
- };
-
- class ReadEncaps : private ::IceUtil::noncopyable
- {
- public:
-
- ReadEncaps() : start(0), decoder(0), previous(0)
- {
- // Inlined for performance reasons.
- }
- ~ReadEncaps()
- {
- // Inlined for performance reasons.
- delete decoder;
- }
- void reset()
- {
- // Inlined for performance reasons.
- delete decoder;
- decoder = 0;
-
- previous = 0;
- }
-
- Container::size_type start;
- Ice::Int sz;
- Ice::EncodingVersion encoding;
-
- EncapsDecoder* decoder;
-
- ReadEncaps* previous;
- };
-
- class WriteEncaps : private ::IceUtil::noncopyable
- {
-
- public:
-
- WriteEncaps() : format(Ice::DefaultFormat), encoder(0), previous(0)
- {
- // Inlined for performance reasons.
- }
- ~WriteEncaps()
- {
- // Inlined for performance reasons.
- delete encoder;
- }
- void reset()
- {
- // Inlined for performance reasons.
- delete encoder;
- encoder = 0;
-
- previous = 0;
- }
-
- Container::size_type start;
- Ice::EncodingVersion encoding;
- Ice::FormatType format;
-
- EncapsEncoder* encoder;
-
- WriteEncaps* previous;
- };
-
- //
- // The encoding version to use when there's no encapsulation to
- // read from or write to. This is for example used to read message
- // headers or when the user is using the streaming API with no
- // encapsulation.
- //
- Ice::EncodingVersion _encoding;
-
- ReadEncaps* _currentReadEncaps;
- WriteEncaps* _currentWriteEncaps;
-
- void initReadEncaps();
- void initWriteEncaps();
-
- ReadEncaps _preAllocatedReadEncaps;
- WriteEncaps _preAllocatedWriteEncaps;
-
- bool _sliceObjects;
-
- const IceUtil::StringConverterPtr _stringConverter;
- const IceUtil::WstringConverterPtr _wstringConverter;
-
- int _startSeq;
- int _minSeqSize;
-};
-
-} // End namespace IceInternal
-
-#endif
diff --git a/cpp/include/Ice/BatchRequestInterceptor.h b/cpp/include/Ice/BatchRequestInterceptor.h
index 7f3b36e581c..70c6a7a8e61 100644
--- a/cpp/include/Ice/BatchRequestInterceptor.h
+++ b/cpp/include/Ice/BatchRequestInterceptor.h
@@ -11,11 +11,7 @@
#define ICE_BATCH_REQUEST_INTERCEPTOR_H
#include <IceUtil/Shared.h>
-
#include <Ice/ProxyF.h>
-#ifdef ICE_CPP11
-# include <functional>
-#endif
namespace Ice
{
@@ -31,9 +27,11 @@ public:
virtual void enqueue() const = 0;
virtual int getSize() const = 0;
virtual const std::string& getOperation() const = 0;
- virtual const Ice::ObjectPrx& getProxy() const = 0;
+ virtual const Ice::ObjectPrxPtr& getProxy() const = 0;
};
+#ifndef ICE_CPP11_MAPPING
+
class BatchRequestInterceptor : public IceUtil::Shared
{
public:
@@ -42,11 +40,8 @@ public:
};
typedef IceUtil::Handle<BatchRequestInterceptor> BatchRequestInterceptorPtr;
-#ifdef ICE_CPP11
-ICE_API BatchRequestInterceptorPtr
-newBatchRequestInterceptor(const ::std::function<void (const BatchRequest&, int, int)>&);
#endif
-};
+}
#endif
diff --git a/cpp/include/Ice/Buffer.h b/cpp/include/Ice/Buffer.h
index 15df1a23745..c9264e258cb 100644
--- a/cpp/include/Ice/Buffer.h
+++ b/cpp/include/Ice/Buffer.h
@@ -21,7 +21,8 @@ public:
Buffer() : i(b.begin()) { }
Buffer(const Ice::Byte* beg, const Ice::Byte* end) : b(beg, end), i(b.begin()) { }
- virtual ~Buffer() { }
+ Buffer(const std::vector<Ice::Byte>& v) : b(v), i(b.begin()) { }
+ Buffer(Buffer& o, bool adopt) : b(o.b, adopt), i(b.begin()) { }
void swapBuffer(Buffer&);
@@ -43,6 +44,8 @@ public:
Container();
Container(const_iterator, const_iterator);
+ Container(const std::vector<value_type>&);
+ Container(Container&, bool);
~Container();
@@ -77,13 +80,11 @@ public:
}
void swap(Container&);
-
+
void clear();
void resize(size_type n) // Inlined for performance reasons.
{
- assert(!_buf || _capacity > 0);
-
if(n == 0)
{
clear();
@@ -94,17 +95,15 @@ public:
}
_size = n;
}
-
+
void reset()
{
- assert(!_buf || _capacity > 0);
-
if(_size > 0 && _size * 2 < _capacity)
{
//
// If the current buffer size is smaller than the
// buffer capacity, we shrink the buffer memory to the
- // current size. This is to avoid holding on too much
+ // current size. This is to avoid holding onto too much
// memory if it's not needed anymore.
//
if(++_shrinkCounter > 2)
@@ -137,7 +136,7 @@ public:
assert(n < _size);
return _buf[n];
}
-
+
private:
Container(const Container&);
@@ -148,6 +147,7 @@ public:
size_type _size;
size_type _capacity;
int _shrinkCounter;
+ bool _owned;
};
Container b;
diff --git a/cpp/include/Ice/CommunicatorAsync.h b/cpp/include/Ice/CommunicatorAsync.h
index 2c55e03c634..4dcbb9d4310 100644
--- a/cpp/include/Ice/CommunicatorAsync.h
+++ b/cpp/include/Ice/CommunicatorAsync.h
@@ -10,6 +10,8 @@
#ifndef ICE_COMMUNICATOR_ASYNC_H
#define ICE_COMMUNICATOR_ASYNC_H
+#ifndef ICE_CPP11_MAPPING
+
#include <Ice/Communicator.h>
namespace Ice
@@ -31,18 +33,18 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- ::Ice::CommunicatorPtr __com = __result->getCommunicator();
- assert(__com);
+ ::Ice::CommunicatorPtr communicator = result->getCommunicator();
+ assert(communicator);
try
{
- __com->end_flushBatchRequests(__result);
+ communicator->end_flushBatchRequests(result);
assert(false);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::CallbackNC<T>::exception(__result, ex);
+ ::IceInternal::CallbackNC<T>::exception(result, ex);
}
}
};
@@ -79,18 +81,18 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- ::Ice::CommunicatorPtr __com = __result->getCommunicator();
- assert(__com);
+ ::Ice::CommunicatorPtr communicator = result->getCommunicator();
+ assert(communicator);
try
{
- __com->end_flushBatchRequests(__result);
+ communicator->end_flushBatchRequests(result);
assert(false);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::Callback<T, CT>::exception(__result, ex);
+ ::IceInternal::Callback<T, CT>::exception(result, ex);
}
}
};
@@ -111,5 +113,6 @@ newCallback_Communicator_flushBatchRequests(T* instance, void (T::*excb)(const :
}
}
+#endif
#endif
diff --git a/cpp/include/Ice/Comparable.h b/cpp/include/Ice/Comparable.h
new file mode 100644
index 00000000000..aa630de3581
--- /dev/null
+++ b/cpp/include/Ice/Comparable.h
@@ -0,0 +1,130 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_COMPARABLE_H
+#define ICE_COMPARABLE_H
+
+#include <functional>
+
+namespace Ice
+{
+
+template<typename T, typename U>
+inline bool targetEqualTo(const T& lhs, const U& rhs)
+{
+ if(lhs && rhs)
+ {
+ return *lhs == *rhs;
+ }
+ else
+ {
+ return !lhs && !rhs;
+ }
+}
+
+template<typename T, typename U>
+inline bool targetLess(const T& lhs, const U& rhs)
+{
+ if(lhs && rhs)
+ {
+ return *lhs < *rhs;
+ }
+ else
+ {
+ return !lhs && rhs;
+ }
+}
+
+template<typename T, typename U>
+inline bool targetGreater(const T& lhs, const U& rhs)
+{
+ return targetLess(rhs, lhs);
+}
+
+template<typename T, typename U>
+inline bool targetLessEqual(const T& lhs, const U& rhs)
+{
+ return !targetGreater(lhs, rhs);
+}
+
+template<typename T, typename U>
+inline bool targetGreaterEqual(const T& lhs, const U& rhs)
+{
+ return !targetLess(lhs, rhs);
+}
+
+template<typename T, typename U>
+inline bool targetNotEqualTo(const T& lhs, const U& rhs)
+{
+ return !targetEqualTo(lhs, rhs);
+}
+
+#ifdef ICE_CPP11_MAPPING
+
+template<typename T, template<typename> class Compare>
+struct TargetCompare
+{
+ bool operator()(const T& lhs, const T& rhs) const
+ {
+ if(lhs && rhs)
+ {
+ return Compare<typename T::element_type>()(*lhs, *rhs);
+ }
+ else
+ {
+ return Compare<bool>()(static_cast<const bool>(lhs), static_cast<const bool>(rhs));
+ }
+ }
+};
+
+//
+// Relational operators for generated structs and classes
+//
+
+template<class C, typename = std::enable_if<std::is_member_function_pointer<decltype(&C::ice_tuple)>::value>>
+bool operator<(const C& lhs, const C& rhs)
+{
+ return lhs.ice_tuple() < rhs.ice_tuple();
+}
+
+template<class C, typename = std::enable_if<std::is_member_function_pointer<decltype(&C::ice_tuple)>::value>>
+bool operator<=(const C& lhs, const C& rhs)
+{
+ return lhs.ice_tuple() <= rhs.ice_tuple();
+}
+
+template<class C, typename = std::enable_if<std::is_member_function_pointer<decltype(&C::ice_tuple)>::value>>
+bool operator>(const C& lhs, const C& rhs)
+{
+ return lhs.ice_tuple() > rhs.ice_tuple();
+}
+
+template<class C, typename = std::enable_if<std::is_member_function_pointer<decltype(&C::ice_tuple)>::value>>
+bool operator>=(const C& lhs, const C& rhs)
+{
+ return lhs.ice_tuple() >= rhs.ice_tuple();
+}
+
+template<class C, typename = std::enable_if<std::is_member_function_pointer<decltype(&C::ice_tuple)>::value>>
+bool operator==(const C& lhs, const C& rhs)
+{
+ return lhs.ice_tuple() == rhs.ice_tuple();
+}
+
+template<class C, typename = std::enable_if<std::is_member_function_pointer<decltype(&C::ice_tuple)>::value>>
+bool operator!=(const C& lhs, const C& rhs)
+{
+ return lhs.ice_tuple() != rhs.ice_tuple();
+}
+
+#endif
+
+}
+
+#endif
diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h
index dba1536ea53..756837794a7 100644
--- a/cpp/include/Ice/Config.h
+++ b/cpp/include/Ice/Config.h
@@ -22,7 +22,7 @@
#include <vector>
#include <map>
-#ifndef ICE_OS_WINRT
+#ifndef ICE_OS_UWP
# if defined(_WIN32)
# include <process.h>
# else
@@ -33,24 +33,6 @@
#endif
//
-// Automatically link Ice[D].lib with Visual C++
-//
-
-#if !defined(ICE_BUILDING_ICE) && defined(ICE_API_EXPORTS)
-# define ICE_BUILDING_ICE
-#endif
-
-#if defined(_MSC_VER)
-# if !defined(ICE_BUILDING_ICE)
-# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
-# pragma comment(lib, "IceD.lib")
-# else
-# pragma comment(lib, "Ice.lib")
-# endif
-# endif
-#endif
-
-//
// Define the Ice and IceInternal namespace, so that we can use the following
// everywhere in our code:
//
@@ -65,23 +47,17 @@ namespace IceInternal
{
}
-#ifndef ICE_API
-# ifdef ICE_API_EXPORTS
-# define ICE_API ICE_DECLSPEC_EXPORT
-# elif defined(ICE_STATIC_LIBS)
-# define ICE_API /**/
-# else
-# define ICE_API ICE_DECLSPEC_IMPORT
-# endif
-#endif
-
namespace Ice
{
typedef unsigned char Byte;
typedef short Short;
typedef int Int;
+#ifdef ICE_CPP11_MAPPING
+typedef long long int Long;
+#else
typedef IceUtil::Int64 Long;
+#endif
typedef float Float;
typedef double Double;
@@ -90,12 +66,7 @@ typedef double Double;
namespace IceInternal
{
-// TODO: Should not be inline, this is not performance critical.
-#ifdef _WIN32
-inline int getSystemErrno() { return GetLastError(); }
-#else
-inline int getSystemErrno() { return errno; }
-#endif
+ICE_API int getSystemErrno();
}
diff --git a/cpp/include/Ice/ConnectionAsync.h b/cpp/include/Ice/ConnectionAsync.h
index 9e6728a1f72..efb0bbc3ec6 100644
--- a/cpp/include/Ice/ConnectionAsync.h
+++ b/cpp/include/Ice/ConnectionAsync.h
@@ -10,6 +10,8 @@
#ifndef ICE_CONNECTION_ASYNC_H
#define ICE_CONNECTION_ASYNC_H
+#ifndef ICE_CPP11_MAPPING
+
#include <Ice/Connection.h>
#include <Ice/Proxy.h>
@@ -32,18 +34,18 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- ::Ice::ConnectionPtr __con = __result->getConnection();
- assert(__con);
+ ::Ice::ConnectionPtr connection = result->getConnection();
+ assert(connection);
try
{
- __con->end_flushBatchRequests(__result);
+ connection->end_flushBatchRequests(result);
assert(false);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::CallbackNC<T>::exception(__result, ex);
+ ::IceInternal::CallbackNC<T>::exception(result, ex);
}
}
};
@@ -79,18 +81,18 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- ::Ice::ConnectionPtr __con = __result->getConnection();
- assert(__con);
+ ::Ice::ConnectionPtr connection = result->getConnection();
+ assert(connection);
try
{
- __con->end_flushBatchRequests(__result);
+ connection->end_flushBatchRequests(result);
assert(false);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::Callback<T, CT>::exception(__result, ex);
+ ::IceInternal::Callback<T, CT>::exception(result, ex);
}
}
};
@@ -110,6 +112,100 @@ newCallback_Connection_flushBatchRequests(T* instance, void (T::*excb)(const ::I
return new Callback_Connection_flushBatchRequests<T, CT>(instance, excb, sentcb);
}
+template<class T>
+class CallbackNC_Connection_heartbeat : public Callback_Connection_heartbeat_Base,
+ public ::IceInternal::OnewayCallbackNC<T>
+{
+public:
+
+ typedef IceUtil::Handle<T> TPtr;
+
+ typedef void (T::*Exception)(const ::Ice::Exception&);
+ typedef void (T::*Sent)(bool);
+
+ CallbackNC_Connection_heartbeat(const TPtr& obj, Exception excb, Sent sentcb)
+ : ::IceInternal::OnewayCallbackNC<T>(obj, 0, excb, sentcb)
+ {
+ }
+
+ virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ {
+ ::Ice::ConnectionPtr __con = __result->getConnection();
+ assert(__con);
+ try
+ {
+ __con->end_heartbeat(__result);
+ assert(false);
+ }
+ catch(const ::Ice::Exception& ex)
+ {
+ ::IceInternal::CallbackNC<T>::exception(__result, ex);
+ }
+ }
+};
+
+template<class T> Callback_Connection_heartbeatPtr
+newCallback_Connection_heartbeat(const IceUtil::Handle<T>& instance,
+ void (T::*excb)(const ::Ice::Exception&),
+ void (T::*sentcb)(bool) = 0)
+{
+ return new CallbackNC_Connection_heartbeat<T>(instance, excb, sentcb);
+}
+
+template<class T> Callback_Connection_heartbeatPtr
+newCallback_Connection_heartbeat(T* instance, void (T::*excb)(const ::Ice::Exception&), void (T::*sentcb)(bool) = 0)
+{
+ return new CallbackNC_Connection_heartbeat<T>(instance, excb, sentcb);
}
+template<class T, typename CT>
+class Callback_Connection_heartbeat : public Callback_Connection_heartbeat_Base,
+ public ::IceInternal::OnewayCallback<T, CT>
+{
+public:
+
+ typedef IceUtil::Handle<T> TPtr;
+
+ typedef void (T::*Exception)(const ::Ice::Exception& , const CT&);
+ typedef void (T::*Sent)(bool , const CT&);
+
+ Callback_Connection_heartbeat(const TPtr& obj, Exception excb, Sent sentcb)
+ : ::IceInternal::OnewayCallback<T, CT>(obj, 0, excb, sentcb)
+ {
+ }
+
+ virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ {
+ ::Ice::ConnectionPtr __con = __result->getConnection();
+ assert(__con);
+ try
+ {
+ __con->end_heartbeat(__result);
+ assert(false);
+ }
+ catch(const ::Ice::Exception& ex)
+ {
+ ::IceInternal::Callback<T, CT>::exception(__result, ex);
+ }
+ }
+};
+
+template<class T, typename CT> Callback_Connection_heartbeatPtr
+newCallback_Connection_heartbeat(const IceUtil::Handle<T>& instance,
+ void (T::*excb)(const ::Ice::Exception&, const CT&),
+ void (T::*sentcb)(bool, const CT&) = 0)
+{
+ return new Callback_Connection_heartbeat<T, CT>(instance, excb, sentcb);
+}
+
+template<class T, typename CT> Callback_Connection_heartbeatPtr
+newCallback_Connection_heartbeat(T* instance, void (T::*excb)(const ::Ice::Exception&, const CT&),
+ void (T::*sentcb)(bool, const CT&) = 0)
+{
+ return new Callback_Connection_heartbeat<T, CT>(instance, excb, sentcb);
+}
+
+}
+
+#endif
#endif
diff --git a/cpp/include/Ice/ConnectionFactoryF.h b/cpp/include/Ice/ConnectionFactoryF.h
deleted file mode 100644
index 70c35efeea4..00000000000
--- a/cpp/include/Ice/ConnectionFactoryF.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_CONNECTION_FACTORY_F_H
-#define ICE_CONNECTION_FACTORY_F_H
-
-#include <IceUtil/Shared.h>
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class OutgoingConnectionFactory;
-ICE_API IceUtil::Shared* upCast(OutgoingConnectionFactory*);
-typedef IceInternal::Handle<OutgoingConnectionFactory> OutgoingConnectionFactoryPtr;
-
-class IncomingConnectionFactory;
-ICE_API IceUtil::Shared* upCast(IncomingConnectionFactory*);
-typedef IceInternal::Handle<IncomingConnectionFactory> IncomingConnectionFactoryPtr;
-
-}
-
-#endif
diff --git a/cpp/include/Ice/ConnectionIF.h b/cpp/include/Ice/ConnectionIF.h
index 712e23b7533..c783e0d6fa3 100644
--- a/cpp/include/Ice/ConnectionIF.h
+++ b/cpp/include/Ice/ConnectionIF.h
@@ -17,8 +17,12 @@ namespace Ice
{
class ConnectionI;
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+using ConnectionIPtr = ::std::shared_ptr<ConnectionI>;
+#else // C++98 mapping
ICE_API Ice::LocalObject* upCast(Ice::ConnectionI*);
typedef IceInternal::Handle<ConnectionI> ConnectionIPtr;
+#endif
}
diff --git a/cpp/include/Ice/ConsoleUtil.h b/cpp/include/Ice/ConsoleUtil.h
new file mode 100644
index 00000000000..10a6d3827a5
--- /dev/null
+++ b/cpp/include/Ice/ConsoleUtil.h
@@ -0,0 +1,28 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_CONSOLE_UTIL_H
+#define ICE_CONSOLE_UTIL_H
+
+#include <IceUtil/ConsoleUtil.h>
+
+namespace IceInternal
+{
+
+using IceUtilInternal::consoleOut;
+using IceUtilInternal::consoleErr;
+
+#if defined(_WIN32) && !defined(ICE_OS_UWP)
+using IceUtilInternal::endl;
+using IceUtilInternal::flush;
+#endif
+
+}
+
+#endif
diff --git a/cpp/include/Ice/DefaultObjectFactory.h b/cpp/include/Ice/DefaultValueFactory.h
index 4ff4f9f60ab..addcc005b6e 100644
--- a/cpp/include/Ice/DefaultObjectFactory.h
+++ b/cpp/include/Ice/DefaultValueFactory.h
@@ -1,26 +1,43 @@
// **********************************************************************
//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-#ifndef ICE_DEFAULT_OBJECT_FACTORY_H
-#define ICE_DEFAULT_OBJECT_FACTORY_H
+#ifndef ICE_DEFAULT_VALUE_FACTORY_H
+#define ICE_DEFAULT_VALUE_FACTORY_H
#include <Ice/Config.h>
-#include <Ice/ObjectFactory.h>
+#include <Ice/ValueFactory.h>
namespace IceInternal
{
-template<class O>
-class DefaultObjectFactory : public Ice::ObjectFactory
+
+#ifdef ICE_CPP11_MAPPING
+
+template<class V>
+::std::shared_ptr<::Ice::Value>
+#ifdef NDEBUG
+defaultValueFactory(const std::string&)
+#else
+defaultValueFactory(const std::string& typeId)
+#endif
+{
+ assert(typeId == V::ice_staticId());
+ return std::make_shared<V>();
+}
+
+#else
+
+template<class V>
+class DefaultValueFactory : public Ice::ValueFactory
{
public:
-
- DefaultObjectFactory(const ::std::string& typeId) :
+
+ DefaultValueFactory(const ::std::string& typeId) :
_typeId(typeId)
{
}
@@ -32,17 +49,14 @@ public:
#endif
{
assert(typeId == _typeId);
- return new O;
- }
-
- virtual void destroy()
- {
+ return new V;
}
private:
const ::std::string _typeId;
};
-}
+#endif
+}
#endif
diff --git a/cpp/include/Ice/DeprecatedStringConverter.h b/cpp/include/Ice/DeprecatedStringConverter.h
deleted file mode 100644
index 141e7705dc6..00000000000
--- a/cpp/include/Ice/DeprecatedStringConverter.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_DEPRECATED_STRING_CONVERTER_H
-#define ICE_DEPRECATED_STRING_CONVERTER_H
-
-#include <Ice/Config.h>
-#include <Ice/CommunicatorF.h>
-#include <IceUtil/StringConverter.h>
-#include <Ice/Plugin.h>
-
-namespace Ice
-{
-
-typedef IceUtil::StringConverterPtr StringConverterPtr;
-typedef IceUtil::WstringConverterPtr WstringConverterPtr;
-
-//
-// A plug-in that sets the process string converter and wide string in its constructor.
-// Both initialize and destroy are no-op.
-// It's deprecated because if you want to install your own string converters with a
-// plugin, you should simply implement your own Plugin class, derived directly from
-// Ice::Plugin.
-//
-class ICE_API StringConverterPlugin : public Plugin
-{
-public:
-
- ICE_DEPRECATED_API("StringConverterPlugin is deprecated, use Ice::Plugin instead")
- StringConverterPlugin(const CommunicatorPtr&,
- const StringConverterPtr&, const WstringConverterPtr& = 0);
-
- virtual void initialize();
-
- virtual void destroy();
-};
-
-ICE_DEPRECATED_API("is deprecated, use IceUtil::nativeToUTF8(const std::string&, const StringConverterPtr&) instead")
-ICE_API std::string
-nativeToUTF8(const StringConverterPtr&, const std::string&);
-
-ICE_DEPRECATED_API("is deprecated, use IceUtil::nativeToUTF8(const std::string&, const StringConverterPtr&) instead")
-ICE_API std::string
-nativeToUTF8(const CommunicatorPtr&, const std::string&);
-
-ICE_DEPRECATED_API("is deprecated, use IceUtil::UTF8ToNative(const std::string&, const StringConverterPtr&) instead")
-ICE_API std::string
-UTF8toNative(const StringConverterPtr&, const std::string&);
-
-ICE_DEPRECATED_API("is deprecated, use IceUtil::UTF8ToNative(const std::string&, const StringConverterPtr&) instead")
-ICE_API std::string
-UTF8ToNative(const CommunicatorPtr&, const std::string&);
-
-}
-
-#endif
diff --git a/cpp/include/Ice/DispatchInterceptor.h b/cpp/include/Ice/DispatchInterceptor.h
index 1b537e6e210..5233f2fadbb 100644
--- a/cpp/include/Ice/DispatchInterceptor.h
+++ b/cpp/include/Ice/DispatchInterceptor.h
@@ -19,14 +19,12 @@ class ICE_API DispatchInterceptor : public virtual Object
{
public:
- virtual DispatchStatus
- dispatch(Request&) = 0;
+ virtual bool dispatch(Request&) = 0;
- virtual DispatchStatus
- __dispatch(IceInternal::Incoming&, const Current&);
+ virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
};
-typedef IceInternal::Handle<DispatchInterceptor> DispatchInterceptorPtr;
+ICE_DEFINE_PTR(DispatchInterceptorPtr, DispatchInterceptor);
}
diff --git a/cpp/include/Ice/Dispatcher.h b/cpp/include/Ice/Dispatcher.h
index 645a97140da..c30c240699c 100644
--- a/cpp/include/Ice/Dispatcher.h
+++ b/cpp/include/Ice/Dispatcher.h
@@ -10,42 +10,43 @@
#ifndef ICE_DISPATCHER_H
#define ICE_DISPATCHER_H
-#include <IceUtil/Config.h>
+#if !defined(ICE_CPP11_MAPPING) || defined(ICE_BUILDING_SRC)
+//
+// Part of the C++98 mapping, and "internal" definitions when building Ice
+// with the C++11 mapping
+//
+
+#include <Ice/Config.h>
#include <IceUtil/Shared.h>
#include <IceUtil/Handle.h>
#include <Ice/ConnectionF.h>
-#ifdef ICE_CPP11
-# include <functional>
-#endif
namespace Ice
{
-class ICE_API DispatcherCall : virtual public IceUtil::Shared
+class ICE_API DispatcherCall : public virtual IceUtil::Shared
{
public:
- virtual ~DispatcherCall() { }
+ virtual ~DispatcherCall();
virtual void run() = 0;
};
typedef IceUtil::Handle<DispatcherCall> DispatcherCallPtr;
-class ICE_API Dispatcher : virtual public IceUtil::Shared
+class ICE_API Dispatcher : public virtual IceUtil::Shared
{
public:
+ virtual ~Dispatcher();
+
virtual void dispatch(const DispatcherCallPtr&, const ConnectionPtr&) = 0;
};
typedef IceUtil::Handle<Dispatcher> DispatcherPtr;
-#ifdef ICE_CPP11
-ICE_API DispatcherPtr
-newDispatcher(const ::std::function<void (const DispatcherCallPtr&, const ConnectionPtr)>&);
-#endif
-
}
#endif
+#endif
diff --git a/cpp/include/Ice/DynamicLibrary.h b/cpp/include/Ice/DynamicLibrary.h
index 3c931bf120c..f181dc0196a 100644
--- a/cpp/include/Ice/DynamicLibrary.h
+++ b/cpp/include/Ice/DynamicLibrary.h
@@ -21,7 +21,7 @@ class ICE_API DynamicLibrary : public ::IceUtil::Shared
public:
DynamicLibrary();
- ~DynamicLibrary();
+ virtual ~DynamicLibrary();
#ifdef _WIN32
typedef FARPROC symbol_type;
@@ -40,12 +40,12 @@ public:
//
// The name of the library is constructed from the given
// information. If no version is supplied and the boolean
- // argument is true, the Ice version (10 * major + minor) is
+ // argument is true, the Ice version (10 * major + minor) is
// used instead.
//
// For example, consider the following entry point:
- //
- // foo:create
+ //
+ // foo:create
//
// This would result in libfoo.so.11 (Unix) and foo11.dll
// (Windows), where the Ice version is 1.1.x.
@@ -93,6 +93,8 @@ class ICE_API DynamicLibraryList : public ::IceUtil::Shared
{
public:
+ virtual ~DynamicLibraryList();
+
void add(const DynamicLibraryPtr&);
private:
diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h
index 8f6465c1e17..dd47405c1f0 100644
--- a/cpp/include/Ice/Exception.h
+++ b/cpp/include/Ice/Exception.h
@@ -15,99 +15,106 @@
#include <Ice/Format.h>
#include <Ice/Handle.h>
#include <Ice/ObjectF.h>
-#include <Ice/StreamF.h>
-
-namespace IceInternal
-{
-
-class BasicStream;
-
-namespace Ex
-{
-
-ICE_API void throwUOE(const ::std::string&, const ::Ice::ObjectPtr&);
-ICE_API void throwMemoryLimitException(const char*, int, size_t, size_t);
-ICE_API void throwMarshalException(const char*, int, const std::string&);
-
-}
-
-}
+#include <Ice/ValueF.h>
namespace Ice
{
+class OutputStream;
+class InputStream;
+
typedef IceUtil::Exception Exception;
+//
+// Base class for all Ice run-time exceptions
+//
class ICE_API LocalException : public IceUtil::Exception
{
public:
LocalException(const char*, int);
+
+#ifdef ICE_CPP11_COMPILER
+ LocalException(const LocalException&) = default;
+ virtual ~LocalException();
+#else
virtual ~LocalException() throw();
- virtual std::string ice_name() const = 0;
+#endif
+
+#ifdef ICE_CPP11_MAPPING
+ std::unique_ptr<LocalException> ice_clone() const;
+#else
virtual LocalException* ice_clone() const = 0;
- virtual void ice_throw() const = 0;
+#endif
+
+ static const std::string& ice_staticId();
};
+
+//
+// Base class for all Ice user exceptions
+//
class ICE_API UserException : public IceUtil::Exception
{
public:
- virtual std::string ice_name() const = 0;
- virtual UserException* ice_clone() const = 0;
- virtual void ice_throw() const = 0;
+ virtual void _write(::Ice::OutputStream*) const;
+ virtual void _read(::Ice::InputStream*);
- virtual void __write(::IceInternal::BasicStream*) const;
- virtual void __read(::IceInternal::BasicStream*);
+ virtual bool _usesClasses() const;
- virtual void __write(const OutputStreamPtr&) const;
- virtual void __read(const InputStreamPtr&);
+#ifdef ICE_CPP11_MAPPING
+ std::unique_ptr<UserException> ice_clone() const;
+#else
+ virtual UserException* ice_clone() const = 0;
+#endif
- virtual bool __usesClasses() const;
+ static const std::string& ice_staticId();
protected:
- virtual void __writeImpl(::IceInternal::BasicStream*) const = 0;
- virtual void __readImpl(::IceInternal::BasicStream*) = 0;
-
- virtual void __writeImpl(const OutputStreamPtr&) const;
- virtual void __readImpl(const InputStreamPtr&);
+ virtual void _writeImpl(::Ice::OutputStream*) const {}
+ virtual void _readImpl(::Ice::InputStream*) {}
};
-typedef ::IceInternal::Handle<UserException> UserExceptionPtr;
+//
+// Base class for all Ice system exceptions
+//
class ICE_API SystemException : public IceUtil::Exception
{
public:
SystemException(const char*, int);
+#ifdef ICE_CPP11_COMPILER
+ SystemException(const SystemException&) = default;
+ virtual ~SystemException();
+#else
virtual ~SystemException() throw();
- virtual std::string ice_name() const = 0;
+#endif
+
+#ifdef ICE_CPP11_MAPPING
+ std::unique_ptr<SystemException> ice_clone() const;
+#else
virtual SystemException* ice_clone() const = 0;
- virtual void ice_throw() const = 0;
+#endif
+
+ static const std::string& ice_staticId();
};
-typedef ::IceInternal::Handle<SystemException> SystemExceptionPtr;
+}
-#if defined(__SUNPRO_CC)
-//
-// COMPILERFIX: With Sun CC the presence of the overloaded operator
-// in ProxyHandle.h
-//
-// template<class OStream, class Y>
-// OStream& operator<<(OStream& os, ::IceInternal::ProxyHandle<Y> p)
-//
-// prevents the compiler from using the overloaded operator for
-// Exception in IceUtil/Exception.h
-//
-// std::ostream& operator<<(std::ostream&, const Exception&);
-//
-// thus causing a compile error and making these overloads necessary.
-//
-ICE_API std::ostream& operator<<(std::ostream&, const LocalException&);
-ICE_API std::ostream& operator<<(std::ostream&, const UserException&);
-ICE_API std::ostream& operator<<(std::ostream&, const SystemException&);
-#endif
+namespace IceInternal
+{
+
+namespace Ex
+{
+
+ICE_API void throwUOE(const ::std::string&, const ::Ice::ValuePtr&);
+ICE_API void throwMemoryLimitException(const char*, int, size_t, size_t);
+ICE_API void throwMarshalException(const char*, int, const std::string&);
+
+}
}
diff --git a/cpp/include/Ice/ExceptionHelpers.h b/cpp/include/Ice/ExceptionHelpers.h
new file mode 100644
index 00000000000..28efc9c9060
--- /dev/null
+++ b/cpp/include/Ice/ExceptionHelpers.h
@@ -0,0 +1,69 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_EXCEPTION_HELPERS_H
+#define ICE_EXCEPTION_HELPERS_H
+
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+
+#include <Ice/InputStream.h>
+#include <Ice/OutputStream.h>
+
+namespace Ice
+{
+
+class LocalException;
+
+template<typename T, typename B> class LocalExceptionHelper : public IceUtil::ExceptionHelper<T, B>
+{
+public:
+
+ using IceUtil::ExceptionHelper<T, B>::ExceptionHelper;
+
+ virtual std::string ice_id() const override
+ {
+ return T::ice_staticId();
+ }
+};
+
+template<typename T, typename B> class UserExceptionHelper : public IceUtil::ExceptionHelper<T, B>
+{
+public:
+
+ using IceUtil::ExceptionHelper<T, B>::ExceptionHelper;
+
+ virtual std::string ice_id() const override
+ {
+ return T::ice_staticId();
+ }
+
+protected:
+
+ virtual void _writeImpl(Ice::OutputStream* os) const override
+ {
+ os->startSlice(T::ice_staticId(), -1, std::is_same<B, Ice::LocalException>::value ? true : false);
+ Ice::StreamWriter<T, Ice::OutputStream>::write(os, static_cast<const T&>(*this));
+ os->endSlice();
+ B::_writeImpl(os);
+ }
+
+ virtual void _readImpl(Ice::InputStream* is) override
+ {
+ is->startSlice();
+ Ice::StreamReader<T, ::Ice::InputStream>::read(is, static_cast<T&>(*this));
+ is->endSlice();
+ B::_readImpl(is);
+ }
+};
+
+}
+
+#endif // C++11 mapping end
+
+#endif
diff --git a/cpp/include/Ice/FactoryTable.h b/cpp/include/Ice/FactoryTable.h
index 4cbcc199135..401d6a94e3b 100644
--- a/cpp/include/Ice/FactoryTable.h
+++ b/cpp/include/Ice/FactoryTable.h
@@ -12,8 +12,7 @@
#include <IceUtil/Mutex.h>
#include <Ice/UserExceptionFactory.h>
-#include <Ice/ObjectFactoryF.h>
-
+#include <Ice/ValueFactory.h>
namespace Ice
{
@@ -35,13 +34,13 @@ class ICE_API FactoryTable : private IceUtil::noncopyable
{
public:
- void addExceptionFactory(const ::std::string&, const IceInternal::UserExceptionFactoryPtr&);
- IceInternal::UserExceptionFactoryPtr getExceptionFactory(const ::std::string&) const;
+ void addExceptionFactory(const ::std::string&, ICE_IN(ICE_USER_EXCEPTION_FACTORY));
+ ICE_USER_EXCEPTION_FACTORY getExceptionFactory(const ::std::string&) const;
void removeExceptionFactory(const ::std::string&);
- void addObjectFactory(const ::std::string&, const Ice::ObjectFactoryPtr&);
- Ice::ObjectFactoryPtr getObjectFactory(const ::std::string&) const;
- void removeObjectFactory(const ::std::string&);
+ void addValueFactory(const ::std::string&, ICE_IN(ICE_VALUE_FACTORY));
+ ICE_VALUE_FACTORY getValueFactory(const ::std::string&) const;
+ void removeValueFactory(const ::std::string&);
void addTypeId(int, const ::std::string&);
std::string getTypeId(int) const;
@@ -51,13 +50,13 @@ private:
IceUtil::Mutex _m;
- typedef ::std::pair<IceInternal::UserExceptionFactoryPtr, int> EFPair;
+ typedef ::std::pair<ICE_USER_EXCEPTION_FACTORY, int> EFPair;
typedef ::std::map< ::std::string, EFPair> EFTable;
EFTable _eft;
- typedef ::std::pair<Ice::ObjectFactoryPtr, int> OFPair;
- typedef ::std::map< ::std::string, OFPair> OFTable;
- OFTable _oft;
+ typedef ::std::pair<ICE_VALUE_FACTORY, int> VFPair;
+ typedef ::std::map< ::std::string, VFPair> VFTable;
+ VFTable _vft;
typedef ::std::pair< ::std::string, int> TypeIdPair;
typedef ::std::map<int, TypeIdPair> TypeIdTable;
diff --git a/cpp/include/Ice/FactoryTableInit.h b/cpp/include/Ice/FactoryTableInit.h
index cd3723801f6..00afef7c91c 100644
--- a/cpp/include/Ice/FactoryTableInit.h
+++ b/cpp/include/Ice/FactoryTableInit.h
@@ -11,7 +11,7 @@
#define ICE_FACTORYTABLEINIT_H
#include <Ice/FactoryTable.h>
-#include <Ice/DefaultObjectFactory.h>
+#include <Ice/DefaultValueFactory.h>
namespace IceInternal
{
@@ -32,12 +32,12 @@ extern ICE_API FactoryTable* factoryTable;
class ICE_API CompactIdInit
{
public:
-
+
CompactIdInit(const char*, int);
-
~CompactIdInit();
-
+
private:
+
const int _compactId;
};
@@ -45,41 +45,44 @@ template<class E>
class DefaultUserExceptionFactoryInit
{
public:
-
- DefaultUserExceptionFactoryInit(const char* typeId) :
- _typeId(typeId)
+
+ DefaultUserExceptionFactoryInit(const char* tId) : typeId(tId)
{
- factoryTable->addExceptionFactory(_typeId, new DefaultUserExceptionFactory<E>(_typeId));
+#ifdef ICE_CPP11_MAPPING
+ factoryTable->addExceptionFactory(typeId, defaultUserExceptionFactory<E>);
+#else
+ factoryTable->addExceptionFactory(typeId, new DefaultUserExceptionFactory<E>(typeId));
+#endif
}
~DefaultUserExceptionFactoryInit()
{
- factoryTable->removeExceptionFactory(_typeId);
+ factoryTable->removeExceptionFactory(typeId);
}
-
-private:
- const ::std::string _typeId;
+
+ const ::std::string typeId;
};
template<class O>
-class DefaultObjectFactoryInit
+class DefaultValueFactoryInit
{
public:
-
- DefaultObjectFactoryInit(const char* typeId) :
- _typeId(typeId)
+
+ DefaultValueFactoryInit(const char* tId) : typeId(tId)
{
- factoryTable->addObjectFactory(_typeId, new DefaultObjectFactory<O>(_typeId));
+#ifdef ICE_CPP11_MAPPING
+ factoryTable->addValueFactory(typeId, defaultValueFactory<O>);
+#else
+ factoryTable->addValueFactory(typeId, new DefaultValueFactory<O>(typeId));
+#endif
}
- ~DefaultObjectFactoryInit()
+ ~DefaultValueFactoryInit()
{
- factoryTable->removeObjectFactory(_typeId);
+ factoryTable->removeValueFactory(typeId);
}
-
-private:
- const ::std::string _typeId;
-
+
+ const ::std::string typeId;
};
}
diff --git a/cpp/include/Ice/Format.h b/cpp/include/Ice/Format.h
index 4eb43c93412..4e756fd62ce 100644
--- a/cpp/include/Ice/Format.h
+++ b/cpp/include/Ice/Format.h
@@ -18,7 +18,12 @@ namespace Ice
//
// This enumeration describes the possible formats for classes and exceptions.
//
+
+#ifdef ICE_CPP11_MAPPING
+enum class FormatType : unsigned char
+#else
enum FormatType
+#endif
{
//
// Indicates that no preference was specified.
diff --git a/cpp/include/Ice/Functional.h b/cpp/include/Ice/Functional.h
index 039ddf9a51d..a132c57033b 100644
--- a/cpp/include/Ice/Functional.h
+++ b/cpp/include/Ice/Functional.h
@@ -22,115 +22,115 @@ namespace Ice
{
template<class R, class T>
-inline ::IceUtilInternal::MemFun<R, T, ::IceInternal::Handle<T> >
+inline ::IceUtilInternal::MemFun<R, T, ICE_INTERNAL_HANDLE<T> >
memFun(R (T::*p)(void))
{
- return ::IceUtilInternal::MemFun<R, T, ::IceInternal::Handle<T> >(p);
+ return ::IceUtilInternal::MemFun<R, T, ICE_INTERNAL_HANDLE<T> >(p);
}
template<class R, class T, class A>
-inline ::IceUtilInternal::MemFun1<R, T, ::IceInternal::Handle<T>, A>
+inline ::IceUtilInternal::MemFun1<R, T, ICE_INTERNAL_HANDLE<T>, A>
memFun1(R (T::*p)(A))
{
- return ::IceUtilInternal::MemFun1<R, T, ::IceInternal::Handle<T>, A>(p);
+ return ::IceUtilInternal::MemFun1<R, T, ICE_INTERNAL_HANDLE<T>, A>(p);
}
template<class T>
-inline ::IceUtilInternal::VoidMemFun<T, ::IceInternal::Handle<T> >
+inline ::IceUtilInternal::VoidMemFun<T, ICE_INTERNAL_HANDLE<T> >
voidMemFun(void (T::*p)(void))
{
- return ::IceUtilInternal::VoidMemFun<T, ::IceInternal::Handle<T> >(p);
+ return ::IceUtilInternal::VoidMemFun<T, ICE_INTERNAL_HANDLE<T> >(p);
}
template<class T, class A>
-inline ::IceUtilInternal::VoidMemFun1<T, ::IceInternal::Handle<T>, A>
+inline ::IceUtilInternal::VoidMemFun1<T, ICE_INTERNAL_HANDLE<T>, A>
voidMemFun1(void (T::*p)(A))
{
- return ::IceUtilInternal::VoidMemFun1<T, ::IceInternal::Handle<T>, A>(p);
+ return ::IceUtilInternal::VoidMemFun1<T, ICE_INTERNAL_HANDLE<T>, A>(p);
}
template<class R, class K, class T>
-inline ::IceUtilInternal::SecondMemFun<R, K, T, ::IceInternal::Handle<T> >
+inline ::IceUtilInternal::SecondMemFun<R, K, T, ICE_INTERNAL_HANDLE<T> >
secondMemFun(R (T::*p)(void))
{
- return ::IceUtilInternal::SecondMemFun<R, K, T, ::IceInternal::Handle<T> >(p);
+ return ::IceUtilInternal::SecondMemFun<R, K, T, ICE_INTERNAL_HANDLE<T> >(p);
}
template<class R, class K, class T, class A>
-inline ::IceUtilInternal::SecondMemFun1<R, K, T, ::IceInternal::Handle<T>, A>
+inline ::IceUtilInternal::SecondMemFun1<R, K, T, ICE_INTERNAL_HANDLE<T>, A>
secondMemFun1(R (T::*p)(A))
{
- return ::IceUtilInternal::SecondMemFun1<R, K, T, ::IceInternal::Handle<T>, A>(p);
+ return ::IceUtilInternal::SecondMemFun1<R, K, T, ICE_INTERNAL_HANDLE<T>, A>(p);
}
template<class K, class T>
-inline ::IceUtilInternal::SecondVoidMemFun<K, T, ::IceInternal::Handle<T> >
+inline ::IceUtilInternal::SecondVoidMemFun<K, T, ICE_INTERNAL_HANDLE<T> >
secondVoidMemFun(void (T::*p)(void))
{
- return ::IceUtilInternal::SecondVoidMemFun<K, T, ::IceInternal::Handle<T> >(p);
+ return ::IceUtilInternal::SecondVoidMemFun<K, T, ICE_INTERNAL_HANDLE<T> >(p);
}
template<class K, class T, class A>
-inline ::IceUtilInternal::SecondVoidMemFun1<K, T, ::IceInternal::Handle<T>, A>
+inline ::IceUtilInternal::SecondVoidMemFun1<K, T, ICE_INTERNAL_HANDLE<T>, A>
secondVoidMemFun1(void (T::*p)(A))
{
- return ::IceUtilInternal::SecondVoidMemFun1<K, T, ::IceInternal::Handle<T>, A>(p);
+ return ::IceUtilInternal::SecondVoidMemFun1<K, T, ICE_INTERNAL_HANDLE<T>, A>(p);
}
template<class R, class T>
-inline ::IceUtilInternal::ConstMemFun<R, T, ::IceInternal::Handle<T> >
+inline ::IceUtilInternal::ConstMemFun<R, T, ICE_INTERNAL_HANDLE<T> >
constMemFun(R (T::*p)(void) const)
{
- return ::IceUtilInternal::ConstMemFun<R, T, ::IceInternal::Handle<T> >(p);
+ return ::IceUtilInternal::ConstMemFun<R, T, ICE_INTERNAL_HANDLE<T> >(p);
}
template<class R, class T, class A>
-inline ::IceUtilInternal::ConstMemFun1<R, T, ::IceInternal::Handle<T>, A>
+inline ::IceUtilInternal::ConstMemFun1<R, T, ICE_INTERNAL_HANDLE<T>, A>
constMemFun1(R (T::*p)(A) const)
{
- return ::IceUtilInternal::ConstMemFun1<R, T, ::IceInternal::Handle<T>, A>(p);
+ return ::IceUtilInternal::ConstMemFun1<R, T, ICE_INTERNAL_HANDLE<T>, A>(p);
}
template<class T>
-inline ::IceUtilInternal::ConstVoidMemFun<T, ::IceInternal::Handle<T> >
+inline ::IceUtilInternal::ConstVoidMemFun<T, ICE_INTERNAL_HANDLE<T> >
constVoidMemFun(void (T::*p)(void) const)
{
- return ::IceUtilInternal::ConstVoidMemFun<T, ::IceInternal::Handle<T> >(p);
+ return ::IceUtilInternal::ConstVoidMemFun<T, ICE_INTERNAL_HANDLE<T> >(p);
}
template<class T, class A>
-inline ::IceUtilInternal::ConstVoidMemFun1<T, ::IceInternal::Handle<T>, A>
+inline ::IceUtilInternal::ConstVoidMemFun1<T, ICE_INTERNAL_HANDLE<T>, A>
constVoidMemFun1(void (T::*p)(A) const)
{
- return ::IceUtilInternal::ConstVoidMemFun1<T, ::IceInternal::Handle<T>, A>(p);
+ return ::IceUtilInternal::ConstVoidMemFun1<T, ICE_INTERNAL_HANDLE<T>, A>(p);
}
template<class R, class K, class T>
-inline ::IceUtilInternal::SecondConstMemFun<R, K, T, ::IceInternal::Handle<T> >
+inline ::IceUtilInternal::SecondConstMemFun<R, K, T, ICE_INTERNAL_HANDLE<T> >
secondConstMemFun(R (T::*p)(void) const)
{
- return ::IceUtilInternal::SecondConstMemFun<R, K, T, ::IceInternal::Handle<T> >(p);
+ return ::IceUtilInternal::SecondConstMemFun<R, K, T, ICE_INTERNAL_HANDLE<T> >(p);
}
template<class R, class K, class T, class A>
-inline ::IceUtilInternal::SecondConstMemFun1<R, K, T, ::IceInternal::Handle<T>, A>
+inline ::IceUtilInternal::SecondConstMemFun1<R, K, T, ICE_INTERNAL_HANDLE<T>, A>
secondConstMemFun1(R (T::*p)(A) const)
{
- return ::IceUtilInternal::SecondConstMemFun1<R, K, T, ::IceInternal::Handle<T>, A>(p);
+ return ::IceUtilInternal::SecondConstMemFun1<R, K, T, ICE_INTERNAL_HANDLE<T>, A>(p);
}
template<class K, class T>
-inline ::IceUtilInternal::SecondConstVoidMemFun<K, T, ::IceInternal::Handle<T> >
+inline ::IceUtilInternal::SecondConstVoidMemFun<K, T, ICE_INTERNAL_HANDLE<T> >
secondConstVoidMemFun(void (T::*p)(void) const)
{
- return ::IceUtilInternal::SecondConstVoidMemFun<K, T, ::IceInternal::Handle<T> >(p);
+ return ::IceUtilInternal::SecondConstVoidMemFun<K, T, ICE_INTERNAL_HANDLE<T> >(p);
}
template<class K, class T, class A>
-inline ::IceUtilInternal::SecondConstVoidMemFun1<K, T, ::IceInternal::Handle<T>, A>
+inline ::IceUtilInternal::SecondConstVoidMemFun1<K, T, ICE_INTERNAL_HANDLE<T>, A>
secondConstVoidMemFun1(void (T::*p)(A) const)
{
- return ::IceUtilInternal::SecondConstVoidMemFun1<K, T, ::IceInternal::Handle<T>, A>(p);
+ return ::IceUtilInternal::SecondConstVoidMemFun1<K, T, ICE_INTERNAL_HANDLE<T>, A>(p);
}
}
diff --git a/cpp/include/Ice/GCObject.h b/cpp/include/Ice/GCObject.h
index 83d50badb6f..1b1d80f0091 100644
--- a/cpp/include/Ice/GCObject.h
+++ b/cpp/include/Ice/GCObject.h
@@ -10,6 +10,8 @@
#ifndef ICE_GC_OBJECT_H
#define ICE_GC_OBJECT_H
+#ifndef ICE_CPP11_MAPPING
+
#include <Ice/Object.h>
#include <IceUtil/MutexPtrLock.h>
@@ -31,7 +33,7 @@ public:
virtual bool visit(GCObject*) = 0;
};
-class ICE_API GCObject : virtual public Ice::Object
+class ICE_API GCObject : public virtual Ice::Object
{
public:
@@ -53,16 +55,16 @@ public:
//
// Override Object methods
//
- virtual bool __gcVisit(GCVisitor&);
+ virtual bool _iceGcVisit(GCVisitor&);
virtual void ice_collectable(bool);
//
// This method is implemented by Slice classes to visit class
// members.
//
- virtual void __gcVisitMembers(IceInternal::GCVisitor&) = 0;
+ virtual void _iceGcVisitMembers(IceInternal::GCVisitor&) = 0;
- int __getRefUnsafe()
+ int _iceGetRefUnsafe()
{
return _ref;
}
@@ -75,3 +77,5 @@ private:
}
#endif
+
+#endif
diff --git a/cpp/include/Ice/Handle.h b/cpp/include/Ice/Handle.h
index 2f59eb5384e..4e11cffca2a 100644
--- a/cpp/include/Ice/Handle.h
+++ b/cpp/include/Ice/Handle.h
@@ -180,11 +180,6 @@ public:
{
return Handle(dynamic_cast<T*>(p));
}
-
- void __clearHandleUnsafe()
- {
- this->_ptr = 0;
- }
};
}
diff --git a/cpp/include/Ice/Ice.h b/cpp/include/Ice/Ice.h
index 823f4f93150..966eeead1aa 100644
--- a/cpp/include/Ice/Ice.h
+++ b/cpp/include/Ice/Ice.h
@@ -12,8 +12,9 @@
#include <IceUtil/PushDisableWarnings.h>
#include <Ice/Config.h>
-#include <Ice/DeprecatedStringConverter.h>
+#include <Ice/Comparable.h>
#include <Ice/Initialize.h>
+#include <Ice/Optional.h>
#include <Ice/LocalException.h>
#include <Ice/PropertiesAdmin.h>
#include <Ice/Properties.h>
@@ -31,13 +32,12 @@
#include <Ice/OutgoingAsync.h>
#include <Ice/IncomingAsync.h>
#include <Ice/Process.h>
-#if !defined(ICE_OS_WINRT) && (!defined(__APPLE__) || TARGET_OS_IPHONE == 0)
+#if !defined(ICE_OS_UWP) && (!defined(__APPLE__) || TARGET_OS_IPHONE == 0)
# include <Ice/Application.h>
#endif
#include <Ice/Connection.h>
#include <Ice/ConnectionAsync.h>
#include <Ice/Functional.h>
-#include <Ice/Stream.h>
#include <Ice/ImplicitContext.h>
#include <Ice/Locator.h>
#include <Ice/Router.h>
@@ -47,10 +47,14 @@
#include <Ice/Instrumentation.h>
#include <Ice/Metrics.h>
#include <Ice/SliceChecksums.h>
-#if !defined(ICE_OS_WINRT) && (!defined(__APPLE__) || TARGET_OS_IPHONE == 0)
+#if !defined(ICE_OS_UWP) && (!defined(__APPLE__) || TARGET_OS_IPHONE == 0)
# include <Ice/Service.h>
#endif
#include <Ice/RegisterPlugins.h>
+#include <Ice/InterfaceByValue.h>
+#include <Ice/StringConverter.h>
+#include <Ice/IconvStringConverter.h>
+#include <Ice/UUID.h>
#include <IceUtil/PopDisableWarnings.h>
#endif
diff --git a/cpp/include/IceUtil/IconvStringConverter.h b/cpp/include/Ice/IconvStringConverter.h
index a94a15faa0c..74ae99585d8 100644
--- a/cpp/include/IceUtil/IconvStringConverter.h
+++ b/cpp/include/Ice/IconvStringConverter.h
@@ -1,16 +1,24 @@
// **********************************************************************
//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-#ifndef ICE_UTIL_ICONV_STRING_CONVERTER
-#define ICE_UTIL_ICONV_STRING_CONVERTER
+#ifndef ICE_ICONV_STRING_CONVERTER
+#define ICE_ICONV_STRING_CONVERTER
-#include <IceUtil/StringConverter.h>
+#include <Ice/Config.h>
+
+//
+// For all platforms except Windows
+//
+#ifndef _WIN32
+
+#include <Ice/StringConverter.h>
+#include <IceUtil/ThreadException.h>
#include <IceUtil/UndefSysMacros.h>
#include <algorithm>
@@ -19,13 +27,42 @@
#include <string.h> // For strerror
#if (defined(__APPLE__) && _LIBICONV_VERSION < 0x010B)
- //
- // See http://sourceware.org/bugzilla/show_bug.cgi?id=2962
- //
+//
+// See http://sourceware.org/bugzilla/show_bug.cgi?id=2962
+//
# define ICE_CONST_ICONV_INBUF 1
#endif
-namespace IceUtil
+namespace Ice
+{
+
+class ICE_API IconvInitializationException : public IceUtil::ExceptionHelper<IconvInitializationException>
+{
+public:
+
+ IconvInitializationException(const char*, int, const std::string&);
+
+#ifndef ICE_CPP11_COMPILER
+ virtual ~IconvInitializationException() throw();
+#endif
+
+ virtual std::string ice_id() const;
+ virtual void ice_print(std::ostream&) const;
+
+#ifndef ICE_CPP11_MAPPING
+ virtual IconvInitializationException* ice_clone() const;
+#endif
+
+ std::string reason() const;
+
+private:
+
+ std::string _reason;
+};
+
+}
+
+namespace IceInternal
{
//
@@ -36,18 +73,18 @@ namespace IceUtil
//
//
template<typename charT>
-class IconvStringConverter : public BasicStringConverter<charT>
+class IconvStringConverter : public IceUtil::BasicStringConverter<charT>
{
public:
- IconvStringConverter(const char* = nl_langinfo(CODESET));
+ IconvStringConverter(const std::string&);
virtual ~IconvStringConverter();
- virtual Byte* toUTF8(const charT*, const charT*, UTF8Buffer&) const;
-
- virtual void fromUTF8(const Byte*, const Byte*, std::basic_string<charT>&) const;
-
+ virtual Ice::Byte* toUTF8(const charT*, const charT*, Ice::UTF8Buffer&) const;
+
+ virtual void fromUTF8(const Ice::Byte*, const Ice::Byte*, std::basic_string<charT>&) const;
+
private:
std::pair<iconv_t, iconv_t> createDescriptors() const;
@@ -72,7 +109,7 @@ extern "C"
#endif
template<typename charT>
-IconvStringConverter<charT>::IconvStringConverter(const char* internalCode) :
+IconvStringConverter<charT>::IconvStringConverter(const std::string& internalCode) :
_internalCode(internalCode)
{
//
@@ -82,9 +119,9 @@ IconvStringConverter<charT>::IconvStringConverter(const char* internalCode) :
{
close(createDescriptors());
}
- catch(const IllegalConversionException& sce)
+ catch(const Ice::IllegalConversionException& sce)
{
- throw IconvInitializationException(__FILE__, __LINE__, sce.reason());
+ throw Ice::IconvInitializationException(__FILE__, __LINE__, sce.reason());
}
//
@@ -98,7 +135,7 @@ IconvStringConverter<charT>::IconvStringConverter(const char* internalCode) :
if(rs != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rs);
+ throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rs);
}
}
@@ -128,16 +165,16 @@ IconvStringConverter<charT>::createDescriptors() const
{
std::ostringstream os;
os << "iconv cannot convert from " << externalCode << " to " << _internalCode;
- throw IllegalConversionException(__FILE__, __LINE__, os.str());
+ throw Ice::IllegalConversionException(__FILE__, __LINE__, os.str());
}
-
+
cdp.second = iconv_open(externalCode, _internalCode.c_str());
if(cdp.second == iconv_t(-1))
{
iconv_close(cdp.first);
std::ostringstream os;
os << "iconv cannot convert from " << _internalCode << " to " << externalCode;
- throw IllegalConversionException(__FILE__, __LINE__, os.str());
+ throw Ice::IllegalConversionException(__FILE__, __LINE__, os.str());
}
return cdp;
}
@@ -156,7 +193,7 @@ IconvStringConverter<charT>::getDescriptors() const
int rs = pthread_setspecific(_key, new std::pair<iconv_t, iconv_t>(cdp));
if(rs != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rs);
+ throw IceUtil::ThreadSyscallException(__FILE__, __LINE__, rs);
}
return cdp;
}
@@ -185,12 +222,14 @@ IconvStringConverter<charT>::close(std::pair<iconv_t, iconv_t> cdp)
iconv_close(cdp.second);
#endif
}
-
-template<typename charT> Byte*
-IconvStringConverter<charT>::toUTF8(const charT* sourceStart, const charT* sourceEnd, UTF8Buffer& buf) const
-{
+
+template<typename charT> Ice::Byte*
+IconvStringConverter<charT>::toUTF8(const charT* sourceStart,
+ const charT* sourceEnd,
+ Ice::UTF8Buffer& buf) const
+{
iconv_t cd = getDescriptors().second;
-
+
//
// Reset cd
//
@@ -208,31 +247,34 @@ IconvStringConverter<charT>::toUTF8(const charT* sourceStart, const charT* sourc
#endif
size_t inbytesleft = (sourceEnd - sourceStart) * sizeof(charT);
char* outbuf = 0;
-
- size_t count = 0;
+
+ size_t count = 0;
//
// Loop while we need more buffer space
//
do
{
size_t howMany = std::max(inbytesleft, size_t(4));
- outbuf = reinterpret_cast<char*>(buf.getMoreBytes(howMany, reinterpret_cast<Byte*>(outbuf)));
+ outbuf = reinterpret_cast<char*>(buf.getMoreBytes(howMany,
+ reinterpret_cast<Ice::Byte*>(outbuf)));
count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &howMany);
} while(count == size_t(-1) && errno == E2BIG);
if(count == size_t(-1))
{
- throw IllegalConversionException(__FILE__, __LINE__, errno != 0 ? strerror(errno) : "Unknown error");
+ throw Ice::IllegalConversionException(__FILE__,
+ __LINE__,
+ errno != 0 ? strerror(errno) : "Unknown error");
}
- return reinterpret_cast<Byte*>(outbuf);
+ return reinterpret_cast<Ice::Byte*>(outbuf);
}
-
+
template<typename charT> void
-IconvStringConverter<charT>::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
+IconvStringConverter<charT>::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd,
std::basic_string<charT>& target) const
{
iconv_t cd = getDescriptors().first;
-
+
//
// Reset cd
//
@@ -246,19 +288,12 @@ IconvStringConverter<charT>::fromUTF8(const Byte* sourceStart, const Byte* sourc
#ifdef ICE_CONST_ICONV_INBUF
const char* inbuf = reinterpret_cast<const char*>(sourceStart);
#else
- char* inbuf = reinterpret_cast<char*>(const_cast<Byte*>(sourceStart));
+ char* inbuf = reinterpret_cast<char*>(const_cast<Ice::Byte*>(sourceStart));
#endif
size_t inbytesleft = sourceEnd - sourceStart;
- //
- // Result buffer
- //
- char* buf = 0;
- size_t bufsize = 0;
-
char* outbuf = 0;
size_t outbytesleft = 0;
-
size_t count = 0;
//
@@ -266,37 +301,48 @@ IconvStringConverter<charT>::fromUTF8(const Byte* sourceStart, const Byte* sourc
//
do
{
- size_t increment = std::max(inbytesleft * sizeof(wchar_t), size_t(8));
- bufsize += increment;
- char* newbuf = static_cast<char*>(realloc(buf, bufsize));
-
- if(newbuf == 0)
+ size_t bytesused = 0;
+ if(outbuf != 0)
{
- free(buf);
- throw IllegalConversionException(__FILE__, __LINE__, "Out of memory");
+ bytesused = outbuf - reinterpret_cast<const char*>(target.data());
}
- outbuf = newbuf + (outbuf - buf);
- outbytesleft += increment;
+ const size_t increment = std::max<size_t>(inbytesleft, 4);
+ target.resize(target.size() + increment);
+ outbuf = const_cast<char*>(reinterpret_cast<const char*>(target.data())) + bytesused;
+ outbytesleft += increment * sizeof(charT);
- buf = newbuf;
-
count = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
+
} while(count == size_t(-1) && errno == E2BIG);
if(count == size_t(-1))
{
- free(buf);
- throw IllegalConversionException(__FILE__, __LINE__, errno != 0 ? strerror(errno) : "Unknown error");
+ throw Ice::IllegalConversionException(__FILE__,
+ __LINE__,
+ errno != 0 ? strerror(errno) : "Unknown error");
}
-
- size_t length = (bufsize - outbytesleft) / sizeof(charT);
-
- std::basic_string<charT> result(reinterpret_cast<charT*>(buf), length);
- target.swap(result);
- free(buf);
+
+ target.resize(target.size() - (outbytesleft / sizeof(charT)));
+}
}
+namespace Ice
+{
+template<typename charT>
+ICE_HANDLE<IceUtil::BasicStringConverter<charT> >
+createIconvStringConverter(const std::string& internalCodeWithDefault = "")
+{
+ std::string internalCode = internalCodeWithDefault;
+
+ if(internalCode.empty())
+ {
+ internalCode = nl_langinfo(CODESET);
+ }
+
+ return ICE_MAKE_SHARED(IceInternal::IconvStringConverter<charT>, internalCode);
+}
}
#endif
+#endif
diff --git a/cpp/include/Ice/Incoming.h b/cpp/include/Ice/Incoming.h
index 420af723527..7b24cf482f9 100644
--- a/cpp/include/Ice/Incoming.h
+++ b/cpp/include/Ice/Incoming.h
@@ -14,7 +14,8 @@
#include <Ice/ConnectionIF.h>
#include <Ice/ServantLocatorF.h>
#include <Ice/ServantManagerF.h>
-#include <Ice/BasicStream.h>
+#include <Ice/OutputStream.h>
+#include <Ice/InputStream.h>
#include <Ice/Object.h>
#include <Ice/Current.h>
#include <Ice/IncomingAsyncF.h>
@@ -23,6 +24,31 @@
#include <deque>
+#ifdef ICE_CPP11_MAPPING
+
+namespace Ice
+{
+
+class ICE_API MarshaledResult
+{
+public:
+
+ MarshaledResult(const Current&);
+
+ std::shared_ptr<OutputStream> getOutputStream() const
+ {
+ return ostr;
+ }
+
+protected:
+
+ std::shared_ptr<OutputStream> ostr;
+};
+
+}
+
+#endif
+
namespace IceInternal
{
@@ -30,37 +56,45 @@ class ICE_API IncomingBase : private IceUtil::noncopyable
{
public:
- void __adopt(IncomingBase&);
+ Ice::OutputStream* startWriteParams();
+ void endWriteParams();
+ void writeEmptyParams();
+ void writeParamEncaps(const Ice::Byte*, Ice::Int, bool);
+
+#ifdef ICE_CPP11_MAPPING
+ void setMarshaledResult(const Ice::MarshaledResult&);
+#endif
- BasicStream* __startWriteParams(Ice::FormatType);
- void __endWriteParams(bool);
- void __writeEmptyParams();
- void __writeParamEncaps(const Ice::Byte*, Ice::Int, bool);
- void __writeUserException(const Ice::UserException&, Ice::FormatType);
+ void response(bool);
+ void exception(const std::exception&, bool);
+ void exception(const std::string&, bool);
protected:
- IncomingBase(Instance*, ResponseHandler*, Ice::Connection*, const Ice::ObjectAdapterPtr&, bool, Ice::Byte,
- Ice::Int);
- IncomingBase(IncomingBase&); // Adopts the argument. It must not be used afterwards.
+ IncomingBase(Instance*, ResponseHandler*, Ice::Connection*, const Ice::ObjectAdapterPtr&, bool, Ice::Byte, Ice::Int);
+ IncomingBase(IncomingBase&);
- void __warning(const Ice::Exception&) const;
- void __warning(const std::string&) const;
+ void warning(const Ice::Exception&) const;
+ void warning(const std::string&) const;
- bool __servantLocatorFinished(bool);
+ bool servantLocatorFinished(bool);
- void __handleException(const std::exception&, bool);
- void __handleException(bool);
+ void handleException(const std::exception&, bool);
+ void handleException(const std::string&, bool);
Ice::Current _current;
Ice::ObjectPtr _servant;
Ice::ServantLocatorPtr _locator;
+#ifdef ICE_CPP11_MAPPING
+ ::std::shared_ptr<void> _cookie;
+#else
Ice::LocalObjectPtr _cookie;
+#endif
DispatchObserver _observer;
bool _response;
Ice::Byte _compress;
-
- BasicStream _os;
+ Ice::FormatType _format;
+ Ice::OutputStream _os;
//
// Optimization. The request handler may not be deleted while a
@@ -68,7 +102,13 @@ protected:
//
ResponseHandler* _responseHandler;
- std::deque<Ice::DispatchInterceptorAsyncCallbackPtr> _interceptorAsyncCallbackQueue;
+#ifdef ICE_CPP11_MAPPING
+ using DispatchInterceptorCallbacks = std::deque<std::pair<std::function<bool()>,
+ std::function<bool(std::exception_ptr)>>>;
+#else
+ typedef std::deque<Ice::DispatchInterceptorAsyncCallbackPtr> DispatchInterceptorCallbacks;
+#endif
+ DispatchInterceptorCallbacks _interceptorCBs;
};
class ICE_API Incoming : public IncomingBase
@@ -82,48 +122,63 @@ public:
return _current;
}
+#ifdef ICE_CPP11_MAPPING
+ void push(std::function<bool()>, std::function<bool(std::exception_ptr)>);
+#else
void push(const Ice::DispatchInterceptorAsyncCallbackPtr&);
+#endif
void pop();
+
+ void setAsync(const IncomingAsyncPtr& in)
+ {
+ assert(!_inAsync);
+ _inAsync = in;
+ }
+
void startOver();
- void killAsync();
- void setActive(IncomingAsync&);
-
- bool isRetriable()
+
+ void setFormat(Ice::FormatType format)
{
- return _inParamPos != 0;
+ _format = format;
}
- void invoke(const ServantManagerPtr&, BasicStream*);
+ void invoke(const ServantManagerPtr&, Ice::InputStream*);
// Inlined for speed optimization.
- BasicStream* startReadParams()
+ void skipReadParams()
+ {
+ _current.encoding = _is->skipEncapsulation();
+ }
+ Ice::InputStream* startReadParams()
{
//
// Remember the encoding used by the input parameters, we'll
// encode the response parameters with the same encoding.
//
- _current.encoding = _is->startReadEncaps();
+ _current.encoding = _is->startEncapsulation();
return _is;
}
void endReadParams() const
{
- _is->endReadEncaps();
+ _is->endEncapsulation();
}
void readEmptyParams()
{
- _current.encoding = _is->skipEmptyEncaps();
+ _current.encoding = _is->skipEmptyEncapsulation();
}
void readParamEncaps(const Ice::Byte*& v, Ice::Int& sz)
{
- _current.encoding = _is->readEncaps(v, sz);
+ _current.encoding = _is->readEncapsulation(v, sz);
}
private:
- BasicStream* _is;
-
- IncomingAsyncPtr _cb;
+ friend class IncomingAsync;
+
+ Ice::InputStream* _is;
Ice::Byte* _inParamPos;
+
+ IncomingAsyncPtr _inAsync;
};
}
diff --git a/cpp/include/Ice/IncomingAsync.h b/cpp/include/Ice/IncomingAsync.h
index f8ac1fc210c..5df41c0ed83 100644
--- a/cpp/include/Ice/IncomingAsync.h
+++ b/cpp/include/Ice/IncomingAsync.h
@@ -13,18 +13,23 @@
#include <Ice/IncomingAsyncF.h>
#include <Ice/Incoming.h>
+#ifndef ICE_CPP11_MAPPING
namespace Ice
{
-class ICE_API AMDCallback : virtual public Ice::LocalObject
+class ICE_API AMDCallback : public Ice::LocalObject
{
public:
+ virtual ~AMDCallback();
+
+
virtual void ice_exception(const ::std::exception&) = 0;
virtual void ice_exception() = 0;
};
}
+#endif
namespace IceInternal
{
@@ -33,52 +38,87 @@ namespace IceInternal
// We need virtual inheritance from AMDCallback, because we use multiple
// inheritance from Ice::AMDCallback for generated AMD code.
//
-class ICE_API IncomingAsync : public IncomingBase, virtual public Ice::AMDCallback
+class ICE_API IncomingAsync : public IncomingBase,
+#ifdef ICE_CPP11_MAPPING
+ public ::std::enable_shared_from_this<IncomingAsync>
+#else
+ public virtual Ice::AMDCallback
+#endif
{
public:
- IncomingAsync(Incoming&); // Adopts the argument. It must not be used afterwards.
-
- void __deactivate(Incoming&);
+ IncomingAsync(Incoming&);
+
+#ifdef ICE_CPP11_MAPPING
+
+ static std::shared_ptr<IncomingAsync> create(Incoming&);
+
+ std::function<void()> response()
+ {
+ auto self = shared_from_this();
+ return [self]()
+ {
+ self->writeEmptyParams();
+ self->completed();
+ };
+ }
+
+ template<class T>
+ std::function<void(const T&)> response()
+ {
+ auto self = shared_from_this();
+ return [self](const T& marshaledResult)
+ {
+ self->setMarshaledResult(marshaledResult);
+ self->completed();
+ };
+ }
+
+ std::function<void(std::exception_ptr)> exception()
+ {
+ auto self = shared_from_this();
+ return [self](std::exception_ptr ex) { self->completed(ex); };
+ }
+
+#else
virtual void ice_exception(const ::std::exception&);
virtual void ice_exception();
-protected:
+#endif
+
+ void kill(Incoming&);
- void __response();
- void __exception(const std::exception&);
- void __exception();
+ void completed();
- bool __validateResponse(bool);
+#ifdef ICE_CPP11_MAPPING
+ void completed(std::exception_ptr);
+#endif
private:
- //
- // We need a separate InstancePtr, because _is and _os only hold a
- // Instance* for optimization.
- //
- const InstancePtr _instanceCopy;
+ void checkResponseSent();
+ bool _responseSent;
//
// We need a separate ConnectionIPtr, because IncomingBase only
// holds a ConnectionI* for optimization.
//
const ResponseHandlerPtr _responseHandlerCopy;
-
- const bool _retriable;
- bool _active;
};
}
+#ifndef ICE_CPP11_MAPPING
namespace Ice
{
-class ICE_API AMD_Object_ice_invoke : virtual public Ice::AMDCallback
+class ICE_API AMD_Object_ice_invoke : public virtual Ice::AMDCallback
{
public:
-
+
+ virtual ~AMD_Object_ice_invoke();
+
virtual void ice_response(bool, const std::vector<Ice::Byte>&) = 0;
virtual void ice_response(bool, const std::pair<const Ice::Byte*, const Ice::Byte*>&) = 0;
};
@@ -94,9 +134,9 @@ namespace Ice
class ICE_API AMD_Object_ice_invoke : public ::Ice::AMD_Object_ice_invoke, public IceInternal::IncomingAsync
{
public:
-
+
AMD_Object_ice_invoke(IceInternal::Incoming&);
-
+
virtual void ice_response(bool, const std::vector< ::Ice::Byte>&);
virtual void ice_response(bool, const std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&);
};
@@ -104,5 +144,6 @@ public:
}
}
+#endif
#endif
diff --git a/cpp/include/Ice/IncomingAsyncF.h b/cpp/include/Ice/IncomingAsyncF.h
index ee7db32e881..73cf63c4ac2 100644
--- a/cpp/include/Ice/IncomingAsyncF.h
+++ b/cpp/include/Ice/IncomingAsyncF.h
@@ -18,11 +18,16 @@ namespace IceInternal
{
class IncomingAsync;
+#ifdef ICE_CPP11_MAPPING
+using IncomingAsyncPtr = ::std::shared_ptr<IncomingAsync>;
+#else
ICE_API IceUtil::Shared* upCast(IncomingAsync*);
typedef IceInternal::Handle<IncomingAsync> IncomingAsyncPtr;
+#endif
}
+#ifndef ICE_CPP11_MAPPING
namespace Ice
{
@@ -31,5 +36,6 @@ ICE_API IceUtil::Shared* upCast(::Ice::AMD_Object_ice_invoke*);
typedef IceInternal::Handle<AMD_Object_ice_invoke> AMD_Object_ice_invokePtr;
}
+#endif
#endif
diff --git a/cpp/include/Ice/Initialize.h b/cpp/include/Ice/Initialize.h
index 5a547b9e523..5461a3f4017 100644
--- a/cpp/include/Ice/Initialize.h
+++ b/cpp/include/Ice/Initialize.h
@@ -11,11 +11,10 @@
#define ICE_INITIALIZE_H
#include <IceUtil/Timer.h>
-#include <Ice/CommunicatorF.h>
+#include <Ice/Communicator.h>
#include <Ice/PropertiesF.h>
#include <Ice/InstanceF.h>
#include <Ice/LoggerF.h>
-#include <Ice/StreamF.h>
#include <Ice/InstrumentationF.h>
#include <Ice/Dispatcher.h>
#include <Ice/FactoryTable.h>
@@ -43,10 +42,22 @@ ICE_API StringSeq argsToStringSeq(int, wchar_t*[]);
//
ICE_API void stringSeqToArgs(const StringSeq&, int&, char*[]);
+#ifdef _WIN32
+
+ICE_API void stringSeqToArgs(const StringSeq&, int&, wchar_t*[]);
+
+#endif
+
ICE_API PropertiesPtr createProperties();
ICE_API PropertiesPtr createProperties(StringSeq&, const PropertiesPtr& = 0);
ICE_API PropertiesPtr createProperties(int&, char*[], const PropertiesPtr& = 0);
+#ifdef _WIN32
+
+ICE_API PropertiesPtr createProperties(int&, wchar_t*[], const PropertiesPtr& = 0);
+
+#endif
+
//
// This class is used to notify user of when Ice threads are started
// and stopped.
@@ -69,8 +80,11 @@ class ICE_API ThreadHookPlugin : public Ice::Plugin
{
public:
+#ifdef ICE_CPP11_MAPPING
+ ThreadHookPlugin(const CommunicatorPtr& communicator, std::function<void()>, std::function<void()>);
+#else
ThreadHookPlugin(const CommunicatorPtr& communicator, const ThreadNotificationPtr&);
-
+#endif
virtual void initialize();
virtual void destroy();
@@ -84,49 +98,79 @@ struct InitializationData
PropertiesPtr properties;
LoggerPtr logger;
Instrumentation::CommunicatorObserverPtr observer;
+#ifdef ICE_CPP11_MAPPING
+ std::function<void()> threadStart;
+ std::function<void()> threadStop;
+ std::function<void(std::function<void()>, const std::shared_ptr<Ice::Connection>&)> dispatcher;
+ std::function<std::string(int)> compactIdResolver;
+ std::function<void(const Ice::BatchRequest&, int, int)> batchRequestInterceptor;
+#else
ThreadNotificationPtr threadHook;
DispatcherPtr dispatcher;
CompactIdResolverPtr compactIdResolver;
BatchRequestInterceptorPtr batchRequestInterceptor;
+#endif
+ ValueFactoryManagerPtr valueFactoryManager;
};
ICE_API CommunicatorPtr initialize(int&, char*[], const InitializationData& = InitializationData(),
Int = ICE_INT_VERSION);
+#ifdef _WIN32
+ICE_API CommunicatorPtr initialize(int&, wchar_t*[], const InitializationData& = InitializationData(),
+ Int = ICE_INT_VERSION);
+#endif
+
ICE_API CommunicatorPtr initialize(Ice::StringSeq&, const InitializationData& = InitializationData(),
Int = ICE_INT_VERSION);
ICE_API CommunicatorPtr initialize(const InitializationData& = InitializationData(),
Int = ICE_INT_VERSION);
-
-ICE_API InputStreamPtr createInputStream(const CommunicatorPtr&, const ::std::vector< Byte >&);
-ICE_API InputStreamPtr createInputStream(const CommunicatorPtr&, const ::std::vector< Byte >&,
- const EncodingVersion&);
-ICE_API InputStreamPtr wrapInputStream(const CommunicatorPtr&, const ::std::vector< Byte >&);
-ICE_API InputStreamPtr wrapInputStream(const CommunicatorPtr&, const ::std::vector< Byte >&, const EncodingVersion&);
-ICE_API InputStreamPtr createInputStream(const CommunicatorPtr&,
- const ::std::pair< const Ice::Byte*, const Ice::Byte*>&);
-ICE_API InputStreamPtr createInputStream(const CommunicatorPtr&,
- const ::std::pair< const Ice::Byte*, const Ice::Byte*>&,
- const EncodingVersion&);
-ICE_API InputStreamPtr wrapInputStream(const CommunicatorPtr&,
- const ::std::pair< const Ice::Byte*, const Ice::Byte*>&);
-ICE_API InputStreamPtr wrapInputStream(const CommunicatorPtr&,
- const ::std::pair< const Ice::Byte*, const Ice::Byte*>&,
- const EncodingVersion&);
-
-ICE_API OutputStreamPtr createOutputStream(const CommunicatorPtr&);
-ICE_API OutputStreamPtr createOutputStream(const CommunicatorPtr&, const EncodingVersion&);
-
ICE_API LoggerPtr getProcessLogger();
ICE_API void setProcessLogger(const LoggerPtr&);
-typedef Ice::Plugin* (*PLUGIN_FACTORY)(const ::Ice::CommunicatorPtr&, const std::string&, const ::Ice::StringSeq&);
-ICE_API void registerPluginFactory(const std::string&, PLUGIN_FACTORY, bool);
+typedef Ice::Plugin* (*PluginFactory)(const ::Ice::CommunicatorPtr&, const std::string&, const ::Ice::StringSeq&);
+ICE_API void registerPluginFactory(const std::string&, PluginFactory, bool);
+
+//
+// RAII helper class
+//
+class ICE_API CommunicatorHolder
+{
+public:
+
+#ifdef ICE_CPP11_MAPPING
+ CommunicatorHolder(std::shared_ptr<Communicator>);
+
+ CommunicatorHolder(const CommunicatorHolder&) = delete;
+
+ CommunicatorHolder(CommunicatorHolder&&) = default;
+ CommunicatorHolder& operator=(CommunicatorHolder&&) = default;
+
+#else
+ CommunicatorHolder(const CommunicatorPtr&);
+
+ // Required for successful copy-initialization, but not
+ // defined as it should always be elided by compiler
+ CommunicatorHolder(const CommunicatorHolder&);
+
+#endif
+
+ ~CommunicatorHolder();
+
+ const CommunicatorPtr& communicator() const;
+ CommunicatorPtr release();
+ const CommunicatorPtr& operator->() const;
+
+private:
+
+ CommunicatorPtr _communicator;
+};
ICE_API Identity stringToIdentity(const std::string&);
-ICE_API std::string identityToString(const Identity&);
+ICE_API std::string identityToString(const Identity&, ToStringMode = ICE_ENUM(ToStringMode, Unicode));
+
}
namespace IceInternal
diff --git a/cpp/include/Ice/InputStream.h b/cpp/include/Ice/InputStream.h
new file mode 100644
index 00000000000..a6cad15a451
--- /dev/null
+++ b/cpp/include/Ice/InputStream.h
@@ -0,0 +1,982 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_INPUT_STREAM_H
+#define ICE_INPUT_STREAM_H
+
+#include <Ice/CommunicatorF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/Object.h>
+#include <Ice/ValueF.h>
+#include <Ice/ProxyF.h>
+#include <Ice/LoggerF.h>
+#include <Ice/ValueFactory.h>
+#include <Ice/Buffer.h>
+#include <Ice/Protocol.h>
+#include <Ice/SlicedDataF.h>
+#include <Ice/UserExceptionFactory.h>
+#include <Ice/StreamHelpers.h>
+#include <Ice/FactoryTable.h>
+
+namespace Ice
+{
+
+class UserException;
+
+template<typename T> inline void
+patchHandle(void* addr, const ValuePtr& v)
+{
+#ifdef ICE_CPP11_MAPPING
+ ::std::shared_ptr<T>* handle = static_cast<::std::shared_ptr<T>*>(addr);
+ *handle = ::std::dynamic_pointer_cast<T>(v);
+ if(v && !(*handle))
+ {
+ IceInternal::Ex::throwUOE(T::ice_staticId(), v);
+ }
+#else
+ IceInternal::Handle<T>* p = static_cast<IceInternal::Handle<T>*>(addr);
+ _icePatchObjectPtr(*p, v); // Generated _icePatchObjectPtr function, necessary for forward declarations.
+#endif
+}
+
+class ICE_API InputStream : public IceInternal::Buffer
+{
+public:
+
+ typedef size_t size_type;
+ typedef void (*PatchFunc)(void*, const ValuePtr&);
+
+ //
+ // These constructors use the latest encoding version. Without a communicator, the stream
+ // will not be able to unmarshal a proxy. For other unmarshaling tasks, you can provide
+ // Helpers for objects that are normally provided by a communicator.
+ //
+ InputStream();
+ InputStream(const std::vector<Byte>&);
+ InputStream(const std::pair<const Byte*, const Byte*>&);
+ InputStream(IceInternal::Buffer&, bool = false);
+
+ //
+ // These constructors use the communicator's default encoding version.
+ //
+ InputStream(const CommunicatorPtr&);
+ InputStream(const CommunicatorPtr&, const std::vector<Byte>&);
+ InputStream(const CommunicatorPtr&, const std::pair<const Byte*, const Byte*>&);
+ InputStream(const CommunicatorPtr&, IceInternal::Buffer&, bool = false);
+
+ //
+ // These constructors use the given encoding version. Without a communicator, the stream
+ // will not be able to unmarshal a proxy. For other unmarshaling tasks, you can provide
+ // Helpers for objects that are normally provided by a communicator.
+ //
+ InputStream(const EncodingVersion&);
+ InputStream(const EncodingVersion&, const std::vector<Byte>&);
+ InputStream(const EncodingVersion&, const std::pair<const Byte*, const Byte*>&);
+ InputStream(const EncodingVersion&, IceInternal::Buffer&, bool = false);
+
+ //
+ // These constructors use the given communicator and encoding version.
+ //
+ InputStream(const CommunicatorPtr&, const EncodingVersion&);
+ InputStream(const CommunicatorPtr&, const EncodingVersion&, const std::vector<Byte>&);
+ InputStream(const CommunicatorPtr&, const EncodingVersion&, const std::pair<const Byte*, const Byte*>&);
+ InputStream(const CommunicatorPtr&, const EncodingVersion&, IceInternal::Buffer&, bool = false);
+
+ ~InputStream()
+ {
+ // Inlined for performance reasons.
+
+ if(_currentEncaps != &_preAllocatedEncaps)
+ {
+ clear(); // Not inlined.
+ }
+
+#ifdef ICE_CPP11_MAPPING
+
+ for(auto d: _deleters)
+ {
+ d();
+ }
+#endif
+ }
+
+ //
+ // Use initialize() if you originally constructed the stream without a communicator.
+ //
+ void initialize(const CommunicatorPtr&);
+ void initialize(const CommunicatorPtr&, const EncodingVersion&);
+
+ void clear();
+
+ //
+ // Must return Instance*, because we don't hold an InstancePtr for
+ // optimization reasons (see comments below).
+ //
+ IceInternal::Instance* instance() const { return _instance; } // Inlined for performance reasons.
+
+ void setValueFactoryManager(const ValueFactoryManagerPtr&);
+
+ void setLogger(const LoggerPtr&);
+
+#ifdef ICE_CPP11_MAPPING
+ void setCompactIdResolver(std::function<std::string(int)>);
+#else
+ void setCompactIdResolver(const CompactIdResolverPtr&);
+#endif
+
+#ifndef ICE_CPP11_MAPPING
+ void setCollectObjects(bool);
+#endif
+
+ void setSliceValues(bool);
+
+ void setTraceSlicing(bool);
+
+ void* getClosure() const;
+ void* setClosure(void*);
+
+ void swap(InputStream&);
+
+ void resetEncapsulation();
+
+ void resize(Container::size_type sz)
+ {
+ b.resize(sz);
+ i = b.end();
+ }
+
+ void startValue()
+ {
+ assert(_currentEncaps && _currentEncaps->decoder);
+ _currentEncaps->decoder->startInstance(ValueSlice);
+ }
+ SlicedDataPtr endValue(bool preserve)
+ {
+ assert(_currentEncaps && _currentEncaps->decoder);
+ return _currentEncaps->decoder->endInstance(preserve);
+ }
+
+ void startException()
+ {
+ assert(_currentEncaps && _currentEncaps->decoder);
+ _currentEncaps->decoder->startInstance(ExceptionSlice);
+ }
+ SlicedDataPtr endException(bool preserve)
+ {
+ assert(_currentEncaps && _currentEncaps->decoder);
+ return _currentEncaps->decoder->endInstance(preserve);
+ }
+
+ const EncodingVersion& startEncapsulation()
+ {
+ Encaps* oldEncaps = _currentEncaps;
+ if(!oldEncaps) // First allocated encaps?
+ {
+ _currentEncaps = &_preAllocatedEncaps;
+ }
+ else
+ {
+ _currentEncaps = new Encaps();
+ _currentEncaps->previous = oldEncaps;
+ }
+ _currentEncaps->start = i - b.begin();
+
+ //
+ // I don't use readSize() and writeSize() for encapsulations,
+ // because when creating an encapsulation, I must know in advance
+ // how many bytes the size information will require in the data
+ // stream. If I use an Int, it is always 4 bytes. For
+ // readSize()/writeSize(), it could be 1 or 5 bytes.
+ //
+ Int sz;
+ read(sz);
+ if(sz < 6)
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ if(i - sizeof(Int) + sz > b.end())
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ _currentEncaps->sz = sz;
+
+ read(_currentEncaps->encoding);
+ IceInternal::checkSupportedEncoding(_currentEncaps->encoding); // Make sure the encoding is supported
+
+ return _currentEncaps->encoding;
+ }
+
+ void endEncapsulation()
+ {
+ assert(_currentEncaps);
+
+ if(_currentEncaps->encoding != Encoding_1_0)
+ {
+ skipOptionals();
+ if(i != b.begin() + _currentEncaps->start + _currentEncaps->sz)
+ {
+ throwEncapsulationException(__FILE__, __LINE__);
+ }
+ }
+ else if(i != b.begin() + _currentEncaps->start + _currentEncaps->sz)
+ {
+ if(i + 1 != b.begin() + _currentEncaps->start + _currentEncaps->sz)
+ {
+ throwEncapsulationException(__FILE__, __LINE__);
+ }
+
+ //
+ // Ice version < 3.3 had a bug where user exceptions with
+ // class members could be encoded with a trailing byte
+ // when dispatched with AMD. So we tolerate an extra byte
+ // in the encapsulation.
+ //
+ ++i;
+ }
+
+ Encaps* oldEncaps = _currentEncaps;
+ _currentEncaps = _currentEncaps->previous;
+ if(oldEncaps == &_preAllocatedEncaps)
+ {
+ oldEncaps->reset();
+ }
+ else
+ {
+ delete oldEncaps;
+ }
+ }
+
+ EncodingVersion skipEmptyEncapsulation()
+ {
+ Ice::Int sz;
+ read(sz);
+ if(sz < 6)
+ {
+ throwEncapsulationException(__FILE__, __LINE__);
+ }
+ if(i - sizeof(Ice::Int) + sz > b.end())
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ Ice::EncodingVersion encoding;
+ read(encoding);
+ IceInternal::checkSupportedEncoding(encoding); // Make sure the encoding is supported
+
+ if(encoding == Ice::Encoding_1_0)
+ {
+ if(sz != static_cast<Ice::Int>(sizeof(Ice::Int)) + 2)
+ {
+ throwEncapsulationException(__FILE__, __LINE__);
+ }
+ }
+ else
+ {
+ // Skip the optional content of the encapsulation if we are expecting an
+ // empty encapsulation.
+ i += sz - sizeof(Ice::Int) - 2;
+ }
+ return encoding;
+ }
+
+ EncodingVersion readEncapsulation(const Byte*& v, Int& sz)
+ {
+ EncodingVersion encoding;
+ v = i;
+ read(sz);
+ if(sz < 6)
+ {
+ throwEncapsulationException(__FILE__, __LINE__);
+ }
+ if(i - sizeof(Int) + sz > b.end())
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+
+ read(encoding);
+ i += sz - sizeof(Int) - 2;
+ return encoding;
+ }
+
+ const EncodingVersion& getEncoding() const
+ {
+ return _currentEncaps ? _currentEncaps->encoding : _encoding;
+ }
+
+ Int getEncapsulationSize();
+ EncodingVersion skipEncapsulation();
+
+ std::string startSlice()
+ {
+ assert(_currentEncaps && _currentEncaps->decoder);
+ return _currentEncaps->decoder->startSlice();
+ }
+ void endSlice()
+ {
+ assert(_currentEncaps && _currentEncaps->decoder);
+ _currentEncaps->decoder->endSlice();
+ }
+ void skipSlice()
+ {
+ assert(_currentEncaps && _currentEncaps->decoder);
+ _currentEncaps->decoder->skipSlice();
+ }
+
+ void readPendingValues();
+
+ Int readSize() // Inlined for performance reasons.
+ {
+ Byte byte;
+ read(byte);
+ unsigned char val = static_cast<unsigned char>(byte);
+ if(val == 255)
+ {
+ Int v;
+ read(v);
+ if(v < 0)
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ return v;
+ }
+ else
+ {
+ return static_cast<Int>(static_cast<unsigned char>(byte));
+ }
+ }
+
+ Int readAndCheckSeqSize(int);
+
+ void readBlob(std::vector<Byte>&, Int);
+
+ void readBlob(const Byte*& v, Container::size_type sz)
+ {
+ if(sz > 0)
+ {
+ v = i;
+ if(static_cast<Container::size_type>(b.end() - i) < sz)
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ i += sz;
+ }
+ else
+ {
+ v = i;
+ }
+ }
+
+ template<typename T> void read(T& v)
+ {
+ StreamHelper<T, StreamableTraits<T>::helper>::read(this, v);
+ }
+
+ template<typename T> void read(Int tag, IceUtil::Optional<T>& v)
+ {
+ if(readOptional(tag, StreamOptionalHelper<T,
+ StreamableTraits<T>::helper,
+ StreamableTraits<T>::fixedLength>::optionalFormat))
+ {
+#ifdef ICE_CPP11_MAPPING
+ v.emplace();
+#else
+ v.__setIsSet();
+#endif
+ StreamOptionalHelper<T,
+ StreamableTraits<T>::helper,
+ StreamableTraits<T>::fixedLength>::read(this, *v);
+ }
+ else
+ {
+ v = IceUtil::None;
+ }
+ }
+
+#ifdef ICE_CPP11_MAPPING
+
+ template<typename T> void read(std::pair<const T*, const T*>& v)
+ {
+ auto holder = new std::vector<T>;
+ _deleters.push_back([holder] { delete holder; });
+ read(*holder);
+ if(holder->size() > 0)
+ {
+ v.first = holder->data();
+ v.second = holder->data() + holder->size();
+ }
+ else
+ {
+ v.first = 0;
+ v.second = 0;
+ }
+ }
+
+ template<typename T> void readAll(T& v)
+ {
+ read(v);
+ }
+
+ template<typename T, typename... Te> void readAll(T& v, Te&... ve)
+ {
+ read(v);
+ readAll(ve...);
+ }
+
+ template<typename T>
+ void readAll(std::initializer_list<int> tags, IceUtil::Optional<T>& v)
+ {
+ read(*(tags.begin() + tags.size() - 1), v);
+ }
+
+ template<typename T, typename... Te>
+ void readAll(std::initializer_list<int> tags, IceUtil::Optional<T>& v, IceUtil::Optional<Te>&... ve)
+ {
+ size_t index = tags.size() - sizeof...(ve) - 1;
+ read(*(tags.begin() + index), v);
+ readAll(tags, ve...);
+ }
+
+#endif
+
+ // Read type and tag for optionals
+ bool readOptional(Int tag, OptionalFormat expectedFormat)
+ {
+ assert(_currentEncaps);
+ if(_currentEncaps->decoder)
+ {
+ return _currentEncaps->decoder->readOptional(tag, expectedFormat);
+ }
+ else
+ {
+ return readOptImpl(tag, expectedFormat);
+ }
+ }
+
+ // Byte
+ void read(Byte& v)
+ {
+ if(i >= b.end())
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ v = *i++;
+ }
+ void read(std::vector<Byte>&);
+ void read(std::pair<const Byte*, const Byte*>&);
+
+#ifndef ICE_CPP11_MAPPING
+ // This method is useful for generic stream helpers
+ void read(std::pair<const Byte*, const Byte*>& p, ::IceUtil::ScopedArray<Byte>& result)
+ {
+ result.reset();
+ read(p);
+ }
+#endif
+
+ // Bool
+ void read(bool& v)
+ {
+ if(i >= b.end())
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ v = (0 != *i++);
+ }
+ void read(std::vector<bool>&);
+
+#ifdef ICE_CPP11_MAPPING
+ void read(std::pair<const bool*, const bool*>&);
+#else
+ void read(std::pair<const bool*, const bool*>&, ::IceUtil::ScopedArray<bool>&);
+#endif
+
+ // Short
+ void read(Short&);
+ void read(std::vector<Short>&);
+#ifdef ICE_CPP11_MAPPING
+ void read(std::pair<const short*, const short*>&);
+#else
+ void read(std::pair<const Short*, const Short*>&, ::IceUtil::ScopedArray<Short>&);
+#endif
+
+ // Int
+ void read(Int& v) // Inlined for performance reasons.
+ {
+ if(b.end() - i < static_cast<int>(sizeof(Int)))
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ const Byte* src = &(*i);
+ i += sizeof(Int);
+#ifdef ICE_BIG_ENDIAN
+ Byte* dest = reinterpret_cast<Byte*>(&v) + sizeof(Int) - 1;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest = *src;
+#else
+ Byte* dest = reinterpret_cast<Byte*>(&v);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
+#endif
+ }
+
+ void read(std::vector<Int>&);
+#ifdef ICE_CPP11_MAPPING
+ void read(std::pair<const int*, const int*>&);
+#else
+ void read(std::pair<const Int*, const Int*>&, ::IceUtil::ScopedArray<Int>&);
+#endif
+
+ // Long
+
+ void read(Long&);
+ void read(std::vector<Long>&);
+#ifdef ICE_CPP11_MAPPING
+ void read(std::pair<const long long*, const long long*>&);
+#else
+ void read(std::pair<const Long*, const Long*>&, ::IceUtil::ScopedArray<Long>&);
+#endif
+
+ // Float
+ void read(Float&);
+ void read(std::vector<Float>&);
+#ifdef ICE_CPP11_MAPPING
+ void read(std::pair<const float*, const float*>&);
+#else
+ void read(std::pair<const Float*, const Float*>&, ::IceUtil::ScopedArray<Float>&);
+#endif
+
+ // Double
+ void read(Double&);
+ void read(std::vector<Double>&);
+#ifdef ICE_CPP11_MAPPING
+ void read(std::pair<const double*, const double*>&);
+#else
+ void read(std::pair<const Double*, const Double*>&, ::IceUtil::ScopedArray<Double>&);
+#endif
+
+ // String
+ void read(std::string& v, bool convert = true);
+
+#ifdef ICE_CPP11_MAPPING
+ void read(const char*& vdata, size_t& vsize, bool convert = true);
+#else
+ // For custom strings, convert = false
+ void read(const char*& vdata, size_t& vsize);
+
+ // For custom strings, convert = true
+ void read(const char*& vdata, size_t& vsize, std::string& holder);
+#endif
+
+ void read(std::vector<std::string>&, bool = true);
+
+ void read(std::wstring&);
+ void read(std::vector<std::wstring>&);
+
+ // Proxy
+#ifdef ICE_CPP11_MAPPING
+ std::shared_ptr<ObjectPrx> readProxy();
+
+ template<typename T, typename ::std::enable_if<::std::is_base_of<ObjectPrx, T>::value>::type* = nullptr>
+ void read(::std::shared_ptr<T>& v)
+ {
+ ::std::shared_ptr<ObjectPrx> proxy(readProxy());
+ if(!proxy)
+ {
+ v = 0;
+ }
+ else
+ {
+ v = ::IceInternal::createProxy<T>();
+ v->_copyFrom(proxy);
+ }
+ }
+#else
+ void read(ObjectPrx&);
+ template<typename T> void read(IceInternal::ProxyHandle<T>& v)
+ {
+ _readProxy(this, v); // Generated _readProxy method, necessary for forward declarations.
+ }
+#endif
+
+ // Class
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+ template<typename T, typename ::std::enable_if<::std::is_base_of<Value, T>::value>::type* = nullptr>
+ void read(::std::shared_ptr<T>& v)
+ {
+ read(&patchHandle<T>, &v);
+ }
+#else // C++98 mapping
+ template<typename T> void read(IceInternal::Handle<T>& v)
+ {
+ read(&patchHandle<T>, &v);
+ }
+#endif
+
+ void read(PatchFunc patchFunc, void* patchAddr)
+ {
+ initEncaps();
+ _currentEncaps->decoder->read(patchFunc, patchAddr);
+ }
+
+ // Enum
+ Int readEnum(Int);
+
+ // Exception
+ void throwException(ICE_IN(ICE_USER_EXCEPTION_FACTORY) = ICE_NULLPTR);
+
+ // Read/write/skip optionals
+ void skipOptional(OptionalFormat);
+ void skipOptionals();
+
+ // Skip bytes from the stream
+ void skip(size_type size)
+ {
+ if(i + size > b.end())
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ i += size;
+ }
+ void skipSize()
+ {
+ Byte bt;
+ read(bt);
+ if(static_cast<unsigned char>(bt) == 255)
+ {
+ skip(4);
+ }
+ }
+
+ size_type pos()
+ {
+ return i - b.begin();
+ }
+
+ void pos(size_type p)
+ {
+ i = b.begin() + p;
+ }
+
+ InputStream(IceInternal::Instance*, const EncodingVersion&);
+ InputStream(IceInternal::Instance*, const EncodingVersion&, IceInternal::Buffer&, bool = false);
+
+ void initialize(IceInternal::Instance*, const EncodingVersion&);
+
+ bool readOptImpl(Int, OptionalFormat);
+
+private:
+
+ void initialize(const EncodingVersion&);
+
+ //
+ // String
+ //
+ bool readConverted(std::string&, Int);
+
+ //
+ // We can't throw these exception from inline functions from within
+ // this file, because we cannot include the header with the
+ // exceptions. Doing so would screw up the whole include file
+ // ordering.
+ //
+ void throwUnmarshalOutOfBoundsException(const char*, int);
+ void throwEncapsulationException(const char*, int);
+
+ std::string resolveCompactId(int) const;
+
+ void postUnmarshal(const ValuePtr&) const;
+
+ class Encaps;
+ enum SliceType { NoSlice, ValueSlice, ExceptionSlice };
+
+ void traceSkipSlice(const std::string&, SliceType) const;
+
+ ValueFactoryManagerPtr valueFactoryManager() const;
+
+ LoggerPtr logger() const;
+
+#ifdef ICE_CPP11_MAPPING
+ std::function<std::string(int)> compactIdResolver() const;
+#else
+ CompactIdResolverPtr compactIdResolver() const;
+#endif
+
+ typedef std::vector<ValuePtr> ValueList;
+
+ class ICE_API EncapsDecoder : private ::IceUtil::noncopyable
+ {
+ public:
+
+ virtual ~EncapsDecoder();
+
+ virtual void read(PatchFunc, void*) = 0;
+ virtual void throwException(ICE_IN(ICE_USER_EXCEPTION_FACTORY)) = 0;
+
+ virtual void startInstance(SliceType) = 0;
+ virtual SlicedDataPtr endInstance(bool) = 0;
+ virtual const std::string& startSlice() = 0;
+ virtual void endSlice() = 0;
+ virtual void skipSlice() = 0;
+
+ virtual bool readOptional(Int, OptionalFormat)
+ {
+ return false;
+ }
+
+ virtual void readPendingValues()
+ {
+ }
+
+ protected:
+
+ EncapsDecoder(InputStream* stream, Encaps* encaps, bool sliceValues, const Ice::ValueFactoryManagerPtr& f) :
+ _stream(stream), _encaps(encaps), _sliceValues(sliceValues), _valueFactoryManager(f), _typeIdIndex(0)
+ {
+ }
+
+ std::string readTypeId(bool);
+ ValuePtr newInstance(const std::string&);
+
+ void addPatchEntry(Int, PatchFunc, void*);
+ void unmarshal(Int, const ValuePtr&);
+
+ typedef std::map<Int, ValuePtr> IndexToPtrMap;
+ typedef std::map<Int, std::string> TypeIdMap;
+
+ struct PatchEntry
+ {
+ PatchFunc patchFunc;
+ void* patchAddr;
+ };
+ typedef std::vector<PatchEntry> PatchList;
+ typedef std::map<Int, PatchList> PatchMap;
+
+ InputStream* _stream;
+ Encaps* _encaps;
+ const bool _sliceValues;
+ Ice::ValueFactoryManagerPtr _valueFactoryManager;
+
+ // Encapsulation attributes for object un-marshalling
+ PatchMap _patchMap;
+
+ private:
+
+ // Encapsulation attributes for object un-marshalling
+ IndexToPtrMap _unmarshaledMap;
+ TypeIdMap _typeIdMap;
+ Int _typeIdIndex;
+ ValueList _valueList;
+ };
+
+ class ICE_API EncapsDecoder10 : public EncapsDecoder
+ {
+ public:
+
+ EncapsDecoder10(InputStream* stream, Encaps* encaps, bool sliceValues, const Ice::ValueFactoryManagerPtr& f) :
+ EncapsDecoder(stream, encaps, sliceValues, f), _sliceType(NoSlice)
+ {
+ }
+
+ virtual void read(PatchFunc, void*);
+ virtual void throwException(ICE_IN(ICE_USER_EXCEPTION_FACTORY));
+
+ virtual void startInstance(SliceType);
+ virtual SlicedDataPtr endInstance(bool);
+ virtual const std::string& startSlice();
+ virtual void endSlice();
+ virtual void skipSlice();
+
+ virtual void readPendingValues();
+
+ private:
+
+ void readInstance();
+
+ // Instance attributes
+ SliceType _sliceType;
+ bool _skipFirstSlice;
+
+ // Slice attributes
+ Int _sliceSize;
+ std::string _typeId;
+ };
+
+ class ICE_API EncapsDecoder11 : public EncapsDecoder
+ {
+ public:
+
+ EncapsDecoder11(InputStream* stream, Encaps* encaps, bool sliceValues, const Ice::ValueFactoryManagerPtr& f) :
+ EncapsDecoder(stream, encaps, sliceValues, f), _preAllocatedInstanceData(0), _current(0), _valueIdIndex(1)
+ {
+ }
+
+ virtual void read(PatchFunc, void*);
+ virtual void throwException(ICE_IN(ICE_USER_EXCEPTION_FACTORY));
+
+ virtual void startInstance(SliceType);
+ virtual SlicedDataPtr endInstance(bool);
+ virtual const std::string& startSlice();
+ virtual void endSlice();
+ virtual void skipSlice();
+
+ virtual bool readOptional(Int, OptionalFormat);
+
+ private:
+
+ Int readInstance(Int, PatchFunc, void*);
+ SlicedDataPtr readSlicedData();
+
+ struct IndirectPatchEntry
+ {
+ Int index;
+ PatchFunc patchFunc;
+ void* patchAddr;
+ };
+ typedef std::vector<IndirectPatchEntry> IndirectPatchList;
+
+ typedef std::vector<Int> IndexList;
+ typedef std::vector<IndexList> IndexListList;
+
+ struct InstanceData
+ {
+ InstanceData(InstanceData* p) : previous(p), next(0)
+ {
+ if(previous)
+ {
+ previous->next = this;
+ }
+ }
+
+ ~InstanceData()
+ {
+ if(next)
+ {
+ delete next;
+ }
+ }
+
+ // Instance attributes
+ SliceType sliceType;
+ bool skipFirstSlice;
+ SliceInfoSeq slices; // Preserved slices.
+ IndexListList indirectionTables;
+
+ // Slice attributes
+ Byte sliceFlags;
+ Int sliceSize;
+ std::string typeId;
+ int compactId;
+ IndirectPatchList indirectPatchList;
+
+ InstanceData* previous;
+ InstanceData* next;
+ };
+ InstanceData _preAllocatedInstanceData;
+ InstanceData* _current;
+
+ void push(SliceType sliceType)
+ {
+ if(!_current)
+ {
+ _current = &_preAllocatedInstanceData;
+ }
+ else
+ {
+ _current = _current->next ? _current->next : new InstanceData(_current);
+ }
+ _current->sliceType = sliceType;
+ _current->skipFirstSlice = false;
+ }
+
+ Int _valueIdIndex; // The ID of the next value to unmarshal.
+ };
+
+ class Encaps : private ::IceUtil::noncopyable
+ {
+ public:
+
+ Encaps() : start(0), decoder(0), previous(0)
+ {
+ // Inlined for performance reasons.
+ }
+ ~Encaps()
+ {
+ // Inlined for performance reasons.
+ delete decoder;
+ }
+ void reset()
+ {
+ // Inlined for performance reasons.
+ delete decoder;
+ decoder = 0;
+
+ previous = 0;
+ }
+
+ Container::size_type start;
+ Int sz;
+ EncodingVersion encoding;
+
+ EncapsDecoder* decoder;
+
+ Encaps* previous;
+ };
+
+
+ //
+ // Optimization. The instance may not be deleted while a
+ // stack-allocated stream still holds it.
+ //
+ IceInternal::Instance* _instance;
+
+ //
+ // The encoding version to use when there's no encapsulation to
+ // read from. This is for example used to read message headers.
+ //
+ EncodingVersion _encoding;
+
+ Encaps* _currentEncaps;
+
+ void initEncaps();
+
+ Encaps _preAllocatedEncaps;
+
+#ifndef ICE_CPP11_MAPPING
+ bool _collectObjects;
+#endif
+
+ bool _traceSlicing;
+
+ void* _closure;
+
+ bool _sliceValues;
+
+ int _startSeq;
+ int _minSeqSize;
+
+ ValueFactoryManagerPtr _valueFactoryManager;
+ LoggerPtr _logger;
+#ifdef ICE_CPP11_MAPPING
+ std::function<std::string(int)> _compactIdResolver;
+#else
+ CompactIdResolverPtr _compactIdResolver;
+#endif
+
+#ifdef ICE_CPP11_MAPPING
+ std::vector<std::function<void()>> _deleters;
+#endif
+
+};
+
+} // End namespace Ice
+
+#endif
diff --git a/cpp/include/Ice/InstanceF.h b/cpp/include/Ice/InstanceF.h
index 0da1bb3cfa5..b5ff9d77aa4 100644
--- a/cpp/include/Ice/InstanceF.h
+++ b/cpp/include/Ice/InstanceF.h
@@ -20,7 +20,6 @@ namespace IceInternal
class Instance;
ICE_API IceUtil::Shared* upCast(Instance*);
typedef IceInternal::Handle<Instance> InstancePtr;
-
}
#endif
diff --git a/cpp/include/Ice/InterfaceByValue.h b/cpp/include/Ice/InterfaceByValue.h
new file mode 100644
index 00000000000..6e1bd42590c
--- /dev/null
+++ b/cpp/include/Ice/InterfaceByValue.h
@@ -0,0 +1,46 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_INTERFACE_BY_VALUE_H
+#define ICE_INTERFACE_BY_VALUE_H
+
+#include <Ice/Value.h>
+#include <Ice/OutputStream.h>
+#include <Ice/InputStream.h>
+
+#ifdef ICE_CPP11_MAPPING
+
+namespace Ice
+{
+
+template<typename T>
+class InterfaceByValue : public ValueHelper<InterfaceByValue<T>, Value>
+{
+public:
+ virtual std::string ice_id() const
+ {
+ return T::ice_staticId();
+ }
+
+ static const std::string& ice_staticId()
+ {
+ return T::ice_staticId();
+ }
+
+ std::tuple<> ice_tuple() const
+ {
+ return std::tie();
+ }
+};
+
+}
+
+#endif
+
+#endif
diff --git a/cpp/include/Ice/LocalObject.h b/cpp/include/Ice/LocalObject.h
index af747a1007f..b3c47c225f1 100644
--- a/cpp/include/Ice/LocalObject.h
+++ b/cpp/include/Ice/LocalObject.h
@@ -10,20 +10,19 @@
#ifndef ICE_LOCAL_OBJECT_H
#define ICE_LOCAL_OBJECT_H
+#if !defined(ICE_CPP11_MAPPING) || defined(ICE_BUILDING_SRC)
+//
+// Part of the C++98 mapping, and "internal" definitions when building Ice
+// with the C++11 mapping
+//
+
#include <IceUtil/Shared.h>
#include <Ice/LocalObjectF.h>
-namespace IceInternal
-{
-
-class BasicStream;
-
-}
-
namespace Ice
{
-class ICE_API LocalObject : virtual public ::IceUtil::Shared
+class ICE_API LocalObject : public virtual ::IceUtil::Shared
{
public:
@@ -34,3 +33,4 @@ public:
}
#endif
+#endif
diff --git a/cpp/include/Ice/LoggerUtil.h b/cpp/include/Ice/LoggerUtil.h
index 9d178568a96..a3cfddc49b2 100644
--- a/cpp/include/Ice/LoggerUtil.h
+++ b/cpp/include/Ice/LoggerUtil.h
@@ -23,12 +23,12 @@ class ICE_API LoggerOutputBase : private IceUtil::noncopyable
public:
std::string str() const;
-
- std::ostringstream& __str(); // For internal use only. Don't use in your code.
+
+ std::ostringstream& _stream(); // For internal use only. Don't use in your code.
private:
- std::ostringstream _str;
+ std::ostringstream _os;
};
ICE_API LoggerOutputBase& loggerInsert(LoggerOutputBase& out, const IceUtil::Exception& ex);
@@ -48,7 +48,7 @@ struct LoggerOutputInserter
static inline LoggerOutputBase&
insert(LoggerOutputBase& out, const T& val)
{
- out.__str() << val;
+ out._stream() << val;
return out;
}
};
@@ -68,12 +68,18 @@ template<typename T>
inline LoggerOutputBase&
operator<<(LoggerOutputBase& out, const T& val)
{
- return LoggerOutputInserter<T, IsException<T>::value>::insert(out, val);
+ return LoggerOutputInserter<T, IsException<T>::value>::insert(out, val);
}
+#ifdef ICE_CPP11_MAPPING
+template<typename T, typename ::std::enable_if<::std::is_base_of<::Ice::ObjectPrx, T>::value>::type* = nullptr>
+inline LoggerOutputBase&
+operator<<(LoggerOutputBase& os, const ::std::shared_ptr<T>& p)
+#else
template<typename T>
-inline LoggerOutputBase&
+inline LoggerOutputBase&
operator<<(LoggerOutputBase& os, const ::IceInternal::ProxyHandle<T>& p)
+#endif
{
return os << (p ? p->ice_toString() : "");
}
@@ -81,7 +87,7 @@ operator<<(LoggerOutputBase& os, const ::IceInternal::ProxyHandle<T>& p)
inline LoggerOutputBase&
operator<<(LoggerOutputBase& out, const ::std::exception& ex)
{
- out.__str() << ex.what();
+ out._stream() << ex.what();
return out;
}
@@ -94,7 +100,7 @@ public:
inline LoggerOutput(const LPtr& lptr) :
_logger(lptr)
{}
-
+
inline ~LoggerOutput()
{
flush();
@@ -102,17 +108,17 @@ public:
inline void flush()
{
- std::string s = __str().str();
+ std::string s = _stream().str();
if(!s.empty())
{
L& ref = *_logger;
(ref.*output)(s);
}
- __str().str("");
+ _stream().str("");
}
private:
-
+
LPtr _logger;
};
@@ -126,9 +132,9 @@ public:
Trace(const LoggerPtr&, const std::string&);
~Trace();
void flush();
-
+
private:
-
+
LoggerPtr _logger;
std::string _category;
};
diff --git a/cpp/include/Ice/Makefile b/cpp/include/Ice/Makefile
deleted file mode 100644
index 2a8611aa198..00000000000
--- a/cpp/include/Ice/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ../..
-
-include $(top_srcdir)/config/Make.rules
-
-install::
- @if test ! -d $(DESTDIR)$(install_includedir)/Ice ; \
- then \
- echo "Creating $(DESTDIR)$(install_includedir)/Ice..." ; \
- $(call mkdir,$(DESTDIR)$(install_includedir)/Ice) ; \
- fi
-
- @for i in *.h ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/Ice/$$i ; \
- chmod a+r $(DESTDIR)$(install_includedir)/Ice/$$i ; \
- done
diff --git a/cpp/include/Ice/Makefile.mak b/cpp/include/Ice/Makefile.mak
deleted file mode 100644
index 33f08997665..00000000000
--- a/cpp/include/Ice/Makefile.mak
+++ /dev/null
@@ -1,34 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..\..
-INCLUDE_DIR = Ice
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-!if "$(WINRT)" != "yes"
-
-install::
- @if not exist "$(install_includedir)\Ice" \
- @echo "Creating $(install_includedir)\Ice..." && \
- $(MKDIR) "$(install_includedir)\Ice"
-
- @for %i in ( *.h ) do \
- @echo Installing %i && \
- copy %i "$(install_includedir)\Ice"
-
-!else
-
-!include .headers
-
-all:: $(SDK_HEADERS)
-
-install:: all
-
-!endif
diff --git a/cpp/include/Ice/MetricsAdminI.h b/cpp/include/Ice/MetricsAdminI.h
index 0a9384b821a..a76a74db305 100644
--- a/cpp/include/Ice/MetricsAdminI.h
+++ b/cpp/include/Ice/MetricsAdminI.h
@@ -17,7 +17,7 @@
#include <Ice/Metrics.h>
#ifdef _MSC_VER
-# define ICE_CPP11_REGEXP
+# define ICE_CPP11_COMPILER_REGEXP
#endif
#ifdef __MINGW32__
@@ -25,7 +25,7 @@
// No regexp support with MinGW, when MinGW C++11 mode is not experimental
// we can use std::regex.
//
-#elif defined(ICE_CPP11_REGEXP)
+#elif defined(ICE_CPP11_COMPILER_REGEXP)
# include <regex>
#else
# include <regex.h>
@@ -44,14 +44,22 @@ template<typename T> class MetricsHelperT;
namespace IceInternal
{
-class ICE_API MetricsMapI : public IceUtil::Shared
+class ICE_API MetricsMapI;
+ICE_DEFINE_PTR(MetricsMapIPtr, MetricsMapI);
+
+class ICE_API MetricsMapI :
+#ifdef ICE_CPP11_MAPPING
+ public std::enable_shared_from_this<MetricsMapI>
+#else
+ public virtual IceUtil::Shared
+#endif
{
public:
class ICE_API RegExp : public IceUtil::Shared
{
public:
-
+
RegExp(const std::string&, const std::string&);
~RegExp();
@@ -73,7 +81,7 @@ public:
private:
bool match(const std::string&);
-
+
const std::string _attribute;
#ifdef __MINGW32__
@@ -81,7 +89,7 @@ public:
// No regexp support with MinGW, when MinGW C++11 mode is not experimental
// we can use std::regex.
//
-#elif defined(ICE_CPP11_REGEXP)
+#elif defined(ICE_CPP11_COMPILER_REGEXP)
# if _MSC_VER < 1600
std::tr1::regex _regex;
# else
@@ -89,9 +97,11 @@ public:
# endif
#else
regex_t _preg;
-#endif
+#endif
};
- typedef IceUtil::Handle<RegExp> RegExpPtr;
+ ICE_DEFINE_PTR(RegExpPtr, RegExp);
+
+ virtual ~MetricsMapI();
MetricsMapI(const std::string&, const Ice::PropertiesPtr&);
MetricsMapI(const MetricsMapI&);
@@ -102,7 +112,7 @@ public:
virtual IceMX::MetricsFailures getFailures(const std::string&) = 0;
virtual IceMX::MetricsMap getMetrics() const = 0;
- virtual MetricsMapI* clone() const = 0;
+ virtual MetricsMapIPtr clone() const = 0;
const Ice::PropertyDict& getProperties() const;
@@ -115,43 +125,52 @@ protected:
const std::vector<RegExpPtr> _accept;
const std::vector<RegExpPtr> _reject;
};
-typedef IceUtil::Handle<MetricsMapI> MetricsMapIPtr;
-class ICE_API MetricsMapFactory : public Ice::LocalObject
+class ICE_API MetricsMapFactory
+#ifndef ICE_CPP11_MAPPING
+ : public Ice::LocalObject
+#endif
{
public:
+ virtual ~MetricsMapFactory();
+
MetricsMapFactory(IceMX::Updater*);
virtual MetricsMapIPtr create(const std::string&, const Ice::PropertiesPtr&) = 0;
-
+
void update();
private:
-
+
IceMX::Updater* _updater;
};
-typedef IceUtil::Handle<MetricsMapFactory> MetricsMapFactoryPtr;
+ICE_DEFINE_PTR(MetricsMapFactoryPtr, MetricsMapFactory);
template<class MetricsType> class MetricsMapT : public MetricsMapI, private IceUtil::Mutex
{
public:
typedef MetricsType T;
- typedef IceInternal::Handle<MetricsType> TPtr;
+ typedef ICE_INTERNAL_HANDLE<MetricsType> TPtr;
- typedef IceUtil::Handle<MetricsMapT> MetricsMapTPtr;
+ ICE_DEFINE_PTR(MetricsMapTPtr, MetricsMapT);
typedef IceMX::MetricsMap MetricsType::* SubMapMember;
class EntryT;
- typedef IceUtil::Handle<EntryT> EntryTPtr;
+ ICE_DEFINE_PTR(EntryTPtr, EntryT);
- class EntryT : public Ice::LocalObject
+ class EntryT :
+#ifdef ICE_CPP11_MAPPING
+ public std::enable_shared_from_this<EntryT>
+#else
+ public Ice::LocalObject
+#endif
{
public:
- EntryT(MetricsMapT* map, const TPtr& object, const typename std::list<EntryTPtr>::iterator& p) :
+ EntryT(MetricsMapTPtr map, const TPtr& object, const typename std::list<EntryTPtr>::iterator& p) :
_map(map), _object(object), _detachedPos(p)
{
}
@@ -166,7 +185,7 @@ public:
}
}
- void
+ void
failed(const std::string& exceptionName)
{
IceUtil::Mutex::Lock sync(*_map);
@@ -180,7 +199,7 @@ public:
MetricsMapIPtr m;
{
IceUtil::Mutex::Lock sync(*_map);
- typename std::map<std::string, std::pair<MetricsMapIPtr, SubMapMember> >::iterator p =
+ typename std::map<std::string, std::pair<MetricsMapIPtr, SubMapMember> >::iterator p =
_subMaps.find(mapName);
if(p == _subMaps.end())
{
@@ -196,7 +215,7 @@ public:
}
m = p->second.first;
}
-
+
MetricsMapT<MemberMetricsType>* map = dynamic_cast<MetricsMapT<MemberMetricsType>*>(m.get());
assert(map);
return map->getMatching(helper);
@@ -209,7 +228,11 @@ public:
_object->totalLifetime += lifetime;
if(--_object->current == 0)
{
+#ifdef ICE_CPP11_MAPPING
+ _map->detached(this->shared_from_this());
+#else
_map->detached(this);
+#endif
}
}
@@ -241,7 +264,7 @@ public:
IceMX::MetricsPtr
clone() const
{
- TPtr metrics = TPtr::dynamicCast(_object->ice_clone());
+ TPtr metrics = ICE_DYNAMIC_CAST(T, _object->ice_clone());
for(typename std::map<std::string, std::pair<MetricsMapIPtr, SubMapMember> >::const_iterator p =
_subMaps.begin(); p != _subMaps.end(); ++p)
{
@@ -250,7 +273,7 @@ public:
return metrics;
}
- bool
+ bool
isDetached() const
{
return _object->current == 0;
@@ -274,7 +297,7 @@ public:
MetricsMapT(const std::string& mapPrefix,
const Ice::PropertiesPtr& properties,
- const std::map<std::string, std::pair<SubMapMember, MetricsMapFactoryPtr> >& subMaps) :
+ const std::map<std::string, std::pair<SubMapMember, MetricsMapFactoryPtr> >& subMaps) :
MetricsMapI(mapPrefix, properties), _destroyed(false)
{
std::vector<std::string> subMapNames;
@@ -295,8 +318,8 @@ public:
continue; // This sub-map isn't configured.
}
}
- _subMaps.insert(std::make_pair(p->first,
- std::make_pair(p->second.first,
+ _subMaps.insert(std::make_pair(p->first,
+ std::make_pair(p->second.first,
p->second.second->create(subMapPrefix, properties))));
}
}
@@ -305,7 +328,14 @@ public:
{
}
- virtual void
+#ifdef ICE_CPP11_MAPPING
+ std::shared_ptr<MetricsMapT> shared_from_this()
+ {
+ return std::static_pointer_cast<MetricsMapT>(MetricsMapI::shared_from_this());
+ }
+#endif
+
+ virtual void
destroy()
{
Lock sync(*this);
@@ -318,7 +348,7 @@ public:
getMetrics() const
{
IceMX::MetricsMap objects;
-
+
Lock sync(*this);
for(typename std::map<std::string, EntryTPtr>::const_iterator p = _objects.begin(); p != _objects.end(); ++p)
{
@@ -326,12 +356,12 @@ public:
}
return objects;
}
-
+
virtual IceMX::MetricsFailuresSeq
getFailures()
{
IceMX::MetricsFailuresSeq failures;
-
+
Lock sync(*this);
for(typename std::map<std::string, EntryTPtr>::const_iterator p = _objects.begin(); p != _objects.end(); ++p)
{
@@ -343,7 +373,7 @@ public:
}
return failures;
}
-
+
virtual IceMX::MetricsFailures
getFailures(const std::string& id)
{
@@ -364,9 +394,9 @@ public:
_subMaps.find(subMapName);
if(p != _subMaps.end())
{
- return std::pair<MetricsMapIPtr, SubMapMember>(p->second.second->clone(), p->second.first);
+ return std::pair<MetricsMapIPtr, SubMapMember>(ICE_GET_SHARED_FROM_THIS(p->second.second->clone()), p->second.first);
}
- return std::pair<MetricsMapIPtr, SubMapMember>(MetricsMapIPtr(), static_cast<SubMapMember>(0));
+ return std::pair<MetricsMapIPtr, SubMapMember>(MetricsMapIPtr(ICE_NULLPTR), static_cast<SubMapMember>(0));
}
EntryTPtr
@@ -379,15 +409,15 @@ public:
{
if(!(*p)->match(helper, false))
{
- return 0;
+ return ICE_NULLPTR;
}
}
-
+
for(std::vector<RegExpPtr>::const_iterator p = _reject.begin(); p != _reject.end(); ++p)
{
if((*p)->match(helper, true))
{
- return 0;
+ return ICE_NULLPTR;
}
}
@@ -419,16 +449,16 @@ public:
}
catch(const std::exception&)
{
- return 0;
+ return ICE_NULLPTR;
}
//
// Lookup the metrics object.
- //
+ //
Lock sync(*this);
if(_destroyed)
{
- return 0;
+ return ICE_NULLPTR;
}
if(previous && previous->_object->id == key)
@@ -440,23 +470,30 @@ public:
typename std::map<std::string, EntryTPtr>::const_iterator p = _objects.find(key);
if(p == _objects.end())
{
- TPtr t = new T();
+ TPtr t = ICE_MAKE_SHARED(T);
t->id = key;
+
+#ifdef ICE_CPP11_MAPPING
p = _objects.insert(typename std::map<std::string, EntryTPtr>::value_type(
- key, new EntryT(this, t, _detachedQueue.end()))).first;
+ key, std::make_shared<EntryT>(shared_from_this(), t, _detachedQueue.end()))).first;
+#else
+ p = _objects.insert(typename std::map<std::string, EntryTPtr>::value_type(
+ key, new EntryT(this, t, _detachedQueue.end()))).first;
+#endif
+
}
p->second->attach(helper);
return p->second;
}
-
+
private:
- virtual MetricsMapI* clone() const
+ virtual MetricsMapIPtr clone() const
{
- return new MetricsMapT<MetricsType>(*this);
+ return ICE_MAKE_SHARED(MetricsMapT<MetricsType>, *this);
}
- void detached(EntryT* entry)
+ void detached(EntryTPtr entry)
{
// This is called with the map mutex locked.
@@ -529,14 +566,14 @@ public:
virtual MetricsMapIPtr
create(const std::string& mapPrefix, const Ice::PropertiesPtr& properties)
{
- return new MetricsMapT<MetricsType>(mapPrefix, properties, _subMaps);
+ return ICE_MAKE_SHARED(MetricsMapT<MetricsType>, mapPrefix, properties, _subMaps);
}
template<class SubMapMetricsType> void
registerSubMap(const std::string& subMap, IceMX::MetricsMap MetricsType::* member)
{
- _subMaps[subMap] = std::pair<IceMX::MetricsMap MetricsType::*,
- MetricsMapFactoryPtr>(member, new MetricsMapFactoryT<SubMapMetricsType>(0));
+ _subMaps[subMap] = std::pair<IceMX::MetricsMap MetricsType::*,
+ MetricsMapFactoryPtr>(member, ICE_MAKE_SHARED(MetricsMapFactoryT<SubMapMetricsType>, ICE_NULLPTR));
}
private:
@@ -547,12 +584,12 @@ private:
class MetricsViewI : public IceUtil::Shared
{
public:
-
+
MetricsViewI(const std::string&);
void destroy();
- bool addOrUpdateMap(const Ice::PropertiesPtr&, const std::string&, const MetricsMapFactoryPtr&,
+ bool addOrUpdateMap(const Ice::PropertiesPtr&, const std::string&, const MetricsMapFactoryPtr&,
const Ice::LoggerPtr&);
bool removeMap(const std::string&);
@@ -569,9 +606,12 @@ private:
const std::string _name;
std::map<std::string, MetricsMapIPtr> _maps;
};
-typedef IceUtil::Handle<MetricsViewI> MetricsViewIPtr;
+ICE_DEFINE_PTR(MetricsViewIPtr, MetricsViewI);
-class ICE_API MetricsAdminI : public IceMX::MetricsAdmin, public Ice::PropertiesAdminUpdateCallback,
+class ICE_API MetricsAdminI : public IceMX::MetricsAdmin,
+#ifndef ICE_CPP11_MAPPING
+ public Ice::PropertiesAdminUpdateCallback,
+#endif
private IceUtil::Mutex
{
public:
@@ -583,14 +623,14 @@ public:
void updateViews();
- template<class MetricsType> void
+ template<class MetricsType> void
registerMap(const std::string& map, IceMX::Updater* updater)
{
bool updated;
MetricsMapFactoryPtr factory;
{
Lock sync(*this);
- factory = new MetricsMapFactoryT<MetricsType>(updater);
+ factory = ICE_MAKE_SHARED(MetricsMapFactoryT<MetricsType>, updater);
_factories[map] = factory;
updated = addOrUpdateMap(map, factory);
}
@@ -604,16 +644,19 @@ public:
registerSubMap(const std::string& map, const std::string& subMap, IceMX::MetricsMap MetricsType::* member)
{
bool updated;
- IceUtil::Handle<MetricsMapFactoryT<MetricsType> > factory;
+ ICE_HANDLE<MetricsMapFactoryT<MetricsType> > factory;
{
Lock sync(*this);
-
std::map<std::string, MetricsMapFactoryPtr>::const_iterator p = _factories.find(map);
if(p == _factories.end())
{
return;
}
+#ifdef ICE_CPP11_MAPPING
+ factory = ::std::dynamic_pointer_cast<MetricsMapFactoryT<MetricsType>>(p->second);
+#else
factory = dynamic_cast<MetricsMapFactoryT<MetricsType>*>(p->second.get());
+#endif
factory->template registerSubMap<MemberMetricsType>(subMap, member);
removeMap(map);
updated = addOrUpdateMap(map, factory);
@@ -627,14 +670,24 @@ public:
void unregisterMap(const std::string&);
virtual Ice::StringSeq getMetricsViewNames(Ice::StringSeq&, const ::Ice::Current&);
+
+ void updated(const Ice::PropertyDict&);
+
+#ifdef ICE_CPP11_MAPPING
+ virtual void enableMetricsView(std::string, const ::Ice::Current&);
+ virtual void disableMetricsView(std::string, const ::Ice::Current&);
+ virtual IceMX::MetricsView getMetricsView(std::string, Ice::Long&, const ::Ice::Current&);
+ virtual IceMX::MetricsFailuresSeq getMapMetricsFailures(std::string, std::string, const ::Ice::Current&);
+ virtual IceMX::MetricsFailures getMetricsFailures(std::string, std::string, std::string, const ::Ice::Current&);
+#else
virtual void enableMetricsView(const std::string&, const ::Ice::Current&);
virtual void disableMetricsView(const std::string&, const ::Ice::Current&);
virtual IceMX::MetricsView getMetricsView(const std::string&, Ice::Long&, const ::Ice::Current&);
- virtual IceMX::MetricsFailuresSeq getMapMetricsFailures(const std::string&, const std::string&,
+ virtual IceMX::MetricsFailuresSeq getMapMetricsFailures(const std::string&, const std::string&,
const ::Ice::Current&);
virtual IceMX::MetricsFailures getMetricsFailures(const std::string&, const std::string&, const std::string&,
const ::Ice::Current&);
-
+#endif
std::vector<MetricsMapIPtr> getMaps(const std::string&) const;
const Ice::LoggerPtr& getLogger() const;
@@ -643,8 +696,6 @@ private:
MetricsViewIPtr getMetricsView(const std::string&);
- void updated(const Ice::PropertyDict&);
-
bool addOrUpdateMap(const std::string&, const MetricsMapFactoryPtr&);
bool removeMap(const std::string&);
@@ -655,7 +706,7 @@ private:
const Ice::LoggerPtr _logger;
Ice::PropertiesPtr _properties;
};
-typedef IceUtil::Handle<MetricsAdminI> MetricsAdminIPtr;
+ICE_DEFINE_PTR(MetricsAdminIPtr, MetricsAdminI);
};
diff --git a/cpp/include/Ice/MetricsFunctional.h b/cpp/include/Ice/MetricsFunctional.h
index 701b9dd6cc4..89f3d4b4312 100644
--- a/cpp/include/Ice/MetricsFunctional.h
+++ b/cpp/include/Ice/MetricsFunctional.h
@@ -21,6 +21,23 @@ template<typename R> struct ReferenceWrapper
}
};
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+template<typename R> struct ReferenceWrapper<::std::shared_ptr<R> >
+{
+ static R* get(const ::std::shared_ptr<R>& v)
+ {
+ return v.get();
+ }
+};
+
+template<typename R> struct ReferenceWrapper<const ::std::shared_ptr<R>& >
+{
+ static R* get(const ::std::shared_ptr<R>& v)
+ {
+ return v.get();
+ }
+};
+#else // C++98 mapping
template<typename R> struct ReferenceWrapper<IceInternal::ProxyHandle<R> >
{
static R* get(const IceInternal::ProxyHandle<R>& v)
@@ -52,6 +69,7 @@ template<typename R> struct ReferenceWrapper<const IceInternal::Handle<R>& >
return v.get();
}
};
+#endif
template<typename R> struct ReferenceWrapper<R*>
{
@@ -76,7 +94,7 @@ namespace IceMX
template<class T, typename Y, typename Func> struct ApplyOnMember
{
- ApplyOnMember(Y T::*member, Func func) : func(func), member(member)
+ ApplyOnMember(Y T::*m, Func f) : func(f), member(m)
{
}
@@ -108,7 +126,7 @@ template<typename T> struct Increment
template<typename T> struct Add
{
- Add(T value) : value(value) { }
+ Add(T v) : value(v) { }
template<typename Y>
void operator()(Y& v)
diff --git a/cpp/include/Ice/MetricsObserverI.h b/cpp/include/Ice/MetricsObserverI.h
index 6dc0270aae5..7a3710cd2bc 100644
--- a/cpp/include/Ice/MetricsObserverI.h
+++ b/cpp/include/Ice/MetricsObserverI.h
@@ -36,7 +36,7 @@ public:
virtual std::string operator()(const std::string&) const = 0;
- virtual void initMetrics(const IceInternal::Handle<T>&) const
+ virtual void initMetrics(const ICE_INTERNAL_HANDLE<T>&) const
{
// To be overriden in specialization to initialize state attributes
}
@@ -183,7 +183,7 @@ protected:
virtual std::string operator()(const Helper* r) const
{
O o = (r->*_getFn)();
- I* v = dynamic_cast<I*>(IceInternal::ReferenceWrapper<O>::get(o));
+ I* v = dynamicCast<I>(IceInternal::ReferenceWrapper<O>::get(o));
if(v)
{
return toString(v->*_member);
@@ -212,7 +212,7 @@ protected:
virtual std::string operator()(const Helper* r) const
{
O o = (r->*_getFn)();
- I* v = dynamic_cast<I*>(IceInternal::ReferenceWrapper<O>::get(o));
+ I* v = dynamicCast<I>(IceInternal::ReferenceWrapper<O>::get(o));
if(v)
{
return toString((v->*_memberFn)());
@@ -229,6 +229,40 @@ protected:
Y (I::*_memberFn)() const;
};
+ template<typename I, typename V> static I*
+ dynamicCast(V* v)
+ {
+ return dynamic_cast<I*>(v);
+ }
+
+ template<typename I> static I*
+ dynamicCast(Ice::EndpointInfo* v)
+ {
+ for(Ice::EndpointInfo* info = v; info; info = info->underlying.get())
+ {
+ I* i = dynamic_cast<I*>(info);
+ if(i)
+ {
+ return i;
+ }
+ }
+ return 0;
+ }
+
+ template<typename I> static I*
+ dynamicCast(Ice::ConnectionInfo* v)
+ {
+ for(Ice::ConnectionInfo* info = v; info; info = info->underlying.get())
+ {
+ I* i = dynamic_cast<I*>(info);
+ if(i)
+ {
+ return i;
+ }
+ }
+ return 0;
+ }
+
template<typename I> static std::string
toString(const I& v)
{
@@ -237,6 +271,12 @@ protected:
return os.str();
}
+ static const std::string
+ toString(const Ice::ObjectPrxPtr& p)
+ {
+ return p->ice_toString();
+ }
+
static const std::string&
toString(const std::string& s)
{
@@ -266,20 +306,28 @@ protected:
};
};
-class Updater : public IceUtil::Shared
+class Updater
+#ifndef ICE_CPP11_MAPPING
+ : public virtual IceUtil::Shared
+#endif
{
public:
virtual void update() = 0;
};
-typedef IceUtil::Handle<Updater> UpdaterPtr;
+ICE_DEFINE_PTR(UpdaterPtr, Updater);
template<typename T> class UpdaterT : public Updater
{
public:
+#ifdef ICE_CPP11_MAPPING
+ UpdaterT(const std::shared_ptr<T>& updater, void (T::*fn)()) :
+#else
UpdaterT(T* updater, void (T::*fn)()) :
- _updater(updater), _fn(fn)
+#endif
+ _updater(updater),
+ _fn(fn)
{
}
@@ -290,24 +338,39 @@ public:
private:
- const IceUtil::Handle<T> _updater;
+ const ICE_HANDLE<T> _updater;
void (T::*_fn)();
};
-template<typename T> Updater*
+#ifdef ICE_CPP11_MAPPING
+template<typename T> UpdaterPtr
+newUpdater(const std::shared_ptr<T>& updater, void (T::*fn)())
+{
+ if(updater)
+ {
+ return std::make_shared<UpdaterT<T>>(updater, fn);
+ }
+ else
+ {
+ return nullptr;
+ }
+}
+#else
+template<typename T> UpdaterPtr
newUpdater(const IceInternal::Handle<T>& updater, void (T::*fn)())
{
if(updater)
{
- return new UpdaterT<T>(updater.get(), fn);
+ return UpdaterPtr(new UpdaterT<T>(updater.get(), fn));
}
else
{
return 0;
}
}
+#endif
-template<typename T> class ObserverT : virtual public ::Ice::Instrumentation::Observer
+template<typename T> class ObserverT : public virtual ::Ice::Instrumentation::Observer
{
public:
@@ -367,7 +430,6 @@ public:
}
_previousDelay = previous->_previousDelay + previous->_watch.delay();
-
//
// Detach entries from previous observer which are no longer
// attached to this new observer.
@@ -391,10 +453,10 @@ public:
return *p;
}
}
- return 0;
+ return ICE_NULLPTR;
}
- template<typename ObserverImpl, typename ObserverMetricsType> IceInternal::Handle<ObserverImpl>
+ template<typename ObserverImpl, typename ObserverMetricsType> ICE_INTERNAL_HANDLE<ObserverImpl>
getObserver(const std::string& mapName, const MetricsHelperT<ObserverMetricsType>& helper)
{
std::vector<typename IceInternal::MetricsMapT<ObserverMetricsType>::EntryTPtr> metricsObjects;
@@ -409,10 +471,10 @@ public:
if(metricsObjects.empty())
{
- return 0;
+ return ICE_NULLPTR;
}
- IceInternal::Handle<ObserverImpl> obsv = new ObserverImpl();
+ ICE_INTERNAL_HANDLE<ObserverImpl> obsv = ICE_MAKE_SHARED(ObserverImpl);
obsv->init(helper, metricsObjects);
return obsv;
}
@@ -429,10 +491,15 @@ class ObserverFactoryT : public Updater, private IceUtil::Mutex
{
public:
+#ifdef ICE_CPP11_MAPPING
+ using ObserverImplPtrType = ::std::shared_ptr<ObserverImplType>;
+ using MetricsType = typename ObserverImplType::MetricsType;
+ using MetricsMapSeqType = std::vector<::std::shared_ptr<IceInternal::MetricsMapT<MetricsType>>>;
+#else
typedef IceUtil::Handle<ObserverImplType> ObserverImplPtrType;
typedef typename ObserverImplType::MetricsType MetricsType;
-
typedef std::vector<IceUtil::Handle<IceInternal::MetricsMapT<MetricsType> > > MetricsMapSeqType;
+#endif
ObserverFactoryT(const IceInternal::MetricsAdminIPtr& metrics, const std::string& name) :
_metrics(metrics), _name(name), _enabled(0)
@@ -454,7 +521,7 @@ public:
IceUtil::Mutex::Lock sync(*this);
if(!_metrics)
{
- return 0;
+ return ICE_NULLPTR;
}
typename ObserverImplType::EntrySeqType metricsObjects;
@@ -469,10 +536,10 @@ public:
if(metricsObjects.empty())
{
- return 0;
+ return ICE_NULLPTR;
}
- ObserverImplPtrType obsv = new ObserverImplType();
+ ObserverImplPtrType obsv = ICE_MAKE_SHARED(ObserverImplType);
obsv->init(helper, metricsObjects);
return obsv;
}
@@ -480,16 +547,20 @@ public:
template<typename ObserverPtrType> ObserverImplPtrType
getObserver(const MetricsHelperT<MetricsType>& helper, const ObserverPtrType& observer)
{
+#ifdef ICE_CPP11_MAPPING
+ ObserverImplPtrType old = std::dynamic_pointer_cast<ObserverImplType>(observer);
+#else
ObserverImplPtrType old = ObserverImplPtrType::dynamicCast(observer);
+#endif
+
if(!observer || !old)
{
return getObserver(helper);
}
-
IceUtil::Mutex::Lock sync(*this);
if(!_metrics)
{
- return 0;
+ return ICE_NULLPTR;
}
typename ObserverImplType::EntrySeqType metricsObjects;
@@ -501,14 +572,13 @@ public:
metricsObjects.push_back(entry);
}
}
-
if(metricsObjects.empty())
{
old->detach();
- return 0;
+ return ICE_NULLPTR;
}
- ObserverImplPtrType obsv = new ObserverImplType();
+ ObserverImplPtrType obsv = ICE_MAKE_SHARED(ObserverImplType);
obsv->init(helper, metricsObjects, old.get());
return obsv;
}
@@ -539,7 +609,11 @@ public:
_maps.clear();
for(std::vector<IceInternal::MetricsMapIPtr>::const_iterator p = maps.begin(); p != maps.end(); ++p)
{
+#ifdef ICE_CPP11_MAPPING
+ _maps.push_back(::std::dynamic_pointer_cast<IceInternal::MetricsMapT<MetricsType>>(*p));
+#else
_maps.push_back(IceUtil::Handle<IceInternal::MetricsMapT<MetricsType> >::dynamicCast(*p));
+#endif
assert(_maps.back());
}
_enabled.exchange(_maps.empty() ? 0 : 1);
diff --git a/cpp/include/Ice/NativePropertiesAdmin.h b/cpp/include/Ice/NativePropertiesAdmin.h
index ab75a029fc4..15bcbb4f9e4 100644
--- a/cpp/include/Ice/NativePropertiesAdmin.h
+++ b/cpp/include/Ice/NativePropertiesAdmin.h
@@ -33,22 +33,35 @@ namespace Ice
// Ice ignores any exceptions raised by the callback.
//
-class ICE_API PropertiesAdminUpdateCallback : virtual public Ice::LocalObject
+#ifndef ICE_CPP11_MAPPING
+class ICE_API PropertiesAdminUpdateCallback : public virtual Ice::LocalObject
{
public:
+ virtual ~PropertiesAdminUpdateCallback();
+
virtual void updated(const PropertyDict&) = 0;
};
typedef IceUtil::Handle<PropertiesAdminUpdateCallback> PropertiesAdminUpdateCallbackPtr;
+#endif
-class ICE_API NativePropertiesAdmin : virtual public IceUtil::Shared
+class ICE_API NativePropertiesAdmin
+#ifndef ICE_CPP11_MAPPING
+ : public virtual IceUtil::Shared
+#endif
{
public:
+ virtual ~NativePropertiesAdmin();
+
+#ifdef ICE_CPP11_MAPPING
+ virtual std::function<void()> addUpdateCallback(std::function<void(const PropertyDict&)>) = 0;
+#else
virtual void addUpdateCallback(const PropertiesAdminUpdateCallbackPtr&) = 0;
virtual void removeUpdateCallback(const PropertiesAdminUpdateCallbackPtr&) = 0;
+#endif
};
-typedef IceUtil::Handle<NativePropertiesAdmin> NativePropertiesAdminPtr;
+ICE_DEFINE_PTR(NativePropertiesAdminPtr, NativePropertiesAdmin);
}
diff --git a/cpp/include/Ice/Object.h b/cpp/include/Ice/Object.h
index 801fb9c3d92..6aa5c18ade6 100644
--- a/cpp/include/Ice/Object.h
+++ b/cpp/include/Ice/Object.h
@@ -16,14 +16,20 @@
#include <Ice/ProxyF.h>
#include <Ice/IncomingAsyncF.h>
#include <Ice/Current.h>
-#include <Ice/StreamF.h>
#include <Ice/Format.h>
+namespace Ice
+{
+
+class OutputStream;
+class InpputStream;
+
+}
+
namespace IceInternal
{
class Incoming;
-class BasicStream;
class Direct;
class GCVisitor;
@@ -32,89 +38,123 @@ class GCVisitor;
namespace Ice
{
-enum DispatchStatus
-{
- DispatchOK,
- DispatchUserException,
- DispatchAsync
-};
-
+ICE_API extern const Current noExplicitCurrent;
+#ifndef ICE_CPP11_MAPPING
class ICE_API DispatchInterceptorAsyncCallback : public virtual IceUtil::Shared
{
public:
-
- virtual bool response(bool) = 0;
+
+ virtual ~DispatchInterceptorAsyncCallback();
+
+ virtual bool response() = 0;
virtual bool exception(const std::exception&) = 0;
virtual bool exception() = 0;
};
-typedef IceUtil::Handle<DispatchInterceptorAsyncCallback> DispatchInterceptorAsyncCallbackPtr;
+ICE_DEFINE_PTR(DispatchInterceptorAsyncCallbackPtr, DispatchInterceptorAsyncCallback);
+#endif
-class ICE_API Request
+class ICE_API Request
{
public:
- virtual ~Request() {}
+ virtual ~Request();
virtual const Current& getCurrent() = 0;
};
-class ICE_API Object : virtual public IceUtil::Shared
+#ifdef ICE_CPP11_MAPPING
+class ICE_API Object
+{
+public:
+
+ virtual ~Object() = default;
+
+ virtual bool ice_isA(std::string, const Current& = Ice::noExplicitCurrent) const;
+ bool _iceD_ice_isA(IceInternal::Incoming&, const Current&);
+
+ virtual void ice_ping(const Current& = Ice::noExplicitCurrent) const;
+ bool _iceD_ice_ping(IceInternal::Incoming&, const Current&);
+
+ virtual std::vector< std::string> ice_ids(const Current& = Ice::noExplicitCurrent) const;
+ bool _iceD_ice_ids(IceInternal::Incoming&, const Current&);
+
+ virtual std::string ice_id(const Current& = Ice::noExplicitCurrent) const;
+ bool _iceD_ice_id(IceInternal::Incoming&, const Current&);
+
+ static const std::string& ice_staticId();
+
+#ifndef ICE_CPP11_MAPPING
+ virtual bool ice_dispatch(Ice::Request&, const DispatchInterceptorAsyncCallbackPtr& = 0);
+#else
+ virtual bool ice_dispatch(Ice::Request&,
+ std::function<bool()> = nullptr,
+ std::function<bool(std::exception_ptr)> = nullptr);
+#endif
+ virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
+
+ struct Ice_invokeResult
+ {
+ bool returnValue;
+ std::vector<::Ice::Byte> outParams;
+ };
+
+protected:
+
+ static void _iceCheckMode(OperationMode, OperationMode);
+};
+#else
+class ICE_API Object : public virtual IceUtil::Shared
{
public:
virtual bool operator==(const Object&) const;
virtual bool operator<(const Object&) const;
- virtual bool ice_isA(const std::string&, const Current& = Current()) const;
- DispatchStatus ___ice_isA(IceInternal::Incoming&, const Current&);
+ virtual bool ice_isA(const std::string&, const Current& = Ice::noExplicitCurrent) const;
+ bool _iceD_ice_isA(IceInternal::Incoming&, const Current&);
- virtual void ice_ping(const Current& = Current()) const;
- DispatchStatus ___ice_ping(IceInternal::Incoming&, const Current&);
+ virtual void ice_ping(const Current& = Ice::noExplicitCurrent) const;
+ bool _iceD_ice_ping(IceInternal::Incoming&, const Current&);
- virtual std::vector< std::string> ice_ids(const Current& = Current()) const;
- DispatchStatus ___ice_ids(IceInternal::Incoming&, const Current&);
+ virtual std::vector< std::string> ice_ids(const Current& = Ice::noExplicitCurrent) const;
+ bool _iceD_ice_ids(IceInternal::Incoming&, const Current&);
- virtual const std::string& ice_id(const Current& = Current()) const;
- DispatchStatus ___ice_id(IceInternal::Incoming&, const Current&);
+ virtual const std::string& ice_id(const Current& = Ice::noExplicitCurrent) const;
+ bool _iceD_ice_id(IceInternal::Incoming&, const Current&);
virtual Int ice_operationAttributes(const std::string&) const;
- static const std::string& ice_staticId();
+ virtual void _iceWrite(Ice::OutputStream*) const;
+ virtual void _iceRead(Ice::InputStream*);
- virtual ObjectPtr ice_clone() const;
+ virtual bool _iceGcVisit(IceInternal::GCVisitor&) { return false; }
+ virtual void ice_collectable(bool) { }
virtual void ice_preMarshal();
virtual void ice_postUnmarshal();
- static std::string __all[];
-
- virtual DispatchStatus ice_dispatch(Ice::Request&, const DispatchInterceptorAsyncCallbackPtr& = 0);
- virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&);
-
- virtual void __write(IceInternal::BasicStream*) const;
- virtual void __read(IceInternal::BasicStream*);
+ static const std::string& ice_staticId();
- virtual void __write(const OutputStreamPtr&) const;
- virtual void __read(const InputStreamPtr&);
+ virtual ObjectPtr ice_clone() const;
- virtual bool __gcVisit(IceInternal::GCVisitor&) { return false; };
- virtual void ice_collectable(bool) { };
+ virtual bool ice_dispatch(Ice::Request&, const DispatchInterceptorAsyncCallbackPtr& = 0);
+ virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
protected:
Object() {} // This class is abstract.
virtual ~Object() {}
- virtual void __writeImpl(IceInternal::BasicStream*) const {}
- virtual void __readImpl(IceInternal::BasicStream*) {}
+protected:
- virtual void __writeImpl(const OutputStreamPtr&) const;
- virtual void __readImpl(const InputStreamPtr&);
+ virtual void _iceWriteImpl(Ice::OutputStream*) const {}
+ virtual void _iceReadImpl(Ice::InputStream*) {}
- static void __checkMode(OperationMode, OperationMode);
+ static void _iceCheckMode(OperationMode, OperationMode);
};
+#endif
-class ICE_API Blobject : virtual public Object
+class ICE_API Blobject : public virtual Object
{
public:
@@ -123,10 +163,10 @@ public:
//
virtual bool ice_invoke(const std::vector<Byte>&, std::vector<Byte>&, const Current&) = 0;
- virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&);
+ virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
};
-class ICE_API BlobjectArray : virtual public Object
+class ICE_API BlobjectArray : public virtual Object
{
public:
@@ -135,31 +175,40 @@ public:
//
virtual bool ice_invoke(const std::pair<const Byte*, const Byte*>&, std::vector<Byte>&, const Current&) = 0;
- virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&);
+ virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
};
-class ICE_API BlobjectAsync : virtual public Object
+class ICE_API BlobjectAsync : public virtual Object
{
public:
+#ifdef ICE_CPP11_MAPPING
+ virtual void ice_invokeAsync(std::vector<Byte>,
+ std::function<void(bool, std::vector<Byte>)>,
+ std::function<void(std::exception_ptr)>,
+ const Current&) = 0;
+#else
virtual void ice_invoke_async(const AMD_Object_ice_invokePtr&, const std::vector<Byte>&, const Current&) = 0;
-
- virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&);
+#endif
+ virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
};
-class ICE_API BlobjectArrayAsync : virtual public Object
+class ICE_API BlobjectArrayAsync : public virtual Object
{
public:
+#ifdef ICE_CPP11_MAPPING
+ virtual void ice_invokeAsync(std::pair<const Byte*, const Byte*>,
+ std::function<void(bool, std::pair<const Byte*, const Byte*>)>,
+ std::function<void(std::exception_ptr)>,
+ const Current&) = 0;
+#else
virtual void ice_invoke_async(const AMD_Object_ice_invokePtr&, const std::pair<const Byte*, const Byte*>&,
const Current&) = 0;
-
- virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&);
+#endif
+ virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
};
-ICE_API void ice_writeObject(const OutputStreamPtr&, const ObjectPtr&);
-ICE_API void ice_readObject(const InputStreamPtr&, ObjectPtr&);
-
}
#endif
diff --git a/cpp/include/Ice/ObjectAdapterFactoryF.h b/cpp/include/Ice/ObjectAdapterFactoryF.h
deleted file mode 100644
index 6cea631c372..00000000000
--- a/cpp/include/Ice/ObjectAdapterFactoryF.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_OBJECT_ADAPTER_FACTORY_F_H
-#define ICE_OBJECT_ADAPTER_FACTORY_F_H
-
-#include <IceUtil/Shared.h>
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class ObjectAdapterFactory;
-IceUtil::Shared* upCast(ObjectAdapterFactory*);
-typedef IceInternal::Handle<ObjectAdapterFactory> ObjectAdapterFactoryPtr;
-
-}
-
-#endif
diff --git a/cpp/include/Ice/ObjectF.h b/cpp/include/Ice/ObjectF.h
index 42e24a40e56..cd233caeb99 100644
--- a/cpp/include/Ice/ObjectF.h
+++ b/cpp/include/Ice/ObjectF.h
@@ -17,9 +17,14 @@ namespace Ice
{
class Object;
+#ifdef ICE_CPP11_MAPPING
+using ObjectPtr = ::std::shared_ptr<Object>;
+#else
ICE_API Object* upCast(Object*);
-typedef IceInternal::Handle< Object > ObjectPtr;
-ICE_API void __patch(ObjectPtr&, const ObjectPtr&);
+typedef IceInternal::Handle<Object> ObjectPtr;
+typedef ObjectPtr ValuePtr;
+ICE_API void _icePatchObjectPtr(ObjectPtr&, const ObjectPtr&);
+#endif
}
diff --git a/cpp/include/Ice/ObjectFactoryManagerF.h b/cpp/include/Ice/ObjectFactoryManagerF.h
deleted file mode 100644
index 99721a6f96e..00000000000
--- a/cpp/include/Ice/ObjectFactoryManagerF.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_OBJECT_FACTORY_MANAGER_F_H
-#define ICE_OBJECT_FACTORY_MANAGER_F_H
-
-#include <IceUtil/Shared.h>
-
-#include <Ice/Handle.h>
-
-namespace IceInternal
-{
-
-class ObjectFactoryManager;
-IceUtil::Shared* upCast(ObjectFactoryManager*);
-typedef Handle<ObjectFactoryManager> ObjectFactoryManagerPtr;
-
-}
-
-#endif
diff --git a/cpp/include/Ice/ObserverHelper.h b/cpp/include/Ice/ObserverHelper.h
index 802ef032e99..5cddc952b01 100644
--- a/cpp/include/Ice/ObserverHelper.h
+++ b/cpp/include/Ice/ObserverHelper.h
@@ -21,7 +21,11 @@ template<typename T = Ice::Instrumentation::Observer> class ObserverHelperT
{
public:
+#ifdef ICE_CPP11_MAPPING
+ using TPtr = ::std::shared_ptr<T>;
+#else
typedef IceInternal::Handle<T> TPtr;
+#endif
ObserverHelperT()
{
@@ -37,7 +41,7 @@ public:
operator bool() const
{
- return _observer;
+ return _observer != ICE_NULLPTR;
}
T* operator->() const
@@ -63,11 +67,17 @@ public:
}
}
+#ifdef ICE_CPP11_MAPPING
+ TPtr get() const
+ {
+ return _observer;
+ }
+#else
T* get() const
{
return _observer.get();
}
-
+#endif
void adopt(ObserverHelperT& other)
{
_observer = other._observer;
@@ -99,7 +109,7 @@ protected:
class ICE_API DispatchObserver : public ObserverHelperT<Ice::Instrumentation::DispatchObserver>
{
public:
-
+
void userException()
{
if(_observer)
@@ -121,13 +131,13 @@ class ICE_API InvocationObserver : public ObserverHelperT<Ice::Instrumentation::
{
public:
- InvocationObserver(IceProxy::Ice::Object*, const std::string&, const Ice::Context*);
+ InvocationObserver(const Ice::ObjectPrxPtr&, const std::string&, const Ice::Context&);
InvocationObserver(Instance*, const std::string&);
InvocationObserver()
{
}
- void attach(IceProxy::Ice::Object*, const std::string&, const Ice::Context*);
+ void attach(const Ice::ObjectPrxPtr&, const std::string&, const Ice::Context&);
void attach(Instance*, const std::string&);
void retried()
@@ -145,7 +155,7 @@ public:
{
return _observer->getRemoteObserver(con, endpt, requestId, size);
}
- return 0;
+ return ICE_NULLPTR;
}
::Ice::Instrumentation::ChildInvocationObserverPtr
@@ -155,7 +165,7 @@ public:
{
return _observer->getCollocatedObserver(adapter, requestId, size);
}
- return 0;
+ return ICE_NULLPTR;
}
void
diff --git a/cpp/include/Ice/Optional.h b/cpp/include/Ice/Optional.h
new file mode 100644
index 00000000000..f6a83854fcf
--- /dev/null
+++ b/cpp/include/Ice/Optional.h
@@ -0,0 +1,1107 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+//
+// Ice::optional is a placeholder std::optional:
+// http://en.cppreference.com/w/cpp/utility/optional/optional
+//
+// This implementation is a slighly modified version of Optional.hpp,
+// published at https://github.com/akrzemi1/Optional
+// commit 3922965396fc455c6b1770374b9b4111799588a9
+
+// Copyright (C) 2011 - 2012 Andrzej Krzemienski.
+//
+// Use, modification, and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// The idea and interface is based on Boost.Optional library
+// authored by Fernando Luis Cacciola Carballal
+
+#ifndef ICE_OPTIONAL_H
+#define ICE_OPTIONAL_H
+
+#ifdef ICE_CPP11_MAPPING
+
+# include <utility>
+# include <type_traits>
+# include <initializer_list>
+# include <cassert>
+# include <functional>
+# include <string>
+# include <stdexcept>
+
+# define TR2_OPTIONAL_REQUIRES(...) typename enable_if<__VA_ARGS__::value, bool>::type = false
+
+# if defined __GNUC__ // NOTE: GNUC is also defined for Clang
+# if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)
+# define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___
+# elif (__GNUC__ > 4)
+# define TR2_OPTIONAL_GCC_4_8_AND_HIGHER___
+# endif
+#
+# if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)
+# define TR2_OPTIONAL_GCC_4_7_AND_HIGHER___
+# elif (__GNUC__ > 4)
+# define TR2_OPTIONAL_GCC_4_7_AND_HIGHER___
+# endif
+#
+# if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) && (__GNUC_PATCHLEVEL__ >= 1)
+# define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___
+# elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)
+# define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___
+# elif (__GNUC__ > 4)
+# define TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___
+# endif
+# endif
+#
+# if defined __clang_major__
+# if (__clang_major__ == 3 && __clang_minor__ >= 5)
+# define TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_
+# elif (__clang_major__ > 3)
+# define TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_
+# endif
+# if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_
+# define TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_
+# elif (__clang_major__ == 3 && __clang_minor__ == 4 && __clang_patchlevel__ >= 2)
+# define TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_
+# endif
+# endif
+#
+# if defined _MSC_VER
+# if (_MSC_VER >= 1900)
+# define TR2_OPTIONAL_MSVC_2015_AND_HIGHER___
+# endif
+# endif
+
+# if defined __clang__
+# if (__clang_major__ > 2) || (__clang_major__ == 2) && (__clang_minor__ >= 9)
+# define OPTIONAL_HAS_THIS_RVALUE_REFS 1
+# else
+# define OPTIONAL_HAS_THIS_RVALUE_REFS 0
+# endif
+# elif defined TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___
+# define OPTIONAL_HAS_THIS_RVALUE_REFS 1
+# elif defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___
+# define OPTIONAL_HAS_THIS_RVALUE_REFS 1
+# else
+# define OPTIONAL_HAS_THIS_RVALUE_REFS 0
+# endif
+
+
+# if defined TR2_OPTIONAL_GCC_4_8_1_AND_HIGHER___
+# define OPTIONAL_HAS_CONSTEXPR_INIT_LIST 1
+# define OPTIONAL_CONSTEXPR_INIT_LIST constexpr
+# else
+# define OPTIONAL_HAS_CONSTEXPR_INIT_LIST 0
+# define OPTIONAL_CONSTEXPR_INIT_LIST
+# endif
+
+# if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L)
+# define OPTIONAL_HAS_MOVE_ACCESSORS 1
+# else
+# define OPTIONAL_HAS_MOVE_ACCESSORS 0
+# endif
+
+# // In C++11 constexpr implies const, so we need to make non-const members also non-constexpr
+# if (defined __cplusplus) && (__cplusplus == 201103L)
+# define OPTIONAL_MUTABLE_CONSTEXPR
+# else
+# define OPTIONAL_MUTABLE_CONSTEXPR constexpr
+# endif
+
+namespace std{
+
+namespace experimental{
+
+//
+// Add namespace Ice to avoid conflict with other std::experimental::optional
+// implementation
+//
+namespace Ice{
+
+// BEGIN workaround for missing is_trivially_destructible
+# if defined TR2_OPTIONAL_GCC_4_8_AND_HIGHER___
+ // leave it: it is already there
+# elif defined TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_
+ // leave it: it is already there
+# elif defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___
+ // leave it: it is already there
+# elif defined TR2_OPTIONAL_DISABLE_EMULATION_OF_TYPE_TRAITS
+ // leave it: the user doesn't want it
+# else
+ template <typename T>
+ using is_trivially_destructible = std::has_trivial_destructor<T>;
+# endif
+// END workaround for missing is_trivially_destructible
+
+# if (defined TR2_OPTIONAL_GCC_4_7_AND_HIGHER___)
+ // leave it; our metafunctions are already defined.
+# elif defined TR2_OPTIONAL_CLANG_3_4_2_AND_HIGHER_
+ // leave it; our metafunctions are already defined.
+# elif defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___
+ // leave it: it is already there
+# elif defined TR2_OPTIONAL_DISABLE_EMULATION_OF_TYPE_TRAITS
+ // leave it: the user doesn't want it
+# else
+
+
+// workaround for missing traits in GCC and CLANG
+template <class T>
+struct is_nothrow_move_constructible
+{
+ constexpr static bool value = std::is_nothrow_constructible<T, T&&>::value;
+};
+
+
+template <class T, class U>
+struct is_assignable
+{
+ template <class X, class Y>
+ constexpr static bool has_assign(...) { return false; }
+
+ template <class X, class Y, size_t S = sizeof((std::declval<X>() = std::declval<Y>(), true)) >
+ // the comma operator is necessary for the cases where operator= returns void
+ constexpr static bool has_assign(bool) { return true; }
+
+ constexpr static bool value = has_assign<T, U>(true);
+};
+
+
+template <class T>
+struct is_nothrow_move_assignable
+{
+ template <class X, bool has_any_move_assign>
+ struct has_nothrow_move_assign {
+ constexpr static bool value = false;
+ };
+
+ template <class X>
+ struct has_nothrow_move_assign<X, true> {
+ constexpr static bool value = noexcept( std::declval<X&>() = std::declval<X&&>() );
+ };
+
+ constexpr static bool value = has_nothrow_move_assign<T, is_assignable<T&, T&&>::value>::value;
+};
+// end workaround
+
+
+# endif
+
+
+
+// 20.5.4, optional for object types
+template <class T> class optional;
+
+// 20.5.5, optional for lvalue reference types
+template <class T> class optional<T&>;
+
+
+// workaround: std utility functions aren't constexpr yet
+template <class T> inline constexpr T&& constexpr_forward(typename std::remove_reference<T>::type& t) noexcept
+{
+ return static_cast<T&&>(t);
+}
+
+template <class T> inline constexpr T&& constexpr_forward(typename std::remove_reference<T>::type&& t) noexcept
+{
+ static_assert(!std::is_lvalue_reference<T>::value, "!!");
+ return static_cast<T&&>(t);
+}
+
+template <class T> inline constexpr typename std::remove_reference<T>::type&& constexpr_move(T&& t) noexcept
+{
+ return static_cast<typename std::remove_reference<T>::type&&>(t);
+}
+
+
+#if defined NDEBUG
+# define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) (EXPR)
+#else
+# define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR) ((CHECK) ? (EXPR) : ([]{assert(!#CHECK);}(), (EXPR)))
+#endif
+
+
+namespace detail_
+{
+
+// static_addressof: a constexpr version of addressof
+template <typename T>
+struct has_overloaded_addressof
+{
+ template <class X>
+ constexpr static bool has_overload(...) { return false; }
+
+ template <class X, size_t S = sizeof(std::declval<X&>().operator&()) >
+ constexpr static bool has_overload(bool) { return true; }
+
+ constexpr static bool value = has_overload<T>(true);
+};
+
+template <typename T, TR2_OPTIONAL_REQUIRES(!has_overloaded_addressof<T>)>
+constexpr T* static_addressof(T& ref)
+{
+ return &ref;
+}
+
+template <typename T, TR2_OPTIONAL_REQUIRES(has_overloaded_addressof<T>)>
+T* static_addressof(T& ref)
+{
+ return std::addressof(ref);
+}
+
+
+// the call to convert<A>(b) has return type A and converts b to type A iff b decltype(b) is implicitly convertible to A
+template <class U>
+constexpr U convert(U v) { return v; }
+
+} // namespace detail
+
+
+constexpr struct trivial_init_t{} trivial_init{};
+
+
+// 20.5.6, In-place construction
+constexpr struct in_place_t{} in_place{};
+
+
+// 20.5.7, Disengaged state indicator
+struct nullopt_t
+{
+ struct init{};
+ constexpr explicit nullopt_t(init){}
+};
+constexpr nullopt_t nullopt{nullopt_t::init()};
+
+
+// 20.5.8, class bad_optional_access
+class bad_optional_access : public logic_error {
+public:
+ explicit bad_optional_access(const string& what_arg) : logic_error{what_arg} {}
+ explicit bad_optional_access(const char* what_arg) : logic_error{what_arg} {}
+};
+
+
+template <class T>
+union storage_t
+{
+ unsigned char dummy_;
+ T value_;
+
+ constexpr storage_t( trivial_init_t ) noexcept : dummy_() {}
+
+ template <class... Args>
+ constexpr storage_t( Args&&... args ) : value_(constexpr_forward<Args>(args)...) {}
+
+ ~storage_t(){}
+};
+
+
+template <class T>
+union constexpr_storage_t
+{
+ unsigned char dummy_;
+ T value_;
+
+ constexpr constexpr_storage_t( trivial_init_t ) noexcept : dummy_() {}
+
+ template <class... Args>
+ constexpr constexpr_storage_t( Args&&... args ) : value_(constexpr_forward<Args>(args)...) {}
+
+ ~constexpr_storage_t() = default;
+};
+
+
+template <class T>
+struct optional_base
+{
+ bool init_;
+ storage_t<T> storage_;
+
+ constexpr optional_base() noexcept : init_(false), storage_(trivial_init) {}
+
+ explicit constexpr optional_base(const T& v) : init_(true), storage_(v) {}
+
+ explicit constexpr optional_base(T&& v) : init_(true), storage_(constexpr_move(v)) {}
+
+ template <class... Args> explicit optional_base(in_place_t, Args&&... args)
+ : init_(true), storage_(constexpr_forward<Args>(args)...) {}
+
+ template <class U, class... Args, TR2_OPTIONAL_REQUIRES(is_constructible<T, std::initializer_list<U>>)>
+ explicit optional_base(in_place_t, std::initializer_list<U> il, Args&&... args)
+ : init_(true), storage_(il, std::forward<Args>(args)...) {}
+
+ ~optional_base() { if (init_) storage_.value_.T::~T(); }
+};
+
+
+template <class T>
+struct constexpr_optional_base
+{
+ bool init_;
+ constexpr_storage_t<T> storage_;
+
+ constexpr constexpr_optional_base() noexcept : init_(false), storage_(trivial_init) {}
+
+ explicit constexpr constexpr_optional_base(const T& v) : init_(true), storage_(v) {}
+
+ explicit constexpr constexpr_optional_base(T&& v) : init_(true), storage_(constexpr_move(v)) {}
+
+ template <class... Args> explicit constexpr constexpr_optional_base(in_place_t, Args&&... args)
+ : init_(true), storage_(constexpr_forward<Args>(args)...) {}
+
+ template <class U, class... Args, TR2_OPTIONAL_REQUIRES(is_constructible<T, std::initializer_list<U>>)>
+ OPTIONAL_CONSTEXPR_INIT_LIST explicit constexpr_optional_base(in_place_t, std::initializer_list<U> il, Args&&... args)
+ : init_(true), storage_(il, std::forward<Args>(args)...) {}
+
+ ~constexpr_optional_base() = default;
+};
+
+template <class T>
+using OptionalBase = typename std::conditional<
+ is_trivially_destructible<T>::value,
+ constexpr_optional_base<typename std::remove_const<T>::type>,
+ optional_base<typename std::remove_const<T>::type>
+>::type;
+
+
+
+template <class T>
+class optional : private OptionalBase<T>
+{
+ static_assert( !std::is_same<typename std::decay<T>::type, nullopt_t>::value, "bad T" );
+ static_assert( !std::is_same<typename std::decay<T>::type, in_place_t>::value, "bad T" );
+
+
+ constexpr bool initialized() const noexcept { return OptionalBase<T>::init_; }
+ typename std::remove_const<T>::type* dataptr() { return std::addressof(OptionalBase<T>::storage_.value_); }
+ constexpr const T* dataptr() const { return detail_::static_addressof(OptionalBase<T>::storage_.value_); }
+
+# if OPTIONAL_HAS_THIS_RVALUE_REFS == 1
+ constexpr const T& contained_val() const& { return OptionalBase<T>::storage_.value_; }
+# if OPTIONAL_HAS_MOVE_ACCESSORS == 1
+ OPTIONAL_MUTABLE_CONSTEXPR T&& contained_val() && { return std::move(OptionalBase<T>::storage_.value_); }
+ OPTIONAL_MUTABLE_CONSTEXPR T& contained_val() & { return OptionalBase<T>::storage_.value_; }
+# else
+ T& contained_val() & { return OptionalBase<T>::storage_.value_; }
+ T&& contained_val() && { return std::move(OptionalBase<T>::storage_.value_); }
+# endif
+# else
+ constexpr const T& contained_val() const { return OptionalBase<T>::storage_.value_; }
+ T& contained_val() { return OptionalBase<T>::storage_.value_; }
+# endif
+
+ void clear() noexcept {
+ if (initialized()) dataptr()->T::~T();
+ OptionalBase<T>::init_ = false;
+ }
+
+ template <class... Args>
+ void initialize(Args&&... args) noexcept(noexcept(T(std::forward<Args>(args)...)))
+ {
+ assert(!OptionalBase<T>::init_);
+ ::new (static_cast<void*>(dataptr())) T(std::forward<Args>(args)...);
+ OptionalBase<T>::init_ = true;
+ }
+
+ template <class U, class... Args>
+ void initialize(std::initializer_list<U> il, Args&&... args) noexcept(noexcept(T(il, std::forward<Args>(args)...)))
+ {
+ assert(!OptionalBase<T>::init_);
+ ::new (static_cast<void*>(dataptr())) T(il, std::forward<Args>(args)...);
+ OptionalBase<T>::init_ = true;
+ }
+
+public:
+ typedef T value_type;
+
+ // 20.5.5.1, constructors
+ constexpr optional() noexcept : OptionalBase<T>() {}
+ constexpr optional(nullopt_t) noexcept : OptionalBase<T>() {}
+
+ optional(const optional& rhs)
+ : OptionalBase<T>()
+ {
+ if (rhs.initialized()) {
+ ::new (static_cast<void*>(dataptr())) T(*rhs);
+ OptionalBase<T>::init_ = true;
+ }
+ }
+
+ optional(optional&& rhs) noexcept(is_nothrow_move_constructible<T>::value)
+ : OptionalBase<T>()
+ {
+ if (rhs.initialized()) {
+ ::new (static_cast<void*>(dataptr())) T(std::move(*rhs));
+ OptionalBase<T>::init_ = true;
+ }
+ }
+
+ constexpr optional(const T& v) : OptionalBase<T>(v) {}
+
+ constexpr optional(T&& v) : OptionalBase<T>(constexpr_move(v)) {}
+
+ template <class... Args>
+ explicit constexpr optional(in_place_t, Args&&... args)
+ : OptionalBase<T>(in_place_t{}, constexpr_forward<Args>(args)...) {}
+
+ template <class U, class... Args, TR2_OPTIONAL_REQUIRES(is_constructible<T, std::initializer_list<U>>)>
+ OPTIONAL_CONSTEXPR_INIT_LIST explicit optional(in_place_t, std::initializer_list<U> il, Args&&... args)
+ : OptionalBase<T>(in_place_t{}, il, constexpr_forward<Args>(args)...) {}
+
+ // 20.5.4.2, Destructor
+ ~optional() = default;
+
+ // 20.5.4.3, assignment
+ optional& operator=(nullopt_t) noexcept
+ {
+ clear();
+ return *this;
+ }
+
+ optional& operator=(const optional& rhs)
+ {
+ if (initialized() == true && rhs.initialized() == false) clear();
+ else if (initialized() == false && rhs.initialized() == true) initialize(*rhs);
+ else if (initialized() == true && rhs.initialized() == true) contained_val() = *rhs;
+ return *this;
+ }
+
+ optional& operator=(optional&& rhs)
+ noexcept(is_nothrow_move_assignable<T>::value && is_nothrow_move_constructible<T>::value)
+ {
+ if (initialized() == true && rhs.initialized() == false) clear();
+ else if (initialized() == false && rhs.initialized() == true) initialize(std::move(*rhs));
+ else if (initialized() == true && rhs.initialized() == true) contained_val() = std::move(*rhs);
+ return *this;
+ }
+
+ template <class U>
+ auto operator=(U&& v)
+ -> typename enable_if
+ <
+ is_same<typename decay<U>::type, T>::value,
+ optional&
+ >::type
+ {
+ if (initialized()) { contained_val() = std::forward<U>(v); }
+ else { initialize(std::forward<U>(v)); }
+ return *this;
+ }
+
+
+ template <class... Args>
+ void emplace(Args&&... args)
+ {
+ clear();
+ initialize(std::forward<Args>(args)...);
+ }
+
+ template <class U, class... Args>
+ void emplace(initializer_list<U> il, Args&&... args)
+ {
+ clear();
+ initialize<U, Args...>(il, std::forward<Args>(args)...);
+ }
+
+ // 20.5.4.4, Swap
+ void swap(optional<T>& rhs) noexcept(is_nothrow_move_constructible<T>::value && noexcept(swap(declval<T&>(), declval<T&>())))
+ {
+ if (initialized() == true && rhs.initialized() == false) { rhs.initialize(std::move(**this)); clear(); }
+ else if (initialized() == false && rhs.initialized() == true) { initialize(std::move(*rhs)); rhs.clear(); }
+ else if (initialized() == true && rhs.initialized() == true) { using std::swap; swap(**this, *rhs); }
+ }
+
+ // 20.5.4.5, Observers
+
+ explicit constexpr operator bool() const noexcept { return initialized(); }
+
+ constexpr T const* operator ->() const {
+ return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), dataptr());
+ }
+
+# if OPTIONAL_HAS_MOVE_ACCESSORS == 1
+
+ OPTIONAL_MUTABLE_CONSTEXPR T* operator ->() {
+ assert (initialized());
+ return dataptr();
+ }
+
+ constexpr T const& operator *() const& {
+ return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val());
+ }
+
+ OPTIONAL_MUTABLE_CONSTEXPR T& operator *() & {
+ assert (initialized());
+ return contained_val();
+ }
+
+ OPTIONAL_MUTABLE_CONSTEXPR T&& operator *() && {
+ assert (initialized());
+ return constexpr_move(contained_val());
+ }
+
+ constexpr T const& value() const& {
+ return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val());
+ }
+
+ OPTIONAL_MUTABLE_CONSTEXPR T& value() & {
+ return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val());
+ }
+
+ OPTIONAL_MUTABLE_CONSTEXPR T&& value() && {
+ if (!initialized()) throw bad_optional_access("bad optional access");
+ return std::move(contained_val());
+ }
+
+# else
+
+ T* operator ->() {
+ assert (initialized());
+ return dataptr();
+ }
+
+ constexpr T const& operator *() const {
+ return TR2_OPTIONAL_ASSERTED_EXPRESSION(initialized(), contained_val());
+ }
+
+ T& operator *() {
+ assert (initialized());
+ return contained_val();
+ }
+
+ constexpr T const& value() const {
+ return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val());
+ }
+
+ T& value() {
+ return initialized() ? contained_val() : (throw bad_optional_access("bad optional access"), contained_val());
+ }
+
+# endif
+
+# if OPTIONAL_HAS_THIS_RVALUE_REFS == 1
+
+ template <class V>
+ constexpr T value_or(V&& v) const&
+ {
+ return *this ? **this : detail_::convert<T>(constexpr_forward<V>(v));
+ }
+
+# if OPTIONAL_HAS_MOVE_ACCESSORS == 1
+
+ template <class V>
+ OPTIONAL_MUTABLE_CONSTEXPR T value_or(V&& v) &&
+ {
+ return *this ? constexpr_move(const_cast<optional<T>&>(*this).contained_val()) : detail_::convert<T>(constexpr_forward<V>(v));
+ }
+
+# else
+
+ template <class V>
+ T value_or(V&& v) &&
+ {
+ return *this ? constexpr_move(const_cast<optional<T>&>(*this).contained_val()) : detail_::convert<T>(constexpr_forward<V>(v));
+ }
+
+# endif
+
+# else
+
+ template <class V>
+ constexpr T value_or(V&& v) const
+ {
+ return *this ? **this : detail_::convert<T>(constexpr_forward<V>(v));
+ }
+
+# endif
+
+};
+
+
+template <class T>
+class optional<T&>
+{
+ static_assert( !std::is_same<T, nullopt_t>::value, "bad T" );
+ static_assert( !std::is_same<T, in_place_t>::value, "bad T" );
+ T* ref;
+
+public:
+
+ // 20.5.5.1, construction/destruction
+ constexpr optional() noexcept : ref(nullptr) {}
+
+ constexpr optional(nullopt_t) noexcept : ref(nullptr) {}
+
+ constexpr optional(T& v) noexcept : ref(detail_::static_addressof(v)) {}
+
+ optional(T&&) = delete;
+
+ constexpr optional(const optional& rhs) noexcept : ref(rhs.ref) {}
+
+ explicit constexpr optional(in_place_t, T& v) noexcept : ref(detail_::static_addressof(v)) {}
+
+ explicit optional(in_place_t, T&&) = delete;
+
+ ~optional() = default;
+
+ // 20.5.5.2, mutation
+ optional& operator=(nullopt_t) noexcept {
+ ref = nullptr;
+ return *this;
+ }
+
+ // optional& operator=(const optional& rhs) noexcept {
+ // ref = rhs.ref;
+ // return *this;
+ // }
+
+ // optional& operator=(optional&& rhs) noexcept {
+ // ref = rhs.ref;
+ // return *this;
+ // }
+
+ template <typename U>
+ auto operator=(U&& rhs) noexcept
+ -> typename enable_if
+ <
+ is_same<typename decay<U>::type, optional<T&>>::value,
+ optional&
+ >::type
+ {
+ ref = rhs.ref;
+ return *this;
+ }
+
+ template <typename U>
+ auto operator=(U&& rhs) noexcept
+ -> typename enable_if
+ <
+ !is_same<typename decay<U>::type, optional<T&>>::value,
+ optional&
+ >::type
+ = delete;
+
+ void emplace(T& v) noexcept {
+ ref = detail_::static_addressof(v);
+ }
+
+ void emplace(T&&) = delete;
+
+
+ void swap(optional<T&>& rhs) noexcept
+ {
+ std::swap(ref, rhs.ref);
+ }
+
+ // 20.5.5.3, observers
+ constexpr T* operator->() const {
+ return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, ref);
+ }
+
+ constexpr T& operator*() const {
+ return TR2_OPTIONAL_ASSERTED_EXPRESSION(ref, *ref);
+ }
+
+ constexpr T& value() const {
+ return ref ? *ref : (throw bad_optional_access("bad optional access"), *ref);
+ }
+
+ explicit constexpr operator bool() const noexcept {
+ return ref != nullptr;
+ }
+
+ template <class V>
+ constexpr typename decay<T>::type value_or(V&& v) const
+ {
+ return *this ? **this : detail_::convert<typename decay<T>::type>(constexpr_forward<V>(v));
+ }
+};
+
+
+template <class T>
+class optional<T&&>
+{
+ static_assert( sizeof(T) == 0, "optional rvalue references disallowed" );
+};
+
+
+// 20.5.8, Relational operators
+template <class T> constexpr bool operator==(const optional<T>& x, const optional<T>& y)
+{
+ return bool(x) != bool(y) ? false : bool(x) == false ? true : *x == *y;
+}
+
+template <class T> constexpr bool operator!=(const optional<T>& x, const optional<T>& y)
+{
+ return !(x == y);
+}
+
+template <class T> constexpr bool operator<(const optional<T>& x, const optional<T>& y)
+{
+ return (!y) ? false : (!x) ? true : *x < *y;
+}
+
+template <class T> constexpr bool operator>(const optional<T>& x, const optional<T>& y)
+{
+ return (y < x);
+}
+
+template <class T> constexpr bool operator<=(const optional<T>& x, const optional<T>& y)
+{
+ return !(y < x);
+}
+
+template <class T> constexpr bool operator>=(const optional<T>& x, const optional<T>& y)
+{
+ return !(x < y);
+}
+
+
+// 20.5.9, Comparison with nullopt
+template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept
+{
+ return (!x);
+}
+
+template <class T> constexpr bool operator==(nullopt_t, const optional<T>& x) noexcept
+{
+ return (!x);
+}
+
+template <class T> constexpr bool operator!=(const optional<T>& x, nullopt_t) noexcept
+{
+ return bool(x);
+}
+
+template <class T> constexpr bool operator!=(nullopt_t, const optional<T>& x) noexcept
+{
+ return bool(x);
+}
+
+template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept
+{
+ return false;
+}
+
+template <class T> constexpr bool operator<(nullopt_t, const optional<T>& x) noexcept
+{
+ return bool(x);
+}
+
+template <class T> constexpr bool operator<=(const optional<T>& x, nullopt_t) noexcept
+{
+ return (!x);
+}
+
+template <class T> constexpr bool operator<=(nullopt_t, const optional<T>&) noexcept
+{
+ return true;
+}
+
+template <class T> constexpr bool operator>(const optional<T>& x, nullopt_t) noexcept
+{
+ return bool(x);
+}
+
+template <class T> constexpr bool operator>(nullopt_t, const optional<T>&) noexcept
+{
+ return false;
+}
+
+template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept
+{
+ return true;
+}
+
+template <class T> constexpr bool operator>=(nullopt_t, const optional<T>& x) noexcept
+{
+ return (!x);
+}
+
+
+
+// 20.5.10, Comparison with T
+template <class T> constexpr bool operator==(const optional<T>& x, const T& v)
+{
+ return bool(x) ? *x == v : false;
+}
+
+template <class T> constexpr bool operator==(const T& v, const optional<T>& x)
+{
+ return bool(x) ? v == *x : false;
+}
+
+template <class T> constexpr bool operator!=(const optional<T>& x, const T& v)
+{
+ return bool(x) ? *x != v : true;
+}
+
+template <class T> constexpr bool operator!=(const T& v, const optional<T>& x)
+{
+ return bool(x) ? v != *x : true;
+}
+
+template <class T> constexpr bool operator<(const optional<T>& x, const T& v)
+{
+ return bool(x) ? *x < v : true;
+}
+
+template <class T> constexpr bool operator>(const T& v, const optional<T>& x)
+{
+ return bool(x) ? v > *x : true;
+}
+
+template <class T> constexpr bool operator>(const optional<T>& x, const T& v)
+{
+ return bool(x) ? *x > v : false;
+}
+
+template <class T> constexpr bool operator<(const T& v, const optional<T>& x)
+{
+ return bool(x) ? v < *x : false;
+}
+
+template <class T> constexpr bool operator>=(const optional<T>& x, const T& v)
+{
+ return bool(x) ? *x >= v : false;
+}
+
+template <class T> constexpr bool operator<=(const T& v, const optional<T>& x)
+{
+ return bool(x) ? v <= *x : false;
+}
+
+template <class T> constexpr bool operator<=(const optional<T>& x, const T& v)
+{
+ return bool(x) ? *x <= v : true;
+}
+
+template <class T> constexpr bool operator>=(const T& v, const optional<T>& x)
+{
+ return bool(x) ? v >= *x : true;
+}
+
+
+// Comparison of optional<T&> with T
+template <class T> constexpr bool operator==(const optional<T&>& x, const T& v)
+{
+ return bool(x) ? *x == v : false;
+}
+
+template <class T> constexpr bool operator==(const T& v, const optional<T&>& x)
+{
+ return bool(x) ? v == *x : false;
+}
+
+template <class T> constexpr bool operator!=(const optional<T&>& x, const T& v)
+{
+ return bool(x) ? *x != v : true;
+}
+
+template <class T> constexpr bool operator!=(const T& v, const optional<T&>& x)
+{
+ return bool(x) ? v != *x : true;
+}
+
+template <class T> constexpr bool operator<(const optional<T&>& x, const T& v)
+{
+ return bool(x) ? *x < v : true;
+}
+
+template <class T> constexpr bool operator>(const T& v, const optional<T&>& x)
+{
+ return bool(x) ? v > *x : true;
+}
+
+template <class T> constexpr bool operator>(const optional<T&>& x, const T& v)
+{
+ return bool(x) ? *x > v : false;
+}
+
+template <class T> constexpr bool operator<(const T& v, const optional<T&>& x)
+{
+ return bool(x) ? v < *x : false;
+}
+
+template <class T> constexpr bool operator>=(const optional<T&>& x, const T& v)
+{
+ return bool(x) ? *x >= v : false;
+}
+
+template <class T> constexpr bool operator<=(const T& v, const optional<T&>& x)
+{
+ return bool(x) ? v <= *x : false;
+}
+
+template <class T> constexpr bool operator<=(const optional<T&>& x, const T& v)
+{
+ return bool(x) ? *x <= v : true;
+}
+
+template <class T> constexpr bool operator>=(const T& v, const optional<T&>& x)
+{
+ return bool(x) ? v >= *x : true;
+}
+
+// Comparison of optional<T const&> with T
+template <class T> constexpr bool operator==(const optional<const T&>& x, const T& v)
+{
+ return bool(x) ? *x == v : false;
+}
+
+template <class T> constexpr bool operator==(const T& v, const optional<const T&>& x)
+{
+ return bool(x) ? v == *x : false;
+}
+
+template <class T> constexpr bool operator!=(const optional<const T&>& x, const T& v)
+{
+ return bool(x) ? *x != v : true;
+}
+
+template <class T> constexpr bool operator!=(const T& v, const optional<const T&>& x)
+{
+ return bool(x) ? v != *x : true;
+}
+
+template <class T> constexpr bool operator<(const optional<const T&>& x, const T& v)
+{
+ return bool(x) ? *x < v : true;
+}
+
+template <class T> constexpr bool operator>(const T& v, const optional<const T&>& x)
+{
+ return bool(x) ? v > *x : true;
+}
+
+template <class T> constexpr bool operator>(const optional<const T&>& x, const T& v)
+{
+ return bool(x) ? *x > v : false;
+}
+
+template <class T> constexpr bool operator<(const T& v, const optional<const T&>& x)
+{
+ return bool(x) ? v < *x : false;
+}
+
+template <class T> constexpr bool operator>=(const optional<const T&>& x, const T& v)
+{
+ return bool(x) ? *x >= v : false;
+}
+
+template <class T> constexpr bool operator<=(const T& v, const optional<const T&>& x)
+{
+ return bool(x) ? v <= *x : false;
+}
+
+template <class T> constexpr bool operator<=(const optional<const T&>& x, const T& v)
+{
+ return bool(x) ? *x <= v : true;
+}
+
+template <class T> constexpr bool operator>=(const T& v, const optional<const T&>& x)
+{
+ return bool(x) ? v >= *x : true;
+}
+
+
+// 20.5.12, Specialized algorithms
+template <class T>
+void swap(optional<T>& x, optional<T>& y) noexcept(noexcept(x.swap(y)))
+{
+ x.swap(y);
+}
+
+
+template <class T>
+constexpr optional<typename decay<T>::type> make_optional(T&& v)
+{
+ return optional<typename decay<T>::type>(constexpr_forward<T>(v));
+}
+
+template <class X>
+constexpr optional<X&> make_optional(reference_wrapper<X> v)
+{
+ return optional<X&>(v.get());
+}
+
+} // namespace Ice
+} // namespace experimental
+} // namespace std
+
+namespace std
+{
+ template <typename T>
+ struct hash<std::experimental::Ice::optional<T>>
+ {
+ typedef typename hash<T>::result_type result_type;
+ typedef std::experimental::Ice::optional<T> argument_type;
+
+ constexpr result_type operator()(argument_type const& arg) const {
+ return arg ? std::hash<T>{}(*arg) : result_type{};
+ }
+ };
+
+ template <typename T>
+ struct hash<std::experimental::Ice::optional<T&>>
+ {
+ typedef typename hash<T>::result_type result_type;
+ typedef std::experimental::Ice::optional<T&> argument_type;
+
+ constexpr result_type operator()(argument_type const& arg) const {
+ return arg ? std::hash<T>{}(*arg) : result_type{};
+ }
+ };
+}
+
+# undef TR2_OPTIONAL_REQUIRES
+# undef TR2_OPTIONAL_ASSERTED_EXPRESSION
+
+namespace Ice{
+
+template<class T> using optional = std::experimental::Ice::optional<T>;
+
+using std::experimental::Ice::operator==;
+using std::experimental::Ice::operator!=;
+using std::experimental::Ice::operator<;
+using std::experimental::Ice::operator<=;
+using std::experimental::Ice::operator>;
+using std::experimental::Ice::operator>=;
+
+using std::experimental::Ice::make_optional;
+using std::experimental::Ice::swap;
+
+using nullopt_t = std::experimental::Ice::nullopt_t;
+using std::experimental::Ice::nullopt;
+
+using bad_optional_access = std::experimental::Ice::bad_optional_access;
+
+using in_place_t = std::experimental::Ice::in_place_t;
+using std::experimental::Ice::in_place;
+
+}
+
+//
+// For compatibility with the Ice C++98 mapping, do not use in new code:
+//
+namespace IceUtil{
+
+template<class T> using Optional = std::experimental::Ice::optional<T>;
+constexpr std::experimental::Ice::nullopt_t None{std::experimental::Ice::nullopt_t::init()};
+
+}
+
+#else // C++98 mapping
+
+# include <IceUtil/Optional.h>
+
+#endif
+
+#endif
diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h
deleted file mode 100644
index 870608090e5..00000000000
--- a/cpp/include/Ice/Outgoing.h
+++ /dev/null
@@ -1,225 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_OUTGOING_H
-#define ICE_OUTGOING_H
-
-#include <IceUtil/Mutex.h>
-#include <IceUtil/Monitor.h>
-#include <IceUtil/UniquePtr.h>
-
-#include <Ice/RequestHandlerF.h>
-#include <Ice/InstanceF.h>
-#include <Ice/ConnectionIF.h>
-#include <Ice/ReferenceF.h>
-#include <Ice/BasicStream.h>
-#include <Ice/Current.h>
-#include <Ice/ObserverHelper.h>
-#include <Ice/ObjectAdapterF.h>
-
-namespace Ice
-{
-
-class LocalException;
-
-}
-
-namespace IceInternal
-{
-
-class CollocatedRequestHandler; // Forward declaration
-
-class ICE_API OutgoingBase : private IceUtil::noncopyable
-{
-public:
-
- virtual ~OutgoingBase() { }
-
- virtual void sent() = 0;
- virtual void completed(const Ice::Exception&) = 0;
- virtual void completed(BasicStream&) = 0;
- virtual void retryException(const Ice::Exception&) = 0;
-
- BasicStream* os() { return &_os; }
-
- void attachRemoteObserver(const Ice::ConnectionInfoPtr& c, const Ice::EndpointPtr& endpt, Ice::Int requestId)
- {
- const Ice::Int size = static_cast<Ice::Int>(_os.b.size() - IceInternal::headerSize - 4);
- _childObserver.attach(_observer.getRemoteObserver(c, endpt, requestId, size));
- }
-
- void attachCollocatedObserver(const Ice::ObjectAdapterPtr& adapter, Ice::Int requestId)
- {
- const Ice::Int size = static_cast<Ice::Int>(_os.b.size() - IceInternal::headerSize - 4);
- _childObserver.attach(_observer.getCollocatedObserver(adapter, requestId, size));
- }
-
-protected:
-
- OutgoingBase(Instance*);
-
- BasicStream _os;
- IceUtil::UniquePtr<Ice::Exception> _exception;
- bool _sent;
- InvocationObserver _observer;
- ObserverHelperT<Ice::Instrumentation::ChildInvocationObserver> _childObserver;
-
- IceUtil::Monitor<IceUtil::Mutex> _monitor;
-};
-
-class ICE_API ProxyOutgoingBase : public OutgoingBase
-{
-public:
-
- ProxyOutgoingBase(IceProxy::Ice::Object*, Ice::OperationMode);
- ~ProxyOutgoingBase();
-
- virtual bool invokeRemote(const Ice::ConnectionIPtr&, bool, bool) = 0;
- virtual void invokeCollocated(CollocatedRequestHandler*) = 0;
-
- virtual void sent();
- virtual void completed(const Ice::Exception&);
- virtual void completed(BasicStream&);
- virtual void retryException(const Ice::Exception&);
-
-protected:
-
- bool invokeImpl(); // Returns true if ok, false if user exception.
-
- //
- // Optimization. The request handler and the reference may not be
- // deleted while a stack-allocated Outgoing still holds it.
- //
- IceProxy::Ice::Object* _proxy;
- Ice::OperationMode _mode;
- RequestHandlerPtr _handler;
- IceUtil::Time _invocationTimeoutDeadline;
-
- enum
- {
- StateUnsent,
- StateInProgress,
- StateRetry,
- StateOK,
- StateUserException,
- StateLocalException,
- StateFailed
- } _state;
-};
-
-class ICE_API Outgoing : public ProxyOutgoingBase
-{
-public:
-
- Outgoing(IceProxy::Ice::Object*, const std::string&, Ice::OperationMode, const Ice::Context*);
- ~Outgoing();
-
- virtual bool invokeRemote(const Ice::ConnectionIPtr&, bool, bool);
- virtual void invokeCollocated(CollocatedRequestHandler*);
-
- bool invoke(); // Returns true if ok, false if user exception.
- void abort(const Ice::LocalException&);
-
- virtual void completed(BasicStream&);
-
- // Inlined for speed optimization.
- BasicStream* startReadParams()
- {
- _is.startReadEncaps();
- return &_is;
- }
- void endReadParams()
- {
- _is.endReadEncaps();
- }
- void readEmptyParams()
- {
- _is.skipEmptyEncaps();
- }
- void readParamEncaps(const Ice::Byte*& encaps, Ice::Int& sz)
- {
- _is.readEncaps(encaps, sz);
- }
-
- BasicStream* startWriteParams(Ice::FormatType format)
- {
- _os.startWriteEncaps(_encoding, format);
- return &_os;
- }
- void endWriteParams()
- {
- _os.endWriteEncaps();
- }
- void writeEmptyParams()
- {
- _os.writeEmptyEncaps(_encoding);
- }
- void writeParamEncaps(const Ice::Byte* encaps, Ice::Int size)
- {
- if(size == 0)
- {
- _os.writeEmptyEncaps(_encoding);
- }
- else
- {
- _os.writeEncaps(encaps, size);
- }
- }
-
- bool hasResponse()
- {
- return !_is.b.empty();
- }
-
- void throwUserException();
-
-private:
-
- Ice::EncodingVersion _encoding;
- BasicStream _is;
- const std::string& _operation;
-};
-
-class ProxyFlushBatch : public ProxyOutgoingBase
-{
-public:
-
- ProxyFlushBatch(IceProxy::Ice::Object*, const std::string&);
-
- virtual bool invokeRemote(const Ice::ConnectionIPtr&, bool, bool);
- virtual void invokeCollocated(CollocatedRequestHandler*);
-
- void invoke();
-
-private:
-
- int _batchRequestNum;
-};
-
-class ConnectionFlushBatch : public OutgoingBase
-{
-public:
-
- ConnectionFlushBatch(Ice::ConnectionI*, Instance*, const std::string&);
-
- void invoke();
-
- virtual void sent();
- virtual void completed(const Ice::Exception&);
- virtual void completed(BasicStream&);
- virtual void retryException(const Ice::Exception&);
-
-private:
-
- Ice::ConnectionI* _connection;
-};
-
-}
-
-#endif
diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h
index d7bd28e8055..84a11e84a4c 100644
--- a/cpp/include/Ice/OutgoingAsync.h
+++ b/cpp/include/Ice/OutgoingAsync.h
@@ -11,11 +11,24 @@
#define ICE_OUTGOING_ASYNC_H
#include <IceUtil/Timer.h>
+#include <IceUtil/Monitor.h>
#include <Ice/OutgoingAsyncF.h>
-#include <Ice/AsyncResult.h>
#include <Ice/CommunicatorF.h>
#include <Ice/ConnectionIF.h>
#include <Ice/ObjectAdapterF.h>
+#include <Ice/RequestHandlerF.h>
+#include <Ice/ConnectionF.h>
+#include <Ice/OutputStream.h>
+#include <Ice/InputStream.h>
+#include <Ice/ObserverHelper.h>
+#include <Ice/LocalException.h>
+#include <Ice/UniquePtr.h>
+
+#ifndef ICE_CPP11_MAPPING
+# include <Ice/AsyncResult.h>
+#endif
+
+#include <exception>
namespace IceInternal
{
@@ -23,25 +36,80 @@ namespace IceInternal
class RetryException;
class CollocatedRequestHandler;
+class ICE_API OutgoingAsyncCompletionCallback
+{
+public:
+ virtual ~OutgoingAsyncCompletionCallback();
+
+protected:
+
+ virtual bool handleSent(bool, bool) = 0;
+ virtual bool handleException(const Ice::Exception&) = 0;
+ virtual bool handleResponse(bool) = 0;
+
+ virtual void handleInvokeSent(bool, OutgoingAsyncBase*) const = 0;
+ virtual void handleInvokeException(const Ice::Exception&, OutgoingAsyncBase*) const = 0;
+ virtual void handleInvokeResponse(bool, OutgoingAsyncBase*) const = 0;
+};
+
//
// Base class for handling asynchronous invocations. This class is
// responsible for the handling of the output stream and the child
// invocation observer.
//
-class ICE_API OutgoingAsyncBase : public Ice::AsyncResult
+class ICE_API OutgoingAsyncBase : virtual public OutgoingAsyncCompletionCallback,
+#ifdef ICE_CPP11_MAPPING
+ public std::enable_shared_from_this<OutgoingAsyncBase>
+#else
+ public Ice::AsyncResult
+#endif
{
public:
virtual bool sent();
- virtual bool completed(const Ice::Exception&);
- virtual bool completed();
+ virtual bool exception(const Ice::Exception&);
+ virtual bool response();
+
+ void invokeSentAsync();
+ void invokeExceptionAsync();
+ void invokeResponseAsync();
+
+ void invokeSent();
+ void invokeException();
+ void invokeResponse();
- // Those methods are public when called from an OutgoingAsyncBase reference.
- using Ice::AsyncResult::cancelable;
- using Ice::AsyncResult::invokeSent;
- using Ice::AsyncResult::invokeSentAsync;
- using Ice::AsyncResult::invokeCompleted;
- using Ice::AsyncResult::invokeCompletedAsync;
+ virtual void cancelable(const IceInternal::CancellationHandlerPtr&);
+ void cancel();
+
+#ifndef ICE_CPP11_MAPPING
+ virtual Ice::Int getHash() const;
+
+ virtual Ice::CommunicatorPtr getCommunicator() const;
+ virtual Ice::ConnectionPtr getConnection() const;
+ virtual Ice::ObjectPrx getProxy() const;
+
+ virtual Ice::LocalObjectPtr getCookie() const;
+ virtual const std::string& getOperation() const;
+
+ virtual bool isCompleted() const;
+ virtual void waitForCompleted();
+
+ virtual bool isSent() const;
+ virtual void waitForSent();
+
+ virtual bool sentSynchronously() const;
+
+ virtual void throwLocalException() const;
+
+ virtual bool waitForResponse();
+ virtual Ice::InputStream* startReadParams();
+ virtual void endReadParams();
+ virtual void readEmptyParams();
+ virtual void readParamEncaps(const ::Ice::Byte*&, ::Ice::Int&);
+ virtual void throwUserException();
+
+ virtual void scheduleCallback(const CallbackPtr&);
+#endif
void attachRemoteObserver(const Ice::ConnectionInfoPtr& c, const Ice::EndpointPtr& endpt, Ice::Int requestId)
{
@@ -55,24 +123,71 @@ public:
_childObserver.attach(getObserver().getCollocatedObserver(adapter, requestId, size));
}
- BasicStream* getOs()
+ Ice::OutputStream* getOs()
{
return &_os;
}
- virtual BasicStream* getIs();
+ Ice::InputStream* getIs()
+ {
+ return &_is;
+ }
protected:
- OutgoingAsyncBase(const Ice::CommunicatorPtr&, const InstancePtr&, const std::string&, const CallbackBasePtr&,
- const Ice::LocalObjectPtr&);
+ OutgoingAsyncBase(const InstancePtr&);
+
+ bool sentImpl(bool);
+ bool exceptionImpl(const Ice::Exception&);
+ bool responseImpl(bool);
- bool sent(bool);
- bool finished(const Ice::Exception&);
+ void cancel(const Ice::LocalException&);
+ void checkCanceled();
+
+ void warning(const std::exception&) const;
+ void warning() const;
+
+ //
+ // This virtual method is necessary for the communicator flush
+ // batch requests implementation.
+ //
+ virtual IceInternal::InvocationObserver& getObserver()
+ {
+ return _observer;
+ }
+ const InstancePtr _instance;
+ Ice::ConnectionPtr _cachedConnection;
+ bool _sentSynchronously;
+ bool _doneInSent;
+ unsigned char _state;
+
+#ifdef ICE_CPP11_MAPPING
+ std::mutex _m;
+ using Lock = std::lock_guard<std::mutex>;
+#else
+ IceUtil::Monitor<IceUtil::Mutex> _m;
+ typedef IceUtil::Monitor<IceUtil::Mutex>::Lock Lock;
+ Ice::LocalObjectPtr _cookie;
+#endif
+
+ IceInternal::UniquePtr<Ice::Exception> _ex;
+ IceInternal::UniquePtr<Ice::LocalException> _cancellationException;
+
+ InvocationObserver _observer;
ObserverHelperT<Ice::Instrumentation::ChildInvocationObserver> _childObserver;
- BasicStream _os;
+ Ice::OutputStream _os;
+ Ice::InputStream _is;
+
+ CancellationHandlerPtr _cancellationHandler;
+
+ static const unsigned char OK;
+ static const unsigned char Sent;
+#ifndef ICE_CPP11_MAPPING
+ static const unsigned char Done;
+ static const unsigned char EndCalled;
+#endif
};
//
@@ -81,38 +196,44 @@ protected:
// correct notified of failures and make sure the retry task is
// correctly canceled when the invocation completes.
//
-class ICE_API ProxyOutgoingAsyncBase : public OutgoingAsyncBase, protected IceUtil::TimerTask
+class ICE_API ProxyOutgoingAsyncBase : public OutgoingAsyncBase,
+ public IceUtil::TimerTask
{
public:
virtual AsyncStatus invokeRemote(const Ice::ConnectionIPtr&, bool, bool) = 0;
virtual AsyncStatus invokeCollocated(CollocatedRequestHandler*) = 0;
- virtual Ice::ObjectPrx getProxy() const;
-
- using OutgoingAsyncBase::sent;
- virtual bool completed(const Ice::Exception&);
- void retryException(const Ice::Exception&);
+ virtual bool exception(const Ice::Exception&);
virtual void cancelable(const CancellationHandlerPtr&);
+ void retryException(const Ice::Exception&);
void retry();
void abort(const Ice::Exception&);
+#ifdef ICE_CPP11_MAPPING
+ std::shared_ptr<ProxyOutgoingAsyncBase> shared_from_this()
+ {
+ return std::static_pointer_cast<ProxyOutgoingAsyncBase>(OutgoingAsyncBase::shared_from_this());
+ }
+#else
+ virtual Ice::ObjectPrx getProxy() const;
+ virtual Ice::CommunicatorPtr getCommunicator() const;
+#endif
+
protected:
- ProxyOutgoingAsyncBase(const Ice::ObjectPrx&, const std::string&, const CallbackBasePtr&,
- const Ice::LocalObjectPtr&);
+ ProxyOutgoingAsyncBase(const Ice::ObjectPrxPtr&);
+ ~ProxyOutgoingAsyncBase();
void invokeImpl(bool);
+ bool sentImpl(bool);
+ bool exceptionImpl(const Ice::Exception&);
+ bool responseImpl(bool);
- bool sent(bool);
- bool finished(const Ice::Exception&);
- bool finished(bool);
-
- int handleException(const Ice::Exception&);
virtual void runTimerTask();
- const Ice::ObjectPrx _proxy;
+ const Ice::ObjectPrxPtr _proxy;
RequestHandlerPtr _handler;
Ice::OperationMode _mode;
@@ -129,133 +250,583 @@ class ICE_API OutgoingAsync : public ProxyOutgoingAsyncBase
{
public:
- OutgoingAsync(const Ice::ObjectPrx&, const std::string&, const CallbackBasePtr&, const Ice::LocalObjectPtr&);
+ OutgoingAsync(const Ice::ObjectPrxPtr&, bool);
- void prepare(const std::string&, Ice::OperationMode, const Ice::Context*);
+ void prepare(const std::string&, Ice::OperationMode, const Ice::Context&);
virtual bool sent();
+ virtual bool response();
virtual AsyncStatus invokeRemote(const Ice::ConnectionIPtr&, bool, bool);
virtual AsyncStatus invokeCollocated(CollocatedRequestHandler*);
- using ProxyOutgoingAsyncBase::completed;
- virtual bool completed();
-
void abort(const Ice::Exception&);
+ void invoke(const std::string&);
+#ifdef ICE_CPP11_MAPPING
+ void invoke(const std::string&, Ice::OperationMode, Ice::FormatType, const Ice::Context&,
+ std::function<void(Ice::OutputStream*)>);
+ void throwUserException();
+#endif
- void invoke();
-
- BasicStream* startWriteParams(Ice::FormatType format)
+ Ice::OutputStream* startWriteParams(Ice::FormatType format)
{
- _os.startWriteEncaps(_encoding, format);
+ _os.startEncapsulation(_encoding, format);
return &_os;
}
void endWriteParams()
{
- _os.endWriteEncaps();
+ _os.endEncapsulation();
}
void writeEmptyParams()
{
- _os.writeEmptyEncaps(_encoding);
+ _os.writeEmptyEncapsulation(_encoding);
}
void writeParamEncaps(const ::Ice::Byte* encaps, ::Ice::Int size)
{
if(size == 0)
{
- _os.writeEmptyEncaps(_encoding);
+ _os.writeEmptyEncapsulation(_encoding);
}
else
{
- _os.writeEncaps(encaps, size);
+ _os.writeEncapsulation(encaps, size);
}
}
- virtual BasicStream* getIs()
+protected:
+
+ const Ice::EncodingVersion _encoding;
+
+#ifdef ICE_CPP11_MAPPING
+ std::function<void(const ::Ice::UserException&)> _userException;
+#endif
+
+ bool _synchronous;
+};
+
+}
+
+namespace IceInternal
+{
+
+#ifdef ICE_CPP11_MAPPING
+
+class ICE_API LambdaInvoke : virtual public OutgoingAsyncCompletionCallback
+{
+public:
+
+ LambdaInvoke(std::function<void(::std::exception_ptr)> exception, std::function<void(bool)> sent) :
+ _exception(std::move(exception)), _sent(std::move(sent))
{
- return &_is;
}
-private:
+protected:
- const Ice::EncodingVersion _encoding;
+ virtual bool handleSent(bool, bool) override;
+ virtual bool handleException(const Ice::Exception&) override;
+ virtual bool handleResponse(bool) override;
+
+ virtual void handleInvokeSent(bool, OutgoingAsyncBase*) const override;
+ virtual void handleInvokeException(const Ice::Exception&, OutgoingAsyncBase*) const override;
+ virtual void handleInvokeResponse(bool, OutgoingAsyncBase*) const override;
+
+ std::function<void(::std::exception_ptr)> _exception;
+ std::function<void(bool)> _sent;
+ std::function<void(bool)> _response;
};
-//
-// Class for handling the proxy's begin_ice_flushBatchRequest request.
-//
-class ICE_API ProxyFlushBatchAsync : public ProxyOutgoingAsyncBase
+template<typename Promise>
+class PromiseInvoke : virtual public OutgoingAsyncCompletionCallback
{
public:
- ProxyFlushBatchAsync(const Ice::ObjectPrx&, const std::string&, const CallbackBasePtr&, const Ice::LocalObjectPtr&);
+ auto
+ getFuture() -> decltype(std::declval<Promise>().get_future())
+ {
+ return _promise.get_future();
+ }
- virtual AsyncStatus invokeRemote(const Ice::ConnectionIPtr&, bool, bool);
- virtual AsyncStatus invokeCollocated(CollocatedRequestHandler*);
+protected:
- void invoke();
+ Promise _promise;
+ std::function<void(bool)> _response;
private:
- int _batchRequestNum;
+ virtual bool handleSent(bool, bool) override
+ {
+ return false;
+ }
+
+ virtual bool handleException(const Ice::Exception& ex) override
+ {
+ try
+ {
+ ex.ice_throw();
+ }
+ catch(const Ice::Exception&)
+ {
+ _promise.set_exception(std::current_exception());
+ }
+ return false;
+ }
+
+ virtual bool handleResponse(bool ok) override
+ {
+ _response(ok);
+ return false;
+ }
+
+ virtual void handleInvokeSent(bool, OutgoingAsyncBase*) const override
+ {
+ assert(false);
+ }
+
+ virtual void handleInvokeException(const Ice::Exception&, OutgoingAsyncBase*) const override
+ {
+ assert(false);
+ }
+
+ virtual void handleInvokeResponse(bool, OutgoingAsyncBase*) const override
+ {
+ assert(false);
+ }
+};
+
+template<typename T>
+class OutgoingAsyncT : public OutgoingAsync
+{
+public:
+
+ using OutgoingAsync::OutgoingAsync;
+
+ void
+ invoke(const std::string& operation,
+ Ice::OperationMode mode,
+ Ice::FormatType format,
+ const Ice::Context& ctx,
+ std::function<void(Ice::OutputStream*)> write,
+ std::function<void(const Ice::UserException&)> userException)
+ {
+ _read = [](Ice::InputStream* stream)
+ {
+ T v;
+ stream->read(v);
+ return v;
+ };
+ _userException = std::move(userException);
+ OutgoingAsync::invoke(operation, mode, format, ctx, std::move(write));
+ }
+
+ void
+ invoke(const std::string& operation,
+ Ice::OperationMode mode,
+ Ice::FormatType format,
+ const Ice::Context& ctx,
+ std::function<void(Ice::OutputStream*)> write,
+ std::function<void(const Ice::UserException&)> userException,
+ std::function<T(Ice::InputStream*)> read)
+ {
+ _read = std::move(read);
+ _userException = std::move(userException);
+ OutgoingAsync::invoke(operation, mode, format, ctx, std::move(write));
+ }
+
+protected:
+
+ std::function<T(Ice::InputStream*)> _read;
+};
+
+template<>
+class OutgoingAsyncT<void> : public OutgoingAsync
+{
+public:
+
+ using OutgoingAsync::OutgoingAsync;
+
+ void
+ invoke(const std::string& operation,
+ Ice::OperationMode mode,
+ Ice::FormatType format,
+ const Ice::Context& ctx,
+ std::function<void(Ice::OutputStream*)> write,
+ std::function<void(const Ice::UserException&)> userException)
+ {
+ _userException = std::move(userException);
+ OutgoingAsync::invoke(operation, mode, format, ctx, std::move(write));
+ }
+};
+
+template<typename R>
+class LambdaOutgoing : public OutgoingAsyncT<R>, public LambdaInvoke
+{
+public:
+
+ LambdaOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy,
+ std::function<void(R)> response,
+ std::function<void(::std::exception_ptr)> ex,
+ std::function<void(bool)> sent) :
+ OutgoingAsyncT<R>(proxy, false), LambdaInvoke(std::move(ex), std::move(sent))
+ {
+ _response = [this, response](bool ok)
+ {
+ if(!ok)
+ {
+ this->throwUserException();
+ }
+ else if(response)
+ {
+ assert(this->_read);
+ this->_is.startEncapsulation();
+ R v = this->_read(&this->_is);
+ this->_is.endEncapsulation();
+ try
+ {
+ response(std::move(v));
+ }
+ catch(...)
+ {
+ throw std::current_exception();
+ }
+ }
+ };
+ }
};
-typedef IceUtil::Handle<ProxyFlushBatchAsync> ProxyFlushBatchAsyncPtr;
+
+template<>
+class LambdaOutgoing<void> : public OutgoingAsyncT<void>, public LambdaInvoke
+{
+public:
+
+ LambdaOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy,
+ std::function<void()> response,
+ std::function<void(::std::exception_ptr)> ex,
+ std::function<void(bool)> sent) :
+ OutgoingAsyncT<void>(proxy, false), LambdaInvoke(std::move(ex), std::move(sent))
+ {
+ _response = [this, response](bool ok)
+ {
+ if(!ok)
+ {
+ this->throwUserException();
+ }
+ else if(response)
+ {
+ if(!this->_is.b.empty())
+ {
+ this->_is.skipEmptyEncapsulation();
+ }
+
+ try
+ {
+ response();
+ }
+ catch(...)
+ {
+ throw std::current_exception();
+ }
+ }
+ };
+ }
+};
+
+class CustomLambdaOutgoing : public OutgoingAsync, public LambdaInvoke
+{
+public:
+
+ CustomLambdaOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy,
+ std::function<void(Ice::InputStream*)> read,
+ std::function<void(::std::exception_ptr)> ex,
+ std::function<void(bool)> sent) :
+ OutgoingAsync(proxy, false), LambdaInvoke(std::move(ex), std::move(sent))
+ {
+ _response = [this, read](bool ok)
+ {
+ if(!ok)
+ {
+ this->throwUserException();
+ }
+ else if(read)
+ {
+ //
+ // Read and respond
+ //
+ read(&this->_is);
+ }
+ };
+ }
+
+ void
+ invoke(const std::string& operation,
+ Ice::OperationMode mode,
+ Ice::FormatType format,
+ const Ice::Context& ctx,
+ std::function<void(Ice::OutputStream*)> write,
+ std::function<void(const Ice::UserException&)> userException)
+ {
+ _userException = std::move(userException);
+ OutgoingAsync::invoke(operation, mode, format, ctx, std::move(write));
+ }
+};
+
+template<typename P, typename R>
+class PromiseOutgoing : public OutgoingAsyncT<R>, public PromiseInvoke<P>
+{
+public:
+
+ PromiseOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy, bool sync) :
+ OutgoingAsyncT<R>(proxy, sync)
+ {
+ this->_response = [this](bool ok)
+ {
+ if(ok)
+ {
+ assert(this->_read);
+ this->_is.startEncapsulation();
+ R v = this->_read(&this->_is);
+ this->_is.endEncapsulation();
+ this->_promise.set_value(v);
+ }
+ else
+ {
+ this->throwUserException();
+ }
+ };
+ }
+};
+
+template<typename P>
+class PromiseOutgoing<P, void> : public OutgoingAsyncT<void>, public PromiseInvoke<P>
+{
+public:
+
+ PromiseOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy, bool sync) :
+ OutgoingAsyncT<void>(proxy, sync)
+ {
+ this->_response = [&](bool ok)
+ {
+ if(this->_is.b.empty())
+ {
+ //
+ // If there's no response (oneway, batch-oneway proxies), we just set the promise
+ // on completion without reading anything from the input stream. This is required for
+ // batch invocations.
+ //
+ this->_promise.set_value();
+ }
+ else if(ok)
+ {
+ this->_is.skipEmptyEncapsulation();
+ this->_promise.set_value();
+ }
+ else
+ {
+ this->throwUserException();
+ }
+ };
+ }
+
+ virtual bool handleSent(bool done, bool) override
+ {
+ if(done)
+ {
+ PromiseInvoke<P>::_promise.set_value();
+ }
+ return false;
+ }
+};
+
+#else
//
-// Class for handling the proxy's begin_ice_getConnection request.
+// Base class for all callbacks.
//
-class ICE_API ProxyGetConnection : public ProxyOutgoingAsyncBase
+class ICE_API CallbackBase : public IceUtil::Shared
{
public:
- ProxyGetConnection(const Ice::ObjectPrx&, const std::string&, const CallbackBasePtr&, const Ice::LocalObjectPtr&);
+ virtual ~CallbackBase();
- virtual AsyncStatus invokeRemote(const Ice::ConnectionIPtr&, bool, bool);
- virtual AsyncStatus invokeCollocated(CollocatedRequestHandler*);
+ void checkCallback(bool, bool);
+
+ virtual void completed(const ::Ice::AsyncResultPtr&) const = 0;
+ virtual IceUtil::Handle<CallbackBase> verify(const ::Ice::LocalObjectPtr&) = 0;
+ virtual void sent(const ::Ice::AsyncResultPtr&) const = 0;
+ virtual bool hasSentCallback() const = 0;
+};
+typedef IceUtil::Handle<CallbackBase> CallbackBasePtr;
+
+//
+// Base class for generic callbacks.
+//
+class ICE_API GenericCallbackBase : public virtual CallbackBase
+{
+public:
- void invoke();
+ virtual ~GenericCallbackBase();
};
-typedef IceUtil::Handle<ProxyGetConnection> ProxyGetConnectionPtr;
//
-// Class for handling Ice::Connection::begin_flushBatchRequests
+// See comments in OutgoingAsync.cpp
+//
+extern ICE_API CallbackBasePtr dummyCallback;
+
+//
+// Generic callback template that requires the caller to down-cast the
+// proxy and the cookie that are obtained from the AsyncResult.
//
-class ICE_API ConnectionFlushBatchAsync : public OutgoingAsyncBase
+template<class T>
+class AsyncCallback : public GenericCallbackBase
{
public:
- ConnectionFlushBatchAsync(const Ice::ConnectionIPtr&, const Ice::CommunicatorPtr&, const InstancePtr&,
- const std::string&, const CallbackBasePtr&, const Ice::LocalObjectPtr&);
+ typedef T callback_type;
+ typedef IceUtil::Handle<T> TPtr;
- virtual Ice::ConnectionPtr getConnection() const;
+ typedef void (T::*Callback)(const ::Ice::AsyncResultPtr&);
+
+ AsyncCallback(const TPtr& instance, Callback cb, Callback sentcb = 0) :
+ _callback(instance), _completed(cb), _sent(sentcb)
+ {
+ checkCallback(instance, cb != 0);
+ }
- void invoke();
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
+ {
+ (_callback.get()->*_completed)(result);
+ }
+
+ virtual CallbackBasePtr verify(const ::Ice::LocalObjectPtr&)
+ {
+ return this; // Nothing to do, the cookie is not type-safe.
+ }
+
+ virtual void sent(const ::Ice::AsyncResultPtr& result) const
+ {
+ if(_sent)
+ {
+ (_callback.get()->*_sent)(result);
+ }
+ }
+
+ virtual bool hasSentCallback() const
+ {
+ return _sent != 0;
+ }
private:
- const Ice::ConnectionIPtr _connection;
+ TPtr _callback;
+ Callback _completed;
+ Callback _sent;
};
-typedef IceUtil::Handle<ConnectionFlushBatchAsync> ConnectionFlushBatchAsyncPtr;
-//
-// Class for handling Ice::Communicator::begin_flushBatchRequests
-//
-class ICE_API CommunicatorFlushBatchAsync : public Ice::AsyncResult
+class CallbackCompletion : virtual public OutgoingAsyncCompletionCallback
{
public:
- CommunicatorFlushBatchAsync(const Ice::CommunicatorPtr&, const InstancePtr&, const std::string&,
- const CallbackBasePtr&, const Ice::LocalObjectPtr&);
+ CallbackCompletion(const CallbackBasePtr& cb, const Ice::LocalObjectPtr& cookie) : _callback(cb)
+ {
+ if(!_callback)
+ {
+ throw IceUtil::IllegalArgumentException(__FILE__, __LINE__);
+ }
+ const_cast<CallbackBasePtr&>(_callback) = _callback->verify(cookie);
+ }
+
+ virtual bool handleSent(bool, bool alreadySent)
+ {
+ return _callback && _callback->hasSentCallback() && !alreadySent;
+ }
+
+ virtual bool handleException(const Ice::Exception&)
+ {
+ return _callback;
+ }
+
+ virtual bool handleResponse(bool)
+ {
+ return _callback;
+ }
+
+ virtual void handleInvokeSent(bool, OutgoingAsyncBase* outAsync) const
+ {
+ _callback->sent(outAsync);
+ }
+
+ virtual void handleInvokeException(const Ice::Exception&, OutgoingAsyncBase* outAsync) const
+ {
+ _callback->completed(outAsync);
+ }
- void flushConnection(const Ice::ConnectionIPtr&);
- void ready();
+ virtual void handleInvokeResponse(bool, OutgoingAsyncBase* outAsync) const
+ {
+ _callback->completed(outAsync);
+ }
private:
- void check(bool);
+ const CallbackBasePtr _callback;
+};
+
+class CallbackOutgoing : public OutgoingAsync, public CallbackCompletion
+{
+public:
+
+ CallbackOutgoing(const Ice::ObjectPrx& proxy,
+ const std::string& operation,
+ const CallbackBasePtr& cb,
+ const Ice::LocalObjectPtr& cookie,
+ bool sync) :
+ OutgoingAsync(proxy, sync), CallbackCompletion(cb, cookie), _operation(operation)
+ {
+ _cookie = cookie;
+ }
+
+ virtual const std::string&
+ getOperation() const
+ {
+ return _operation;
+ }
+
+private:
- int _useCount;
+ const std::string& _operation;
};
+#endif
+
+}
+
+#ifndef ICE_CPP11_MAPPING
+
+namespace Ice
+{
+
+typedef IceUtil::Handle< ::IceInternal::GenericCallbackBase> CallbackPtr;
+
+template<class T> CallbackPtr
+newCallback(const IceUtil::Handle<T>& instance,
+ void (T::*cb)(const AsyncResultPtr&),
+ void (T::*sentcb)(const AsyncResultPtr&) = 0)
+{
+ return new ::IceInternal::AsyncCallback<T>(instance, cb, sentcb);
+}
+
+template<class T> CallbackPtr
+newCallback(T* instance,
+ void (T::*cb)(const AsyncResultPtr&),
+ void (T::*sentcb)(const AsyncResultPtr&) = 0)
+{
+ return new ::IceInternal::AsyncCallback<T>(instance, cb, sentcb);
+}
+
}
+//
+// Operation callbacks are specified in Proxy.h
+//
+
+#endif
+
#endif
diff --git a/cpp/include/Ice/OutgoingAsyncF.h b/cpp/include/Ice/OutgoingAsyncF.h
index b885486eb8e..b49d3dc112e 100644
--- a/cpp/include/Ice/OutgoingAsyncF.h
+++ b/cpp/include/Ice/OutgoingAsyncF.h
@@ -11,28 +11,34 @@
#define ICE_OUTGOING_ASYNC_F_H
#include <IceUtil/Shared.h>
-
#include <Ice/Handle.h>
namespace IceInternal
{
class OutgoingAsyncBase;
+class OutgoingAsync;
+class ProxyOutgoingAsyncBase;
+class CommunicatorFlushBatchAsync;
+
+#ifdef ICE_CPP11_MAPPING
+using OutgoingAsyncBasePtr = ::std::shared_ptr<OutgoingAsyncBase>;
+using OutgoingAsyncPtr = ::std::shared_ptr<OutgoingAsync>;
+using ProxyOutgoingAsyncBasePtr = ::std::shared_ptr<ProxyOutgoingAsyncBase>;
+using CommunicatorFlushBatchAsyncPtr = ::std::shared_ptr<CommunicatorFlushBatchAsync>;
+#else
ICE_API IceUtil::Shared* upCast(OutgoingAsyncBase*);
typedef IceInternal::Handle<OutgoingAsyncBase> OutgoingAsyncBasePtr;
-class OutgoingAsync;
ICE_API IceUtil::Shared* upCast(OutgoingAsync*);
typedef IceInternal::Handle<OutgoingAsync> OutgoingAsyncPtr;
-class ProxyOutgoingAsyncBase;
ICE_API IceUtil::Shared* upCast(ProxyOutgoingAsyncBase*);
typedef IceInternal::Handle<ProxyOutgoingAsyncBase> ProxyOutgoingAsyncBasePtr;
-class CommunicatorFlushBatchAsync;
ICE_API IceUtil::Shared* upCast(CommunicatorFlushBatchAsync*);
typedef IceInternal::Handle<CommunicatorFlushBatchAsync> CommunicatorFlushBatchAsyncPtr;
-
+#endif
}
#endif
diff --git a/cpp/include/Ice/OutputStream.h b/cpp/include/Ice/OutputStream.h
new file mode 100644
index 00000000000..de0bec23cdd
--- /dev/null
+++ b/cpp/include/Ice/OutputStream.h
@@ -0,0 +1,753 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_OUTPUT_STREAM_H
+#define ICE_OUTPUT_STREAM_H
+
+#include <Ice/CommunicatorF.h>
+#include <Ice/InstanceF.h>
+#include <Ice/Object.h>
+#include <Ice/ValueF.h>
+#include <Ice/ProxyF.h>
+#include <Ice/Buffer.h>
+#include <Ice/Protocol.h>
+#include <Ice/SlicedDataF.h>
+#include <Ice/StreamHelpers.h>
+
+namespace Ice
+{
+
+class UserException;
+
+class ICE_API OutputStream : public IceInternal::Buffer
+{
+public:
+
+ typedef size_t size_type;
+
+ //
+ // Constructing an OutputStream without providing a communicator means the stream will
+ // use the default encoding version, the default format for class encoding, and the
+ // process string converters. You can supply a communicator later by calling initialize().
+ //
+ OutputStream();
+
+ //
+ // This constructor uses the communicator's default encoding version.
+ //
+ OutputStream(const CommunicatorPtr&);
+
+ //
+ // This constructor uses the given communicator and encoding version.
+ //
+ OutputStream(const CommunicatorPtr&, const EncodingVersion&);
+
+ //
+ // This constructor uses the given communicator and encoding version. The byte pair denotes
+ // application-supplied memory that the stream uses as its initial marshaling buffer. The
+ // stream will reallocate if the size of the marshaled data exceeds the application's buffer.
+ //
+ OutputStream(const CommunicatorPtr&, const EncodingVersion&, const std::pair<const Byte*, const Byte*>&);
+
+ ~OutputStream()
+ {
+ // Inlined for performance reasons.
+
+ if(_currentEncaps != &_preAllocatedEncaps)
+ {
+ clear(); // Not inlined.
+ }
+ }
+
+ //
+ // Initializes the stream to use the communicator's default encoding version and class
+ // encoding format
+ //
+ void initialize(const CommunicatorPtr&);
+
+ //
+ // Initializes the stream to use the given encoding version and the communicator's
+ // default class encoding format and string converters.
+ //
+ void initialize(const CommunicatorPtr&, const EncodingVersion&);
+
+ void clear();
+
+ //
+ // Must return Instance*, because we don't hold an InstancePtr for
+ // optimization reasons (see comments below).
+ //
+ IceInternal::Instance* instance() const { return _instance; } // Inlined for performance reasons.
+
+ void setFormat(FormatType);
+
+ void* getClosure() const;
+ void* setClosure(void*);
+
+ void swap(OutputStream&);
+ void resetEncapsulation();
+
+ void resize(Container::size_type sz)
+ {
+ b.resize(sz);
+ }
+
+ void startValue(const SlicedDataPtr& data)
+ {
+ assert(_currentEncaps && _currentEncaps->encoder);
+ _currentEncaps->encoder->startInstance(ValueSlice, data);
+ }
+ void endValue()
+ {
+ assert(_currentEncaps && _currentEncaps->encoder);
+ _currentEncaps->encoder->endInstance();
+ }
+
+ void startException(const SlicedDataPtr& data)
+ {
+ assert(_currentEncaps && _currentEncaps->encoder);
+ _currentEncaps->encoder->startInstance(ExceptionSlice, data);
+ }
+ void endException()
+ {
+ assert(_currentEncaps && _currentEncaps->encoder);
+ _currentEncaps->encoder->endInstance();
+ }
+
+ void startEncapsulation();
+
+ void startEncapsulation(const EncodingVersion& encoding, FormatType format)
+ {
+ IceInternal::checkSupportedEncoding(encoding);
+
+ Encaps* oldEncaps = _currentEncaps;
+ if(!oldEncaps) // First allocated encaps?
+ {
+ _currentEncaps = &_preAllocatedEncaps;
+ }
+ else
+ {
+ _currentEncaps = new Encaps();
+ _currentEncaps->previous = oldEncaps;
+ }
+ _currentEncaps->format = format;
+ _currentEncaps->encoding = encoding;
+ _currentEncaps->start = b.size();
+
+ write(Int(0)); // Placeholder for the encapsulation length.
+ write(_currentEncaps->encoding);
+ }
+ void endEncapsulation()
+ {
+ assert(_currentEncaps);
+
+ // Size includes size and version.
+ const Int sz = static_cast<Int>(b.size() - _currentEncaps->start);
+ write(sz, &(*(b.begin() + _currentEncaps->start)));
+
+ Encaps* oldEncaps = _currentEncaps;
+ _currentEncaps = _currentEncaps->previous;
+ if(oldEncaps == &_preAllocatedEncaps)
+ {
+ oldEncaps->reset();
+ }
+ else
+ {
+ delete oldEncaps;
+ }
+ }
+
+ void writeEmptyEncapsulation(const EncodingVersion& encoding)
+ {
+ IceInternal::checkSupportedEncoding(encoding);
+ write(Int(6)); // Size
+ write(encoding);
+ }
+ void writeEncapsulation(const Byte* v, Int sz)
+ {
+ if(sz < 6)
+ {
+ throwEncapsulationException(__FILE__, __LINE__);
+ }
+
+ Container::size_type position = b.size();
+ resize(position + sz);
+ memcpy(&b[position], &v[0], sz);
+ }
+
+ const EncodingVersion& getEncoding() const
+ {
+ return _currentEncaps ? _currentEncaps->encoding : _encoding;
+ }
+
+ void startSlice(const std::string& typeId, int compactId, bool last)
+ {
+ assert(_currentEncaps && _currentEncaps->encoder);
+ _currentEncaps->encoder->startSlice(typeId, compactId, last);
+ }
+ void endSlice()
+ {
+ assert(_currentEncaps && _currentEncaps->encoder);
+ _currentEncaps->encoder->endSlice();
+ }
+
+ void writePendingValues();
+
+ void writeSize(Int v) // Inlined for performance reasons.
+ {
+ assert(v >= 0);
+ if(v > 254)
+ {
+ write(Byte(255));
+ write(v);
+ }
+ else
+ {
+ write(static_cast<Byte>(v));
+ }
+ }
+ void rewriteSize(Int v, Container::iterator dest)
+ {
+ assert(v >= 0);
+ if(v > 254)
+ {
+ *dest++ = Byte(255);
+ write(v, dest);
+ }
+ else
+ {
+ *dest = static_cast<Byte>(v);
+ }
+ }
+
+ size_type startSize()
+ {
+ size_type position = b.size();
+ write(Int(0));
+ return position;
+ }
+
+ void endSize(size_type position)
+ {
+ rewrite(static_cast<Int>(b.size() - position) - 4, position);
+ }
+
+ void writeBlob(const std::vector<Byte>&);
+
+ void writeBlob(const Byte* v, Container::size_type sz)
+ {
+ if(sz > 0)
+ {
+ Container::size_type position = b.size();
+ resize(position + sz);
+ memcpy(&b[position], &v[0], sz);
+ }
+ }
+
+ template<typename T> void write(const T& v)
+ {
+ StreamHelper<T, StreamableTraits<T>::helper>::write(this, v);
+ }
+
+ template<typename T> void write(Int tag, const IceUtil::Optional<T>& v)
+ {
+ if(!v)
+ {
+ return; // Optional not set
+ }
+
+ if(writeOptional(tag, StreamOptionalHelper<T,
+ StreamableTraits<T>::helper,
+ StreamableTraits<T>::fixedLength>::optionalFormat))
+ {
+ StreamOptionalHelper<T,
+ StreamableTraits<T>::helper,
+ StreamableTraits<T>::fixedLength>::write(this, *v);
+ }
+ }
+
+ //
+ // Template functions for sequences and custom sequences
+ //
+ template<typename T> void write(const std::vector<T>& v)
+ {
+ if(v.empty())
+ {
+ writeSize(0);
+ }
+ else
+ {
+ write(&v[0], &v[0] + v.size());
+ }
+ }
+
+ template<typename T> void write(const T* begin, const T* end)
+ {
+ writeSize(static_cast<Int>(end - begin));
+ for(const T* p = begin; p != end; ++p)
+ {
+ write(*p);
+ }
+ }
+
+#ifdef ICE_CPP11_MAPPING
+
+ template<typename T> void writeAll(const T& v)
+ {
+ write(v);
+ }
+
+ template<typename T, typename... Te> void writeAll(const T& v, const Te&... ve)
+ {
+ write(v);
+ writeAll(ve...);
+ }
+
+ template<size_t I = 0, typename... Te>
+ typename std::enable_if<I == sizeof...(Te), void>::type
+ writeAll(std::tuple<Te...>)
+ {
+ // Do nothing. Either tuple is empty or we are at the end.
+ }
+
+ template<size_t I = 0, typename... Te>
+ typename std::enable_if<I < sizeof...(Te), void>::type
+ writeAll(std::tuple<Te...> tuple)
+ {
+ write(std::get<I>(tuple));
+ writeAll<I + 1, Te...>(tuple);
+ }
+
+ template<typename T>
+ void writeAll(std::initializer_list<int> tags, const IceUtil::Optional<T>& v)
+ {
+ write(*(tags.begin() + tags.size() - 1), v);
+ }
+
+ template<typename T, typename... Te>
+ void writeAll(std::initializer_list<int> tags, const IceUtil::Optional<T>& v, const IceUtil::Optional<Te>&... ve)
+ {
+ size_t index = tags.size() - sizeof...(ve) - 1;
+ write(*(tags.begin() + index), v);
+ writeAll(tags, ve...);
+ }
+
+#endif
+
+ // Write type and tag for optionals
+ bool writeOptional(Int tag, OptionalFormat format)
+ {
+ assert(_currentEncaps);
+ if(_currentEncaps->encoder)
+ {
+ return _currentEncaps->encoder->writeOptional(tag, format);
+ }
+ else
+ {
+ return writeOptImpl(tag, format);
+ }
+ }
+
+ // Byte
+ void write(Byte v)
+ {
+ b.push_back(v);
+ }
+ void write(const Byte*, const Byte*);
+
+ // Bool
+ void write(bool v)
+ {
+ b.push_back(static_cast<Byte>(v));
+ }
+ void write(const std::vector<bool>&);
+ void write(const bool*, const bool*);
+
+ // Short
+ void write(Short);
+ void write(const Short*, const Short*);
+
+ // Int
+ void write(Int v) // Inlined for performance reasons.
+ {
+ Container::size_type position = b.size();
+ resize(position + sizeof(Int));
+ write(v, &b[position]);
+ }
+ void write(Int v, Container::iterator dest)
+ {
+#ifdef ICE_BIG_ENDIAN
+ const Byte* src = reinterpret_cast<const Byte*>(&v) + sizeof(Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
+#else
+ const Byte* src = reinterpret_cast<const Byte*>(&v);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
+#endif
+ }
+
+ void write(const Int*, const Int*);
+
+ // Long
+ void write(Long);
+ void write(const Long*, const Long*);
+
+ // Float
+ void write(Float);
+ void write(const Float*, const Float*);
+
+ // Double
+ void write(Double);
+ void write(const Double*, const Double*);
+
+ // String
+ void write(const std::string& v, bool convert = true)
+ {
+ Int sz = static_cast<Int>(v.size());
+ if(convert && sz > 0)
+ {
+ writeConverted(v.data(), static_cast<size_t>(sz));
+ }
+ else
+ {
+ writeSize(sz);
+ if(sz > 0)
+ {
+ Container::size_type position = b.size();
+ resize(position + sz);
+ memcpy(&b[position], v.data(), sz);
+ }
+ }
+ }
+
+ // for custom strings
+ void write(const char* vdata, size_t vsize, bool convert = true)
+ {
+ Int sz = static_cast<Int>(vsize);
+ if(convert && sz > 0)
+ {
+ writeConverted(vdata, vsize);
+ }
+ else
+ {
+ writeSize(sz);
+ if(sz > 0)
+ {
+ Container::size_type position = b.size();
+ resize(position + sz);
+ memcpy(&b[position], vdata, vsize);
+ }
+ }
+ }
+
+ // Null-terminated C string
+ void write(const char* vdata, bool convert = true)
+ {
+ write(vdata, strlen(vdata), convert);
+ }
+
+ void write(const std::string*, const std::string*, bool = true);
+
+ void write(const std::wstring& v);
+ void write(const std::wstring*, const std::wstring*);
+
+ // Proxy
+#ifdef ICE_CPP11_MAPPING
+ void writeProxy(const ::std::shared_ptr<ObjectPrx>&);
+
+ template<typename T, typename ::std::enable_if<::std::is_base_of<ObjectPrx, T>::value>::type* = nullptr>
+ void write(const ::std::shared_ptr<T>& v)
+ {
+ writeProxy(::std::static_pointer_cast<ObjectPrx>(v));
+ }
+#else
+ void write(const ObjectPrx&);
+ template<typename T> void write(const IceInternal::ProxyHandle<T>& v)
+ {
+ write(ObjectPrx(upCast(v.get())));
+ }
+#endif
+
+ // Class
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+ template<typename T, typename ::std::enable_if<::std::is_base_of<Value, T>::value>::type* = nullptr>
+ void write(const ::std::shared_ptr<T>& v)
+ {
+ initEncaps();
+ _currentEncaps->encoder->write(v);
+ }
+#else // C++98 mapping
+ void write(const ObjectPtr& v)
+ {
+ initEncaps();
+ _currentEncaps->encoder->write(v);
+ }
+ template<typename T> void write(const IceInternal::Handle<T>& v)
+ {
+ write(ObjectPtr(upCast(v.get())));
+ }
+#endif
+
+ // Enum
+ void writeEnum(Int, Int);
+
+ // Exception
+ void writeException(const UserException&);
+
+ size_type pos()
+ {
+ return b.size();
+ }
+
+ void rewrite(Int value, size_type p)
+ {
+ write(value, b.begin() + p);
+ }
+
+ OutputStream(IceInternal::Instance*, const EncodingVersion&);
+
+ void initialize(IceInternal::Instance*, const EncodingVersion&);
+
+ void finished(std::vector<Byte>&);
+ std::pair<const Byte*, const Byte*> finished();
+
+ // Optionals
+ bool writeOptImpl(Int, OptionalFormat);
+
+private:
+
+ //
+ // String
+ //
+ void writeConverted(const char*, size_t);
+
+ //
+ // We can't throw this exception from inline functions from within
+ // this file, because we cannot include the header with the
+ // exceptions. Doing so would screw up the whole include file
+ // ordering.
+ //
+ void throwEncapsulationException(const char*, int);
+
+ //
+ // Optimization. The instance may not be deleted while a
+ // stack-allocated stream still holds it.
+ //
+ IceInternal::Instance* _instance;
+
+ //
+ // The public stream API needs to attach data to a stream.
+ //
+ void* _closure;
+
+ class Encaps;
+ enum SliceType { NoSlice, ValueSlice, ExceptionSlice };
+
+ typedef std::vector<ValuePtr> ValueList;
+
+ class ICE_API EncapsEncoder : private ::IceUtil::noncopyable
+ {
+ public:
+
+ virtual ~EncapsEncoder();
+
+ virtual void write(const ValuePtr&) = 0;
+ virtual void write(const UserException&) = 0;
+
+ virtual void startInstance(SliceType, const SlicedDataPtr&) = 0;
+ virtual void endInstance() = 0;
+ virtual void startSlice(const std::string&, int, bool) = 0;
+ virtual void endSlice() = 0;
+
+ virtual bool writeOptional(Int, OptionalFormat)
+ {
+ return false;
+ }
+
+ virtual void writePendingValues()
+ {
+ }
+
+ protected:
+
+ EncapsEncoder(OutputStream* stream, Encaps* encaps) : _stream(stream), _encaps(encaps), _typeIdIndex(0)
+ {
+ }
+
+ Int registerTypeId(const std::string&);
+
+ OutputStream* _stream;
+ Encaps* _encaps;
+
+ typedef std::map<ValuePtr, Int> PtrToIndexMap;
+ typedef std::map<std::string, Int> TypeIdMap;
+
+ // Encapsulation attributes for value marshaling.
+ PtrToIndexMap _marshaledMap;
+
+ private:
+
+ // Encapsulation attributes for value marshaling.
+ TypeIdMap _typeIdMap;
+ Int _typeIdIndex;
+ };
+
+ class ICE_API EncapsEncoder10 : public EncapsEncoder
+ {
+ public:
+
+ EncapsEncoder10(OutputStream* stream, Encaps* encaps) :
+ EncapsEncoder(stream, encaps), _sliceType(NoSlice), _valueIdIndex(0)
+ {
+ }
+
+ virtual void write(const ValuePtr&);
+ virtual void write(const UserException&);
+
+ virtual void startInstance(SliceType, const SlicedDataPtr&);
+ virtual void endInstance();
+ virtual void startSlice(const std::string&, int, bool);
+ virtual void endSlice();
+
+ virtual void writePendingValues();
+
+ private:
+
+ Int registerValue(const ValuePtr&);
+
+ // Instance attributes
+ SliceType _sliceType;
+
+ // Slice attributes
+ Container::size_type _writeSlice; // Position of the slice data members
+
+ // Encapsulation attributes for value marshaling.
+ Int _valueIdIndex;
+ PtrToIndexMap _toBeMarshaledMap;
+ };
+
+ class ICE_API EncapsEncoder11 : public EncapsEncoder
+ {
+ public:
+
+ EncapsEncoder11(OutputStream* stream, Encaps* encaps) :
+ EncapsEncoder(stream, encaps), _preAllocatedInstanceData(0), _current(0), _valueIdIndex(1)
+ {
+ }
+
+ virtual void write(const ValuePtr&);
+ virtual void write(const UserException&);
+
+ virtual void startInstance(SliceType, const SlicedDataPtr&);
+ virtual void endInstance();
+ virtual void startSlice(const std::string&, int, bool);
+ virtual void endSlice();
+
+ virtual bool writeOptional(Int, OptionalFormat);
+
+ private:
+
+ void writeSlicedData(const SlicedDataPtr&);
+ void writeInstance(const ValuePtr&);
+
+ struct InstanceData
+ {
+ InstanceData(InstanceData* p) : previous(p), next(0)
+ {
+ if(previous)
+ {
+ previous->next = this;
+ }
+ }
+
+ ~InstanceData()
+ {
+ if(next)
+ {
+ delete next;
+ }
+ }
+
+ // Instance attributes
+ SliceType sliceType;
+ bool firstSlice;
+
+ // Slice attributes
+ Byte sliceFlags;
+ Container::size_type writeSlice; // Position of the slice data members
+ Container::size_type sliceFlagsPos; // Position of the slice flags
+ PtrToIndexMap indirectionMap;
+ ValueList indirectionTable;
+
+ InstanceData* previous;
+ InstanceData* next;
+ };
+ InstanceData _preAllocatedInstanceData;
+ InstanceData* _current;
+
+ Int _valueIdIndex; // The ID of the next value to marhsal
+ };
+
+ class Encaps : private ::IceUtil::noncopyable
+ {
+
+ public:
+
+ Encaps() : format(ICE_ENUM(FormatType, DefaultFormat)), encoder(0), previous(0)
+ {
+ // Inlined for performance reasons.
+ }
+ ~Encaps()
+ {
+ // Inlined for performance reasons.
+ delete encoder;
+ }
+ void reset()
+ {
+ // Inlined for performance reasons.
+ delete encoder;
+ encoder = 0;
+
+ previous = 0;
+ }
+
+ Container::size_type start;
+ EncodingVersion encoding;
+ FormatType format;
+
+ EncapsEncoder* encoder;
+
+ Encaps* previous;
+ };
+
+ //
+ // The encoding version to use when there's no encapsulation to
+ // read from or write to. This is for example used to read message
+ // headers or when the user is using the streaming API with no
+ // encapsulation.
+ //
+ EncodingVersion _encoding;
+
+ FormatType _format;
+
+ Encaps* _currentEncaps;
+
+ void initEncaps();
+
+ Encaps _preAllocatedEncaps;
+};
+
+} // End namespace Ice
+
+#endif
diff --git a/cpp/include/Ice/Protocol.h b/cpp/include/Ice/Protocol.h
index bf3665f0366..e29cd892f1d 100644
--- a/cpp/include/Ice/Protocol.h
+++ b/cpp/include/Ice/Protocol.h
@@ -72,9 +72,6 @@ enum ProtocolSupport
EnableBoth
};
-// Forward declaration
-class BasicStream;
-
ICE_API void stringToMajorMinor(const ::std::string&, Ice::Byte&, Ice::Byte&);
template<typename T> std::string
@@ -104,6 +101,16 @@ ICE_API void throwUnsupportedProtocolException(const char*, int, const Ice::Prot
ICE_API void throwUnsupportedEncodingException(const char*, int, const Ice::EncodingVersion&,
const Ice::EncodingVersion&);
+const ::Ice::Byte OPTIONAL_END_MARKER = 0xFF;
+
+const ::Ice::Byte FLAG_HAS_TYPE_ID_STRING = (1<<0);
+const ::Ice::Byte FLAG_HAS_TYPE_ID_INDEX = (1<<1);
+const ::Ice::Byte FLAG_HAS_TYPE_ID_COMPACT = (1<<0) | (1<<1);
+const ::Ice::Byte FLAG_HAS_OPTIONAL_MEMBERS = (1<<2);
+const ::Ice::Byte FLAG_HAS_INDIRECTION_TABLE = (1<<3);
+const ::Ice::Byte FLAG_HAS_SLICE_SIZE = (1<<4);
+const ::Ice::Byte FLAG_IS_LAST_SLICE = (1<<5);
+
}
namespace Ice
diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h
index 35d3b76d6f3..375cec1f145 100644
--- a/cpp/include/Ice/Proxy.h
+++ b/cpp/include/Ice/Proxy.h
@@ -18,7 +18,7 @@
#include <Ice/RequestHandlerF.h>
#include <Ice/EndpointF.h>
#include <Ice/EndpointTypes.h>
-#include <Ice/ObjectF.h>
+#include <Ice/Object.h>
#include <Ice/ObjectAdapterF.h>
#include <Ice/ReferenceF.h>
#include <Ice/BatchRequestQueueF.h>
@@ -26,679 +26,1272 @@
//#include <Ice/RouterF.h> // Can't include RouterF.h here, otherwise we have cyclic includes
//#include <Ice/LocatorF.h> // Can't include RouterF.h here, otherwise we have cyclic includes
#include <Ice/Current.h>
-#include <Ice/StreamF.h>
#include <Ice/CommunicatorF.h>
-#include <Ice/ObserverHelper.h>
+#include <Ice/OutgoingAsync.h>
+#include <Ice/LocalException.h>
#include <iosfwd>
-namespace IceProxy
-{
-
namespace Ice
{
-class Locator;
-ICE_API ::IceProxy::Ice::Object* upCast(::IceProxy::Ice::Locator*);
-
-class Router;
-ICE_API ::IceProxy::Ice::Object* upCast(::IceProxy::Ice::Router*);
-
-}
+ICE_API extern const Context noExplicitContext;
}
namespace IceInternal
{
-class Outgoing;
-
-}
-
-namespace Ice
+//
+// Class for handling the proxy's begin_ice_flushBatchRequest request.
+//
+class ICE_API ProxyFlushBatchAsync : public ProxyOutgoingAsyncBase
{
+public:
-typedef ::IceInternal::ProxyHandle< ::IceProxy::Ice::Router> RouterPrx;
-typedef ::IceInternal::ProxyHandle< ::IceProxy::Ice::Locator> LocatorPrx;
+ ProxyFlushBatchAsync(const Ice::ObjectPrxPtr&);
-class LocalException;
+ virtual AsyncStatus invokeRemote(const Ice::ConnectionIPtr&, bool, bool);
+ virtual AsyncStatus invokeCollocated(CollocatedRequestHandler*);
-ICE_API void ice_writeObjectPrx(const ::Ice::OutputStreamPtr&, const ObjectPrx&);
-ICE_API void ice_readObjectPrx(const ::Ice::InputStreamPtr&, ObjectPrx&);
+ void invoke(const std::string&);
-class Callback_Object_ice_isA_Base : virtual public ::IceInternal::CallbackBase { };
-typedef ::IceUtil::Handle< Callback_Object_ice_isA_Base> Callback_Object_ice_isAPtr;
+private:
-class Callback_Object_ice_ping_Base : virtual public ::IceInternal::CallbackBase { };
-typedef ::IceUtil::Handle< Callback_Object_ice_ping_Base> Callback_Object_ice_pingPtr;
+ int _batchRequestNum;
+};
+typedef IceUtil::Handle<ProxyFlushBatchAsync> ProxyFlushBatchAsyncPtr;
-class Callback_Object_ice_ids_Base : virtual public ::IceInternal::CallbackBase { };
-typedef ::IceUtil::Handle< Callback_Object_ice_ids_Base> Callback_Object_ice_idsPtr;
+//
+// Class for handling the proxy's begin_ice_getConnection request.
+//
+class ICE_API ProxyGetConnection : public ProxyOutgoingAsyncBase
+{
+public:
-class Callback_Object_ice_id_Base : virtual public ::IceInternal::CallbackBase { };
-typedef ::IceUtil::Handle< Callback_Object_ice_id_Base> Callback_Object_ice_idPtr;
+ ProxyGetConnection(const Ice::ObjectPrxPtr&);
-class Callback_Object_ice_invoke_Base : virtual public ::IceInternal::CallbackBase { };
-typedef ::IceUtil::Handle< Callback_Object_ice_invoke_Base> Callback_Object_ice_invokePtr;
+ virtual AsyncStatus invokeRemote(const Ice::ConnectionIPtr&, bool, bool);
+ virtual AsyncStatus invokeCollocated(CollocatedRequestHandler*);
-class Callback_Object_ice_flushBatchRequests_Base : virtual public ::IceInternal::CallbackBase { };
-typedef ::IceUtil::Handle< Callback_Object_ice_flushBatchRequests_Base> Callback_Object_ice_flushBatchRequestsPtr;
+ virtual Ice::ConnectionPtr getConnection() const;
-class Callback_Object_ice_getConnection_Base : virtual public ::IceInternal::CallbackBase { };
-typedef ::IceUtil::Handle< Callback_Object_ice_getConnection_Base> Callback_Object_ice_getConnectionPtr;
+ void invoke(const std::string&);
+};
+typedef IceUtil::Handle<ProxyGetConnection> ProxyGetConnectionPtr;
}
-#ifdef ICE_CPP11
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+
namespace IceInternal
{
-class ICE_API Cpp11FnCallbackNC : public CallbackBase
+template<typename P>
+::std::shared_ptr<P> createProxy()
{
-public:
+ return ::std::shared_ptr<P>(new P());
+}
- Cpp11FnCallbackNC(const ::std::function<void (const ::Ice::Exception&)>&,
- const ::std::function<void (bool)>&);
+inline ::std::pair<const Ice::Byte*, const Ice::Byte*>
+makePair(const Ice::ByteSeq& seq)
+{
+ if(seq.empty())
+ {
+ return { nullptr, nullptr };
+ }
+ else
+ {
+ return { seq.data(), seq.data() + seq.size() };
+ }
+}
- virtual CallbackBasePtr verify(const ::Ice::LocalObjectPtr&);
+template<typename R>
+class InvokeOutgoingAsyncT : public OutgoingAsync
+{
+public:
- virtual void sent(const ::Ice::AsyncResultPtr&) const;
+ using OutgoingAsync::OutgoingAsync;
- virtual bool hasSentCallback() const;
+ void
+ invoke(const std::string& operation,
+ Ice::OperationMode mode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
+ const Ice::Context& context)
+ {
+ _read = [](bool ok, Ice::InputStream* stream)
+ {
+ const ::Ice::Byte* encaps;
+ ::Ice::Int sz;
+ stream->readEncapsulation(encaps, sz);
+ return R { ok, { encaps, encaps + sz } };
+ };
+
+ try
+ {
+ prepare(operation, mode, context);
+ if(inParams.first == inParams.second)
+ {
+ _os.writeEmptyEncapsulation(_encoding);
+ }
+ else
+ {
+ _os.writeEncapsulation(inParams.first, static_cast<Ice::Int>(inParams.second - inParams.first));
+ }
+ OutgoingAsync::invoke(operation);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ abort(ex);
+ }
+ }
protected:
- void exception(const ::Ice::AsyncResultPtr&, const ::Ice::Exception& ex) const;
+ std::function<R(bool, Ice::InputStream*)> _read;
+};
+
+template<typename R>
+class InvokeLambdaOutgoing : public InvokeOutgoingAsyncT<R>, public LambdaInvoke
+{
+public:
+
+ InvokeLambdaOutgoing(const ::std::shared_ptr<::Ice::ObjectPrx>& proxy,
+ ::std::function<void(R)> response,
+ ::std::function<void(::std::exception_ptr)> ex,
+ ::std::function<void(bool)> sent) :
+ InvokeOutgoingAsyncT<R>(proxy, false), LambdaInvoke(::std::move(ex), ::std::move(sent))
+ {
+ if(response)
+ {
+ _response = [this, response](bool ok)
+ {
+ if(this->_is.b.empty())
+ {
+ response(R { ok, { 0, 0 }});
+ }
+ else
+ {
+ response(this->_read(ok, &this->_is));
+ }
+ };
+ }
+ }
+};
+
+template<typename P, typename R>
+class InvokePromiseOutgoing : public InvokeOutgoingAsyncT<R>, public PromiseInvoke<P>
+{
+public:
+
+ InvokePromiseOutgoing(const std::shared_ptr<Ice::ObjectPrx>& proxy, bool synchronous) :
+ InvokeOutgoingAsyncT<R>(proxy, false)
+ {
+ this->_synchronous = synchronous;
+ this->_response = [this](bool ok)
+ {
+ if(this->_is.b.empty())
+ {
+ this->_promise.set_value(R { ok, { 0, 0 }});
+ }
+ else
+ {
+ this->_promise.set_value(this->_read(ok, &this->_is));
+ }
+ };
+ }
- ::std::function<void (const ::Ice::Exception&)> _exception;
- ::std::function<void (bool)> _sent;
+ virtual bool handleSent(bool done, bool) override
+ {
+ if(done)
+ {
+ this->_promise.set_value(R { true, { 0, 0 }});
+ }
+ return false;
+ }
};
-class ICE_API Cpp11FnOnewayCallbackNC : public Cpp11FnCallbackNC
+class ProxyGetConnectionLambda : public ProxyGetConnection, public LambdaInvoke
{
public:
- Cpp11FnOnewayCallbackNC(const ::std::function<void ()>&,
- const ::std::function<void (const ::Ice::Exception&)>&,
- const ::std::function<void (bool)>&);
+ ProxyGetConnectionLambda(const ::std::shared_ptr<::Ice::ObjectPrx>& proxy,
+ ::std::function<void(::std::shared_ptr<Ice::Connection>)> response,
+ ::std::function<void(::std::exception_ptr)> ex,
+ ::std::function<void(bool)> sent) :
+ ProxyGetConnection(proxy), LambdaInvoke(::std::move(ex), ::std::move(sent))
+ {
+ _response = [&, response](bool)
+ {
+ response(getConnection());
+ };
+ }
+};
+
+template<typename P>
+class ProxyGetConnectionPromise : public ProxyGetConnection, public PromiseInvoke<P>
+{
+public:
- virtual void
- completed(const ::Ice::AsyncResultPtr&) const;
+ ProxyGetConnectionPromise(const ::std::shared_ptr<::Ice::ObjectPrx>& proxy) : ProxyGetConnection(proxy)
+ {
+ this->_response = [&](bool)
+ {
+ this->_promise.set_value(getConnection());
+ };
+ }
+};
-private:
+class ProxyFlushBatchLambda : public ProxyFlushBatchAsync, public LambdaInvoke
+{
+public:
- ::std::function<void ()> _cb;
+ ProxyFlushBatchLambda(const ::std::shared_ptr<::Ice::ObjectPrx>& proxy,
+ ::std::function<void(::std::exception_ptr)> ex,
+ ::std::function<void(bool)> sent) :
+ ProxyFlushBatchAsync(proxy), LambdaInvoke(::std::move(ex), ::std::move(sent))
+ {
+ }
+};
+
+template<typename P>
+class ProxyFlushBatchPromise : public ProxyFlushBatchAsync, public PromiseInvoke<P>
+{
+public:
+
+ using ProxyFlushBatchAsync::ProxyFlushBatchAsync;
+
+ virtual bool handleSent(bool, bool) override
+ {
+ this->_promise.set_value(_sentSynchronously);
+ return false;
+ }
};
}
-#endif
-namespace IceProxy { namespace Ice
+namespace Ice
{
-class ICE_API Object : public ::IceUtil::Shared
+class RouterPrx;
+using RouterPrxPtr = ::std::shared_ptr<::Ice::RouterPrx>;
+
+class LocatorPrx;
+using LocatorPrxPtr = ::std::shared_ptr<::Ice::LocatorPrx>;
+
+class LocalException;
+class OutputStream;
+
+class ICE_API ObjectPrx : public ::std::enable_shared_from_this<ObjectPrx>
{
public:
- bool operator==(const Object&) const;
- bool operator!=(const Object&) const;
- bool operator<(const Object&) const;
+ virtual ~ObjectPrx() = default;
- ::Ice::CommunicatorPtr ice_getCommunicator() const;
+ friend ICE_API bool operator<(const ObjectPrx&, const ObjectPrx&);
+ friend ICE_API bool operator==(const ObjectPrx&, const ObjectPrx&);
+
+ ::std::shared_ptr<::Ice::Communicator> ice_getCommunicator() const;
::std::string ice_toString() const;
- bool ice_isA(const ::std::string& typeId)
+ bool
+ ice_isA(const ::std::string& typeId, const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return ice_isA(typeId, 0);
+ return _makePromiseOutgoing<bool>(true, this, &ObjectPrx::_iceI_isA, typeId, context).get();
}
- bool ice_isA(const ::std::string& typeId, const ::Ice::Context& context)
+
+ ::std::function<void()>
+ ice_isAAsync(const ::std::string& typeId,
+ ::std::function<void(bool)> response,
+ ::std::function<void(::std::exception_ptr)> ex = nullptr,
+ ::std::function<void(bool)> sent = nullptr,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return ice_isA(typeId, &context);
+ return _makeLamdaOutgoing<bool>(response, ex, sent, this, &ObjectPrx::_iceI_isA, typeId, context);
}
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr
- begin_ice_isA(const ::std::string& typeId,
- const ::Ice::Context& ctx,
- const ::IceInternal::Function<void (bool)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ template<template<typename> class P = std::promise> auto
+ ice_isAAsync(const ::std::string& typeId, const ::Ice::Context& context = ::Ice::noExplicitContext)
+ -> decltype(std::declval<P<bool>>().get_future())
{
- return __begin_ice_isA(typeId, &ctx, response, exception, sent);
+ return _makePromiseOutgoing<bool, P>(false, this, &ObjectPrx::_iceI_isA, typeId, context);
}
- ::Ice::AsyncResultPtr
- begin_ice_isA(const ::std::string& typeId,
- const ::IceInternal::Function<void (bool)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ void
+ _iceI_isA(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<bool>>&, const ::std::string&, const ::Ice::Context&);
+
+ void
+ ice_ping(const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return __begin_ice_isA(typeId, 0, response, exception, sent);
+ _makePromiseOutgoing<void>(true, this, &ObjectPrx::_iceI_ping, context).get();
}
- ::Ice::AsyncResultPtr
- begin_ice_isA(const ::std::string& typeId,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& sent =
- ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>())
+ ::std::function<void()>
+ ice_pingAsync(::std::function<void()> response,
+ ::std::function<void(::std::exception_ptr)> ex = nullptr,
+ ::std::function<void(bool)> sent = nullptr,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return begin_ice_isA(typeId, 0, ::Ice::newCallback(completed, sent), 0);
+ return _makeLamdaOutgoing<void>(response, ex, sent, this, &ObjectPrx::_iceI_ping, context);
}
- ::Ice::AsyncResultPtr
- begin_ice_isA(const ::std::string& typeId,
- const ::Ice::Context& ctx,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& sent =
- ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>())
+ template<template<typename> class P = std::promise>
+ auto ice_pingAsync(const ::Ice::Context& context = ::Ice::noExplicitContext)
+ -> decltype(std::declval<P<void>>().get_future())
{
- return begin_ice_isA(typeId, &ctx, ::Ice::newCallback(completed, sent), 0);
+ return _makePromiseOutgoing<void, P>(false, this, &ObjectPrx::_iceI_ping, context);
}
-#endif
- ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId)
+ void
+ _iceI_ping(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<void>>&, const ::Ice::Context&);
+
+ ::std::vector<::std::string>
+ ice_ids(const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return begin_ice_isA(typeId, 0, ::IceInternal::__dummyCallback, 0);
+ return _makePromiseOutgoing<::std::vector<::std::string>>(true, this, &ObjectPrx::_iceI_ids, context).get();
}
- ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId, const ::Ice::Context& __ctx)
+ ::std::function<void()>
+ ice_idsAsync(::std::function<void(::std::vector<::std::string>)> response,
+ ::std::function<void(::std::exception_ptr)> ex = nullptr,
+ ::std::function<void(bool)> sent = nullptr,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return begin_ice_isA(typeId, &__ctx, ::IceInternal::__dummyCallback, 0);
+ return _makeLamdaOutgoing<::std::vector<::std::string>>(response, ex, sent, this, &ObjectPrx::_iceI_ids, context);
}
- ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId,
- const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ template<template<typename> class P = std::promise> auto
+ ice_idsAsync(const ::Ice::Context& context = ::Ice::noExplicitContext)
+ -> decltype(std::declval<P<::std::vector<::std::string>>>().get_future())
{
- return begin_ice_isA(typeId, 0, __del, __cookie);
+ return _makePromiseOutgoing<::std::vector<::std::string>, P>(false, this, &ObjectPrx::_iceI_ids, context);
}
- ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId,
- const ::Ice::Context& __ctx,
- const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ void
+ _iceI_ids(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::std::vector<::std::string>>>&, const ::Ice::Context&);
+
+ ::std::string
+ ice_id(const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return begin_ice_isA(typeId, &__ctx, __del, __cookie);
+ return _makePromiseOutgoing<::std::string>(true, this, &ObjectPrx::_iceI_id, context).get();
}
- ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId,
- const ::Ice::Callback_Object_ice_isAPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ ::std::function<void()>
+ ice_idAsync(::std::function<void(::std::string)> response,
+ ::std::function<void(::std::exception_ptr)> ex = nullptr,
+ ::std::function<void(bool)> sent = nullptr,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return begin_ice_isA(typeId, 0, __del, __cookie);
+ return _makeLamdaOutgoing<::std::string>(response, ex, sent, this, &ObjectPrx::_iceI_id, context);
}
- ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId,
- const ::Ice::Context& __ctx,
- const ::Ice::Callback_Object_ice_isAPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ template<template<typename> class P = std::promise>
+ auto ice_idAsync(const ::Ice::Context& context = ::Ice::noExplicitContext)
+ -> decltype(std::declval<P<::std::string>>().get_future())
{
- return begin_ice_isA(typeId, &__ctx, __del, __cookie);
+ return _makePromiseOutgoing<::std::string, P>(false, this, &ObjectPrx::_iceI_id, context);
}
- bool end_ice_isA(const ::Ice::AsyncResultPtr&);
+ void
+ _iceI_id(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::std::string>>&, const ::Ice::Context&);
- void ice_ping()
+ static const ::std::string& ice_staticId()
{
- ice_ping(0);
+ return ::Ice::Object::ice_staticId();
}
- void ice_ping(const ::Ice::Context& context)
+
+
+ //
+ // ice_invoke with default vector mapping for byte-sequence parameters
+ //
+
+ bool
+ ice_invoke(const ::std::string& operation,
+ ::Ice::OperationMode mode,
+ const ::std::vector<Byte>& inP,
+ ::std::vector<::Ice::Byte>& outParams,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- ice_ping(&context);
+ return ice_invoke(operation, mode, ::IceInternal::makePair(inP), outParams, context);
}
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr
- begin_ice_ping(const ::IceInternal::Function<void ()>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ template<template<typename> class P = std::promise> auto
+ ice_invokeAsync(const ::std::string& operation,
+ ::Ice::OperationMode mode,
+ const ::std::vector<Byte>& inP,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
+ -> decltype(std::declval<P<::Ice::Object::Ice_invokeResult>>().get_future())
{
- return __begin_ice_ping(0, response, exception, sent);
+ return ice_invokeAsync<P>(operation, mode, ::IceInternal::makePair(inP), context);
}
- ::Ice::AsyncResultPtr
- begin_ice_ping(const ::Ice::Context& ctx,
- const ::IceInternal::Function<void ()>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ ::std::function<void()>
+ ice_invokeAsync(const ::std::string& operation,
+ ::Ice::OperationMode mode,
+ const ::std::vector<::Ice::Byte>& inP,
+ ::std::function<void(bool, ::std::vector<::Ice::Byte>)> response,
+ ::std::function<void(::std::exception_ptr)> ex = nullptr,
+ ::std::function<void(bool)> sent = nullptr,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
+ {
+ using Outgoing = ::IceInternal::InvokeLambdaOutgoing<::Ice::Object::Ice_invokeResult>;
+ ::std::function<void(::Ice::Object::Ice_invokeResult&&)> r;
+ if(response)
+ {
+ r = [response](::Ice::Object::Ice_invokeResult&& result)
+ {
+ response(result.returnValue, std::move(result.outParams));
+ };
+ }
+ auto outAsync = ::std::make_shared<Outgoing>(shared_from_this(), r, ex, sent);
+ outAsync->invoke(operation, mode, ::IceInternal::makePair(inP), context);
+ return [outAsync]() { outAsync->cancel(); };
+ }
+
+
+ //
+ // ice_invoke with cpp:array mapping for byte sequence parameters
+ //
+
+ bool
+ ice_invoke(const ::std::string& operation,
+ ::Ice::OperationMode mode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inP,
+ ::std::vector<::Ice::Byte>& outParams,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return __begin_ice_ping(&ctx, response, exception, sent);
+ using Outgoing = ::IceInternal::InvokePromiseOutgoing<
+ ::std::promise<::Ice::Object::Ice_invokeResult>, ::Ice::Object::Ice_invokeResult>;
+ auto outAsync = ::std::make_shared<Outgoing>(shared_from_this(), true);
+ outAsync->invoke(operation, mode, inP, context);
+ auto result = outAsync->getFuture().get();
+ outParams.swap(result.outParams);
+ return result.returnValue;
}
- ::Ice::AsyncResultPtr
- begin_ice_ping(const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& sent =
- ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>())
+ template<template<typename> class P = std::promise> auto
+ ice_invokeAsync(const ::std::string& operation,
+ ::Ice::OperationMode mode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inP,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
+ -> decltype(std::declval<P<::Ice::Object::Ice_invokeResult>>().get_future())
{
- return begin_ice_ping(0, ::Ice::newCallback(completed, sent), 0);
+ using Outgoing =
+ ::IceInternal::InvokePromiseOutgoing<P<::Ice::Object::Ice_invokeResult>, ::Ice::Object::Ice_invokeResult>;
+ auto outAsync = ::std::make_shared<Outgoing>(shared_from_this(), false);
+ outAsync->invoke(operation, mode, inP, context);
+ return outAsync->getFuture();
}
- ::Ice::AsyncResultPtr
- begin_ice_ping(const ::Ice::Context& ctx,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& sent =
- ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>())
+ ::std::function<void()>
+ ice_invokeAsync(const ::std::string& operation,
+ ::Ice::OperationMode mode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inP,
+ ::std::function<void(bool, ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>)> response,
+ ::std::function<void(::std::exception_ptr)> ex = nullptr,
+ ::std::function<void(bool)> sent = nullptr,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return begin_ice_ping(&ctx, ::Ice::newCallback(completed, sent), 0);
+ using Result = ::std::tuple<bool, ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>>;
+ using Outgoing = ::IceInternal::InvokeLambdaOutgoing<Result>;
+
+ ::std::function<void(Result&&)> r;
+ if(response)
+ {
+ r = [response](Result&& result)
+ {
+ response(::std::get<0>(result), ::std::move(::std::get<1>(result)));
+ };
+ }
+ auto outAsync = ::std::make_shared<Outgoing>(shared_from_this(), r, ex, sent);
+ outAsync->invoke(operation, mode, inP, context);
+ return [outAsync]() { outAsync->cancel(); };
}
-#endif
- ::Ice::AsyncResultPtr begin_ice_ping()
+
+ ::Ice::Identity ice_getIdentity() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_identity(const ::Ice::Identity&) const;
+
+ ::Ice::Context ice_getContext() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_context(const ::Ice::Context&) const;
+
+ const ::std::string& ice_getFacet() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_facet(const ::std::string&) const;
+
+ ::std::string ice_getAdapterId() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_adapterId(const ::std::string&) const;
+
+ ::Ice::EndpointSeq ice_getEndpoints() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_endpoints(const ::Ice::EndpointSeq&) const;
+
+ ::Ice::Int ice_getLocatorCacheTimeout() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_locatorCacheTimeout(::Ice::Int) const;
+
+ bool ice_isConnectionCached() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_connectionCached(bool) const;
+
+ ::Ice::EndpointSelectionType ice_getEndpointSelection() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_endpointSelection(::Ice::EndpointSelectionType) const;
+
+ bool ice_isSecure() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_secure(bool) const;
+
+ ::Ice::EncodingVersion ice_getEncodingVersion() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_encodingVersion(const ::Ice::EncodingVersion&) const;
+
+ bool ice_isPreferSecure() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_preferSecure(bool) const;
+
+ ::std::shared_ptr<::Ice::RouterPrx> ice_getRouter() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_router(const ::std::shared_ptr<::Ice::RouterPrx>&) const;
+
+ ::std::shared_ptr<::Ice::LocatorPrx> ice_getLocator() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_locator(const ::std::shared_ptr<::Ice::LocatorPrx>&) const;
+
+ bool ice_isCollocationOptimized() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_collocationOptimized(bool) const;
+
+ ::Ice::Int ice_getInvocationTimeout() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_invocationTimeout(::Ice::Int) const;
+
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_twoway() const;
+ bool ice_isTwoway() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_oneway() const;
+ bool ice_isOneway() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_batchOneway() const;
+ bool ice_isBatchOneway() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_datagram() const;
+ bool ice_isDatagram() const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_batchDatagram() const;
+ bool ice_isBatchDatagram() const;
+
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_compress(bool) const;
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_timeout(int) const;
+
+ ::std::shared_ptr<::Ice::ObjectPrx> ice_connectionId(const ::std::string&) const;
+ ::std::string ice_getConnectionId() const;
+
+ ::std::shared_ptr<::Ice::Connection>
+ ice_getConnection()
{
- return begin_ice_ping(0, ::IceInternal::__dummyCallback, 0);
+ return ice_getConnectionAsync().get();
}
- ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& __ctx)
+ ::std::function<void()>
+ ice_getConnectionAsync(::std::function<void(::std::shared_ptr<::Ice::Connection>)> response,
+ ::std::function<void(::std::exception_ptr)> ex = nullptr,
+ ::std::function<void(bool)> sent = nullptr)
{
- return begin_ice_ping(&__ctx, ::IceInternal::__dummyCallback, 0);
+ using LambdaOutgoing = ::IceInternal::ProxyGetConnectionLambda;
+ auto outAsync = ::std::make_shared<LambdaOutgoing>(shared_from_this(), response, ex, sent);
+ _iceI_getConnection(outAsync);
+ return [outAsync]() { outAsync->cancel(); };
}
- ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ template<template<typename> class P = std::promise> auto
+ ice_getConnectionAsync() -> decltype(std::declval<P<::std::shared_ptr<::Ice::Connection>>>().get_future())
{
- return begin_ice_ping(0, __del, __cookie);
+ using PromiseOutgoing = ::IceInternal::ProxyGetConnectionPromise<P<::std::shared_ptr<::Ice::Connection>>>;
+ auto outAsync = ::std::make_shared<PromiseOutgoing>(shared_from_this());
+ _iceI_getConnection(outAsync);
+ return outAsync->getFuture();
}
- ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& __ctx, const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ void _iceI_getConnection(const ::std::shared_ptr<::IceInternal::ProxyGetConnection>&);
+
+ ::std::shared_ptr<::Ice::Connection> ice_getCachedConnection() const;
+
+ bool ice_flushBatchRequests()
{
- return begin_ice_ping(&__ctx, __del, __cookie);
+ return ice_flushBatchRequestsAsync().get();
}
+ std::function<void()>
+ ice_flushBatchRequestsAsync(::std::function<void(::std::exception_ptr)> ex,
+ ::std::function<void(bool)> sent = nullptr)
+ {
+ using LambdaOutgoing = ::IceInternal::ProxyFlushBatchLambda;
+ auto outAsync = ::std::make_shared<LambdaOutgoing>(shared_from_this(), ex, sent);
+ _iceI_flushBatchRequests(outAsync);
+ return [outAsync]() { outAsync->cancel(); };
+ }
- ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Callback_Object_ice_pingPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ template<template<typename> class P = std::promise> auto
+ ice_flushBatchRequestsAsync() -> decltype(std::declval<P<bool>>().get_future())
{
- return begin_ice_ping(0, __del, __cookie);
+ using PromiseOutgoing = ::IceInternal::ProxyFlushBatchPromise<P<bool>>;
+ auto outAsync = ::std::make_shared<PromiseOutgoing>(shared_from_this());
+ _iceI_flushBatchRequests(outAsync);
+ return outAsync->getFuture();
}
- ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& __ctx, const ::Ice::Callback_Object_ice_pingPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ void _iceI_flushBatchRequests(const ::std::shared_ptr<::IceInternal::ProxyFlushBatchAsync>&);
+
+ const ::IceInternal::ReferencePtr& _getReference() const { return _reference; }
+
+ void _copyFrom(const std::shared_ptr<::Ice::ObjectPrx>&);
+
+ int _handleException(const ::Ice::Exception&, const ::IceInternal::RequestHandlerPtr&, ::Ice::OperationMode,
+ bool, int&);
+
+ void _checkTwowayOnly(const ::std::string&) const;
+
+ ::IceInternal::RequestHandlerPtr _getRequestHandler();
+ ::IceInternal::BatchRequestQueuePtr _getBatchRequestQueue();
+ ::IceInternal::RequestHandlerPtr _setRequestHandler(const ::IceInternal::RequestHandlerPtr&);
+ void _updateRequestHandler(const ::IceInternal::RequestHandlerPtr&, const ::IceInternal::RequestHandlerPtr&);
+
+ int _hash() const;
+
+ void _write(OutputStream&) const;
+
+protected:
+
+ template<typename R, template<typename> class P = ::std::promise, typename Obj, typename Fn, typename... Args>
+ auto _makePromiseOutgoing(bool sync, Obj obj, Fn fn, Args&&... args)
+ -> decltype(std::declval<P<R>>().get_future())
{
- return begin_ice_ping(&__ctx, __del, __cookie);
+ auto outAsync = ::std::make_shared<::IceInternal::PromiseOutgoing<P<R>, R>>(shared_from_this(), sync);
+ (obj->*fn)(outAsync, std::forward<Args>(args)...);
+ return outAsync->getFuture();
}
- void end_ice_ping(const ::Ice::AsyncResultPtr&);
+ template<typename R, typename Re, typename E, typename S, typename Obj, typename Fn, typename... Args>
+ ::std::function<void()> _makeLamdaOutgoing(Re r, E e, S s, Obj obj, Fn fn, Args&&... args)
+ {
+ auto outAsync = ::std::make_shared<::IceInternal::LambdaOutgoing<R>>(shared_from_this(), r, e, s);
+ (obj->*fn)(outAsync, std::forward<Args>(args)...);
+ return [outAsync]() { outAsync->cancel(); };
+ }
+
+ virtual ::std::shared_ptr<ObjectPrx> _newInstance() const;
+ ObjectPrx() = default;
+ friend ::std::shared_ptr<ObjectPrx> IceInternal::createProxy<ObjectPrx>();
- ::std::vector< ::std::string> ice_ids()
+private:
+
+ void setup(const ::IceInternal::ReferencePtr&);
+ friend class ::IceInternal::ProxyFactory;
+
+ ::IceInternal::ReferencePtr _reference;
+ ::IceInternal::RequestHandlerPtr _requestHandler;
+ ::IceInternal::BatchRequestQueuePtr _batchRequestQueue;
+ IceUtil::Mutex _mutex;
+};
+
+inline bool
+operator>(const ObjectPrx& lhs, const ObjectPrx& rhs)
+{
+ return rhs < lhs;
+}
+
+inline bool
+operator<=(const ObjectPrx& lhs, const ObjectPrx& rhs)
+{
+ return !(lhs > rhs);
+}
+
+inline bool
+operator>=(const ObjectPrx& lhs, const ObjectPrx& rhs)
+{
+ return !(lhs < rhs);
+}
+
+inline bool
+operator!=(const ObjectPrx& lhs, const ObjectPrx& rhs)
+{
+ return !(lhs == rhs);
+}
+
+template<typename Prx, typename... Bases>
+class Proxy : public virtual Bases...
+{
+public:
+
+ ::std::shared_ptr<Prx> ice_context(const ::Ice::Context& context) const
{
- return ice_ids(0);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_context(context));
}
- ::std::vector< ::std::string> ice_ids(const ::Ice::Context& context)
+
+ ::std::shared_ptr<Prx> ice_adapterId(const ::std::string& id) const
{
- return ice_ids(&context);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_adapterId(id));
}
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr
- begin_ice_ids(const ::IceInternal::Function<void (const ::std::vector< ::std::string>&)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ ::std::shared_ptr<Prx> ice_endpoints(const ::Ice::EndpointSeq& endpoints) const
{
- return __begin_ice_ids(0, response, exception, sent);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_endpoints(endpoints));
}
- ::Ice::AsyncResultPtr
- begin_ice_ids(const ::Ice::Context& ctx,
- const ::IceInternal::Function<void (const ::std::vector< ::std::string>&)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ ::std::shared_ptr<Prx> ice_locatorCacheTimeout(int timeout) const
{
- return __begin_ice_ids(&ctx, response, exception, sent);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_locatorCacheTimeout(timeout));
}
- ::Ice::AsyncResultPtr
- begin_ice_ids(const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& sent =
- ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>())
+ ::std::shared_ptr<Prx> ice_connectionCached(bool cached) const
{
- return begin_ice_ids(0, ::Ice::newCallback(completed, sent), 0);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_connectionCached(cached));
}
- ::Ice::AsyncResultPtr
- begin_ice_ids(const ::Ice::Context& ctx,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& sent =
- ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>())
+ ::std::shared_ptr<Prx> ice_endpointSelection(::Ice::EndpointSelectionType selection) const
{
- return begin_ice_ids(&ctx, ::Ice::newCallback(completed, sent), 0);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_endpointSelection(selection));
}
-#endif
- ::Ice::AsyncResultPtr begin_ice_ids()
+ ::std::shared_ptr<Prx> ice_secure(bool secure) const
{
- return begin_ice_ids(0, ::IceInternal::__dummyCallback, 0);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_secure(secure));
}
- ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& __ctx)
+ ::std::shared_ptr<Prx> ice_preferSecure(bool preferSecure) const
{
- return begin_ice_ids(&__ctx, ::IceInternal::__dummyCallback, 0);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_preferSecure(preferSecure));
}
- ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ ::std::shared_ptr<Prx> ice_router(const ::std::shared_ptr<::Ice::RouterPrx>& router) const
{
- return begin_ice_ids(0, __del, __cookie);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_router(router));
}
- ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& __ctx,
- const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ ::std::shared_ptr<Prx> ice_locator(const ::std::shared_ptr<::Ice::LocatorPrx>& locator) const
{
- return begin_ice_ids(&__ctx, __del, __cookie);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_locator(locator));
}
- ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Callback_Object_ice_idsPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ ::std::shared_ptr<Prx> ice_collocationOptimized(bool collocated) const
{
- return begin_ice_ids(0, __del, __cookie);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_collocationOptimized(collocated));
}
- ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& __ctx,
- const ::Ice::Callback_Object_ice_idsPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ ::std::shared_ptr<Prx> ice_invocationTimeout(int timeout) const
{
- return begin_ice_ids(&__ctx, __del, __cookie);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_invocationTimeout(timeout));
}
- ::std::vector< ::std::string> end_ice_ids(const ::Ice::AsyncResultPtr&);
+ ::std::shared_ptr<Prx> ice_twoway() const
+ {
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_twoway());
+ }
- ::std::string ice_id()
+ ::std::shared_ptr<Prx> ice_oneway() const
{
- return ice_id(0);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_oneway());
}
- ::std::string ice_id(const ::Ice::Context& context)
+
+ ::std::shared_ptr<Prx> ice_batchOneway() const
{
- return ice_id(&context);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_batchOneway());
}
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr
- begin_ice_id(const ::IceInternal::Function<void (const ::std::string&)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ ::std::shared_ptr<Prx> ice_datagram() const
{
- return __begin_ice_id(0, response, exception, sent);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_datagram());
}
- ::Ice::AsyncResultPtr
- begin_ice_id(const ::Ice::Context& ctx,
- const ::IceInternal::Function<void (const ::std::string&)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ ::std::shared_ptr<Prx> ice_batchDatagram() const
{
- return __begin_ice_id(&ctx, response, exception, sent);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_batchDatagram());
}
- ::Ice::AsyncResultPtr
- begin_ice_id(const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& sent =
- ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>())
+ ::std::shared_ptr<Prx> ice_compress(bool compress) const
{
- return begin_ice_id(0, ::Ice::newCallback(completed, sent), 0);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_compress(compress));
}
- ::Ice::AsyncResultPtr
- begin_ice_id(const ::Ice::Context& ctx,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed,
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& sent =
- ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>())
+ ::std::shared_ptr<Prx> ice_timeout(int timeout) const
{
- return begin_ice_id(&ctx, ::Ice::newCallback(completed, sent), 0);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_timeout(timeout));
}
-#endif
- ::Ice::AsyncResultPtr begin_ice_id()
+ ::std::shared_ptr<Prx> ice_connectionId(const ::std::string& id) const
{
- return begin_ice_id(0, ::IceInternal::__dummyCallback, 0);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_connectionId(id));
}
- ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& __ctx)
+ ::std::shared_ptr<Prx> ice_encodingVersion(const ::Ice::EncodingVersion& version) const
{
- return begin_ice_id(&__ctx, ::IceInternal::__dummyCallback, 0);
+ return ::std::dynamic_pointer_cast<Prx>(ObjectPrx::ice_encodingVersion(version));
}
- ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+protected:
+
+ virtual ::std::shared_ptr<ObjectPrx> _newInstance() const = 0;
+};
+
+ICE_API ::std::ostream& operator<<(::std::ostream&, const ::Ice::ObjectPrx&);
+
+ICE_API bool proxyIdentityLess(const ::std::shared_ptr<ObjectPrx>&, const ::std::shared_ptr<ObjectPrx>&);
+ICE_API bool proxyIdentityEqual(const ::std::shared_ptr<ObjectPrx>&, const ::std::shared_ptr<ObjectPrx>&);
+
+ICE_API bool proxyIdentityAndFacetLess(const ::std::shared_ptr<ObjectPrx>&, const ::std::shared_ptr<ObjectPrx>&);
+ICE_API bool proxyIdentityAndFacetEqual(const ::std::shared_ptr<ObjectPrx>&, const ::std::shared_ptr<ObjectPrx>&);
+
+struct ProxyIdentityLess : std::binary_function<bool, ::std::shared_ptr<ObjectPrx>&, ::std::shared_ptr<ObjectPrx>&>
+{
+ bool operator()(const ::std::shared_ptr<ObjectPrx>& lhs, const ::std::shared_ptr<ObjectPrx>& rhs) const
{
- return begin_ice_id(0, __del, __cookie);
+ return proxyIdentityLess(lhs, rhs);
}
+};
- ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& __ctx,
- const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+struct ProxyIdentityEqual : std::binary_function<bool, ::std::shared_ptr<ObjectPrx>&, ::std::shared_ptr<ObjectPrx>&>
+{
+ bool operator()(const ::std::shared_ptr<ObjectPrx>& lhs, const ::std::shared_ptr<ObjectPrx>& rhs) const
{
- return begin_ice_id(&__ctx, __del, __cookie);
+ return proxyIdentityEqual(lhs, rhs);
}
+};
- ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Callback_Object_ice_idPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+struct ProxyIdentityAndFacetLess : std::binary_function<bool, ::std::shared_ptr<ObjectPrx>&, ::std::shared_ptr<ObjectPrx>&>
+{
+ bool operator()(const ::std::shared_ptr<ObjectPrx>& lhs, const ::std::shared_ptr<ObjectPrx>& rhs) const
{
- return begin_ice_id(0, __del, __cookie);
+ return proxyIdentityAndFacetLess(lhs, rhs);
}
+};
- ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& __ctx,
- const ::Ice::Callback_Object_ice_idPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+struct ProxyIdentityAndFacetEqual : std::binary_function<bool, ::std::shared_ptr<ObjectPrx>&, ::std::shared_ptr<ObjectPrx>&>
+{
+ bool operator()(const ::std::shared_ptr<ObjectPrx>& lhs, const ::std::shared_ptr<ObjectPrx>& rhs) const
{
- return begin_ice_id(&__ctx, __del, __cookie);
+ return proxyIdentityAndFacetEqual(lhs, rhs);
}
+};
- ::std::string end_ice_id(const ::Ice::AsyncResultPtr&);
+template<typename P,
+ typename T,
+ typename ::std::enable_if<::std::is_base_of<::Ice::ObjectPrx, P>::value>::type* = nullptr,
+ typename ::std::enable_if<::std::is_base_of<::Ice::ObjectPrx, T>::value>::type* = nullptr> ::std::shared_ptr<P>
+uncheckedCast(const ::std::shared_ptr<T>& b)
+{
+ ::std::shared_ptr<P> r;
+ if(b)
+ {
+ r = ::std::dynamic_pointer_cast<P>(b);
+ if(!r)
+ {
+ r = IceInternal::createProxy<P>();
+ r->_copyFrom(b);
+ }
+ }
+ return r;
+}
+template<typename P,
+ typename T,
+ typename ::std::enable_if<::std::is_base_of<::Ice::ObjectPrx, P>::value>::type* = nullptr,
+ typename ::std::enable_if<::std::is_base_of<::Ice::ObjectPrx, T>::value>::type* = nullptr> ::std::shared_ptr<P>
+uncheckedCast(const ::std::shared_ptr<T>& b, const std::string& f)
+{
+ ::std::shared_ptr<P> r;
+ if(b)
+ {
+ r = IceInternal::createProxy<P>();
+ r->_copyFrom(b->ice_facet(f));
+ }
+ return r;
+}
- static const ::std::string& ice_staticId()
+template<typename P,
+ typename T,
+ typename ::std::enable_if<::std::is_base_of<::Ice::ObjectPrx, P>::value>::type* = nullptr,
+ typename ::std::enable_if<::std::is_base_of<::Ice::ObjectPrx, T>::value>::type* = nullptr> ::std::shared_ptr<P>
+checkedCast(const ::std::shared_ptr<T>& b, const ::Ice::Context& context = Ice::noExplicitContext)
+{
+ ::std::shared_ptr<P> r;
+ if(b)
{
- return ::Ice::Object::ice_staticId();
+ if(b->ice_isA(P::ice_staticId(), context))
+ {
+ r = IceInternal::createProxy<P>();
+ r->_copyFrom(b);
+ }
+ }
+ return r;
+}
+
+template<typename P,
+ typename T,
+ typename ::std::enable_if<::std::is_base_of<::Ice::ObjectPrx, P>::value>::type* = nullptr,
+ typename ::std::enable_if<::std::is_base_of<::Ice::ObjectPrx, T>::value>::type* = nullptr> ::std::shared_ptr<P>
+checkedCast(const ::std::shared_ptr<T>& b, const std::string& f, const ::Ice::Context& context = Ice::noExplicitContext)
+{
+ ::std::shared_ptr<P> r;
+ if(b)
+ {
+ try
+ {
+ ::std::shared_ptr<::Ice::ObjectPrx> bb = b->ice_facet(f);
+ if(bb->ice_isA(P::ice_staticId(), context))
+ {
+ r = IceInternal::createProxy<P>();
+ r->_copyFrom(bb);
+ }
+ }
+ catch(const Ice::FacetNotExistException&)
+ {
+ }
}
+ return r;
+}
+ICE_API ::std::ostream& operator<<(::std::ostream&, const Ice::ObjectPrx&);
- // Returns true if ok, false if user exception.
- bool ice_invoke(const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::vector< ::Ice::Byte>& inParams,
- ::std::vector< ::Ice::Byte>& outParams)
+}
+
+#else // C++98 mapping
+
+namespace IceProxy
+{
+
+namespace Ice
+{
+
+class Locator;
+ICE_API ::IceProxy::Ice::Object* upCast(::IceProxy::Ice::Locator*);
+
+class Router;
+ICE_API ::IceProxy::Ice::Object* upCast(::IceProxy::Ice::Router*);
+
+}
+
+}
+
+namespace Ice
+{
+
+typedef ::IceInternal::ProxyHandle< ::IceProxy::Ice::Router> RouterPrx;
+typedef RouterPrx RouterPrxPtr;
+typedef ::IceInternal::ProxyHandle< ::IceProxy::Ice::Locator> LocatorPrx;
+typedef LocatorPrx LocatorPrxPtr;
+
+class LocalException;
+class OutputStream;
+
+class Callback_Object_ice_isA_Base : public virtual ::IceInternal::CallbackBase { };
+typedef ::IceUtil::Handle< Callback_Object_ice_isA_Base> Callback_Object_ice_isAPtr;
+
+class Callback_Object_ice_ping_Base : public virtual ::IceInternal::CallbackBase { };
+typedef ::IceUtil::Handle< Callback_Object_ice_ping_Base> Callback_Object_ice_pingPtr;
+
+class Callback_Object_ice_ids_Base : public virtual ::IceInternal::CallbackBase { };
+typedef ::IceUtil::Handle< Callback_Object_ice_ids_Base> Callback_Object_ice_idsPtr;
+
+class Callback_Object_ice_id_Base : public virtual ::IceInternal::CallbackBase { };
+typedef ::IceUtil::Handle< Callback_Object_ice_id_Base> Callback_Object_ice_idPtr;
+
+class Callback_Object_ice_invoke_Base : public virtual ::IceInternal::CallbackBase { };
+typedef ::IceUtil::Handle< Callback_Object_ice_invoke_Base> Callback_Object_ice_invokePtr;
+
+class Callback_Object_ice_flushBatchRequests_Base : public virtual ::IceInternal::CallbackBase { };
+typedef ::IceUtil::Handle< Callback_Object_ice_flushBatchRequests_Base> Callback_Object_ice_flushBatchRequestsPtr;
+
+class Callback_Object_ice_getConnection_Base : public virtual ::IceInternal::CallbackBase { };
+typedef ::IceUtil::Handle< Callback_Object_ice_getConnection_Base> Callback_Object_ice_getConnectionPtr;
+
+}
+
+namespace IceProxy { namespace Ice
+{
+
+class ICE_API Object : public ::IceUtil::Shared
+{
+public:
+
+ bool operator==(const Object&) const;
+ bool operator<(const Object&) const;
+
+ ::Ice::CommunicatorPtr ice_getCommunicator() const;
+
+ ::std::string ice_toString() const;
+
+ bool ice_isA(const ::std::string& typeId, const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return ice_invoke(operation, mode, inParams, outParams, 0);
+ return end_ice_isA(_iceI_begin_ice_isA(typeId, context, ::IceInternal::dummyCallback, 0, true));
}
- bool ice_invoke(const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::vector< ::Ice::Byte>& inParams,
- ::std::vector< ::Ice::Byte>& outParams,
- const ::Ice::Context& context)
+ ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return ice_invoke(operation, mode, inParams, outParams, &context);
+ return _iceI_begin_ice_isA(typeId, context, ::IceInternal::dummyCallback, 0);
}
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr begin_ice_invoke(
- const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::vector< ::Ice::Byte>& inParams,
- const ::IceInternal::Function<void (bool, const ::std::vector< ::Ice::Byte>&)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId,
+ const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return __begin_ice_invoke(operation, mode, inParams, 0, response, exception, sent);
+ return _iceI_begin_ice_isA(typeId, ::Ice::noExplicitContext, del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(
- const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::vector< ::Ice::Byte>& inParams,
- const ::Ice::Context& ctx,
- const ::IceInternal::Function<void (bool, const ::std::vector< ::Ice::Byte>&)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId,
+ const ::Ice::Context& context,
+ const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return __begin_ice_invoke(operation, mode, inParams, &ctx, response, exception, sent);
+ return _iceI_begin_ice_isA(typeId, context, del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(
- const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- const ::IceInternal::Function<void (bool, const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId,
+ const ::Ice::Callback_Object_ice_isAPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return __begin_ice_invoke(operation, mode, inParams, 0, response, exception, sent);
+ return _iceI_begin_ice_isA(typeId, ::Ice::noExplicitContext, del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(
- const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- const ::Ice::Context& ctx,
- const ::IceInternal::Function<void (bool, const ::std::pair<const ::Ice::Byte*,
- const ::Ice::Byte*>&)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string& typeId,
+ const ::Ice::Context& context,
+ const ::Ice::Callback_Object_ice_isAPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return __begin_ice_invoke(operation, mode, inParams, &ctx, response, exception, sent);
+ return _iceI_begin_ice_isA(typeId, context, del, cookie);
+ }
+
+ bool end_ice_isA(const ::Ice::AsyncResultPtr&);
+
+ void ice_ping(const ::Ice::Context& context = ::Ice::noExplicitContext)
+ {
+ end_ice_ping(_iceI_begin_ice_ping(context, ::IceInternal::dummyCallback, 0, true));
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& context = ::Ice::noExplicitContext)
+ {
+ return _iceI_begin_ice_ping(context, ::IceInternal::dummyCallback, 0);
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::CallbackPtr& del, const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_ping(::Ice::noExplicitContext, del, cookie);
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& context, const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_ping(context, del, cookie);
+ }
+
+
+ ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Callback_Object_ice_pingPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_ping(::Ice::noExplicitContext, del, cookie);
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context& context, const ::Ice::Callback_Object_ice_pingPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_ping(context, del, cookie);
+ }
+
+ void end_ice_ping(const ::Ice::AsyncResultPtr&);
+
+ ::std::vector< ::std::string> ice_ids(const ::Ice::Context& context = ::Ice::noExplicitContext)
+ {
+ return end_ice_ids(_iceI_begin_ice_ids(context, ::IceInternal::dummyCallback, 0, true));
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& context = ::Ice::noExplicitContext)
+ {
+ return _iceI_begin_ice_ids(context, ::IceInternal::dummyCallback, 0);
}
-#endif
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_ids(::Ice::noExplicitContext, del, cookie);
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& context,
+ const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_ids(context, del, cookie);
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Callback_Object_ice_idsPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_ids(::Ice::noExplicitContext, del, cookie);
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context& context,
+ const ::Ice::Callback_Object_ice_idsPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_ids(context, del, cookie);
+ }
+
+ ::std::vector< ::std::string> end_ice_ids(const ::Ice::AsyncResultPtr&);
+
+ ::std::string ice_id(const ::Ice::Context& context = ::Ice::noExplicitContext)
+ {
+ return end_ice_id(_iceI_begin_ice_id(context, ::IceInternal::dummyCallback, 0, true));
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& context = ::Ice::noExplicitContext)
+ {
+ return _iceI_begin_ice_id(context, ::IceInternal::dummyCallback, 0);
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_id(::Ice::noExplicitContext, del, cookie);
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& context,
+ const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_id(context, del, cookie);
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Callback_Object_ice_idPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_id(::Ice::noExplicitContext, del, cookie);
+ }
+
+ ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context& context,
+ const ::Ice::Callback_Object_ice_idPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
+ {
+ return _iceI_begin_ice_id(context, del, cookie);
+ }
+
+ ::std::string end_ice_id(const ::Ice::AsyncResultPtr&);
+
+ static const ::std::string& ice_staticId()
+ {
+ return ::Ice::Object::ice_staticId();
+ }
+
+
+ // Returns true if ok, false if user exception.
+ bool ice_invoke(const ::std::string&,
+ ::Ice::OperationMode,
+ const ::std::vector< ::Ice::Byte>&,
+ ::std::vector< ::Ice::Byte>&,
+ const ::Ice::Context& = ::Ice::noExplicitContext);
+
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::vector< ::Ice::Byte>& inParams)
{
- return begin_ice_invoke(operation, mode, inParams, 0, ::IceInternal::__dummyCallback, 0);
+ return _iceI_begin_ice_invoke(op, mode, inParams, ::Ice::noExplicitContext, ::IceInternal::dummyCallback, 0);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::vector< ::Ice::Byte>& inParams,
- const ::Ice::Context& __ctx)
+ const ::Ice::Context& context)
{
- return begin_ice_invoke(operation, mode, inParams, &__ctx, ::IceInternal::__dummyCallback, 0);
+ return _iceI_begin_ice_invoke(op, mode, inParams, context, ::IceInternal::dummyCallback, 0);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::vector< ::Ice::Byte>& inParams,
- const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_invoke(operation, mode, inParams, 0, __del, __cookie);
+ return _iceI_begin_ice_invoke(op, mode, inParams, ::Ice::noExplicitContext, del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::vector< ::Ice::Byte>& inParams,
- const ::Ice::Context& __ctx,
- const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ const ::Ice::Context& context,
+ const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_invoke(operation, mode, inParams, &__ctx, __del, __cookie);
+ return _iceI_begin_ice_invoke(op, mode, inParams, context, del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::vector< ::Ice::Byte>& inParams,
- const ::Ice::Callback_Object_ice_invokePtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ const ::Ice::Callback_Object_ice_invokePtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_invoke(operation, mode, inParams, 0, __del, __cookie);
+ return _iceI_begin_ice_invoke(op, mode, inParams, ::Ice::noExplicitContext, del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::vector< ::Ice::Byte>& inParams,
- const ::Ice::Context& __ctx,
- const ::Ice::Callback_Object_ice_invokePtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ const ::Ice::Context& context,
+ const ::Ice::Callback_Object_ice_invokePtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_invoke(operation, mode, inParams, &__ctx, __del, __cookie);
+ return _iceI_begin_ice_invoke(op, mode, inParams, context, del, cookie);
}
bool end_ice_invoke(::std::vector< ::Ice::Byte>&, const ::Ice::AsyncResultPtr&);
- bool ice_invoke(const ::std::string& operation,
+ bool ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- ::std::vector< ::Ice::Byte>& outParams)
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inP,
+ ::std::vector< ::Ice::Byte>& outP,
+ const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- return ice_invoke(operation, mode, inParams, outParams, 0);
+ return end_ice_invoke(outP, _iceI_begin_ice_invoke(op, mode, inP, context, ::IceInternal::dummyCallback, 0, true));
}
- bool ice_invoke(const ::std::string& operation,
- ::Ice::OperationMode mode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- ::std::vector< ::Ice::Byte>& outParams,
- const ::Ice::Context& context)
- {
- return ice_invoke(operation, mode, inParams, outParams, &context);
- }
-
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams)
{
- return begin_ice_invoke(operation, mode, inParams, 0, ::IceInternal::__dummyCallback, 0);
+ return _iceI_begin_ice_invoke(op, mode, inParams, ::Ice::noExplicitContext, ::IceInternal::dummyCallback, 0);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- const ::Ice::Context& __ctx,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ const ::Ice::Context& context,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_invoke(operation, mode, inParams, &__ctx, ::IceInternal::__dummyCallback, __cookie);
+ return _iceI_begin_ice_invoke(op, mode, inParams, context, ::IceInternal::dummyCallback, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_invoke(operation, mode, inParams, 0, __del, __cookie);
+ return _iceI_begin_ice_invoke(op, mode, inParams, ::Ice::noExplicitContext, del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- const ::Ice::Context& __ctx,
- const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ const ::Ice::Context& context,
+ const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_invoke(operation, mode, inParams, &__ctx, __del, __cookie);
+ return _iceI_begin_ice_invoke(op, mode, inParams, context, del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- const ::Ice::Callback_Object_ice_invokePtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ const ::Ice::Callback_Object_ice_invokePtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_invoke(operation, mode, inParams, 0, __del, __cookie);
+ return _iceI_begin_ice_invoke(op, mode, inParams, ::Ice::noExplicitContext, del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& operation,
+ ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string& op,
::Ice::OperationMode mode,
const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& inParams,
- const ::Ice::Context& __ctx,
- const ::Ice::Callback_Object_ice_invokePtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ const ::Ice::Context& context,
+ const ::Ice::Callback_Object_ice_invokePtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_invoke(operation, mode, inParams, &__ctx, __del, __cookie);
+ return _iceI_begin_ice_invoke(op, mode, inParams, context, del, cookie);
}
- bool ___end_ice_invoke(::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&, const ::Ice::AsyncResultPtr&);
+ bool _iceI_end_ice_invoke(::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&, const ::Ice::AsyncResultPtr&);
::Ice::Identity ice_getIdentity() const;
::Ice::ObjectPrx ice_identity(const ::Ice::Identity&) const;
@@ -762,218 +1355,124 @@ public:
::Ice::ObjectPrx ice_connectionId(const ::std::string&) const;
::std::string ice_getConnectionId() const;
- ::Ice::ConnectionPtr ice_getConnection();
-
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr begin_ice_getConnection(
- const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed)
+ ::Ice::ConnectionPtr ice_getConnection()
{
- return begin_ice_getConnectionInternal(::Ice::newCallback(completed, 0), 0);
+ return end_ice_getConnection(begin_ice_getConnection());
}
- ::Ice::AsyncResultPtr begin_ice_getConnection(
- const ::IceInternal::Function<void (const ::Ice::ConnectionPtr&)>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>());
-#endif
-
::Ice::AsyncResultPtr begin_ice_getConnection()
{
- return begin_ice_getConnectionInternal(::IceInternal::__dummyCallback, 0);
+ return _iceI_begin_ice_getConnection(::IceInternal::dummyCallback, 0);
}
- ::Ice::AsyncResultPtr begin_ice_getConnection(const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ ::Ice::AsyncResultPtr begin_ice_getConnection(const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_getConnectionInternal(__del, __cookie);
+ return _iceI_begin_ice_getConnection(del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_getConnection(const ::Ice::Callback_Object_ice_getConnectionPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ ::Ice::AsyncResultPtr begin_ice_getConnection(const ::Ice::Callback_Object_ice_getConnectionPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_getConnectionInternal(__del, __cookie);
+ return _iceI_begin_ice_getConnection(del, cookie);
}
::Ice::ConnectionPtr end_ice_getConnection(const ::Ice::AsyncResultPtr&);
::Ice::ConnectionPtr ice_getCachedConnection() const;
- void ice_flushBatchRequests();
-
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr begin_ice_flushBatchRequests(
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception,
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
+ void ice_flushBatchRequests()
{
- return begin_ice_flushBatchRequestsInternal(
- new ::IceInternal::Cpp11FnOnewayCallbackNC(nullptr, exception, sent), 0);
+ return end_ice_flushBatchRequests(begin_ice_flushBatchRequests());
}
-#endif
::Ice::AsyncResultPtr begin_ice_flushBatchRequests()
{
- return begin_ice_flushBatchRequestsInternal(::IceInternal::__dummyCallback, 0);
+ return _iceI_begin_ice_flushBatchRequests(::IceInternal::dummyCallback, 0);
}
- ::Ice::AsyncResultPtr begin_ice_flushBatchRequests(const ::Ice::CallbackPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ ::Ice::AsyncResultPtr begin_ice_flushBatchRequests(const ::Ice::CallbackPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_flushBatchRequestsInternal(__del, __cookie);
+ return _iceI_begin_ice_flushBatchRequests(del, cookie);
}
- ::Ice::AsyncResultPtr begin_ice_flushBatchRequests(const ::Ice::Callback_Object_ice_flushBatchRequestsPtr& __del,
- const ::Ice::LocalObjectPtr& __cookie = 0)
+ ::Ice::AsyncResultPtr begin_ice_flushBatchRequests(const ::Ice::Callback_Object_ice_flushBatchRequestsPtr& del,
+ const ::Ice::LocalObjectPtr& cookie = 0)
{
- return begin_ice_flushBatchRequestsInternal(__del, __cookie);
+ return _iceI_begin_ice_flushBatchRequests(del, cookie);
}
void end_ice_flushBatchRequests(const ::Ice::AsyncResultPtr&);
- const ::IceInternal::ReferencePtr& __reference() const { return _reference; }
+ const ::IceInternal::ReferencePtr& _getReference() const { return _reference; }
- ::Ice::Int __hash() const;
+ ::Ice::Int _hash() const;
- void __copyFrom(const ::Ice::ObjectPrx&);
+ void _copyFrom(const ::Ice::ObjectPrx&);
- int __handleException(const ::Ice::Exception&, const ::IceInternal::RequestHandlerPtr&, ::Ice::OperationMode,
+ int _handleException(const ::Ice::Exception&, const ::IceInternal::RequestHandlerPtr&, ::Ice::OperationMode,
bool, int&);
- void __checkTwowayOnly(const ::std::string&) const;
- void __checkAsyncTwowayOnly(const ::std::string&) const;
+ void _checkTwowayOnly(const ::std::string&, bool) const;
+
+ void _end(const ::Ice::AsyncResultPtr&, const std::string&) const;
- void __invoke(::IceInternal::Outgoing&) const;
- void __end(const ::Ice::AsyncResultPtr&, const std::string&) const;
+ ::IceInternal::RequestHandlerPtr _getRequestHandler();
+ ::IceInternal::BatchRequestQueuePtr _getBatchRequestQueue();
+ ::IceInternal::RequestHandlerPtr _setRequestHandler(const ::IceInternal::RequestHandlerPtr&);
+ void _updateRequestHandler(const ::IceInternal::RequestHandlerPtr&, const ::IceInternal::RequestHandlerPtr&);
- ::IceInternal::RequestHandlerPtr __getRequestHandler();
- ::IceInternal::BatchRequestQueuePtr __getBatchRequestQueue();
- ::IceInternal::RequestHandlerPtr __setRequestHandler(const ::IceInternal::RequestHandlerPtr&);
- void __updateRequestHandler(const ::IceInternal::RequestHandlerPtr&, const ::IceInternal::RequestHandlerPtr&);
+ void _write(::Ice::OutputStream&) const;
protected:
- virtual Object* __newInstance() const;
+ virtual Object* _newInstance() const;
private:
- bool ice_isA(const ::std::string&, const ::Ice::Context*);
- ::Ice::AsyncResultPtr begin_ice_isA(const ::std::string&,
- const ::Ice::Context*,
- const ::IceInternal::CallbackBasePtr&,
- const ::Ice::LocalObjectPtr&);
-
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr __begin_ice_isA(
- const ::std::string&,
- const ::Ice::Context*,
- const ::IceInternal::Function<void (bool)>&,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& = ::IceInternal::Function<void (bool)>());
-#endif
-
-
- void ice_ping(const ::Ice::Context*);
- ::Ice::AsyncResultPtr begin_ice_ping(const ::Ice::Context*,
- const ::IceInternal::CallbackBasePtr&,
- const ::Ice::LocalObjectPtr&);
-
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr __begin_ice_ping(
- const ::Ice::Context* ctx,
- const ::IceInternal::Function<void ()>& response,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>())
- {
- return begin_ice_ping(ctx, new ::IceInternal::Cpp11FnOnewayCallbackNC(response, exception, sent), 0);
- }
-#endif
-
- ::std::vector< ::std::string> ice_ids(const ::Ice::Context*);
- ::Ice::AsyncResultPtr begin_ice_ids(const ::Ice::Context*,
- const ::IceInternal::CallbackBasePtr&,
- const ::Ice::LocalObjectPtr&);
-
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr __begin_ice_ids(
- const ::Ice::Context*,
- const ::IceInternal::Function<void (const ::std::vector< ::std::string>&)>&,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& =
- ::IceInternal::Function<void (bool)>());
-#endif
+ ::Ice::AsyncResultPtr _iceI_begin_ice_isA(const ::std::string&,
+ const ::Ice::Context&,
+ const ::IceInternal::CallbackBasePtr&,
+ const ::Ice::LocalObjectPtr&,
+ bool = false);
- ::std::string ice_id(const ::Ice::Context*);
- ::Ice::AsyncResultPtr begin_ice_id(const ::Ice::Context*,
- const ::IceInternal::CallbackBasePtr&,
- const ::Ice::LocalObjectPtr&);
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr __begin_ice_id(
- const ::Ice::Context*,
- const ::IceInternal::Function<void (const ::std::string&)>&,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& sent =
- ::IceInternal::Function<void (bool)>());
-#endif
-
- bool ice_invoke(const ::std::string&,
- ::Ice::OperationMode,
- const ::std::vector< ::Ice::Byte>&,
- ::std::vector< ::Ice::Byte>&,
- const ::Ice::Context*);
-
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string&,
- ::Ice::OperationMode,
- const ::std::vector< ::Ice::Byte>&,
- const ::Ice::Context*,
- const ::IceInternal::CallbackBasePtr&,
- const ::Ice::LocalObjectPtr&);
-
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr __begin_ice_invoke(
- const ::std::string&,
- ::Ice::OperationMode,
- const ::std::vector< ::Ice::Byte>&,
- const ::Ice::Context*,
- const ::IceInternal::Function<void (bool, const ::std::vector< ::Ice::Byte>&)>&,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& = ::IceInternal::Function<void (bool)>());
-
-#endif
-
- bool ice_invoke(const ::std::string&,
- ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- ::std::vector< ::Ice::Byte>&,
- const ::Ice::Context*);
-
- ::Ice::AsyncResultPtr begin_ice_invoke(const ::std::string&,
- ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- const ::Ice::Context*,
+ ::Ice::AsyncResultPtr _iceI_begin_ice_ping(const ::Ice::Context&,
const ::IceInternal::CallbackBasePtr&,
- const ::Ice::LocalObjectPtr&);
-
-#ifdef ICE_CPP11
- ::Ice::AsyncResultPtr __begin_ice_invoke(
- const ::std::string&,
- ::Ice::OperationMode,
- const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
- const ::Ice::Context*,
- const ::IceInternal::Function<void (bool, const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&)>&,
- const ::IceInternal::Function<void (const ::Ice::Exception&)>& =
- ::IceInternal::Function<void (const ::Ice::Exception&)>(),
- const ::IceInternal::Function<void (bool)>& = ::IceInternal::Function<void (bool)>());
-#endif
+ const ::Ice::LocalObjectPtr&,
+ bool = false);
- ::Ice::AsyncResultPtr begin_ice_getConnectionInternal(const ::IceInternal::CallbackBasePtr&,
- const ::Ice::LocalObjectPtr&);
+ ::Ice::AsyncResultPtr _iceI_begin_ice_ids(const ::Ice::Context&,
+ const ::IceInternal::CallbackBasePtr&,
+ const ::Ice::LocalObjectPtr&,
+ bool = false);
- ::Ice::AsyncResultPtr begin_ice_flushBatchRequestsInternal(const ::IceInternal::CallbackBasePtr&,
- const ::Ice::LocalObjectPtr&);
+ ::Ice::AsyncResultPtr _iceI_begin_ice_id(const ::Ice::Context&,
+ const ::IceInternal::CallbackBasePtr&,
+ const ::Ice::LocalObjectPtr&,
+ bool = false);
+
+ ::Ice::AsyncResultPtr _iceI_begin_ice_invoke(const ::std::string&,
+ ::Ice::OperationMode,
+ const ::std::vector< ::Ice::Byte>&,
+ const ::Ice::Context&,
+ const ::IceInternal::CallbackBasePtr&,
+ const ::Ice::LocalObjectPtr&,
+ bool = false);
+
+ ::Ice::AsyncResultPtr _iceI_begin_ice_invoke(const ::std::string&,
+ ::Ice::OperationMode,
+ const ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&,
+ const ::Ice::Context&,
+ const ::IceInternal::CallbackBasePtr&,
+ const ::Ice::LocalObjectPtr&,
+ bool = false);
+
+ ::Ice::AsyncResultPtr _iceI_begin_ice_getConnection(const ::IceInternal::CallbackBasePtr&,
+ const ::Ice::LocalObjectPtr&);
+
+ ::Ice::AsyncResultPtr _iceI_begin_ice_flushBatchRequests(const ::IceInternal::CallbackBasePtr&,
+ const ::Ice::LocalObjectPtr&);
void setup(const ::IceInternal::ReferencePtr&);
friend class ::IceInternal::ProxyFactory;
@@ -991,6 +1490,121 @@ ICE_API ::std::ostream& operator<<(::std::ostream&, const ::IceProxy::Ice::Objec
namespace Ice
{
+template<typename Prx, typename Base>
+class Proxy : public virtual Base
+{
+public:
+
+ IceInternal::ProxyHandle<Prx> ice_context(const ::Ice::Context& context) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_context(context).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_adapterId(const ::std::string& id) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_adapterId(id).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_endpoints(const ::Ice::EndpointSeq& endpoints) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_endpoints(endpoints).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_locatorCacheTimeout(int timeout) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_locatorCacheTimeout(timeout).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_connectionCached(bool cached) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_connectionCached(cached).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_endpointSelection(::Ice::EndpointSelectionType selection) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_endpointSelection(selection).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_secure(bool secure) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_secure(secure).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_preferSecure(bool preferSecure) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_preferSecure(preferSecure).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_router(const ::Ice::RouterPrx& router) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_router(router).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_locator(const ::Ice::LocatorPrx& locator) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_locator(locator).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_collocationOptimized(bool collocated) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_collocationOptimized(collocated).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_invocationTimeout(int timeout) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_invocationTimeout(timeout).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_twoway() const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_twoway().get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_oneway() const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_oneway().get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_batchOneway() const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_batchOneway().get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_datagram() const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_datagram().get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_batchDatagram() const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_batchDatagram().get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_compress(bool compress) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_compress(compress).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_timeout(int timeout) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_timeout(timeout).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_connectionId(const ::std::string& id) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_connectionId(id).get());
+ }
+
+ IceInternal::ProxyHandle<Prx> ice_encodingVersion(const ::Ice::EncodingVersion& version) const
+ {
+ return dynamic_cast<Prx*>(::IceProxy::Ice::Object::ice_encodingVersion(version).get());
+ }
+
+protected:
+
+ virtual ::IceProxy::Ice::Object* _newInstance() const = 0;
+};
+
ICE_API bool proxyIdentityLess(const ObjectPrx&, const ObjectPrx&);
ICE_API bool proxyIdentityEqual(const ObjectPrx&, const ObjectPrx&);
@@ -1040,8 +1654,8 @@ namespace IceInternal
template<typename T, typename U>
inline bool operator==(const ProxyHandle<T>& lhs, const ProxyHandle<U>& rhs)
{
- ::IceProxy::Ice::Object* l = lhs.__upCast();
- ::IceProxy::Ice::Object* r = rhs.__upCast();
+ ::IceProxy::Ice::Object* l = lhs._upCast();
+ ::IceProxy::Ice::Object* r = rhs._upCast();
if(l && r)
{
return *l == *r;
@@ -1061,8 +1675,8 @@ inline bool operator!=(const ProxyHandle<T>& lhs, const ProxyHandle<U>& rhs)
template<typename T, typename U>
inline bool operator<(const ProxyHandle<T>& lhs, const ProxyHandle<U>& rhs)
{
- ::IceProxy::Ice::Object* l = lhs.__upCast();
- ::IceProxy::Ice::Object* r = rhs.__upCast();
+ ::IceProxy::Ice::Object* l = lhs._upCast();
+ ::IceProxy::Ice::Object* r = rhs._upCast();
if(l && r)
{
return *l < *r;
@@ -1096,20 +1710,17 @@ inline bool operator>=(const ProxyHandle<T>& lhs, const ProxyHandle<U>& rhs)
// checkedCast and uncheckedCast functions without facet:
//
template<typename P> P
-checkedCastImpl(const ::Ice::ObjectPrx& b, const ::Ice::Context* context)
+checkedCastImpl(const ::Ice::ObjectPrx& b, const ::Ice::Context& context)
{
P d = 0;
if(b.get())
{
typedef typename P::element_type T;
- d = dynamic_cast<T*>(b.get());
- if(!d && (context == 0 ?
- b->ice_isA(T::ice_staticId()) :
- b->ice_isA(T::ice_staticId(), *context)))
+ if(b->ice_isA(T::ice_staticId(), context))
{
d = new T;
- d->__copyFrom(b);
+ d->_copyFrom(b);
}
}
return d;
@@ -1127,7 +1738,7 @@ uncheckedCastImpl(const ::Ice::ObjectPrx& b)
if(!d)
{
d = new T;
- d->__copyFrom(b);
+ d->_copyFrom(b);
}
}
return d;
@@ -1141,7 +1752,7 @@ uncheckedCastImpl(const ::Ice::ObjectPrx& b)
// Helper with type ID.
//
ICE_API ::Ice::ObjectPrx checkedCastImpl(const ::Ice::ObjectPrx&, const std::string&, const std::string&,
- const ::Ice::Context*);
+ const ::Ice::Context&);
//
// Specializations for P = ::Ice::ObjectPrx
@@ -1149,7 +1760,7 @@ ICE_API ::Ice::ObjectPrx checkedCastImpl(const ::Ice::ObjectPrx&, const std::str
//
template<> inline ::Ice::ObjectPrx
-checkedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context* context)
+checkedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& context)
{
return checkedCastImpl(b, f, "::Ice::Object", context);
}
@@ -1166,7 +1777,7 @@ uncheckedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::strin
}
template<typename P> P
-checkedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context* context)
+checkedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& context)
{
P d = 0;
@@ -1176,7 +1787,7 @@ checkedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Co
if(bb)
{
d = new T;
- d->__copyFrom(bb);
+ d->_copyFrom(bb);
}
return d;
}
@@ -1191,29 +1802,23 @@ uncheckedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f)
::Ice::ObjectPrx bb = b->ice_facet(f);
d = new T;
- d->__copyFrom(bb);
+ d->_copyFrom(bb);
}
return d;
}
}
//
-// checkedCast and uncheckedCast functions provided in the global namespace
+// checkedCast and uncheckedCast functions provided in the Ice namespace
//
-
-template<typename P, typename Y> inline P
-checkedCast(const ::IceInternal::ProxyHandle<Y>& b)
+namespace Ice
{
- Y* tag = 0;
- Ice::Context* ctx = 0;
- return ::IceInternal::checkedCastHelper<typename P::element_type>(b, tag, ctx);
-}
template<typename P, typename Y> inline P
-checkedCast(const ::IceInternal::ProxyHandle<Y>& b, const ::Ice::Context& context)
+checkedCast(const ::IceInternal::ProxyHandle<Y>& b, const ::Ice::Context& context = ::Ice::noExplicitContext)
{
Y* tag = 0;
- return ::IceInternal::checkedCastHelper<typename P::element_type>(b, tag, &context);
+ return ::IceInternal::checkedCastHelper<typename P::element_type>(b, tag, context);
}
template<typename P, typename Y> inline P
@@ -1224,16 +1829,9 @@ uncheckedCast(const ::IceInternal::ProxyHandle<Y>& b)
}
template<typename P> inline P
-checkedCast(const ::Ice::ObjectPrx& b, const std::string& f)
+checkedCast(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& context = ::Ice::noExplicitContext)
{
- Ice::Context* ctx = 0;
- return ::IceInternal::checkedCastImpl<P>(b, f, ctx);
-}
-
-template<typename P> inline P
-checkedCast(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Context& context)
-{
- return ::IceInternal::checkedCastImpl<P>(b, f, &context);
+ return ::IceInternal::checkedCastImpl<P>(b, f, context);
}
template<typename P> inline P
@@ -1242,6 +1840,8 @@ uncheckedCast(const ::Ice::ObjectPrx& b, const std::string& f)
return ::IceInternal::uncheckedCastImpl<P>(b, f);
}
+}
+
namespace IceInternal
{
@@ -1249,7 +1849,7 @@ namespace IceInternal
// Base template for operation callbacks.
//
template<class T>
-class CallbackNC : virtual public CallbackBase
+class CallbackNC : public virtual CallbackBase
{
public:
@@ -1305,7 +1905,7 @@ private:
};
template<class T, typename CT>
-class Callback : virtual public CallbackBase
+class Callback : public virtual CallbackBase
{
public:
@@ -1420,7 +2020,7 @@ public:
{
try
{
- result->getProxy()->__end(result, result->getOperation());
+ result->getProxy()->_end(result, result->getOperation());
}
catch(const ::Ice::Exception& ex)
{
@@ -1459,7 +2059,7 @@ public:
{
try
{
- result->getProxy()->__end(result, result->getOperation());
+ result->getProxy()->_end(result, result->getOperation());
}
catch(const ::Ice::Exception& ex)
{
@@ -1498,21 +2098,21 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- bool __ret;
+ bool ret;
try
{
- __ret = __result->getProxy()->end_ice_isA(__result);
+ ret = result->getProxy()->end_ice_isA(result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::CallbackNC<T>::exception(__result, ex);
+ ::IceInternal::CallbackNC<T>::exception(result, ex);
return;
}
if(_response)
{
- (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(__ret);
+ (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret);
}
}
@@ -1537,22 +2137,22 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- bool __ret;
+ bool ret;
try
{
- __ret = __result->getProxy()->end_ice_isA(__result);
+ ret = result->getProxy()->end_ice_isA(result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::Callback<T, CT>::exception(__result, ex);
+ ::IceInternal::Callback<T, CT>::exception(result, ex);
return;
}
if(_response)
{
- (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(__ret,
- CT::dynamicCast(__result->getCookie()));
+ (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret,
+ CT::dynamicCast(result->getCookie()));
}
}
@@ -1611,21 +2211,21 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- ::std::vector< ::std::string> __ret;
+ ::std::vector< ::std::string> ret;
try
{
- __ret = __result->getProxy()->end_ice_ids(__result);
+ ret = result->getProxy()->end_ice_ids(result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::CallbackNC<T>::exception(__result, ex);
+ ::IceInternal::CallbackNC<T>::exception(result, ex);
return;
}
if(_response)
{
- (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(__ret);
+ (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret);
}
}
@@ -1650,22 +2250,22 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- ::std::vector< ::std::string> __ret;
+ ::std::vector< ::std::string> ret;
try
{
- __ret = __result->getProxy()->end_ice_ids(__result);
+ ret = result->getProxy()->end_ice_ids(result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::Callback<T, CT>::exception(__result, ex);
+ ::IceInternal::Callback<T, CT>::exception(result, ex);
return;
}
if(_response)
{
- (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(__ret,
- CT::dynamicCast(__result->getCookie()));
+ (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret,
+ CT::dynamicCast(result->getCookie()));
}
}
@@ -1690,21 +2290,21 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- ::std::string __ret;
+ ::std::string ret;
try
{
- __ret = __result->getProxy()->end_ice_id(__result);
+ ret = result->getProxy()->end_ice_id(result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::CallbackNC<T>::exception(__result, ex);
+ ::IceInternal::CallbackNC<T>::exception(result, ex);
return;
}
if(_response)
{
- (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(__ret);
+ (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret);
}
}
@@ -1729,22 +2329,22 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- ::std::string __ret;
+ ::std::string ret;
try
{
- __ret = __result->getProxy()->end_ice_id(__result);
+ ret = result->getProxy()->end_ice_id(result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::Callback<T, CT>::exception(__result, ex);
+ ::IceInternal::Callback<T, CT>::exception(result, ex);
return;
}
if(_response)
{
- (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(__ret,
- CT::dynamicCast(__result->getCookie()));
+ (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret,
+ CT::dynamicCast(result->getCookie()));
}
}
@@ -1775,39 +2375,39 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
if(_response)
{
- bool __ok;
+ bool ok;
std::vector< ::Ice::Byte> outParams;
try
{
- __ok = __result->getProxy()->end_ice_invoke(outParams, __result);
+ ok = result->getProxy()->end_ice_invoke(outParams, result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::CallbackNC<T>::exception(__result, ex);
+ ::IceInternal::CallbackNC<T>::exception(result, ex);
return;
}
- (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(__ok, outParams);
+ (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ok, outParams);
}
else
{
- bool __ok;
+ bool ok;
std::pair<const ::Ice::Byte*, const::Ice::Byte*> outParams;
try
{
- __ok = __result->getProxy()->___end_ice_invoke(outParams, __result);
+ ok = result->getProxy()->_iceI_end_ice_invoke(outParams, result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::CallbackNC<T>::exception(__result, ex);
+ ::IceInternal::CallbackNC<T>::exception(result, ex);
return;
}
if(_responseArray)
{
- (::IceInternal::CallbackNC<T>::_callback.get()->*_responseArray)(__ok, outParams);
+ (::IceInternal::CallbackNC<T>::_callback.get()->*_responseArray)(ok, outParams);
}
}
}
@@ -1840,44 +2440,44 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
if(_response)
{
- bool __ok;
+ bool ok;
std::vector< ::Ice::Byte> outParams;
try
{
- __ok = __result->getProxy()->end_ice_invoke(outParams, __result);
+ ok = result->getProxy()->end_ice_invoke(outParams, result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::Callback<T, CT>::exception(__result, ex);
+ ::IceInternal::Callback<T, CT>::exception(result, ex);
return;
}
- (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(__ok,
+ (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ok,
outParams,
- CT::dynamicCast(__result->getCookie()));
+ CT::dynamicCast(result->getCookie()));
}
else
{
- bool __ok;
+ bool ok;
std::pair<const ::Ice::Byte*, const::Ice::Byte*> outParams;
try
{
- __ok = __result->getProxy()->___end_ice_invoke(outParams, __result);
+ ok = result->getProxy()->_iceI_end_ice_invoke(outParams, result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::Callback<T, CT>::exception(__result, ex);
+ ::IceInternal::Callback<T, CT>::exception(result, ex);
return;
}
if(_responseArray)
{
- (::IceInternal::Callback<T, CT>::_callback.get()->*_responseArray)(__ok,
+ (::IceInternal::Callback<T, CT>::_callback.get()->*_responseArray)(ok,
outParams,
CT::dynamicCast(
- __result->getCookie()));
+ result->getCookie()));
}
}
}
@@ -1906,21 +2506,21 @@ public:
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- ::Ice::ConnectionPtr __ret;
+ ::Ice::ConnectionPtr ret;
try
{
- __ret = __result->getProxy()->end_ice_getConnection(__result);
+ ret = result->getProxy()->end_ice_getConnection(result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::CallbackNC<T>::exception(__result, ex);
+ ::IceInternal::CallbackNC<T>::exception(result, ex);
return;
}
if(_response)
{
- (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(__ret);
+ (::IceInternal::CallbackNC<T>::_callback.get()->*_response)(ret);
}
}
@@ -1946,22 +2546,22 @@ public:
{
}
- virtual void completed(const ::Ice::AsyncResultPtr& __result) const
+ virtual void completed(const ::Ice::AsyncResultPtr& result) const
{
- ::Ice::ConnectionPtr __ret;
+ ::Ice::ConnectionPtr ret;
try
{
- __ret = __result->getProxy()->end_ice_getConnection(__result);
+ ret = result->getProxy()->end_ice_getConnection(result);
}
catch(const ::Ice::Exception& ex)
{
- ::IceInternal::Callback<T, CT>::exception(__result, ex);
+ ::IceInternal::Callback<T, CT>::exception(result, ex);
return;
}
if(_response)
{
- (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(__ret,
- CT::dynamicCast(__result->getCookie()));
+ (::IceInternal::Callback<T, CT>::_callback.get()->*_response)(ret,
+ CT::dynamicCast(result->getCookie()));
}
}
@@ -2448,5 +3048,6 @@ newCallback_Object_ice_flushBatchRequests(T* instance,
}
}
+#endif
#endif
diff --git a/cpp/include/Ice/ProxyF.h b/cpp/include/Ice/ProxyF.h
index 59e772e5951..7fcbb158047 100644
--- a/cpp/include/Ice/ProxyF.h
+++ b/cpp/include/Ice/ProxyF.h
@@ -10,51 +10,28 @@
#ifndef ICE_PROXY_F_H
#define ICE_PROXY_F_H
-#include <IceUtil/Shared.h>
-
#include <Ice/Config.h>
#include <Ice/ProxyHandle.h>
-namespace IceProxy
-{
-
-namespace Ice
-{
-
-class Object;
-inline Object* upCast(Object* o) { return o; }
-
-}
-
-}
-
-namespace IceDelegate
-{
-
+#ifdef ICE_CPP11_MAPPING
namespace Ice
{
-class Object;
-inline Object* upCast(Object* o) { return o; }
-
-}
+class ObjectPrx;
+using ObjectPrxPtr = ::std::shared_ptr<ObjectPrx>;
}
-namespace IceDelegateM
+namespace IceInternal
{
-namespace Ice
-{
-
-class Object;
-inline Object* upCast(Object* o) { return o; }
-
-}
+template<typename P>
+::std::shared_ptr<P> createProxy();
}
-namespace IceDelegateD
+#else // C++98 mapping
+namespace IceProxy
{
namespace Ice
@@ -71,8 +48,9 @@ namespace Ice
{
typedef IceInternal::ProxyHandle< ::IceProxy::Ice::Object> ObjectPrx;
+typedef ObjectPrx ObjectPrxPtr;
}
-
+#endif
#endif
diff --git a/cpp/include/Ice/ProxyHandle.h b/cpp/include/Ice/ProxyHandle.h
index 32b57084ad3..cff7f47e0c5 100644
--- a/cpp/include/Ice/ProxyHandle.h
+++ b/cpp/include/Ice/ProxyHandle.h
@@ -10,6 +10,8 @@
#ifndef ICE_PROXY_HANDLE_H
#define ICE_PROXY_HANDLE_H
+#ifndef ICE_CPP11_MAPPING // C++98 mapping
+
#include <IceUtil/Handle.h>
#include <Ice/Config.h>
@@ -23,8 +25,8 @@ template<typename T> class Handle;
}
-namespace IceProxy
-{
+namespace IceProxy
+{
namespace Ice
{
@@ -42,18 +44,20 @@ class ObjectAdapter;
typedef ::IceInternal::Handle< ::Ice::ObjectAdapter> ObjectAdapterPtr;
typedef ::std::map< ::std::string, ::std::string> Context;
+ICE_API extern const Context noExplicitContext;
+
}
namespace IceInternal
{
-template<typename P> P
-checkedCastImpl(const ::Ice::ObjectPrx&, const ::Ice::Context*);
+template<typename P> P
+checkedCastImpl(const ::Ice::ObjectPrx&, const ::Ice::Context&);
-template<typename P> P
-checkedCastImpl(const ::Ice::ObjectPrx&, const std::string&, const ::Ice::Context*);
+template<typename P> P
+checkedCastImpl(const ::Ice::ObjectPrx&, const std::string&, const ::Ice::Context&);
-template<typename P> P
+template<typename P> P
uncheckedCastImpl(const ::Ice::ObjectPrx&);
template<typename P> P
@@ -62,13 +66,13 @@ uncheckedCastImpl(const ::Ice::ObjectPrx&, const std::string&);
//
// Upcast
//
-template<typename T, typename Y> inline ProxyHandle<T>
-checkedCastHelper(const ::IceInternal::ProxyHandle<Y>& b, T*, const ::Ice::Context*)
+template<typename T, typename Y> inline ProxyHandle<T>
+checkedCastHelper(const ::IceInternal::ProxyHandle<Y>& b, T*, const ::Ice::Context&)
{
return b;
}
-template<typename T, typename Y> inline ProxyHandle<T>
+template<typename T, typename Y> inline ProxyHandle<T>
uncheckedCastHelper(const ::IceInternal::ProxyHandle<Y>& b, T*)
{
return b;
@@ -77,8 +81,8 @@ uncheckedCastHelper(const ::IceInternal::ProxyHandle<Y>& b, T*)
//
// Downcast
//
-template<typename T, typename Y> inline ProxyHandle<T>
-checkedCastHelper(const ::IceInternal::ProxyHandle<Y>& b, void*, const ::Ice::Context* ctx)
+template<typename T, typename Y> inline ProxyHandle<T>
+checkedCastHelper(const ::IceInternal::ProxyHandle<Y>& b, void*, const ::Ice::Context& ctx)
{
#ifdef __SUNPRO_CC
//
@@ -91,7 +95,7 @@ checkedCastHelper(const ::IceInternal::ProxyHandle<Y>& b, void*, const ::Ice::Co
#endif
}
-template<typename T, typename Y> inline ProxyHandle<T>
+template<typename T, typename Y> inline ProxyHandle<T>
uncheckedCastHelper(const ::IceInternal::ProxyHandle<Y>& b, void*)
{
#ifdef __SUNPRO_CC
@@ -114,7 +118,7 @@ template<typename T>
class ProxyHandle : public ::IceUtil::HandleBase<T>
{
public:
-
+
ProxyHandle(T* p = 0)
{
this->_ptr = p;
@@ -124,7 +128,7 @@ public:
upCast(this->_ptr)->__incRef();
}
}
-
+
template<typename Y>
ProxyHandle(const ProxyHandle<Y>& r)
{
@@ -156,7 +160,7 @@ public:
upCast(this->_ptr)->__incRef();
}
}
-
+
~ProxyHandle()
{
if(this->_ptr)
@@ -164,7 +168,7 @@ public:
upCast(this->_ptr)->__decRef();
}
}
-
+
ProxyHandle& operator=(T* p)
{
if(this->_ptr != p)
@@ -178,12 +182,12 @@ public:
{
upCast(this->_ptr)->__decRef();
}
-
+
this->_ptr = p;
}
return *this;
}
-
+
template<typename Y>
ProxyHandle& operator=(const ProxyHandle<Y>& r)
{
@@ -198,7 +202,7 @@ public:
{
upCast(this->_ptr)->__decRef();
}
-
+
this->_ptr = r._ptr;
}
return *this;
@@ -218,7 +222,7 @@ public:
{
upCast(this->_ptr)->__decRef();
}
-
+
this->_ptr = r._ptr;
}
return *this;
@@ -237,29 +241,28 @@ public:
{
upCast(this->_ptr)->__decRef();
}
-
+
this->_ptr = r._ptr;
}
return *this;
}
- ::IceProxy::Ice::Object* __upCast() const
+ ::IceProxy::Ice::Object* _upCast() const
{
return upCast(this->_ptr);
}
-
+
template<class Y>
- static ProxyHandle checkedCast(const ProxyHandle<Y>& r)
+ static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const ::Ice::Context& ctx = ::Ice::noExplicitContext)
{
Y* tag = 0;
- Ice::Context* ctx = 0;
return ::IceInternal::checkedCastHelper<T>(r, tag, ctx);
}
template<class Y>
- static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const std::string& f)
+ static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const std::string& f,
+ const ::Ice::Context& ctx = ::Ice::noExplicitContext)
{
- Ice::Context* ctx = 0;
#ifdef __SUNPRO_CC
//
// Sun CC bug introduced in version 5.10
@@ -272,27 +275,6 @@ public:
}
template<class Y>
- static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const ::Ice::Context& ctx)
- {
- Y* tag = 0;
- return ::IceInternal::checkedCastHelper<T>(r, tag, &ctx);
- }
-
- template<class Y>
- static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const std::string& f, const ::Ice::Context& ctx)
- {
-#ifdef __SUNPRO_CC
- //
- // Sun CC bug introduced in version 5.10
- //
- const ::Ice::ObjectPrx& o = r;
- return ::IceInternal::checkedCastImpl<ProxyHandle>(o, f, &ctx);
-#else
- return ::IceInternal::checkedCastImpl<ProxyHandle>(r, f, &ctx);
-#endif
- }
-
- template<class Y>
static ProxyHandle uncheckedCast(const ProxyHandle<Y>& r)
{
Y* tag = 0;
@@ -328,3 +310,5 @@ std::ostream& operator<<(std::ostream& os, ::IceInternal::ProxyHandle<Y> p)
}
#endif
+
+#endif
diff --git a/cpp/include/Ice/RegisterPlugins.h b/cpp/include/Ice/RegisterPlugins.h
index 2b03fd4bb96..28d4e6fce1a 100644
--- a/cpp/include/Ice/RegisterPlugins.h
+++ b/cpp/include/Ice/RegisterPlugins.h
@@ -16,7 +16,7 @@
// Register functions for Ice plugins are declared here.
//
// These functions can be used to explicitly link with a plugin rather
-// thanrelying on the loading of the plugin at runtime. The application
+// than relying on the loading of the plugin at runtime. The application
// must call the register function before initializing the communicator.
//
@@ -38,7 +38,7 @@ namespace Ice
ICE_PLUGIN_REGISTER_DECLSPEC_IMPORT void registerIceStringConverter(bool = true);
#endif
-#ifndef ICE_SSL_API_EXPORTS
+#ifndef ICESSL_API_EXPORTS
ICE_PLUGIN_REGISTER_DECLSPEC_IMPORT void registerIceSSL(bool = true);
#endif
@@ -50,6 +50,23 @@ ICE_PLUGIN_REGISTER_DECLSPEC_IMPORT void registerIceDiscovery(bool = true);
ICE_PLUGIN_REGISTER_DECLSPEC_IMPORT void registerIceLocatorDiscovery(bool = true);
#endif
+#if !defined(_WIN32) && !defined(__APPLE__)
+# ifndef ICEBT_API_EXPORTS
+ICE_PLUGIN_REGISTER_DECLSPEC_IMPORT void registerIceBT(bool = true);
+# endif
+#endif
+
+#if defined(__APPLE__) && TARGET_OS_IPHONE != 0
+# ifndef ICEIAP_API_EXPORTS
+ICE_PLUGIN_REGISTER_DECLSPEC_IMPORT void registerIceIAP(bool = true);
+# endif
+#endif
+
+#if defined(_MSC_VER) && !defined(ICE_BUILDING_SRC)
+# pragma comment(lib, ICE_LIBNAME("IceDiscovery"))
+# pragma comment(lib, ICE_LIBNAME("IceLocatorDiscovery"))
+# pragma comment(lib, ICE_LIBNAME("IceSSL"))
+#endif
}
#endif
diff --git a/cpp/include/Ice/RequestHandlerF.h b/cpp/include/Ice/RequestHandlerF.h
index 5969f9be52c..6ead8421bc0 100644
--- a/cpp/include/Ice/RequestHandlerF.h
+++ b/cpp/include/Ice/RequestHandlerF.h
@@ -16,14 +16,20 @@
namespace IceInternal
{
+class CancellationHandler;
class RequestHandler;
-ICE_API IceUtil::Shared* upCast(RequestHandler*);
-typedef IceInternal::Handle<RequestHandler> RequestHandlerPtr;
-class CancellationHandler;
+#ifdef ICE_CPP11_MAPPING
+using CancellationHandlerPtr = ::std::shared_ptr<CancellationHandler>;
+using RequestHandlerPtr = ::std::shared_ptr<RequestHandler>;
+#else
ICE_API IceUtil::Shared* upCast(CancellationHandler*);
typedef IceInternal::Handle<CancellationHandler> CancellationHandlerPtr;
+ICE_API IceUtil::Shared* upCast(RequestHandler*);
+typedef IceInternal::Handle<RequestHandler> RequestHandlerPtr;
+#endif
+
}
#endif
diff --git a/cpp/include/Ice/ResponseHandlerF.h b/cpp/include/Ice/ResponseHandlerF.h
index e7e255b3ebe..d848a1d307b 100644
--- a/cpp/include/Ice/ResponseHandlerF.h
+++ b/cpp/include/Ice/ResponseHandlerF.h
@@ -17,8 +17,13 @@ namespace IceInternal
{
class ResponseHandler;
+
+#ifdef ICE_CPP11_MAPPING
+using ResponseHandlerPtr = ::std::shared_ptr<ResponseHandler>;
+#else
ICE_API IceUtil::Shared* upCast(ResponseHandler*);
typedef IceInternal::Handle<ResponseHandler> ResponseHandlerPtr;
+#endif
}
diff --git a/cpp/include/IceUtil/SHA1.h b/cpp/include/Ice/SHA1.h
index 154ca842382..7666d0c2a0f 100644
--- a/cpp/include/IceUtil/SHA1.h
+++ b/cpp/include/Ice/SHA1.h
@@ -1,28 +1,28 @@
// **********************************************************************
//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-#ifndef ICE_UTIL_SHA1_H
-#define ICE_UTIL_SHA1_H
+#ifndef ICE_SHA1_H
+#define ICE_SHA1_H
-#include <IceUtil/Config.h>
-#include <IceUtil/UniquePtr.h>
+#include <Ice/Config.h>
+#include <Ice/UniquePtr.h>
#include <vector>
-namespace IceUtilInternal
+namespace IceInternal
{
-ICE_UTIL_API void
+ICE_API void
sha1(const unsigned char*, std::size_t, std::vector<unsigned char>&);
-#ifndef ICE_OS_WINRT
-class ICE_UTIL_API SHA1
+#ifndef ICE_OS_UWP
+class ICE_API SHA1
{
public:
@@ -39,7 +39,7 @@ private:
SHA1 operator=(const SHA1&);
class Hasher;
- IceUtil::UniquePtr<Hasher> _hasher;
+ UniquePtr<Hasher> _hasher;
};
#endif
diff --git a/cpp/include/Ice/Service.h b/cpp/include/Ice/Service.h
index 169eea6df18..8c0b786cda9 100644
--- a/cpp/include/Ice/Service.h
+++ b/cpp/include/Ice/Service.h
@@ -10,8 +10,8 @@
#ifndef ICE_SERVICE_H
#define ICE_SERVICE_H
-#include <IceUtil/Config.h>
-#include <Ice/Ice.h>
+#include <Ice/Initialize.h>
+#include <Ice/LoggerUtil.h>
#ifdef _WIN32
# include <winsvc.h>
diff --git a/cpp/include/Ice/SlicedData.h b/cpp/include/Ice/SlicedData.h
index b09d1c4eabd..6774885028f 100644
--- a/cpp/include/Ice/SlicedData.h
+++ b/cpp/include/Ice/SlicedData.h
@@ -12,6 +12,7 @@
#include <Ice/SlicedDataF.h>
#include <Ice/GCObject.h>
+#include <Ice/Value.h>
namespace Ice
{
@@ -19,7 +20,10 @@ namespace Ice
//
// SliceInfo encapsulates the details of a slice for an unknown class or exception type.
//
-struct ICE_API SliceInfo : public ::IceUtil::Shared
+struct ICE_API SliceInfo
+#ifndef ICE_CPP11_MAPPING
+ : public ::IceUtil::Shared
+#endif
{
//
// The Slice type ID for this slice.
@@ -37,9 +41,9 @@ struct ICE_API SliceInfo : public ::IceUtil::Shared
::std::vector<Byte> bytes;
//
- // The Ice objects referenced by this slice.
+ // The class instances referenced by this slice.
//
- ::std::vector<ObjectPtr> objects;
+ ::std::vector<ValuePtr> instances;
//
// Whether or not the slice contains optional members.
@@ -55,43 +59,59 @@ struct ICE_API SliceInfo : public ::IceUtil::Shared
//
// SlicedData holds the slices of unknown types.
//
-class ICE_API SlicedData : public ::IceUtil::Shared
+class ICE_API SlicedData
+#ifndef ICE_CPP11_MAPPING
+ : public ::IceUtil::Shared
+#endif
{
public:
+#ifndef ICE_CPP11_MAPPING
+ virtual ~SlicedData();
+#endif
+
SlicedData(const SliceInfoSeq&);
const SliceInfoSeq slices;
-
- void __gcVisitMembers(IceInternal::GCVisitor&);
+#ifndef ICE_CPP11_MAPPING
+ void _iceGcVisitMembers(IceInternal::GCVisitor&);
+#endif
};
//
// Unknown sliced object holds instance of unknown type.
//
-
-#ifdef __IBMCPP__
-// xlC does not handle properly the public/private multiple inheritance from Object
-class ICE_API UnknownSlicedObject : public IceInternal::GCObject
+class ICE_API UnknownSlicedValue :
+#ifdef ICE_CPP11_MAPPING
+ public Value
#else
-class ICE_API UnknownSlicedObject : virtual public Object, private IceInternal::GCObject
+ public IceInternal::GCObject
#endif
{
public:
- UnknownSlicedObject(const std::string&);
+ UnknownSlicedValue(const std::string&);
const std::string& getUnknownTypeId() const;
SlicedDataPtr getSlicedData() const;
- virtual void __gcVisitMembers(IceInternal::GCVisitor&);
+#ifdef ICE_CPP11_MAPPING
+ virtual void _iceWrite(::Ice::OutputStream*) const override;
+ virtual void _iceRead(::Ice::InputStream*) override;
+
+ virtual std::string ice_id() const override;
+ std::shared_ptr<UnknownSlicedValue> ice_clone() const;
+
+protected:
- virtual void __write(::IceInternal::BasicStream*) const;
- virtual void __read(::IceInternal::BasicStream*);
-
- using Object::__write;
- using Object::__read;
+ virtual std::shared_ptr<Value> cloneImpl() const override;
+#else
+ virtual void _iceGcVisitMembers(IceInternal::GCVisitor&);
+
+ virtual void _iceWrite(::Ice::OutputStream*) const;
+ virtual void _iceRead(::Ice::InputStream*);
+#endif
private:
diff --git a/cpp/include/Ice/SlicedDataF.h b/cpp/include/Ice/SlicedDataF.h
index 7ab361c2465..aa14576ce4a 100644
--- a/cpp/include/Ice/SlicedDataF.h
+++ b/cpp/include/Ice/SlicedDataF.h
@@ -17,17 +17,25 @@ namespace Ice
{
struct SliceInfo;
+class SlicedData;
+class UnknownSlicedValue;
+
+#ifdef ICE_CPP11_MAPPING
+using SliceInfoPtr = ::std::shared_ptr<SliceInfo>;
+using SlicedDataPtr = ::std::shared_ptr<SlicedData>;
+using UnknownSlicedValuePtr = ::std::shared_ptr<UnknownSlicedValue>;
+#else
ICE_API IceUtil::Shared* upCast(SliceInfo*);
typedef IceInternal::Handle<SliceInfo> SliceInfoPtr;
-typedef ::std::vector<SliceInfoPtr> SliceInfoSeq;
-class SlicedData;
ICE_API IceUtil::Shared* upCast(SlicedData*);
typedef IceInternal::Handle<SlicedData> SlicedDataPtr;
-class UnknownSlicedObject;
-ICE_API IceUtil::Shared* upCast(UnknownSlicedObject*);
-typedef IceInternal::Handle<UnknownSlicedObject> UnknownSlicedObjectPtr;
+ICE_API IceUtil::Shared* upCast(UnknownSlicedValue*);
+typedef IceInternal::Handle<UnknownSlicedValue> UnknownSlicedValuePtr;
+#endif
+
+typedef ::std::vector<SliceInfoPtr> SliceInfoSeq;
}
diff --git a/cpp/include/Ice/Stream.h b/cpp/include/Ice/Stream.h
deleted file mode 100644
index 92ffd981ce3..00000000000
--- a/cpp/include/Ice/Stream.h
+++ /dev/null
@@ -1,447 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_STREAM_H
-#define ICE_STREAM_H
-
-#include <Ice/StreamF.h>
-#include <Ice/CommunicatorF.h>
-#include <Ice/Object.h>
-#include <Ice/Exception.h>
-#include <Ice/Proxy.h>
-#include <Ice/SlicedDataF.h>
-#include <IceUtil/Shared.h>
-#include <Ice/StreamHelpers.h>
-
-namespace Ice
-{
-
-class ICE_API ReadObjectCallback : public ::IceUtil::Shared
-{
-public:
-
- virtual void invoke(const ObjectPtr&) = 0;
-};
-typedef IceUtil::Handle<ReadObjectCallback> ReadObjectCallbackPtr;
-
-template<typename T>
-class ReadObjectCallbackI : public ReadObjectCallback
-{
-
-public:
-
- ReadObjectCallbackI(::IceInternal::Handle<T>& v) :
- _v(v)
- {
- }
-
- virtual void invoke(const ObjectPtr& p)
- {
- _v = ::IceInternal::Handle<T>::dynamicCast(p);
- if(p && !_v)
- {
- IceInternal::Ex::throwUOE(T::ice_staticId(), p);
- }
- }
-
-private:
-
- ::IceInternal::Handle<T>& _v;
-};
-
-class ICE_API UserExceptionReader : public UserException
-{
-public:
-
- UserExceptionReader(const CommunicatorPtr&);
- ~UserExceptionReader() throw();
-
- virtual void read(const InputStreamPtr&) const = 0;
- virtual bool usesClasses() const = 0;
-
- virtual ::std::string ice_name() const = 0;
- virtual UserException* ice_clone() const = 0;
- virtual void ice_throw() const = 0;
-
- virtual void __write(IceInternal::BasicStream*) const;
- virtual void __read(IceInternal::BasicStream*);
-
- virtual bool __usesClasses() const;
-
- using UserException::__read;
- using UserException::__write;
-
-protected:
-
- virtual void __writeImpl(::IceInternal::BasicStream*) const;
- virtual void __readImpl(::IceInternal::BasicStream*);
-
- using UserException::__writeImpl;
- using UserException::__readImpl;
-
- const CommunicatorPtr _communicator;
-};
-
-class ICE_API UserExceptionReaderFactory : public IceUtil::Shared
-{
-public:
-
- virtual void createAndThrow(const std::string&) const = 0;
-};
-typedef ::IceUtil::Handle<UserExceptionReaderFactory> UserExceptionReaderFactoryPtr;
-
-class ICE_API InputStream : public ::IceUtil::Shared
-{
-public:
-
- typedef size_t size_type;
-
- virtual CommunicatorPtr communicator() const = 0;
-
- virtual void sliceObjects(bool) = 0;
-
- virtual Int readSize() = 0;
- virtual Int readAndCheckSeqSize(int) = 0;
-
- virtual ObjectPrx readProxy() = 0;
- template<typename T> void read(IceInternal::ProxyHandle<T>& v)
- {
- ObjectPrx proxy = readProxy();
- if(!proxy)
- {
- v = 0;
- }
- else
- {
- v = new T;
- v->__copyFrom(proxy);
- }
- }
-
- virtual void readObject(const ReadObjectCallbackPtr&) = 0;
- template<typename T> void read(IceInternal::Handle<T>& v)
- {
- readObject(new ReadObjectCallbackI<T>(v));
- }
-
- virtual Int readEnum(Int maxValue)
- {
- if(getEncoding() == Encoding_1_0)
- {
- if(maxValue < 127)
- {
- Byte value;
- read(value);
- return value;
- }
- else if(maxValue < 32767)
- {
- Short value;
- read(value);
- return value;
- }
- else
- {
- Int value;
- read(value);
- return value;
- }
- }
- else
- {
- return readSize();
- }
- }
-
- virtual void throwException() = 0;
- virtual void throwException(const UserExceptionReaderFactoryPtr&) = 0;
-
- virtual void startObject() = 0;
- virtual SlicedDataPtr endObject(bool) = 0;
-
- virtual void startException() = 0;
- virtual SlicedDataPtr endException(bool) = 0;
-
- virtual std::string startSlice() = 0;
- virtual void endSlice() = 0;
- virtual void skipSlice() = 0;
-
- virtual EncodingVersion startEncapsulation() = 0;
- virtual void endEncapsulation() = 0;
- virtual EncodingVersion skipEncapsulation() = 0;
-
- virtual EncodingVersion getEncoding() const = 0;
-
- virtual void readPendingObjects() = 0;
-
- virtual size_type pos() = 0;
- virtual void rewind() = 0;
-
- virtual void skip(Int) = 0;
- virtual void skipSize() = 0;
-
- virtual void read(bool&) = 0;
- virtual void read(Byte&) = 0;
- virtual void read(Short&) = 0;
- virtual void read(Int&) = 0;
- virtual void read(Long&) = 0;
- virtual void read(Float&) = 0;
- virtual void read(Double&) = 0;
- virtual void read(::std::string&, bool = true) = 0;
- virtual void read(const char*&, size_t&) = 0;
- virtual void read(const char*&, size_t&, std::string&) = 0;
- virtual void read(::std::vector< ::std::string>&, bool) = 0; // Overload required for additional bool argument.
- virtual void read(::std::wstring&) = 0;
-
- //
- // std::vector<bool> is a special C++ type, so we give it its own read function
- //
- virtual void read(::std::vector<bool>&) = 0;
-
- virtual void read(::std::pair<const bool*, const bool*>&, ::IceUtil::ScopedArray<bool>&) = 0;
- virtual void read(::std::pair<const Byte*, const Byte*>&) = 0;
- virtual void read(::std::pair<const Short*, const Short*>&, ::IceUtil::ScopedArray<Short>&) = 0;
- virtual void read(::std::pair<const Int*, const Int*>&, ::IceUtil::ScopedArray<Int>&) = 0;
- virtual void read(::std::pair<const Long*, const Long*>&, ::IceUtil::ScopedArray<Long>&) = 0;
- virtual void read(::std::pair<const Float*, const Float*>&, ::IceUtil::ScopedArray<Float>&) = 0;
- virtual void read(::std::pair<const Double*, const Double*>&, ::IceUtil::ScopedArray<Double>&) = 0;
-
- // This method is useful for generic stream helpers
- void read(::std::pair<const Byte*, const Byte*>& p, ::IceUtil::ScopedArray<Byte>& result)
- {
- result.reset();
- read(p);
- }
-
- virtual bool readOptional(Int, OptionalFormat) = 0;
-
- template<typename T> inline void read(T& v)
- {
- StreamHelper<T, StreamableTraits<T>::helper>::read(this, v);
- }
-
- template<typename T> inline void read(Int tag, IceUtil::Optional<T>& v)
- {
- if(readOptional(tag, StreamOptionalHelper<T,
- StreamableTraits<T>::helper,
- StreamableTraits<T>::fixedLength>::optionalFormat))
- {
- v.__setIsSet();
- StreamOptionalHelper<T, StreamableTraits<T>::helper, StreamableTraits<T>::fixedLength>::read(this, *v);
- }
- else
- {
- v = IceUtil::None;
- }
- }
-
- virtual void closure(void*) = 0;
- virtual void* closure() const = 0;
-};
-
-class ICE_API OutputStream : public ::IceUtil::Shared
-{
-public:
-
- typedef size_t size_type;
-
- virtual CommunicatorPtr communicator() const = 0;
-
- virtual void writeSize(Int) = 0;
-
- virtual void writeProxy(const ObjectPrx&) = 0;
- template<typename T> void write(const IceInternal::ProxyHandle<T>& v)
- {
- writeProxy(ObjectPrx(v.get()));
- }
-
- virtual void writeObject(const ObjectPtr&) = 0;
- template<typename T> void write(const IceInternal::Handle<T>& v)
- {
- writeObject(ObjectPtr(v.get()));
- }
-
- virtual void writeEnum(Int v, Int maxValue)
- {
- if(getEncoding() == Encoding_1_0)
- {
- if(maxValue < 127)
- {
- write(static_cast<Byte>(v));
- }
- else if(maxValue < 32767)
- {
- write(static_cast<Short>(v));
- }
- else
- {
- write(v);
- }
- }
- else
- {
- writeSize(v);
- }
- }
-
- virtual void writeException(const UserException&) = 0;
-
- virtual void startObject(const SlicedDataPtr&) = 0;
- virtual void endObject() = 0;
-
- virtual void startException(const SlicedDataPtr&) = 0;
- virtual void endException() = 0;
-
- virtual void startSlice(const ::std::string&, int, bool) = 0;
- virtual void endSlice() = 0;
-
- virtual void startEncapsulation(const EncodingVersion&, FormatType) = 0;
- virtual void startEncapsulation() = 0;
- virtual void endEncapsulation() = 0;
-
- virtual EncodingVersion getEncoding() const = 0;
-
- virtual void writePendingObjects() = 0;
-
- virtual void finished(::std::vector<Byte>&) = 0;
- virtual std::pair<const Byte*, const Byte*> finished() = 0;
-
- virtual size_type pos() = 0;
- virtual void rewrite(Int, size_type) = 0;
-
- virtual void reset(bool) = 0;
-
- virtual void write(bool) = 0;
- virtual void write(Byte) = 0;
- virtual void write(Short) = 0;
- virtual void write(Int) = 0;
- virtual void write(Long) = 0;
- virtual void write(Float) = 0;
- virtual void write(Double) = 0;
- virtual void write(const ::std::string&, bool = true) = 0;
- virtual void write(const char*, size_t, bool = true) = 0;
- virtual void write(const ::std::vector< ::std::string>&, bool) = 0; // Overload required for bool argument.
- virtual void write(const char*, bool = true) = 0;
- virtual void write(const ::std::wstring&) = 0;
-
- //
- // std::vector<bool> is a special C++ type, so we give it its own write function
- //
- virtual void write(const ::std::vector<bool>&) = 0;
-
- virtual void write(const bool*, const bool*) = 0;
- virtual void write(const Byte*, const Byte*) = 0;
- virtual void write(const Short*, const Short*) = 0;
- virtual void write(const Int*, const Int*) = 0;
- virtual void write(const Long*, const Long*) = 0;
- virtual void write(const Float*, const Float*) = 0;
- virtual void write(const Double*, const Double*) = 0;
-
- virtual bool writeOptional(Int, OptionalFormat) = 0;
-
- virtual size_type startSize() = 0;
- virtual void endSize(size_type pos) = 0;
-
- template<typename T> inline void write(const T& v)
- {
- StreamHelper<T, StreamableTraits<T>::helper>::write(this, v);
- }
-
- template<typename T> inline void write(Int tag, const IceUtil::Optional<T>& v)
- {
- if(v)
- {
- writeOptional(tag, StreamOptionalHelper<T,
- StreamableTraits<T>::helper,
- StreamableTraits<T>::fixedLength>::optionalFormat);
- StreamOptionalHelper<T, StreamableTraits<T>::helper, StreamableTraits<T>::fixedLength>::write(this, *v);
- }
- }
-
- //
- // Template functions for sequences and custom sequences
- //
- template<typename T> void write(const T* begin, const T* end)
- {
- writeSize(static_cast<Int>(end - begin));
- for(const T* p = begin; p != end; ++p)
- {
- write(*p);
- }
- }
-};
-
-class ICE_API ObjectReader : public Object
-{
-public:
-
- virtual void read(const InputStreamPtr&) = 0;
-
-private:
-
- virtual void __write(::IceInternal::BasicStream*) const;
- virtual void __read(::IceInternal::BasicStream*);
-
- virtual void __write(const OutputStreamPtr&) const;
- virtual void __read(const InputStreamPtr&);
-};
-typedef ::IceInternal::Handle<ObjectReader> ObjectReaderPtr;
-
-class ICE_API ObjectWriter : public Object
-{
-public:
-
- virtual void write(const OutputStreamPtr&) const = 0;
-
-private:
-
- virtual void __write(::IceInternal::BasicStream*) const;
- virtual void __read(::IceInternal::BasicStream*);
-
- virtual void __write(const OutputStreamPtr&) const;
- virtual void __read(const InputStreamPtr&);
-};
-typedef ::IceInternal::Handle<ObjectWriter> ObjectWriterPtr;
-
-class ICE_API UserExceptionWriter : public UserException
-{
-public:
-
- UserExceptionWriter(const CommunicatorPtr&);
- ~UserExceptionWriter() throw();
-
- virtual void write(const OutputStreamPtr&) const = 0;
- virtual bool usesClasses() const = 0;
-
- virtual ::std::string ice_name() const = 0;
- virtual UserException* ice_clone() const = 0;
- virtual void ice_throw() const = 0;
-
- virtual void __write(IceInternal::BasicStream*) const;
- virtual void __read(IceInternal::BasicStream*);
-
- virtual bool __usesClasses() const;
-
- using UserException::__read;
- using UserException::__write;
-
-protected:
-
- virtual void __writeImpl(::IceInternal::BasicStream*) const;
- virtual void __readImpl(::IceInternal::BasicStream*);
-
- using UserException::__writeImpl;
- using UserException::__readImpl;
-
- const CommunicatorPtr _communicator;
-};
-
-}
-
-#endif
diff --git a/cpp/include/Ice/StreamF.h b/cpp/include/Ice/StreamF.h
deleted file mode 100644
index 30434254879..00000000000
--- a/cpp/include/Ice/StreamF.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_STREAM_F_H
-#define ICE_STREAM_F_H
-
-#include <IceUtil/Shared.h>
-
-#include <Ice/Handle.h>
-
-namespace Ice
-{
-
-class InputStream;
-ICE_API IceUtil::Shared* upCast(::Ice::InputStream*);
-typedef IceInternal::Handle< InputStream > InputStreamPtr;
-
-class OutputStream;
-ICE_API IceUtil::Shared* upCast(::Ice::OutputStream*);
-typedef IceInternal::Handle< OutputStream > OutputStreamPtr;
-
-}
-
-#endif
diff --git a/cpp/include/Ice/StreamHelpers.h b/cpp/include/Ice/StreamHelpers.h
index 4fbca264503..f9cc3f0b48c 100644
--- a/cpp/include/Ice/StreamHelpers.h
+++ b/cpp/include/Ice/StreamHelpers.h
@@ -7,14 +7,16 @@
//
// **********************************************************************
-#ifndef ICE_STREAM_TRAITS_H
-#define ICE_STREAM_TRAITS_H
-
-#include <IceUtil/ScopedArray.h>
-#include <IceUtil/Iterator.h>
+#ifndef ICE_STREAM_HELPERS_H
+#define ICE_STREAM_HELPERS_H
#include <Ice/ObjectF.h>
+#ifndef ICE_CPP11_MAPPING
+# include <IceUtil/ScopedArray.h>
+# include <IceUtil/Iterator.h>
+#endif
+
namespace Ice
{
@@ -44,19 +46,33 @@ const StreamHelperCategory StreamHelperCategoryUserException = 9;
// and how it can be skipped by the unmarshaling code if the optional
// isn't known to the receiver.
//
+
+#ifdef ICE_CPP11_MAPPING
+enum class OptionalFormat : unsigned char
+{
+ F1 = 0, // Fixed 1-byte encoding
+ F2 = 1, // Fixed 2 bytes encoding
+ F4 = 2, // Fixed 4 bytes encoding
+ F8 = 3, // Fixed 8 bytes encoding
+ Size = 4, // "Size encoding" on 1 to 5 bytes, e.g. enum, class identifier
+ VSize = 5, // "Size encoding" on 1 to 5 bytes followed by data, e.g. string, fixed size
+ // struct, or containers whose size can be computed prior to marshaling
+ FSize = 6, // Fixed size on 4 bytes followed by data, e.g. variable-size struct, container.
+ Class = 7
+};
+#else
enum OptionalFormat
{
- OptionalFormatF1 = 0, // Fixed 1-byte encoding
- OptionalFormatF2 = 1, // Fixed 2 bytes encoding
- OptionalFormatF4 = 2, // Fixed 4 bytes encoding
- OptionalFormatF8 = 3, // Fixed 8 bytes encoding
- OptionalFormatSize = 4, // "Size encoding" on 1 to 5 bytes, e.g. enum, class identifier
- OptionalFormatVSize = 5, // "Size encoding" on 1 to 5 bytes followed by data, e.g. string, fixed size
- // struct, or containers whose size can be computed prior to marshaling
- OptionalFormatFSize = 6, // Fixed size on 4 bytes followed by data, e.g. variable-size struct, container.
+ OptionalFormatF1 = 0, // see above
+ OptionalFormatF2 = 1,
+ OptionalFormatF4 = 2,
+ OptionalFormatF8 = 3,
+ OptionalFormatSize = 4,
+ OptionalFormatVSize = 5,
+ OptionalFormatFSize = 6,
OptionalFormatClass = 7
};
-
+#endif
//
// Is the provided type a container?
@@ -92,43 +108,87 @@ struct IsMap
static const bool value = IsContainer<T>::value && sizeof(test<T>(0)) == sizeof(char);
};
+#ifdef ICE_CPP11_MAPPING
+
//
// Base traits template.
// Types with no specialized trait use this trait.
//
-template<typename T, typename Enabler = void>
+template<typename T, typename Enabler = void>
struct StreamableTraits
{
- static const StreamHelperCategory helper = IsMap<T>::value ? StreamHelperCategoryDictionary :
- (IsContainer<T>::value ? StreamHelperCategorySequence : StreamHelperCategoryUnknown);
+ static const StreamHelperCategory helper = StreamHelperCategoryUnknown;
//
// When extracting a sequence<T> from a stream, we can ensure the
// stream has at least StreamableTraits<T>::minWireSize * size bytes
// For containers, the minWireSize is 1 (just 1 byte for an empty container).
//
- static const int minWireSize = 1;
+ //static const int minWireSize = 1;
//
// Is this type encoded on a fixed number of bytes?
// Used only for marshaling/unmarshaling optional data members and parameters.
//
+ //static const bool fixedLength = false;
+};
+
+template<typename T>
+struct StreamableTraits<T, typename ::std::enable_if<IsMap<T>::value || IsContainer<T>::value>::type>
+{
+ static const StreamHelperCategory helper = IsMap<T>::value ? StreamHelperCategoryDictionary : StreamHelperCategorySequence;
+ static const int minWireSize = 1;
static const bool fixedLength = false;
};
+template<typename T>
+struct StreamableTraits<T, typename ::std::enable_if<::std::is_base_of<::Ice::UserException, T>::value>::type>
+{
+ static const StreamHelperCategory helper = StreamHelperCategoryUserException;
+
+ //
+ // There is no sequence/dictionary of UserException (so no need for minWireSize)
+ // and no optional UserException (so no need for fixedLength)
+ //
+};
+
//
-// StreamableTraits specialization for array / range mapped sequences
-// The type can be a std::pair<T, T> or a
-// std::pair<IceUtil::ScopedArray<T>, std::pair<const T*, const T*> >
+// StreamableTraits specialization for arrays (std::pair<const T*, const T*>).
//
-template<typename T, typename U>
-struct StreamableTraits< ::std::pair<T, U> >
+template<typename T>
+struct StreamableTraits<std::pair<T*, T*>>
{
static const StreamHelperCategory helper = StreamHelperCategorySequence;
static const int minWireSize = 1;
static const bool fixedLength = false;
};
+#else
+
+//
+// Base traits template.
+// Types with no specialized trait use this trait.
+//
+template<typename T, typename Enabler = void>
+struct StreamableTraits
+{
+ static const StreamHelperCategory helper = IsMap<T>::value ? StreamHelperCategoryDictionary :
+ (IsContainer<T>::value ? StreamHelperCategorySequence : StreamHelperCategoryUnknown);
+
+ //
+ // When extracting a sequence<T> from a stream, we can ensure the
+ // stream has at least StreamableTraits<T>::minWireSize * size bytes
+ // For containers, the minWireSize is 1 (just 1 byte for an empty container).
+ //
+ static const int minWireSize = 1;
+
+ //
+ // Is this type encoded on a fixed number of bytes?
+ // Used only for marshaling/unmarshaling optional data members and parameters.
+ //
+ static const bool fixedLength = false;
+};
+
//
// StreamableTraits specialization for user exceptions.
//
@@ -143,6 +203,19 @@ struct StreamableTraits<UserException>
//
};
+//
+// StreamableTraits specialization for array / range mapped sequences
+// The type can be a std::pair<T, T> or a
+// std::pair<IceUtil::ScopedArray<T>, std::pair<const T*, const T*> >
+//
+template<typename T, typename U>
+struct StreamableTraits< ::std::pair<T, U> >
+{
+ static const StreamHelperCategory helper = StreamHelperCategorySequence;
+ static const int minWireSize = 1;
+ static const bool fixedLength = false;
+};
+#endif
//
// StreamableTraits specialization for builtins (these are needed for sequence
@@ -233,6 +306,15 @@ struct StreamableTraits< ::std::vector<bool> >
};
+#ifdef ICE_CPP11_MAPPING
+template<typename T>
+struct StreamableTraits<::std::shared_ptr<T>, typename ::std::enable_if<::std::is_base_of<::Ice::ObjectPrx, T>::value>::type>
+{
+ static const StreamHelperCategory helper = StreamHelperCategoryProxy;
+ static const int minWireSize = 2;
+ static const bool fixedLength = false;
+};
+#else
template<typename T>
struct StreamableTraits< ::IceInternal::ProxyHandle<T> >
{
@@ -240,7 +322,17 @@ struct StreamableTraits< ::IceInternal::ProxyHandle<T> >
static const int minWireSize = 2;
static const bool fixedLength = false;
};
+#endif
+#ifdef ICE_CPP11_MAPPING
+template<typename T>
+struct StreamableTraits<::std::shared_ptr<T>, typename ::std::enable_if<::std::is_base_of<::Ice::Value, T>::value>::type>
+{
+ static const StreamHelperCategory helper = StreamHelperCategoryClass;
+ static const int minWireSize = 1;
+ static const bool fixedLength = false;
+};
+#else
template<typename T>
struct StreamableTraits< ::IceInternal::Handle<T> >
{
@@ -248,6 +340,7 @@ struct StreamableTraits< ::IceInternal::Handle<T> >
static const int minWireSize = 1;
static const bool fixedLength = false;
};
+#endif
//
// StreamHelper templates used by streams to read and write data.
@@ -275,15 +368,35 @@ struct StreamHelper<T, StreamHelperCategoryBuiltin>
}
};
+//
// "helpers" for the StreamHelper<T, StreamHelperCategoryStruct[Class]> below
-// We generate specializations, which can be instantiated explicitly and exported from DLLs
+// slice2cpp generates specializations as needed
//
template<typename T, typename S>
-struct StreamWriter;
+struct StreamWriter
+{
+#ifdef ICE_CPP11_MAPPING
+ static inline void write(S* stream, const T& v)
+ {
+ stream->writeAll(v.ice_tuple());
+ }
+#else
+ static inline void write(S*, const T&)
+ {
+ // Default is to write nothing for C++98
+ }
+#endif
+};
template<typename T, typename S>
-struct StreamReader;
+struct StreamReader
+{
+ static inline void read(S*, T&)
+ {
+ // Default is to read nothing
+ }
+};
// Helper for structs
template<typename T>
@@ -302,7 +415,6 @@ struct StreamHelper<T, StreamHelperCategoryStruct>
}
};
-
// Helper for class structs
template<typename T>
struct StreamHelper<T, StreamHelperCategoryStructClass>
@@ -373,7 +485,7 @@ struct StreamHelper<T, StreamHelperCategorySequence>
}
};
-// Helper for array and range:array custom sequence parameters
+// Helper for array custom sequence parameters
template<typename T>
struct StreamHelper<std::pair<const T*, const T*>, StreamHelperCategorySequence>
{
@@ -390,6 +502,8 @@ struct StreamHelper<std::pair<const T*, const T*>, StreamHelperCategorySequence>
}
};
+#ifndef ICE_CPP11_MAPPING
+
// Helper for range custom sequence parameters
template<typename T>
struct StreamHelper<std::pair<T, T>, StreamHelperCategorySequence>
@@ -425,8 +539,6 @@ struct StreamHelper<std::pair< ::std::vector<bool>::const_iterator,
stream->write(static_cast<bool>(*p));
}
}
-
- // no read: only used for marshaling
};
// Helper for zero-copy array sequence parameters
@@ -441,6 +553,8 @@ struct StreamHelper<std::pair<IceUtil::ScopedArray<T>, std::pair<const T*, const
// no write: only used for unmarshaling
};
+#endif
+
// Helper for dictionaries
template<typename T>
@@ -536,43 +650,43 @@ struct GetOptionalFormat;
template<>
struct GetOptionalFormat<StreamHelperCategoryBuiltin, 1, true>
{
- static const OptionalFormat value = OptionalFormatF1;
+ static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, F1);
};
template<>
struct GetOptionalFormat<StreamHelperCategoryBuiltin, 2, true>
{
- static const OptionalFormat value = OptionalFormatF2;
+ static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, F2);
};
template<>
struct GetOptionalFormat<StreamHelperCategoryBuiltin, 4, true>
{
- static const OptionalFormat value = OptionalFormatF4;
+ static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, F4);
};
template<>
struct GetOptionalFormat<StreamHelperCategoryBuiltin, 8, true>
{
- static const OptionalFormat value = OptionalFormatF8;
+ static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, F8);
};
template<>
struct GetOptionalFormat<StreamHelperCategoryBuiltin, 1, false>
{
- static const OptionalFormat value = OptionalFormatVSize;
+ static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, VSize);
};
template<>
struct GetOptionalFormat<StreamHelperCategoryClass, 1, false>
{
- static const OptionalFormat value = OptionalFormatClass;
+ static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, Class);
};
template<int minWireSize>
struct GetOptionalFormat<StreamHelperCategoryEnum, minWireSize, false>
{
- static const OptionalFormat value = OptionalFormatSize;
+ static const OptionalFormat value = ICE_SCOPED_ENUM(OptionalFormat, Size);
};
@@ -606,7 +720,7 @@ struct StreamOptionalHelper
template<typename T>
struct StreamOptionalHelper<T, StreamHelperCategoryStruct, true>
{
- static const OptionalFormat optionalFormat = OptionalFormatVSize;
+ static const OptionalFormat optionalFormat = ICE_SCOPED_ENUM(OptionalFormat, VSize);
template<class S> static inline void
write(S* stream, const T& v)
@@ -627,7 +741,7 @@ struct StreamOptionalHelper<T, StreamHelperCategoryStruct, true>
template<typename T>
struct StreamOptionalHelper<T, StreamHelperCategoryStruct, false>
{
- static const OptionalFormat optionalFormat = OptionalFormatFSize;
+ static const OptionalFormat optionalFormat = ICE_SCOPED_ENUM(OptionalFormat, FSize);
template<class S> static inline void
write(S* stream, const T& v)
@@ -673,7 +787,7 @@ struct StreamOptionalContainerHelper;
template<typename T, int sz>
struct StreamOptionalContainerHelper<T, false, sz>
{
- static const OptionalFormat optionalFormat = OptionalFormatFSize;
+ static const OptionalFormat optionalFormat = ICE_SCOPED_ENUM(OptionalFormat, FSize);
template<class S> static inline void
write(S* stream, const T& v, Int)
@@ -696,7 +810,7 @@ struct StreamOptionalContainerHelper<T, false, sz>
template<typename T, int sz>
struct StreamOptionalContainerHelper<T, true, sz>
{
- static const OptionalFormat optionalFormat = OptionalFormatVSize;
+ static const OptionalFormat optionalFormat = ICE_SCOPED_ENUM(OptionalFormat, VSize);
template<class S> static inline void
write(S* stream, const T& v, Int n)
@@ -727,7 +841,7 @@ struct StreamOptionalContainerHelper<T, true, sz>
template<typename T>
struct StreamOptionalContainerHelper<T, true, 1>
{
- static const OptionalFormat optionalFormat = OptionalFormatVSize;
+ static const OptionalFormat optionalFormat = ICE_SCOPED_ENUM(OptionalFormat, VSize);
template<class S> static inline void
write(S* stream, const T& v, Int)
@@ -796,6 +910,8 @@ struct StreamOptionalHelper<std::pair<const T*, const T*>, StreamHelperCategoryS
}
};
+#ifndef ICE_CPP11_MAPPING
+
template<typename T>
struct StreamOptionalHelper<std::pair<T, T>, StreamHelperCategorySequence, false>
{
@@ -841,6 +957,7 @@ struct StreamOptionalHelper<std::pair<IceUtil::ScopedArray<T>, std::pair<const T
// no write: only used for unmarshaling
};
+#endif
//
// Helper to write dictionaries, delegates to the optional container
diff --git a/cpp/include/Ice/StringConverter.h b/cpp/include/Ice/StringConverter.h
new file mode 100644
index 00000000000..6ec490a7806
--- /dev/null
+++ b/cpp/include/Ice/StringConverter.h
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_STRING_CONVERTER_H
+#define ICE_STRING_CONVERTER_H
+
+#include <Ice/Config.h>
+#include <IceUtil/StringConverter.h>
+#include <IceUtil/ConsoleUtil.h>
+
+namespace Ice
+{
+
+typedef IceUtil::UTF8Buffer UTF8Buffer;
+typedef IceUtil::StringConverter StringConverter;
+typedef IceUtil::StringConverterPtr StringConverterPtr;
+typedef IceUtil::WstringConverter WstringConverter;
+typedef IceUtil::WstringConverterPtr WstringConverterPtr;
+
+typedef IceUtil::IllegalConversionException IllegalConversionException;
+
+#ifdef ICE_CPP11_MAPPING
+template<typename charT>
+using BasicStringConverter = IceUtil::BasicStringConverter<charT>;
+#endif
+
+#ifdef _WIN32
+using IceUtil::createWindowsStringConverter;
+#endif
+
+using IceUtil::createUnicodeWstringConverter;
+
+using IceUtil::setProcessStringConverter;
+using IceUtil::getProcessStringConverter;
+using IceUtil::setProcessWstringConverter;
+using IceUtil::getProcessWstringConverter;
+
+using IceUtil::wstringToString;
+using IceUtil::stringToWstring;
+
+using IceUtil::nativeToUTF8;
+using IceUtil::UTF8ToNative;
+
+}
+
+#endif
diff --git a/cpp/include/Ice/UUID.h b/cpp/include/Ice/UUID.h
new file mode 100644
index 00000000000..711570a0164
--- /dev/null
+++ b/cpp/include/Ice/UUID.h
@@ -0,0 +1,23 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_UUID_H
+#define ICE_UUID_H
+
+#include <Ice/Config.h>
+#include <IceUtil/UUID.h>
+
+namespace Ice
+{
+
+using IceUtil::generateUUID;
+
+}
+
+#endif
diff --git a/cpp/include/IceUtil/UniquePtr.h b/cpp/include/Ice/UniquePtr.h
index fa4517df0c3..0abf17b5843 100644
--- a/cpp/include/IceUtil/UniquePtr.h
+++ b/cpp/include/Ice/UniquePtr.h
@@ -1,25 +1,26 @@
// **********************************************************************
//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-#ifndef ICE_UTIL_UNIQUE_PTR_H
-#define ICE_UTIL_UNIQUE_PTR_H
+#ifndef ICE_UNIQUE_PTR_H
+#define ICE_UNIQUE_PTR_H
-#include <IceUtil/Config.h>
+#include <Ice/Config.h>
-namespace IceUtil
+namespace IceInternal
{
-//
-// This is temporary and very partial placeholder for std::unique_ptr,
-// which is not yet widely available.
-//
+#ifdef ICE_CPP11_MAPPING
+template<typename T>
+using UniquePtr = std::unique_ptr<T>;
+
+#else
template<typename T>
class UniquePtr
@@ -31,17 +32,6 @@ public:
{
}
- UniquePtr(UniquePtr& o) :
- _ptr(o.release())
- {
- }
-
- UniquePtr& operator=(UniquePtr& o)
- {
- reset(o.release());
- return *this;
- }
-
~UniquePtr()
{
if(_ptr != 0)
@@ -78,12 +68,16 @@ public:
return _ptr;
}
-
T* get() const
{
return _ptr;
}
+ operator bool() const
+ {
+ return _ptr != 0;
+ }
+
void swap(UniquePtr& a)
{
T* tmp = a._ptr;
@@ -93,9 +87,14 @@ public:
private:
+ UniquePtr(UniquePtr&);
+ UniquePtr& operator=(UniquePtr&);
+
T* _ptr;
};
+#endif
+
} // End of namespace IceUtil
#endif
diff --git a/cpp/include/Ice/UniqueRef.h b/cpp/include/Ice/UniqueRef.h
new file mode 100644
index 00000000000..0b8f045d43b
--- /dev/null
+++ b/cpp/include/Ice/UniqueRef.h
@@ -0,0 +1,90 @@
+
+#ifndef ICE_UNIQUE_REF_H
+#define ICE_UNIQUE_REF_H
+
+#ifdef __APPLE__
+
+#include <CoreFoundation/CoreFoundation.h>
+
+namespace IceInternal
+{
+
+//
+// UniqueRef helper class for CoreFoundation classes, comparable to std::unique_ptr
+//
+template<typename R>
+class UniqueRef
+{
+public:
+
+ explicit UniqueRef(R ref = 0) :
+ _ref(ref)
+ {
+ }
+
+ ~UniqueRef()
+ {
+ if(_ref != 0)
+ {
+ CFRelease(_ref);
+ }
+ }
+
+ R release()
+ {
+ R r = _ref;
+ _ref = 0;
+ return r;
+ }
+
+ void reset(R ref = 0)
+ {
+ assert(ref == 0 || ref != _ref);
+
+ if(_ref != 0)
+ {
+ CFRelease(_ref);
+ }
+ _ref = ref;
+ }
+
+ void retain(R ref)
+ {
+ reset(ref ? (R)CFRetain(ref) : ref);
+ }
+
+ R& get()
+ {
+ return _ref;
+ }
+
+ R get() const
+ {
+ return _ref;
+ }
+
+ operator bool() const
+ {
+ return _ref != 0;
+ }
+
+ void swap(UniqueRef& a)
+ {
+ R tmp = a._ref;
+ a._ref = _ref;
+ _ref = tmp;
+ }
+
+private:
+
+ UniqueRef(UniqueRef&);
+ UniqueRef& operator=(UniqueRef&);
+
+ R _ref;
+};
+
+}
+
+#endif
+
+#endif
diff --git a/cpp/include/Ice/UserExceptionFactory.h b/cpp/include/Ice/UserExceptionFactory.h
index 6e80b76ec9f..ad47d764dfc 100644
--- a/cpp/include/Ice/UserExceptionFactory.h
+++ b/cpp/include/Ice/UserExceptionFactory.h
@@ -14,33 +14,57 @@
#include <IceUtil/Handle.h>
#include <Ice/Config.h>
+#ifdef ICE_CPP11_MAPPING
+
namespace IceInternal
{
+template<class E>
+void
+#ifdef NDEBUG
+defaultUserExceptionFactory(const std::string&)
+#else
+defaultUserExceptionFactory(const std::string& typeId)
+#endif
+{
+ assert(typeId == E::ice_staticId());
+ throw E();
+}
+
+}
+#else
+
+namespace Ice
+{
+
class ICE_API UserExceptionFactory : public IceUtil::Shared
{
public:
virtual void createAndThrow(const ::std::string&) = 0;
- virtual ~UserExceptionFactory() {}
+ virtual ~UserExceptionFactory();
};
-
typedef ::IceUtil::Handle<UserExceptionFactory> UserExceptionFactoryPtr;
+}
+
+namespace IceInternal
+{
+
template<class E>
-class DefaultUserExceptionFactory : public UserExceptionFactory
+class DefaultUserExceptionFactory : public Ice::UserExceptionFactory
{
public:
-
+
DefaultUserExceptionFactory(const ::std::string& typeId) :
_typeId(typeId)
{
}
-#ifndef NDEBUG
- virtual void createAndThrow(const ::std::string& typeId)
-#else
+#ifdef NDEBUG
virtual void createAndThrow(const ::std::string&)
+#else
+ virtual void createAndThrow(const ::std::string& typeId)
#endif
{
assert(typeId == _typeId);
@@ -54,3 +78,4 @@ private:
}
#endif
+#endif
diff --git a/cpp/include/Ice/Value.h b/cpp/include/Ice/Value.h
new file mode 100644
index 00000000000..dc14eacb76d
--- /dev/null
+++ b/cpp/include/Ice/Value.h
@@ -0,0 +1,102 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_VALUE_H
+#define ICE_VALUE_H
+
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+
+#include <Ice/ValueF.h>
+
+#include <Ice/OutputStream.h>
+#include <Ice/InputStream.h>
+
+namespace Ice
+{
+
+class ICE_API Value
+{
+public:
+
+ // See "Rule of zero" at http://en.cppreference.com/w/cpp/language/rule_of_three
+ // The virtual dtor is actually not stricly necessary since Values are always stored
+ // in std::shared_ptr
+
+ Value() = default;
+ Value(const Value&) = default;
+ Value(Value&&) = default;
+ Value& operator=(const Value&) = default;
+ Value& operator=(Value&&) = default;
+ virtual ~Value() = default;
+
+ virtual void ice_preMarshal();
+ virtual void ice_postUnmarshal();
+
+ virtual void _iceWrite(Ice::OutputStream*) const;
+ virtual void _iceRead(Ice::InputStream*);
+
+ virtual std::string ice_id() const;
+ static const std::string& ice_staticId();
+
+ std::shared_ptr<Value> ice_clone() const;
+
+protected:
+
+ virtual std::shared_ptr<Value> cloneImpl() const = 0;
+
+ virtual void _iceWriteImpl(Ice::OutputStream*) const {}
+ virtual void _iceReadImpl(Ice::InputStream*) {}
+};
+
+template<typename T, typename Base> class ValueHelper : public Base
+{
+public:
+
+ using Base::Base;
+
+ ValueHelper() = default;
+
+ std::shared_ptr<T> ice_clone() const
+ {
+ return std::static_pointer_cast<T>(cloneImpl());
+ }
+
+ virtual std::string ice_id() const override
+ {
+ return T::ice_staticId();
+ }
+
+protected:
+
+ virtual std::shared_ptr<Value> cloneImpl() const override
+ {
+ return std::make_shared<T>(static_cast<const T&>(*this));
+ }
+
+ virtual void _iceWriteImpl(Ice::OutputStream* os) const override
+ {
+ os->startSlice(T::ice_staticId(), -1, std::is_same<Base, Ice::Value>::value ? true : false);
+ Ice::StreamWriter<T, Ice::OutputStream>::write(os, static_cast<const T&>(*this));
+ os->endSlice();
+ Base::_iceWriteImpl(os);
+ }
+
+ virtual void _iceReadImpl(Ice::InputStream* is) override
+ {
+ is->startSlice();
+ Ice::StreamReader<T, Ice::InputStream>::read(is, static_cast<T&>(*this));
+ is->endSlice();
+ Base::_iceReadImpl(is);
+ }
+};
+
+}
+#endif // C++11 mapping end
+
+#endif
diff --git a/cpp/include/Ice/ValueF.h b/cpp/include/Ice/ValueF.h
new file mode 100644
index 00000000000..8c7b309ff09
--- /dev/null
+++ b/cpp/include/Ice/ValueF.h
@@ -0,0 +1,24 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_VALUE_F_H
+#define ICE_VALUE_F_H
+
+#ifdef ICE_CPP11_MAPPING
+#include <Ice/Config.h>
+
+namespace Ice
+{
+
+class Value;
+using ValuePtr = ::std::shared_ptr<Value>;
+
+}
+#endif
+#endif
diff --git a/cpp/include/Slice/Makefile b/cpp/include/IceBT/Makefile
index 520efd3d4e0..4a39268be3f 100644
--- a/cpp/include/Slice/Makefile
+++ b/cpp/include/IceBT/Makefile
@@ -1,6 +1,6 @@
# **********************************************************************
#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
@@ -12,15 +12,15 @@ top_srcdir = ../..
include $(top_srcdir)/config/Make.rules
install::
- @if test ! -d $(DESTDIR)$(install_includedir)/Slice ; \
+ @if test ! -d $(DESTDIR)$(install_includedir)/IceBT ; \
then \
- echo "Creating $(DESTDIR)$(install_includedir)/Slice..." ; \
- $(call mkdir,$(DESTDIR)$(install_includedir)/Slice) ; \
+ echo "Creating $(DESTDIR)$(install_includedir)/IceBT..." ; \
+ $(call mkdir,$(DESTDIR)$(install_includedir)/IceBT) ; \
fi
@for i in *.h ; \
do \
echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/Slice/$$i ; \
- chmod a+r $(DESTDIR)$(install_includedir)/Slice/$$i ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceBT/$$i ; \
+ chmod a+r $(DESTDIR)$(install_includedir)/IceBT/$$i ; \
done
diff --git a/cpp/include/IceBT/Plugin.h b/cpp/include/IceBT/Plugin.h
new file mode 100644
index 00000000000..cb43902f177
--- /dev/null
+++ b/cpp/include/IceBT/Plugin.h
@@ -0,0 +1,84 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_BT_PLUGIN_H
+#define ICE_BT_PLUGIN_H
+
+#include <Ice/Plugin.h>
+
+#ifndef ICEBT_API
+# if defined(ICE_STATIC_LIBS)
+# define ICEBT_API /**/
+# elif defined(ICEBT_API_EXPORTS)
+# define ICEBT_API ICE_DECLSPEC_EXPORT
+# else
+# define ICEBT_API ICE_DECLSPEC_IMPORT
+# endif
+#endif
+
+namespace IceBT
+{
+
+typedef std::map<std::string, std::string> PropertyMap;
+
+typedef std::map<std::string, PropertyMap> DeviceMap;
+
+#ifndef ICE_CPP11_MAPPING
+//
+// An application can receive discovery notifications
+// by implementing the DiscoveryCallback interface.
+//
+class ICEBT_API DiscoveryCallback : public IceUtil::Shared
+{
+public:
+
+ //
+ // Called for each discovered device. The same device may be reported multiple times.
+ // The device's Bluetooth address is provided, along with a map of properties
+ // supplied by the system's Bluetooth stack.
+ //
+ virtual void discovered(const std::string& addr, const PropertyMap& props) = 0;
+};
+typedef IceUtil::Handle<DiscoveryCallback> DiscoveryCallbackPtr;
+#endif
+
+class ICEBT_API Plugin : public Ice::Plugin
+{
+public:
+
+ //
+ // Start Bluetooth device discovery on the adapter with the specified address.
+ // The given callback will be invoked for each discovered device. The same
+ // device may be reported more than once. Discovery remains active until
+ // explicitly stopped by a call to stopDiscovery(), or via other administrative means.
+ //
+#ifdef ICE_CPP11_MAPPING
+ virtual void startDiscovery(const std::string& address,
+ std::function<void(const std::string& addr, const PropertyMap& props)>) = 0;
+#else
+ virtual void startDiscovery(const std::string& address, const DiscoveryCallbackPtr& cb) = 0;
+#endif
+
+ //
+ // Stops Bluetooth device discovery on the adapter with the specified address.
+ // All discovery callbacks are removed when discovery stops.
+ //
+ virtual void stopDiscovery(const std::string& address) = 0;
+
+ //
+ // Retrieve a snapshot of all known remote devices. The plug-in obtains a snapshot of the remote devices at
+ // startup and then dynamically updates its map as the host adds and removes devices.
+ //
+ virtual DeviceMap getDevices() const = 0;
+};
+ICE_DEFINE_PTR(PluginPtr, Plugin);
+
+}
+
+#endif
diff --git a/cpp/include/IceBox/.gitignore b/cpp/include/IceBox/.gitignore
deleted file mode 100644
index e55d237a304..00000000000
--- a/cpp/include/IceBox/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-// Generated by makegitignore.py
-
-// IMPORTANT: Do not edit this file -- any edits made here will be lost!
-IceBox.h
diff --git a/cpp/include/IceBox/Config.h b/cpp/include/IceBox/Config.h
index be00249dd8c..73935353a54 100644
--- a/cpp/include/IceBox/Config.h
+++ b/cpp/include/IceBox/Config.h
@@ -7,25 +7,19 @@
//
// **********************************************************************
-#ifndef ICE_BOX_CONFIG_H
-#define ICE_BOX_CONFIG_H
+#ifndef ICEBOX_CONFIG_H
+#define ICEBOX_CONFIG_H
//
-// Automatically link with IceBox[D].lib
+// Automatically link with IceBox[D|++11|++11D].lib
//
-#if !defined(ICE_BUILDING_ICE_BOX) && defined(ICE_BOX_API_EXPORTS)
-# define ICE_BUILDING_ICE_BOX
+#if !defined(ICE_BUILDING_ICEBOX) && defined(ICEBOX_API_EXPORTS)
+# define ICE_BUILDING_ICEBOX
#endif
-#ifdef _MSC_VER
-# if !defined(ICE_BUILDING_ICE_BOX)
-# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
-# pragma comment(lib, "IceBoxD.lib")
-# else
-# pragma comment(lib, "IceBox.lib")
-# endif
-# endif
+#if defined(_MSC_VER) && !defined(ICE_BUILDING_ICEBOX)
+# pragma comment(lib, ICE_LIBNAME("IceBox"))
#endif
#endif
diff --git a/cpp/include/IceBox/Makefile b/cpp/include/IceBox/Makefile
deleted file mode 100644
index 1a24979650e..00000000000
--- a/cpp/include/IceBox/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ../..
-
-include $(top_srcdir)/config/Make.rules
-
-install::
- @if test ! -d $(DESTDIR)$(install_includedir)/IceBox ; \
- then \
- echo "Creating $(DESTDIR)$(install_includedir)/IceBox..." ; \
- $(call mkdir,$(DESTDIR)$(install_includedir)/IceBox) ; \
- fi
-
- @for i in *.h ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceBox/$$i ; \
- chmod a+r $(DESTDIR)$(install_includedir)/IceBox/$$i ; \
- done
diff --git a/cpp/include/IceBox/Makefile.mak b/cpp/include/IceBox/Makefile.mak
deleted file mode 100644
index eba19871f56..00000000000
--- a/cpp/include/IceBox/Makefile.mak
+++ /dev/null
@@ -1,21 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..\..
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-install::
- @if not exist "$(install_includedir)\IceBox" \
- @echo "Creating $(install_includedir)\IceBox..." && \
- $(MKDIR) "$(install_includedir)\IceBox"
-
- @for %i in ( *.h ) do \
- @echo Installing %i && \
- copy %i "$(install_includedir)\IceBox"
diff --git a/cpp/include/IceGrid/.gitignore b/cpp/include/IceGrid/.gitignore
deleted file mode 100644
index 9d13a816fbf..00000000000
--- a/cpp/include/IceGrid/.gitignore
+++ /dev/null
@@ -1,14 +0,0 @@
-// Generated by makegitignore.py
-
-// IMPORTANT: Do not edit this file -- any edits made here will be lost!
-Admin.h
-Descriptor.h
-Exception.h
-FileParser.h
-Locator.h
-Observer.h
-PluginFacade.h
-Query.h
-Registry.h
-Session.h
-UserAccountMapper.h
diff --git a/cpp/include/IceGrid/.headers b/cpp/include/IceGrid/.headers
deleted file mode 100644
index 973e1bf0a8f..00000000000
--- a/cpp/include/IceGrid/.headers
+++ /dev/null
@@ -1,14 +0,0 @@
-SDK_HEADERS = \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Admin.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Config.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Descriptor.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Exception.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\FileParser.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IceGrid.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Locator.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Observer.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Query.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Registry.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ReplicaGroupFilter.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Session.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\UserAccountMapper.h \
diff --git a/cpp/include/IceGrid/Config.h b/cpp/include/IceGrid/Config.h
index a46de154c96..289b527e654 100644
--- a/cpp/include/IceGrid/Config.h
+++ b/cpp/include/IceGrid/Config.h
@@ -11,21 +11,15 @@
#define ICE_GRID_CONFIG_H
//
-// Automatically link with IceGrid[D].lib
+// Automatically link with IceGrid[D|++11|++11D].lib
//
-#if !defined(ICE_BUILDING_ICE_GRID) && defined(ICE_GRID_API_EXPORTS)
+#if !defined(ICE_BUILDING_ICE_GRID) && defined(ICEGRID_API_EXPORTS)
# define ICE_BUILDING_ICE_GRID
#endif
-#ifdef _MSC_VER
-# if !defined(ICE_BUILDING_ICE_GRID)
-# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
-# pragma comment(lib, "IceGridD.lib")
-# else
-# pragma comment(lib, "IceGrid.lib")
-# endif
-# endif
+#if defined(_MSC_VER) && !defined(ICE_BUILDING_ICE_GRID)
+# pragma comment(lib, ICE_LIBNAME("IceGrid"))
#endif
#endif
diff --git a/cpp/include/IceGrid/IceGrid.h b/cpp/include/IceGrid/IceGrid.h
index 6e3acaa1636..c4b756ec4b3 100644
--- a/cpp/include/IceGrid/IceGrid.h
+++ b/cpp/include/IceGrid/IceGrid.h
@@ -14,9 +14,6 @@
#include <IceGrid/Descriptor.h>
#include <IceGrid/Exception.h>
#include <IceGrid/FileParser.h>
-#include <IceGrid/Locator.h>
-#include <IceGrid/Observer.h>
-#include <IceGrid/Query.h>
#include <IceGrid/Registry.h>
#include <IceGrid/Session.h>
#include <IceGrid/UserAccountMapper.h>
@@ -28,7 +25,7 @@ namespace IceGrid
//
// Global function to obtain a RegistryPluginFacade
//
-ICE_GRID_API RegistryPluginFacadePtr getRegistryPluginFacade();
+ICEGRID_API RegistryPluginFacadePtr getRegistryPluginFacade();
}
diff --git a/cpp/include/IceGrid/Makefile b/cpp/include/IceGrid/Makefile
deleted file mode 100644
index dd1ab79b8ed..00000000000
--- a/cpp/include/IceGrid/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ../..
-
-include $(top_srcdir)/config/Make.rules
-
-install::
- @if test ! -d $(DESTDIR)$(install_includedir)/IceGrid ; \
- then \
- echo "Creating $(DESTDIR)$(install_includedir)/IceGrid..." ; \
- $(call mkdir,$(DESTDIR)$(install_includedir)/IceGrid) ; \
- fi
-
- @for i in *.h ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceGrid/$$i ; \
- chmod a+r $(DESTDIR)$(install_includedir)/IceGrid/$$i ; \
- done
diff --git a/cpp/include/IceGrid/Makefile.mak b/cpp/include/IceGrid/Makefile.mak
deleted file mode 100644
index 6239050efa7..00000000000
--- a/cpp/include/IceGrid/Makefile.mak
+++ /dev/null
@@ -1,34 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..\..
-INCLUDE_DIR = IceGrid
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-!if "$(WINRT)" != "yes"
-
-install::
- @if not exist "$(install_includedir)\IceGrid" \
- @echo "Creating $(install_includedir)\IceGrid..." && \
- $(MKDIR) "$(install_includedir)\IceGrid"
-
- @for %i in ( *.h ) do \
- @echo Installing %i && \
- copy %i "$(install_includedir)\IceGrid"
-
-!else
-
-!include .headers
-
-all:: $(SDK_HEADERS)
-
-install:: all
-
-!endif
diff --git a/cpp/include/Freeze/Freeze.h b/cpp/include/IceIAP/IceIAP.h
index 9292fbb52a7..c494dc799e0 100644
--- a/cpp/include/Freeze/Freeze.h
+++ b/cpp/include/IceIAP/IceIAP.h
@@ -1,22 +1,18 @@
// **********************************************************************
//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-#ifndef FREEZE_FREEZE_H
-#define FREEZE_FREEZE_H
+#ifndef ICE_IAP_ICE_IAP_H
+#define ICE_IAP_ICE_IAP_H
#include <IceUtil/PushDisableWarnings.h>
-#include <Freeze/Initialize.h>
-#include <Freeze/BackgroundSaveEvictor.h>
-#include <Freeze/TransactionalEvictor.h>
-#include <Freeze/Map.h>
-#include <Freeze/TransactionHolder.h>
-#include <Freeze/Catalog.h>
+#include <IceIAP/EndpointInfo.h>
+#include <IceIAP/ConnectionInfo.h>
#include <IceUtil/PopDisableWarnings.h>
#endif
diff --git a/cpp/include/IcePatch2/.gitignore b/cpp/include/IcePatch2/.gitignore
deleted file mode 100644
index 9bb16ec1aaf..00000000000
--- a/cpp/include/IcePatch2/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-// Generated by makegitignore.py
-
-// IMPORTANT: Do not edit this file -- any edits made here will be lost!
-FileInfo.h
-FileServer.h
diff --git a/cpp/include/IcePatch2/ClientUtil.h b/cpp/include/IcePatch2/ClientUtil.h
index 84bca92f865..4c1cfa2fa0b 100644
--- a/cpp/include/IcePatch2/ClientUtil.h
+++ b/cpp/include/IcePatch2/ClientUtil.h
@@ -24,10 +24,12 @@ namespace IcePatch2
// allow the user to interact with the patching and report progress
// on the patching.
//
-class ICE_PATCH2_API PatcherFeedback : public IceUtil::Shared
+class ICEPATCH2_API PatcherFeedback : public IceUtil::Shared
{
public:
+ virtual ~PatcherFeedback();
+
//
// The summary file can't be loaded for the given reason. This
// should return true to accept doing a thorough patch, false
@@ -74,9 +76,12 @@ typedef IceUtil::Handle<PatcherFeedback> PatcherFeedbackPtr;
// IcePatch2 clients instantiate the IcePatch2::Patcher class to patch
// a given local data directory.
//
-class ICE_PATCH2_API Patcher : public IceUtil::Shared
+class ICEPATCH2_API Patcher : public IceUtil::Shared
{
public:
+
+ virtual ~Patcher();
+
//
// Prepare the patching. This involves creating the local checksum
// files if no summary file exists or if a thorough patch was
@@ -112,7 +117,7 @@ typedef IceUtil::Handle<Patcher> PatcherPtr;
// IcePatch2 clients instantiate the IcePatch2::Patcher class
// using the patcher factory.
//
-class ICE_PATCH2_API PatcherFactory : public IceUtil::noncopyable
+class ICEPATCH2_API PatcherFactory : public IceUtil::noncopyable
{
public:
diff --git a/cpp/include/IcePatch2/Config.h b/cpp/include/IcePatch2/Config.h
index 77f8ff525b9..e1d3594c17c 100644
--- a/cpp/include/IcePatch2/Config.h
+++ b/cpp/include/IcePatch2/Config.h
@@ -11,22 +11,15 @@
#define ICE_PATCH2_CONFIG_H
//
-// Automatically link with IcePatch2[D].lib
+// Automatically link with IcePatch2[D|++11|++11D].lib
//
-#if !defined(ICE_BUILDING_ICE_PATCH2) && defined(ICE_PATCH2_API_EXPORTS)
+#if !defined(ICE_BUILDING_ICE_PATCH2) && defined(ICEPATCH2_API_EXPORTS)
# define ICE_BUILDING_ICE_PATCH2
#endif
-#ifdef _MSC_VER
-# if !defined(ICE_BUILDING_ICE_PATCH2)
-# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
-# pragma comment(lib, "IcePatch2D.lib")
-# else
-# pragma comment(lib, "IcePatch2.lib")
-# endif
-# endif
+#if defined(_MSC_VER) && !defined(ICE_BUILDING_ICE_PATCH2)
+# pragma comment(lib, ICE_LIBNAME("IcePatch2"))
#endif
#endif
-
diff --git a/cpp/include/IcePatch2/Makefile b/cpp/include/IcePatch2/Makefile
deleted file mode 100644
index 4807d0533b5..00000000000
--- a/cpp/include/IcePatch2/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ../..
-
-include $(top_srcdir)/config/Make.rules
-
-install::
- @if test ! -d $(DESTDIR)$(install_includedir)/IcePatch2 ; \
- then \
- echo "Creating $(DESTDIR)$(install_includedir)/IcePatch2..." ; \
- $(call mkdir,$(DESTDIR)$(install_includedir)/IcePatch2) ; \
- fi
-
- @for i in *.h ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IcePatch2/$$i ; \
- chmod a+r $(DESTDIR)$(install_includedir)/IcePatch2/$$i ; \
- done
diff --git a/cpp/include/IcePatch2/Makefile.mak b/cpp/include/IcePatch2/Makefile.mak
deleted file mode 100644
index ac5ba7cdc78..00000000000
--- a/cpp/include/IcePatch2/Makefile.mak
+++ /dev/null
@@ -1,21 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..\..
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-install::
- @if not exist "$(install_includedir)\IcePatch2" \
- @echo "Creating $(install_includedir)\IcePatch2..." && \
- $(MKDIR) "$(install_includedir)\IcePatch2"
-
- @for %i in ( *.h ) do \
- @echo Installing %i && \
- copy %i "$(install_includedir)\IcePatch2"
diff --git a/cpp/include/IceSSL/.gitignore b/cpp/include/IceSSL/.gitignore
deleted file mode 100644
index 8ff8c54a7de..00000000000
--- a/cpp/include/IceSSL/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-// Generated by makegitignore.py
-
-// IMPORTANT: Do not edit this file -- any edits made here will be lost!
-ConnectionInfo.h
-EndpointInfo.h
diff --git a/cpp/include/IceSSL/.headers b/cpp/include/IceSSL/.headers
deleted file mode 100644
index 518e94054b0..00000000000
--- a/cpp/include/IceSSL/.headers
+++ /dev/null
@@ -1,6 +0,0 @@
-SDK_HEADERS = \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Config.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ConnectionInfo.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\EndpointInfo.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IceSSL.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Plugin.h \
diff --git a/cpp/include/IceSSL/Config.h b/cpp/include/IceSSL/Config.h
index daf2a6883fd..1436fb61143 100644
--- a/cpp/include/IceSSL/Config.h
+++ b/cpp/include/IceSSL/Config.h
@@ -13,27 +13,27 @@
#include <Ice/Config.h>
//
-// Automatically link IceSSL[D].lib with Visual C++
+// Automatically link IceSSL[D|++11|++11D].lib with Visual C++
//
-
-#if !defined(ICE_BUILDING_ICE_SSL) && defined(ICE_SSL_API_EXPORTS)
+#if !defined(ICE_BUILDING_ICE_SSL) && defined(ICESSL_API_EXPORTS)
# define ICE_BUILDING_ICE_SSL
#endif
-#if defined(_MSC_VER)
-# if !defined(ICE_BUILDING_ICE_SSL)
-# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
-# pragma comment(lib, "IceSSLD.lib")
-# else
-# pragma comment(lib, "IceSSL.lib")
-# endif
-# endif
+#if defined(_MSC_VER) && !defined(ICE_BUILDING_ICE_SSL)
+# pragma comment(lib, ICE_LIBNAME("IceSSL"))
#endif
#if defined(__APPLE__)
# define ICE_USE_SECURE_TRANSPORT 1
+#if defined(__APPLE__) && TARGET_OS_IPHONE != 0
+# define ICE_USE_SECURE_TRANSPORT_IOS 1
+#else
+# define ICE_USE_SECURE_TRANSPORT_MACOS 1
+#endif
#elif defined(_WIN32)
-# define ICE_USE_SCHANNEL 1
+# if !defined(ICE_OS_UWP)
+# define ICE_USE_SCHANNEL 1
+# endif
#else
# define ICE_USE_OPENSSL 1
#endif
diff --git a/cpp/include/IceSSL/IceSSL.h b/cpp/include/IceSSL/IceSSL.h
index 3f62652cc74..49cc160d3cc 100644
--- a/cpp/include/IceSSL/IceSSL.h
+++ b/cpp/include/IceSSL/IceSSL.h
@@ -11,10 +11,8 @@
#define ICE_SSL_ICE_SSL_H
#include <IceUtil/PushDisableWarnings.h>
-#include <IceUtil/Config.h>
-#if !defined(ICE_OS_WINRT) && (!defined(__APPLE__) || TARGET_OS_IPHONE == 0)
-# include <IceSSL/Plugin.h>
-#endif
+#include <Ice/Config.h>
+#include <IceSSL/Plugin.h>
#include <IceSSL/EndpointInfo.h>
#include <IceSSL/ConnectionInfo.h>
#include <IceUtil/PopDisableWarnings.h>
diff --git a/cpp/include/IceSSL/Makefile b/cpp/include/IceSSL/Makefile
deleted file mode 100644
index e2ac0dbdf5e..00000000000
--- a/cpp/include/IceSSL/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ../..
-
-include $(top_srcdir)/config/Make.rules
-
-install::
- @if test ! -d $(DESTDIR)$(install_includedir)/IceSSL ; \
- then \
- echo "Creating $(DESTDIR)$(install_includedir)/IceSSL..." ; \
- $(call mkdir,$(DESTDIR)$(install_includedir)/IceSSL) ; \
- fi
-
- @for i in *.h ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceSSL/$$i ; \
- chmod a+r $(DESTDIR)$(install_includedir)/IceSSL/$$i ; \
- done
diff --git a/cpp/include/IceSSL/Makefile.mak b/cpp/include/IceSSL/Makefile.mak
deleted file mode 100644
index f3e863393a7..00000000000
--- a/cpp/include/IceSSL/Makefile.mak
+++ /dev/null
@@ -1,34 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..\..
-INCLUDE_DIR = IceSSL
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-!if "$(WINRT)" != "yes"
-
-install::
- @if not exist "$(install_includedir)\IceSSL" \
- @echo "Creating $(install_includedir)\IceSSL..." && \
- $(MKDIR) "$(install_includedir)\IceSSL"
-
- @for %i in ( *.h ) do \
- @echo Installing %i && \
- copy %i "$(install_includedir)\IceSSL"
-
-!else
-
-!include .headers
-
-all:: $(SDK_HEADERS)
-
-install:: all
-
-!endif
diff --git a/cpp/include/IceSSL/Plugin.h b/cpp/include/IceSSL/Plugin.h
index 05b57856e18..4e9849431e6 100644
--- a/cpp/include/IceSSL/Plugin.h
+++ b/cpp/include/IceSSL/Plugin.h
@@ -10,34 +10,43 @@
#ifndef ICE_SSL_PLUGIN_H
#define ICE_SSL_PLUGIN_H
-#include <IceUtil/Time.h>
#include <Ice/Plugin.h>
+#include <Ice/UniqueRef.h>
#include <IceSSL/Config.h>
#include <IceSSL/ConnectionInfo.h>
+#ifdef ICE_CPP11_MAPPING
+# include <chrono>
+#else
+# include <IceUtil/Time.h>
+#endif
+
#include <vector>
#include <list>
// For struct sockaddr_storage
#ifdef _WIN32
+#ifndef ICE_OS_UWP
# include <winsock2.h>
+#endif
#else
# include <sys/socket.h>
#endif
#if defined(ICE_USE_SECURE_TRANSPORT)
# include <CoreFoundation/CFError.h>
+# include <Security/Security.h>
#elif defined(ICE_USE_SCHANNEL)
# include <wincrypt.h>
#endif
-#ifndef ICE_SSL_API
-# ifdef ICE_SSL_API_EXPORTS
-# define ICE_SSL_API ICE_DECLSPEC_EXPORT
-# elif defined(ICE_STATIC_LIBS)
-# define ICE_SSL_API /**/
+#ifndef ICESSL_API
+# if defined(ICE_STATIC_LIBS)
+# define ICESSL_API /**/
+# elif defined(ICESSL_API_EXPORTS)
+# define ICESSL_API ICE_DECLSPEC_EXPORT
# else
-# define ICE_SSL_API ICE_DECLSPEC_IMPORT
+# define ICESSL_API ICE_DECLSPEC_IMPORT
# endif
#endif
@@ -49,49 +58,26 @@
// connections.
//
typedef struct ssl_ctx_st SSL_CTX;
+typedef struct X509_name_st X509NAME;
-//
-// Pointer to an opaque certificate object. X509_st is the OpenSSL
-// type that represents a certificate.
-//
typedef struct x509_st* X509CertificateRef;
-
-//
-// EVP_PKEY is the OpenSSL type that represents a public key.
-//
typedef struct evp_pkey_st* KeyRef;
-//
-// Type that represents an X509 distinguished name
-//
-typedef struct X509_name_st X509NAME;
-
#elif defined(ICE_USE_SECURE_TRANSPORT)
-//
-// Pointer to an opaque certificate object.
-//
-struct OpaqueSecCertificateRef;
-typedef struct OpaqueSecCertificateRef* X509CertificateRef;
-
-//
-// Pointer to an opaque key object.
-//
-struct OpaqueSecKeyRef;
-typedef struct OpaqueSecKeyRef* KeyRef;
+typedef SecCertificateRef X509CertificateRef;
+typedef SecKeyRef KeyRef;
#elif defined(ICE_USE_SCHANNEL)
-//
-// Pointer to an opaque certificate object.
-//
typedef CERT_SIGNED_CONTENT_INFO* X509CertificateRef;
-
-//
-// Pointer to an opaque key object.
-//
typedef CERT_PUBLIC_KEY_INFO* KeyRef;
+#elif defined(ICE_OS_UWP)
+
+typedef Windows::Security::Cryptography::Certificates::Certificate^ X509CertificateRef;
+typedef Windows::Security::Cryptography::Core::CryptographicKey^ KeyRef;
+
#endif
namespace IceSSL
@@ -100,15 +86,18 @@ namespace IceSSL
//
// This exception is thrown if the certificate cannot be read.
//
-class ICE_SSL_API CertificateReadException : public IceUtil::Exception
+class ICESSL_API CertificateReadException : public IceUtil::ExceptionHelper<CertificateReadException>
{
public:
CertificateReadException(const char*, int, const std::string&);
+#ifndef ICE_CPP11_COMPILER
virtual ~CertificateReadException() throw();
- virtual std::string ice_name() const;
+#endif
+ virtual std::string ice_id() const;
+#ifndef ICE_CPP11_MAPPING
virtual CertificateReadException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
std::string reason;
@@ -120,7 +109,7 @@ private:
//
// This exception is thrown if the certificate cannot be encoded.
//
-class ICE_SSL_API CertificateEncodingException : public IceUtil::Exception
+class ICESSL_API CertificateEncodingException : public IceUtil::ExceptionHelper<CertificateEncodingException>
{
public:
@@ -128,10 +117,13 @@ public:
#ifdef ICE_USE_SECURE_TRANSPORT
CertificateEncodingException(const char*, int, CFErrorRef);
#endif
+#ifndef ICE_CPP11_COMPILER
virtual ~CertificateEncodingException() throw();
- virtual std::string ice_name() const;
+#endif
+ virtual std::string ice_id() const;
+#ifndef ICE_CPP11_MAPPING
virtual CertificateEncodingException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
std::string reason;
@@ -143,15 +135,18 @@ private:
//
// This exception is thrown if a distinguished name cannot be parsed.
//
-class ICE_SSL_API ParseException : public IceUtil::Exception
+class ICESSL_API ParseException : public IceUtil::ExceptionHelper<ParseException>
{
public:
ParseException(const char*, int, const std::string&);
+#ifndef ICE_CPP11_COMPILER
virtual ~ParseException() throw();
- virtual std::string ice_name() const;
+#endif
+ virtual std::string ice_id() const;
+#ifndef ICE_CPP11_MAPPING
virtual ParseException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
std::string reason;
@@ -164,17 +159,23 @@ private:
// Forward declaration.
//
class Certificate;
-typedef IceUtil::Handle<Certificate> CertificatePtr;
+ICE_DEFINE_PTR(CertificatePtr, Certificate);
//
// A representation of a PublicKey.
//
-class ICE_SSL_API PublicKey : public IceUtil::Shared
+class ICESSL_API PublicKey
+#ifndef ICE_CPP11_MAPPING
+ : public virtual IceUtil::Shared
+#endif
{
public:
- ~PublicKey();
+ PublicKey(const CertificatePtr&, KeyRef);
+#ifdef ICE_USE_OPENSSL
+ ~PublicKey();
+#endif
//
// Retrieve the native public key value wrapped by this object.
//
@@ -186,14 +187,17 @@ public:
private:
- PublicKey(const CertificatePtr&, KeyRef);
friend class Certificate;
CertificatePtr _cert;
+#ifdef __APPLE__
+ IceInternal::UniqueRef<KeyRef> _key;
+#else
KeyRef _key;
+#endif
};
-typedef IceUtil::Handle<PublicKey> PublicKeyPtr;
+ICE_DEFINE_PTR(PublicKeyPtr, PublicKey);
//
// This class represents a DistinguishedName, similar to the Java
@@ -207,7 +211,7 @@ typedef IceUtil::Handle<PublicKey> PublicKeyPtr;
// provided in the constructor (i.e., "ZeroC, Inc." will not turn
// into ZeroC\, Inc.).
//
-class ICE_SSL_API DistinguishedName
+class ICESSL_API DistinguishedName
{
public:
@@ -215,7 +219,11 @@ public:
//
// Create a DistinguishedName using an OpenSSL value.
//
- DistinguishedName(X509NAME*);
+ explicit DistinguishedName(X509NAME*);
+#endif
+
+#if defined(__APPLE__) && TARGET_OS_IPHONE != 0
+ explicit DistinguishedName(CFDataRef);
#endif
//
@@ -224,7 +232,7 @@ public:
//
// Throws ParseException if parsing fails.
//
- DistinguishedName(const std::string&);
+ explicit DistinguishedName(const std::string&);
//
// Create a DistinguishedName from a list of RDN pairs,
@@ -232,15 +240,14 @@ public:
// For example, the RDN "O=ZeroC" is represented by the
// pair ("O", "ZeroC").
//
- DistinguishedName(const std::list<std::pair<std::string, std::string> >&);
+ explicit DistinguishedName(const std::list<std::pair<std::string, std::string> >&);
//
// This is an exact match. The order of the RDN components is
// important.
//
- bool operator==(const DistinguishedName&) const;
- bool operator!=(const DistinguishedName&) const;
- bool operator<(const DistinguishedName&) const;
+ friend ICESSL_API bool operator==(const DistinguishedName&, const DistinguishedName&);
+ friend ICESSL_API bool operator<(const DistinguishedName&, const DistinguishedName&);
//
// Perform a partial match with another DistinguishedName. The function
@@ -248,6 +255,7 @@ public:
// DistinguishedName and they have the same values.
//
bool match(const DistinguishedName&) const;
+ bool match(const std::string&) const;
//
// Encode the DN in RFC2253 format.
@@ -262,11 +270,40 @@ private:
std::list<std::pair<std::string, std::string> > _unescaped;
};
+inline bool
+operator>(const DistinguishedName& lhs, const DistinguishedName& rhs)
+{
+ return rhs < lhs;
+}
+
+inline bool
+operator<=(const DistinguishedName& lhs, const DistinguishedName& rhs)
+{
+ return !(lhs > rhs);
+}
+
+inline bool
+operator>=(const DistinguishedName& lhs, const DistinguishedName& rhs)
+{
+ return !(lhs < rhs);
+}
+
+inline bool
+operator!=(const DistinguishedName& lhs, const DistinguishedName& rhs)
+{
+ return !(lhs == rhs);
+}
+
//
// This convenience class is a wrapper around a native certificate.
// The interface is inspired by java.security.cert.X509Certificate.
//
-class ICE_SSL_API Certificate : public IceUtil::Shared
+class ICESSL_API Certificate :
+#ifdef ICE_CPP11_MAPPING
+ public std::enable_shared_from_this<Certificate>
+#else
+ public virtual IceUtil::Shared
+#endif
{
public:
@@ -274,9 +311,9 @@ public:
// Construct a certificate using a native certificate.
//
// The Certificate class assumes ownership of the given native
- // certificate.
//
- Certificate(X509CertificateRef);
+ // certificate.
+ explicit Certificate(X509CertificateRef);
~Certificate();
//
@@ -294,7 +331,7 @@ public:
static CertificatePtr decode(const std::string&);
//
- // Those operators compare the certificates for equality using the
+ // Compare the certificates for equality using the
// native certificate comparison method.
//
bool operator==(const Certificate&) const;
@@ -330,6 +367,8 @@ public:
//
std::string encode() const;
+#if !defined(__APPLE__) || TARGET_OS_IPHONE == 0
+
//
// Checks that the certificate is currently valid, that is, the current
// date falls between the validity period given in the certificate.
@@ -339,17 +378,31 @@ public:
//
// Checks that the certificate is valid at the given time.
//
+# ifdef ICE_CPP11_MAPPING
+ bool checkValidity(const std::chrono::system_clock::time_point&) const;
+# else
bool checkValidity(const IceUtil::Time&) const;
+# endif
//
// Get the not-after validity time.
//
+# ifdef ICE_CPP11_MAPPING
+ std::chrono::system_clock::time_point getNotAfter() const;
+# else
IceUtil::Time getNotAfter() const;
+# endif
//
// Get the not-before validity time.
//
+# ifdef ICE_CPP11_MAPPING
+ std::chrono::system_clock::time_point getNotBefore() const;
+# else
IceUtil::Time getNotBefore() const;
+# endif
+
+#endif
//
// Get the serial number. This is an arbitrarily large number.
@@ -371,6 +424,7 @@ public:
//
DistinguishedName getIssuerDN() const;
+#if !defined(__APPLE__) || TARGET_OS_IPHONE == 0
//
// Get the values in the issuer's alternative names extension.
//
@@ -398,16 +452,19 @@ public:
// X509* certificate to obtain these values.
//
std::vector<std::pair<int, std::string> > getIssuerAlternativeNames();
+#endif
//
// Get the subject's distinguished name (DN).
//
DistinguishedName getSubjectDN() const;
+#if !defined(__APPLE__) || TARGET_OS_IPHONE == 0
//
// See the comment for getIssuerAlternativeNames.
//
std::vector<std::pair<int, std::string> > getSubjectAlternativeNames();
+#endif
//
// Retrieve the certificate version number.
@@ -434,37 +491,34 @@ public:
private:
+#if defined(__APPLE__)
+ IceInternal::UniqueRef<X509CertificateRef> _cert;
+#else
X509CertificateRef _cert;
+#endif
#ifdef ICE_USE_SCHANNEL
CERT_INFO* _certInfo;
#endif
+
+#if defined(__APPLE__) && TARGET_OS_IPHONE != 0
+ void initializeAttributes() const;
+ mutable IceInternal::UniqueRef<CFDataRef> _subject;
+ mutable IceInternal::UniqueRef<CFDataRef> _issuer;
+ mutable std::string _serial;
+ mutable int _version;
+#endif
};
//
// NativeConnectionInfo is an extension of IceSSL::ConnectionInfo that
// provides access to native certificates.
//
-class ICE_SSL_API NativeConnectionInfo : public ConnectionInfo
+class ICESSL_API NativeConnectionInfo : public ConnectionInfo
{
public:
- //
- // The certificate chain. This may be empty if the peer did not
- // supply a certificate. The peer's certificate (if any) is the
- // first one in the chain.
- //
- std::vector<CertificatePtr> nativeCerts;
-};
-typedef IceUtil::Handle<NativeConnectionInfo> NativeConnectionInfoPtr;
-
-//
-// WSSNativeConnectionInfo is an extension of IceSSL::WSSConnectionInfo
-// that provides access to native certificates.
-//
-class ICE_SSL_API WSSNativeConnectionInfo : public WSSConnectionInfo
-{
-public:
+ virtual ~NativeConnectionInfo();
//
// The certificate chain. This may be empty if the peer did not
@@ -473,16 +527,21 @@ public:
//
std::vector<CertificatePtr> nativeCerts;
};
-typedef IceUtil::Handle<WSSNativeConnectionInfo> WSSNativeConnectionInfoPtr;
+ICE_DEFINE_PTR(NativeConnectionInfoPtr, NativeConnectionInfo);
+
+#ifndef ICE_CPP11_MAPPING // C++98 mapping
//
// An application can customize the certificate verification process
// by implementing the CertificateVerifier interface.
//
-class ICE_SSL_API CertificateVerifier : public IceUtil::Shared
+
+class ICESSL_API CertificateVerifier : public IceUtil::Shared
{
public:
+ virtual ~CertificateVerifier();
+
//
// Return false if the connection should be rejected, or true to
// allow it.
@@ -506,10 +565,12 @@ typedef IceUtil::Handle<CertificateVerifier> CertificateVerifierPtr;
// IceSSL.DelayInit=1), configure the PasswordPrompt, then manually
// initialize the plug-in.
//
-class ICE_SSL_API PasswordPrompt : public IceUtil::Shared
+class ICESSL_API PasswordPrompt : public IceUtil::Shared
{
public:
+ virtual ~PasswordPrompt();
+
//
// The getPassword method may be invoked repeatedly, such as when
// several encrypted files are opened, or when multiple password
@@ -518,22 +579,37 @@ public:
virtual std::string getPassword() = 0;
};
typedef IceUtil::Handle<PasswordPrompt> PasswordPromptPtr;
+#endif
-class ICE_SSL_API Plugin : public Ice::Plugin
+
+class ICESSL_API Plugin : public Ice::Plugin
{
public:
+ virtual ~Plugin();
+
+ virtual std::string getEngineName() const = 0;
+ virtual Ice::Long getEngineVersion() const = 0;
+
//
// Establish the certificate verifier object. This should be done
// before any connections are established.
//
+#ifdef ICE_CPP11_MAPPING
+ virtual void setCertificateVerifier(std::function<bool(const std::shared_ptr<NativeConnectionInfo>&)>) = 0;
+#else
virtual void setCertificateVerifier(const CertificateVerifierPtr&) = 0;
+#endif
//
// Establish the password prompt object. This must be done before
// the plug-in is initialized.
//
+#ifdef ICE_CPP11_MAPPING
+ virtual void setPasswordPrompt(std::function<std::string()>) = 0;
+#else
virtual void setPasswordPrompt(const PasswordPromptPtr&) = 0;
+#endif
#ifdef ICE_USE_OPENSSL
//
@@ -557,7 +633,7 @@ public:
virtual SSL_CTX* getContext() = 0;
#endif
};
-typedef IceUtil::Handle<Plugin> PluginPtr;
+ICE_DEFINE_PTR(PluginPtr, Plugin);
}
diff --git a/cpp/include/IceStorm/.gitignore b/cpp/include/IceStorm/.gitignore
deleted file mode 100644
index 648cffd9098..00000000000
--- a/cpp/include/IceStorm/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-// Generated by makegitignore.py
-
-// IMPORTANT: Do not edit this file -- any edits made here will be lost!
-IceStorm.h
-Metrics.h
diff --git a/cpp/include/IceStorm/.headers b/cpp/include/IceStorm/.headers
deleted file mode 100644
index 71130c8ed79..00000000000
--- a/cpp/include/IceStorm/.headers
+++ /dev/null
@@ -1,4 +0,0 @@
-SDK_HEADERS = \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Config.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IceStorm.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Metrics.h \
diff --git a/cpp/include/IceStorm/Config.h b/cpp/include/IceStorm/Config.h
index 139aa3de315..2c93704e1b8 100644
--- a/cpp/include/IceStorm/Config.h
+++ b/cpp/include/IceStorm/Config.h
@@ -10,22 +10,18 @@
#ifndef ICE_STORM_CONFIG_H
#define ICE_STORM_CONFIG_H
+#include <Ice/Config.h>
+
//
-// Automatically link with IceStorm[D].lib
+// Automatically link with IceStorm[D|++11|++11D].lib
//
-#if !defined(ICE_BUILDING_ICE_STORM_LIB) && defined(ICE_STORM_LIB_API_EXPORTS)
+#if !defined(ICE_BUILDING_ICE_STORM_LIB) && defined(ICESTORM_API_EXPORTS)
# define ICE_BUILDING_ICE_STORM_LIB
#endif
-#ifdef _MSC_VER
-# if !defined(ICE_BUILDING_ICE_STORM_LIB)
-# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
-# pragma comment(lib, "IceStormD.lib")
-# else
-# pragma comment(lib, "IceStorm.lib")
-# endif
-# endif
+#if defined(_MSC_VER) && !defined(ICE_BUILDING_ICE_STORM_LIB)
+# pragma comment(lib, ICE_LIBNAME("IceStorm"))
#endif
#endif
diff --git a/cpp/include/IceStorm/Makefile b/cpp/include/IceStorm/Makefile
deleted file mode 100644
index 06de3d64d11..00000000000
--- a/cpp/include/IceStorm/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ../..
-
-include $(top_srcdir)/config/Make.rules
-
-install::
- @if test ! -d $(DESTDIR)$(install_includedir)/IceStorm ; \
- then \
- echo "Creating $(DESTDIR)$(install_includedir)/IceStorm..." ; \
- $(call mkdir,$(DESTDIR)$(install_includedir)/IceStorm) ; \
- fi
-
- @for i in *.h ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceStorm/$$i ; \
- chmod a+r $(DESTDIR)$(install_includedir)/IceStorm/$$i ; \
- done
diff --git a/cpp/include/IceStorm/Makefile.mak b/cpp/include/IceStorm/Makefile.mak
deleted file mode 100644
index 7feb9ce4bd1..00000000000
--- a/cpp/include/IceStorm/Makefile.mak
+++ /dev/null
@@ -1,34 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..\..
-INCLUDE_DIR = IceStorm
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-!if "$(WINRT)" != "yes"
-
-install::
- @if not exist "$(install_includedir)\IceStorm" \
- @echo "Creating $(install_includedir)\IceStorm..." && \
- $(MKDIR) "$(install_includedir)\IceStorm"
-
- @for %i in ( *.h ) do \
- @echo Installing %i && \
- copy %i "$(install_includedir)\IceStorm"
-
-!else
-
-!include .headers
-
-all:: $(SDK_HEADERS)
-
-install:: all
-
-!endif
diff --git a/cpp/include/IceUtil/.headers b/cpp/include/IceUtil/.headers
deleted file mode 100644
index 9c218caba08..00000000000
--- a/cpp/include/IceUtil/.headers
+++ /dev/null
@@ -1,42 +0,0 @@
-SDK_HEADERS = \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\AbstractMutex.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Atomic.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Cache.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Cond.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Config.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\CountDownLatch.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\CtrlCHandler.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\DisableWarnings.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Exception.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Functional.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Handle.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IceUtil.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\IconvStringConverter.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\InputUtil.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Iterator.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Lock.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Monitor.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Mutex.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MutexProtocol.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MutexPtrLock.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\MutexPtrTryLock.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Optional.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Options.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\OutputUtil.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PopDisableWarnings.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\PushDisableWarnings.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Random.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\RecMutex.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ScannerConfig.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ScopedArray.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\SHA1.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Shared.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\StringConverter.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\StringUtil.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Thread.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\ThreadException.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Time.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\Timer.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\UndefSysMacros.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\UniquePtr.h \
- $(SDK_INCLUDE_PATH)\$(INCLUDE_DIR)\UUID.h \
diff --git a/cpp/include/IceUtil/AbstractMutex.h b/cpp/include/IceUtil/AbstractMutex.h
deleted file mode 100644
index 2988e5d398a..00000000000
--- a/cpp/include/IceUtil/AbstractMutex.h
+++ /dev/null
@@ -1,119 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_UTIL_ABSTRACT_MUTEX_H
-#define ICE_UTIL_ABSTRACT_MUTEX_H
-
-#include <IceUtil/Config.h>
-#include <IceUtil/Lock.h>
-
-
-namespace IceUtil
-{
-
-class ICE_UTIL_API AbstractMutex
-{
-public:
-
- typedef LockT<AbstractMutex> Lock;
- typedef TryLockT<AbstractMutex> TryLock;
-
- virtual ~AbstractMutex()
- {
- }
-
- virtual void lock() const = 0;
- virtual void unlock() const = 0;
- virtual bool tryLock() const = 0;
-};
-
-template <typename T>
-class AbstractMutexI : public AbstractMutex, public T
-{
-public:
-
- typedef LockT<AbstractMutexI> Lock;
- typedef TryLockT<AbstractMutexI> TryLock;
-
- virtual void lock() const
- {
- T::lock();
- }
-
- virtual void unlock() const
- {
- T::unlock();
- }
-
- virtual bool tryLock() const
- {
- return T::tryLock();
- }
-
- virtual ~AbstractMutexI()
- {}
-};
-
-template <typename T>
-class AbstractMutexReadI : public AbstractMutex, public T
-{
-public:
-
- typedef LockT<AbstractMutexReadI> Lock;
- typedef TryLockT<AbstractMutexReadI> TryLock;
-
- virtual void lock() const
- {
- T::readLock();
- }
-
- virtual void unlock() const
- {
- T::unlock();
- }
-
- virtual bool tryLock() const
- {
- return T::tryReadLock();
- }
-
- virtual ~AbstractMutexReadI()
- {}
-};
-
-template <typename T>
-class AbstractMutexWriteI : public AbstractMutex, public T
-{
-public:
-
- typedef LockT<AbstractMutexWriteI> Lock;
- typedef TryLockT<AbstractMutexWriteI> TryLock;
-
- virtual void lock() const
- {
- T::writeLock();
- }
-
- virtual void unlock() const
- {
- T::unlock();
- }
-
- virtual bool tryLock() const
- {
- return T::tryWriteLock();
- }
-
- virtual ~AbstractMutexWriteI()
- {}
-};
-
-}
-
-#endif
diff --git a/cpp/include/IceUtil/Atomic.h b/cpp/include/IceUtil/Atomic.h
index 78ca9a81f35..9d5da29dbef 100644
--- a/cpp/include/IceUtil/Atomic.h
+++ b/cpp/include/IceUtil/Atomic.h
@@ -10,12 +10,12 @@
#ifndef ICE_UTIL_ATOMIC_H
#define ICE_UTIL_ATOMIC_H
-#if ((defined(ICE_CPP11) && defined(_MSC_VER) && (_MSC_VER > 1600)) || \
- (defined(ICE_CPP11) && !defined(_MSC_VER)))
-# define ICE_CPP11_HAS_ATOMIC
+#if ((defined(ICE_CPP11_COMPILER) && defined(_MSC_VER) && (_MSC_VER > 1600)) || \
+ (defined(ICE_CPP11_COMPILER) && !defined(_MSC_VER)))
+# define ICE_CPP11_COMPILER_HAS_ATOMIC
#endif
-#if defined(ICE_CPP11_HAS_ATOMIC)
+#if defined(ICE_CPP11_COMPILER_HAS_ATOMIC)
# include <atomic>
#elif defined(ICE_USE_MUTEX_SHARED)
@@ -45,7 +45,7 @@
namespace IceUtilInternal
{
-#ifdef ICE_CPP11_HAS_ATOMIC
+#ifdef ICE_CPP11_COMPILER_HAS_ATOMIC
typedef std::atomic<int> Atomic;
#else
@@ -68,7 +68,7 @@ typedef int ATOMIC_T;
// This is temporary and very partial placeholder for std::atomic,
// which is not yet widely available.
//
-class ICE_UTIL_API Atomic : public IceUtil::noncopyable
+class ICE_API Atomic : public IceUtil::noncopyable
{
public:
diff --git a/cpp/include/IceUtil/Cache.h b/cpp/include/IceUtil/Cache.h
deleted file mode 100644
index 8aba2ae5c3b..00000000000
--- a/cpp/include/IceUtil/Cache.h
+++ /dev/null
@@ -1,362 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef ICE_UTIL_CACHE_H
-#define ICE_UTIL_CACHE_H
-
-#include <IceUtil/Handle.h>
-#include <IceUtil/Mutex.h>
-#include <IceUtil/CountDownLatch.h>
-#include <map>
-
-namespace IceUtil
-{
-
-//
-// An abstraction to efficiently populate a Cache, without holding
-// a lock while loading from a database.
-//
-
-template<typename Key, typename Value>
-class Cache
-{
-public:
-
- //
- // Latch and CacheValue are implementation details;
- // application code should not use them.
- //
-
- struct Latch : public IceUtilInternal::CountDownLatch
- {
- Latch() :
- IceUtilInternal::CountDownLatch(1),
- useCount(0)
- {
- }
- int useCount;
- };
-
- struct CacheValue
- {
- CacheValue(const Handle<Value>& o) :
- obj(o),
- latch(0)
- {
- }
-
- Handle<Value> obj;
- Latch* latch;
- };
-
- typedef typename std::map<Key, CacheValue>::iterator Position;
-
- Handle<Value> getIfPinned(const Key&, bool = false) const;
-
- void unpin(Position);
-
- void clear();
- size_t size() const;
-
- bool pin(const Key&, const Handle<Value>&);
-
- Handle<Value> pin(const Key&);
- Handle<Value> putIfAbsent(const Key&, const Handle<Value>&);
-
-protected:
-
- virtual Handle<Value> load(const Key&) = 0;
-
- virtual void pinned(const Handle<Value>&, Position)
- {
- }
-
- virtual ~Cache()
- {
- }
-
-private:
-
- Handle<Value> pinImpl(const Key&, const Handle<Value>&);
-
- typedef std::map<Key, CacheValue> CacheMap;
-
- Mutex _mutex;
- CacheMap _map;
-};
-
-
-template<typename Key, typename Value> Handle<Value>
-Cache<Key, Value>::getIfPinned(const Key& key, bool wait) const
-{
- Mutex::Lock sync(_mutex);
-
- for(;;)
- {
- typename CacheMap::const_iterator p = _map.find(key);
- if(p != _map.end())
- {
- Handle<Value> result = (*p).second.obj;
- if(result != 0 || wait == false)
- {
- return result;
- }
-
- //
- // The object is being loaded: we wait
- //
-
- if(p->second.latch == 0)
- {
- const_cast<CacheValue&>(p->second).latch = new Latch;
- }
-
- Latch* latch = p->second.latch;
- ++latch->useCount;
- sync.release();
- latch->await();
- sync.acquire();
- if(--latch->useCount == 0)
- {
- delete latch;
- }
- //
- // Try again
- //
- }
- else
- {
- return 0;
- }
- }
-}
-
-template<typename Key, typename Value> void
-Cache<Key, Value>::unpin(typename Cache::Position p)
-{
- //
- // There is no risk to erase a 'being loaded' position,
- // since such position never got outside yet!
- //
- Mutex::Lock sync(_mutex);
- _map.erase(p);
-}
-
-template<typename Key, typename Value> void
-Cache<Key, Value>::clear()
-{
- //
- // Not safe during a pin!
- //
- Mutex::Lock sync(_mutex);
- _map.clear();
-}
-
-template<typename Key, typename Value> size_t
-Cache<Key, Value>::size() const
-{
- Mutex::Lock sync(_mutex);
- return _map.size();
-}
-
-template<typename Key, typename Value> bool
-Cache<Key, Value>::pin(const Key& key, const Handle<Value>& obj)
-{
- Mutex::Lock sync(_mutex);
- std::pair<typename CacheMap::iterator, bool> ir =
-#ifdef _MSC_VER
- _map.insert(CacheMap::value_type(key, CacheValue(obj)));
-#else
- _map.insert(typename CacheMap::value_type(key, CacheValue(obj)));
-#endif
-
- if(ir.second)
- {
- pinned(obj, ir.first);
- }
- return ir.second;
-}
-
-template<typename Key, typename Value> Handle<Value>
-Cache<Key, Value>::pin(const Key& key)
-{
- return pinImpl(key, 0);
-}
-
-template<typename Key, typename Value> Handle<Value>
-Cache<Key, Value>::putIfAbsent(const Key& key, const Handle<Value>& obj)
-{
- return pinImpl(key, obj);
-}
-
-template<typename Key, typename Value> Handle<Value>
-Cache<Key, Value>::pinImpl(const Key& key, const Handle<Value>& newObj)
-{
- Latch* latch = 0;
- Position p;
-
- do
- {
- {
- Mutex::Lock sync(_mutex);
-
- //
- // Clean up latch from previous loop
- //
- if(latch != 0)
- {
- if(--latch->useCount == 0)
- {
- delete latch;
- }
- latch = 0;
- }
-
- std::pair<typename CacheMap::iterator, bool> ir =
-#if defined(_MSC_VER)
- _map.insert(CacheMap::value_type(key, CacheValue(0)));
-#else
- _map.insert(typename CacheMap::value_type(key, CacheValue(0)));
-#endif
-
- if(ir.second == false)
- {
- CacheValue& val = ir.first->second;
- if(val.obj != 0)
- {
- return val.obj;
- }
-
- //
- // Otherwise wait
- //
- if(val.latch == 0)
- {
- //
- // The first queued thread creates the latch
- //
- val.latch = new Latch;
- }
- latch = val.latch;
- latch->useCount++;
- }
-
- p = ir.first;
- }
-
- if(latch != 0)
- {
- //
- // Note: only the threads owning a "useCount" wait; upon wake-up,
- // they loop back, release this useCount and possibly delete the latch
- //
-
- latch->await();
-
- //
- // p could be stale now, e.g. some other thread pinned and unpinned the
- // object while we were waiting.
- // So start over.
- }
- } while(latch != 0);
-
-
- //
- // Load
- //
- Handle<Value> obj;
- try
- {
- obj = load(key);
- }
- catch(...)
- {
- Mutex::Lock sync(_mutex);
- latch = p->second.latch;
- p->second.latch = 0;
- _map.erase(p);
- if(latch != 0)
- {
- //
- // It is necessary to call countDown() within the sync
- // because countDown may not be atomic, and we don't
- // want the "await" thread to delete the latch while
- // this thread is still in countDown().
- //
- assert(latch->getCount() == 1);
- latch->countDown();
- }
- throw;
- }
-
- Mutex::Lock sync(_mutex);
-
- //
- // p is still valid here -- nobody knows about it. See also unpin().
- //
- latch = p->second.latch;
- p->second.latch = 0;
-
- try
- {
- if(obj != 0)
- {
- p->second.obj = obj;
- pinned(obj, p);
- }
- else
- {
- if(newObj == 0)
- {
- //
- // pin() did not find the object
- //
-
- //
- // The waiting threads will have to call load() to see by themselves.
- //
- _map.erase(p);
- }
- else
- {
- //
- // putIfAbsent() inserts key/newObj
- //
- p->second.obj = newObj;
- pinned(newObj, p);
- }
- }
- }
- catch(...)
- {
- if(latch != 0)
- {
- //
- // Must be called within sync; see ->countDown() note above.
- //
- assert(latch->getCount() == 1);
- latch->countDown();
- }
- throw;
- }
-
- if(latch != 0)
- {
- //
- // Must be called within sync; see ->countDown() note above.
- //
- assert(latch->getCount() == 1);
- latch->countDown();
- }
- return obj;
-}
-
-}
-
-#endif
diff --git a/cpp/include/IceUtil/Cond.h b/cpp/include/IceUtil/Cond.h
index 4218d13f6bf..a2d6bb683ac 100644
--- a/cpp/include/IceUtil/Cond.h
+++ b/cpp/include/IceUtil/Cond.h
@@ -27,7 +27,7 @@ class Semaphore
public:
Semaphore(long = 0);
- ICE_UTIL_API ~Semaphore();
+ ICE_API ~Semaphore();
void wait() const;
bool timedWait(const IceUtil::Time&) const;
@@ -55,7 +55,7 @@ class Mutex;
// Condition variable implementation. Conforms to the same semantics
// as a POSIX threads condition variable.
//
-class ICE_UTIL_API Cond : private noncopyable
+class ICE_API Cond : private noncopyable
{
public:
diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h
index 7453e259e83..050cb6878bf 100644
--- a/cpp/include/IceUtil/Config.h
+++ b/cpp/include/IceUtil/Config.h
@@ -106,11 +106,18 @@
#if (__cplusplus >= 201103) || \
((defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__) && ((__GNUC__* 100) + __GNUC_MINOR__) >= 405)) || \
(defined(_MSC_VER) && (_MSC_VER >= 1600))
-# define ICE_CPP11
+# define ICE_CPP11_COMPILER
#endif
+//
+// Ensure the C++ compiler supports C++11 when using the C++11 mapping
+//
+#if defined(ICE_CPP11_MAPPING) && !defined(ICE_CPP11_COMPILER)
+# error "you need a C++11 capable compiler to use the C++11 mapping"
+#endif
-#if defined(ICE_CPP11) && (!defined(_MSC_VER) || (_MSC_VER >= 1900))
+
+#if defined(ICE_CPP11_COMPILER) && (!defined(_MSC_VER) || (_MSC_VER >= 1900))
# define ICE_NOEXCEPT noexcept
# define ICE_NOEXCEPT_FALSE noexcept(false)
#else
@@ -118,17 +125,28 @@
# define ICE_NOEXCEPT_FALSE /**/
#endif
+
+//
+// Does the C++ compiler library provide std::codecvt_utf8 and
+// std::codecvt_utf8_utf16?
+//
+#if (defined(_MSC_VER) && (_MSC_VER >= 1800)) || \
+ defined(__clang__) || \
+ (defined(ICE_CPP11_COMPILER) && defined(__GNUC__) && (__GNUC__ >= 5))
+#define ICE_HAS_CODECVT_UTF8
+#endif
+
//
-// Visual Studio 2012 or later, without Windows XP/2003 support
+// Visual Studio 2015 or later
//
-#if defined(_MSC_VER) && (_MSC_VER >= 1700) && !defined(_USING_V110_SDK71_)
+#if defined(_MSC_VER) && (_MSC_VER >= 1900)
//
-// Check if building for WinRT
+// Check if building for UWP
//
# include <winapifamily.h>
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
-# define ICE_OS_WINRT
+# define ICE_OS_UWP
# define ICE_STATIC_LIBS
# endif
@@ -138,7 +156,7 @@
// Support for thread-safe function local static initialization
// (a.k.a. "magic statics")
//
-#if defined(__GNUC__) || defined(__clang__)
+#if defined(ICE_CPP11_MAPPING) || defined(__GNUC__) || defined(__clang__) || (defined(_MSC_VER) && (_MSC_VER >= 1900))
# define ICE_HAS_THREAD_SAFE_LOCAL_STATIC
#endif
@@ -146,14 +164,13 @@
// Compiler extensions to export and import symbols: see the documentation
// for Visual Studio, Solaris Studio and GCC.
//
-#if defined(_WIN32)
+#if defined(_MSC_VER)
# define ICE_DECLSPEC_EXPORT __declspec(dllexport)
# define ICE_DECLSPEC_IMPORT __declspec(dllimport)
-//
-// ICE_HAS_DECLSPEC_IMPORT_EXPORT defined only for compilers with distinct
-// declspec for IMPORT and EXPORT
-# define ICE_HAS_DECLSPEC_IMPORT_EXPORT
-#elif defined(__GNUC__)
+// With Visual Studio, we can import/export member functions without importing/
+// exporting the whole class
+# define ICE_MEMBER_IMPORT_EXPORT
+#elif defined(__GNUC__) || defined(__clang__)
# define ICE_DECLSPEC_EXPORT __attribute__((visibility ("default")))
# define ICE_DECLSPEC_IMPORT __attribute__((visibility ("default")))
#elif defined(__SUNPRO_CC)
@@ -164,17 +181,26 @@
# define ICE_DECLSPEC_IMPORT /**/
#endif
-//
-// Let's use these extensions with IceUtil:
-//
-#if defined(ICE_UTIL_API_EXPORTS)
-# define ICE_UTIL_API ICE_DECLSPEC_EXPORT
-#elif defined(ICE_STATIC_LIBS)
-# define ICE_UTIL_API /**/
+#ifdef ICE_MEMBER_IMPORT_EXPORT
+# define ICE_CLASS(API) /**/
+# define ICE_MEMBER(API) API
#else
-# define ICE_UTIL_API ICE_DECLSPEC_IMPORT
+# define ICE_CLASS(API) API
+# define ICE_MEMBER(API) /**/
#endif
+//
+// Let's use these extensions with Ice:
+//
+#ifndef ICE_API
+# if defined(ICE_STATIC_LIBS)
+# define ICE_API /**/
+# elif defined(ICE_API_EXPORTS)
+# define ICE_API ICE_DECLSPEC_EXPORT
+# else
+# define ICE_API ICE_DECLSPEC_IMPORT
+# endif
+#endif
#if defined(_MSC_VER)
# define ICE_DEPRECATED_API(msg) __declspec(deprecated(msg))
@@ -230,29 +256,62 @@
#endif
#ifdef __IBMCPP__
-// TODO: better fix for this warning
+ // TODO: better fix for this warning
# pragma report(disable, "1540-0198") // private inheritance without private keyword
#endif
+//
+// The Ice version.
+//
+#define ICE_STRING_VERSION "3.7a4" // "A.B.C", with A=major, B=minor, C=patch
+#define ICE_INT_VERSION 30754 // AABBCC, with AA=major, BB=minor, CC=patch
+#define ICE_SO_VERSION "37a4" // "ABC", with A=major, B=minor, C=patch
-#if !defined(ICE_BUILDING_ICE_UTIL) && defined(ICE_UTIL_API_EXPORTS)
-# define ICE_BUILDING_ICE_UTIL
+#if !defined(ICE_BUILDING_ICE) && defined(ICE_API_EXPORTS)
+# define ICE_BUILDING_ICE
#endif
#if defined(_MSC_VER)
# if !defined(ICE_STATIC_LIBS) && (!defined(_DLL) || !defined(_MT))
# error "Only multi-threaded DLL libraries can be used with Ice!"
# endif
-//
-// Automatically link with IceUtil[D].lib
-//
-# if !defined(ICE_BUILDING_ICE_UTIL)
-# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
-# pragma comment(lib, "IceUtilD.lib")
+
+# ifdef ICE_CPP11_MAPPING
+# if defined(_DEBUG)
+# if defined(ICE_OS_UWP)
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "uwp++11D.lib"
+# else
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "++11D.lib"
+# endif
+# else
+# if defined(ICE_OS_UWP)
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "uwp++11.lib"
+# else
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "++11.lib"
+# endif
+# endif
+# else
+# if defined(_DEBUG)
+# if defined(ICE_OS_UWP)
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "uwpD.lib"
+# else
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "D.lib"
+# endif
# else
-# pragma comment(lib, "IceUtil.lib")
+# if defined(ICE_OS_UWP)
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "uwp.lib"
+# else
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION ".lib"
+# endif
# endif
# endif
+
+//
+// Automatically link with Ice[D|++11|++11D].lib
+//
+# if !defined(ICE_BUILDING_ICE) && !defined(ICE_BUILDING_SLICE_COMPILERS)
+# pragma comment(lib, ICE_LIBNAME("Ice"))
+# endif
#endif
namespace IceUtil
@@ -261,7 +320,7 @@ namespace IceUtil
//
// By deriving from this class, other classes are made non-copyable.
//
-class ICE_UTIL_API noncopyable
+class ICE_API noncopyable
{
protected:
@@ -275,6 +334,9 @@ private:
const noncopyable& operator=(const noncopyable&);
};
+
+typedef unsigned char Byte;
+
//
// Int64 typedef and ICE_INT64 macro for Int64 literal values
//
@@ -297,9 +359,52 @@ typedef long long Int64;
}
//
-// The Ice version.
-//
-#define ICE_STRING_VERSION "3.6.3" // "A.B.C", with A=major, B=minor, C=patch
-#define ICE_INT_VERSION 30603 // AABBCC, with AA=major, BB=minor, CC=patch
+// Macros to facilitate C++98 -> C++11 transition
+//
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+# include <memory>
+# include <future>
+# define ICE_HANDLE ::std::shared_ptr
+# define ICE_INTERNAL_HANDLE ::std::shared_ptr
+# define ICE_PROXY_HANDLE ::std::shared_ptr
+# define ICE_MAKE_SHARED(T, ...) ::std::make_shared<T>(__VA_ARGS__)
+# define ICE_DEFINE_PTR(TPtr, T) using TPtr = ::std::shared_ptr<T>
+# define ICE_ENUM(CLASS,ENUMERATOR) CLASS::ENUMERATOR
+# define ICE_SCOPED_ENUM(CLASS,ENUMERATOR) CLASS::ENUMERATOR
+# define ICE_NULLPTR nullptr
+# define ICE_DYNAMIC_CAST(T,V) ::std::dynamic_pointer_cast<T>(V)
+# define ICE_SHARED_FROM_THIS shared_from_this()
+# define ICE_SHARED_FROM_CONST_THIS(T) const_cast<T*>(this)->shared_from_this()
+# define ICE_GET_SHARED_FROM_THIS(p) p->shared_from_this()
+# define ICE_CHECKED_CAST(T, ...) Ice::checkedCast<T>(__VA_ARGS__)
+# define ICE_UNCHECKED_CAST(T, ...) Ice::uncheckedCast<T>(__VA_ARGS__)
+# define ICE_VALUE_FACTORY ::std::function<::std::shared_ptr<::Ice::Value>(const std::string&)>
+# define ICE_USER_EXCEPTION_FACTORY ::std::function<void(const std::string&)>
+# define ICE_CLOSE_CALLBACK ::std::function<void(const ::std::shared_ptr<::Ice::Connection>&)>
+# define ICE_HEARTBEAT_CALLBACK ::std::function<void(const ::std::shared_ptr<::Ice::Connection>&)>
+# define ICE_IN(...) __VA_ARGS__
+# define ICE_SET_EXCEPTION_FROM_CLONE(T, V) T = V
+#else // C++98 mapping
+# define ICE_HANDLE ::IceUtil::Handle
+# define ICE_INTERNAL_HANDLE ::IceInternal::Handle
+# define ICE_PROXY_HANDLE ::IceInternal::ProxyHandle
+# define ICE_MAKE_SHARED(T, ...) new T(__VA_ARGS__)
+# define ICE_DEFINE_PTR(TPtr, T) typedef ::IceUtil::Handle<T> TPtr
+# define ICE_ENUM(CLASS,ENUMERATOR) ENUMERATOR
+# define ICE_SCOPED_ENUM(CLASS,ENUMERATOR) CLASS##ENUMERATOR
+# define ICE_NULLPTR 0
+# define ICE_DYNAMIC_CAST(T,V) T##Ptr::dynamicCast(V)
+# define ICE_SHARED_FROM_THIS this
+# define ICE_SHARED_FROM_CONST_THIS(T) const_cast<T*>(this)
+# define ICE_GET_SHARED_FROM_THIS(p) p
+# define ICE_CHECKED_CAST(T, ...) T::checkedCast(__VA_ARGS__)
+# define ICE_UNCHECKED_CAST(T, ...) T::uncheckedCast(__VA_ARGS__)
+# define ICE_VALUE_FACTORY ::Ice::ValueFactoryPtr
+# define ICE_USER_EXCEPTION_FACTORY ::Ice::UserExceptionFactoryPtr
+# define ICE_CLOSE_CALLBACK ::Ice::CloseCallbackPtr
+# define ICE_HEARTBEAT_CALLBACK ::Ice::HeartbeatCallbackPtr
+# define ICE_IN(...) const __VA_ARGS__&
+# define ICE_SET_EXCEPTION_FROM_CLONE(T, V) T.reset(V)
+#endif
#endif
diff --git a/cpp/include/IceUtil/ConsoleUtil.h b/cpp/include/IceUtil/ConsoleUtil.h
new file mode 100644
index 00000000000..876cb61cf69
--- /dev/null
+++ b/cpp/include/IceUtil/ConsoleUtil.h
@@ -0,0 +1,98 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_UTIL_CONSOLE_UTIL_H
+#define ICE_UTIL_CONSOLE_UTIL_H
+
+#include <IceUtil/Config.h>
+#include <IceUtil/StringConverter.h>
+#include <iostream>
+
+namespace IceUtilInternal
+{
+
+#if defined(_WIN32) && !defined(ICE_OS_UWP)
+
+class ConsoleUtil;
+ICE_DEFINE_PTR(ConsoleUtilPtr, ConsoleUtil);
+
+class ICE_API ConsoleUtil
+# ifndef ICE_CPP11_MAPPING
+ : public IceUtil::Shared
+# endif
+{
+public:
+
+ ConsoleUtil();
+ void output(const std::string&) const;
+ void error(const std::string&) const;
+
+private:
+
+ std::string toConsoleEncoding(const std::string&) const;
+ IceUtil::StringConverterPtr _converter;
+ IceUtil::StringConverterPtr _consoleConverter;
+ static ConsoleUtilPtr _instance;
+};
+
+const ICE_API ConsoleUtilPtr& getConsoleUtil();
+
+class ICE_API ConsoleOut
+{
+public:
+
+ ConsoleOut& operator<<(ConsoleOut& (*pf)(ConsoleOut&));
+};
+
+class ICE_API ConsoleErr
+{
+public:
+
+ ConsoleErr& operator<<(ConsoleErr& (*pf)(ConsoleErr&));
+};
+
+template<typename T>
+ConsoleOut&
+operator<<(ConsoleOut& out, const T& val)
+{
+ std::ostringstream s;
+ s << val;
+ getConsoleUtil()->output(s.str());
+ return out;
+}
+
+ICE_API ConsoleOut& endl(ConsoleOut&);
+ICE_API ConsoleOut& flush(ConsoleOut&);
+
+template<typename T>
+ConsoleErr&
+operator<<(ConsoleErr& err, const T& val)
+{
+ std::ostringstream s;
+ s << val;
+ getConsoleUtil()->error(s.str());
+ return err;
+}
+
+ICE_API ConsoleErr& endl(ConsoleErr&);
+ICE_API ConsoleErr& flush(ConsoleErr&);
+
+extern ICE_API ConsoleOut consoleOut;
+extern ICE_API ConsoleErr consoleErr;
+
+#else
+
+extern ICE_API std::ostream& consoleOut;
+extern ICE_API std::ostream& consoleErr;
+
+#endif
+
+}
+
+#endif
diff --git a/cpp/include/IceUtil/CountDownLatch.h b/cpp/include/IceUtil/CountDownLatch.h
index f80d7646769..4f1adce478e 100644
--- a/cpp/include/IceUtil/CountDownLatch.h
+++ b/cpp/include/IceUtil/CountDownLatch.h
@@ -19,7 +19,7 @@ namespace IceUtilInternal
// See java.util.concurrent.CountDownLatch in Java 1.5
//
-class ICE_UTIL_API CountDownLatch
+class ICE_API CountDownLatch
{
public:
diff --git a/cpp/include/IceUtil/CtrlCHandler.h b/cpp/include/IceUtil/CtrlCHandler.h
index d6a847547fb..d203804b898 100644
--- a/cpp/include/IceUtil/CtrlCHandler.h
+++ b/cpp/include/IceUtil/CtrlCHandler.h
@@ -44,7 +44,7 @@ namespace IceUtil
typedef void (*CtrlCHandlerCallback)(int);
-class ICE_UTIL_API CtrlCHandler
+class ICE_API CtrlCHandler
{
public:
@@ -55,14 +55,16 @@ public:
CtrlCHandlerCallback getCallback() const;
};
-class ICE_UTIL_API CtrlCHandlerException : public Exception
+class ICE_API CtrlCHandlerException : public ExceptionHelper<CtrlCHandlerException>
{
public:
CtrlCHandlerException(const char*, int);
- virtual std::string ice_name() const;
+ virtual std::string ice_id() const;
+
+#ifndef ICE_CPP11_MAPPING
virtual CtrlCHandlerException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
};
}
diff --git a/cpp/include/IceUtil/Exception.h b/cpp/include/IceUtil/Exception.h
index 0dfa3382667..759818da858 100644
--- a/cpp/include/IceUtil/Exception.h
+++ b/cpp/include/IceUtil/Exception.h
@@ -18,121 +18,232 @@
namespace IceUtil
{
-class ICE_UTIL_API Exception : public std::exception
+class ICE_API Exception : public std::exception
{
public:
Exception();
Exception(const char*, int);
-
- virtual ~Exception() throw();
- virtual std::string ice_name() const;
+#ifndef ICE_CPP11_COMPILER
+ virtual ~Exception() throw() = 0;
+#endif
+ virtual std::string ice_id() const = 0;
virtual void ice_print(std::ostream&) const;
- virtual const char* what() const throw();
- virtual Exception* ice_clone() const;
- virtual void ice_throw() const;
+ virtual const char* what() const ICE_NOEXCEPT;
+#ifdef ICE_CPP11_MAPPING
+ std::unique_ptr<Exception> ice_clone() const;
+#else
+ virtual Exception* ice_clone() const = 0;
+ ICE_DEPRECATED_API("ice_name() is deprecated, use ice_id() instead.")
+ std::string ice_name() const;
+#endif
+ virtual void ice_throw() const = 0;
const char* ice_file() const;
int ice_line() const;
std::string ice_stackTrace() const;
-
+
+protected:
+
+#ifdef ICE_CPP11_MAPPING
+ virtual Exception* ice_cloneImpl() const = 0;
+#endif
+
private:
-
+
const char* _file;
int _line;
- static const char* _name;
const std::vector<void*> _stackFrames;
mutable ::std::string _str; // Initialized lazily in what().
};
-ICE_UTIL_API std::ostream& operator<<(std::ostream&, const Exception&);
+ICE_API std::ostream& operator<<(std::ostream&, const Exception&);
+
-class ICE_UTIL_API NullHandleException : public Exception
+#ifdef ICE_CPP11_MAPPING
+
+template<typename E, typename B = Exception>
+class ExceptionHelper : public B
{
public:
-
- NullHandleException(const char*, int);
- virtual ~NullHandleException() throw();
- virtual std::string ice_name() const;
- virtual NullHandleException* ice_clone() const;
- virtual void ice_throw() const;
-private:
+ using B::B;
+
+ std::unique_ptr<E> ice_clone() const
+ {
+ return std::unique_ptr<E>(static_cast<E*>(ice_cloneImpl()));
+ }
+
+ virtual void ice_throw() const override
+ {
+ throw static_cast<const E&>(*this);
+ }
+
+protected:
+
+ virtual Exception* ice_cloneImpl() const override
+ {
+ return new E(static_cast<const E&>(*this));
+ }
+};
+
+#else // C++98 mapping
+
+template<typename E>
+class ExceptionHelper : public Exception
+{
+public:
- static const char* _name;
+ ExceptionHelper()
+ {
+ }
+
+ ExceptionHelper(const char* file, int line) : Exception(file, line)
+ {
+ }
+
+ virtual void ice_throw() const
+ {
+ throw static_cast<const E&>(*this);
+ }
+};
+
+#endif
+
+
+class ICE_API NullHandleException : public ExceptionHelper<NullHandleException>
+{
+public:
+
+ NullHandleException(const char*, int);
+ virtual std::string ice_id() const;
+
+#ifndef ICE_CPP11_MAPPING
+ virtual NullHandleException* ice_clone() const;
+#endif
};
-class ICE_UTIL_API IllegalArgumentException : public Exception
+class ICE_API IllegalArgumentException : public ExceptionHelper<IllegalArgumentException>
{
public:
-
+
IllegalArgumentException(const char*, int);
IllegalArgumentException(const char*, int, const std::string&);
+
+#ifndef ICE_CPP11_COMPILER
virtual ~IllegalArgumentException() throw();
- virtual std::string ice_name() const;
+#endif
+
+ virtual std::string ice_id() const;
virtual void ice_print(std::ostream&) const;
+
+#ifndef ICE_CPP11_MAPPING
virtual IllegalArgumentException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
std::string reason() const;
private:
- static const char* _name;
const std::string _reason;
};
//
-// IllegalConversionException is raised to report a string conversion error
+// IllegalConversionException is raised to report a string conversion error
//
-class ICE_UTIL_API IllegalConversionException : public Exception
+class ICE_API IllegalConversionException : public ExceptionHelper<IllegalConversionException>
{
public:
-
+
IllegalConversionException(const char*, int);
IllegalConversionException(const char*, int, const std::string&);
+
+#ifndef ICE_CPP11_COMPILER
virtual ~IllegalConversionException() throw();
- virtual std::string ice_name() const;
+#endif
+
+ virtual std::string ice_id() const;
virtual void ice_print(std::ostream&) const;
+
+#ifndef ICE_CPP11_MAPPING
virtual IllegalConversionException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
std::string reason() const;
+
private:
- static const char* _name;
const std::string _reason;
};
-class ICE_UTIL_API SyscallException : public Exception
+class ICE_API SyscallException : public ExceptionHelper<SyscallException>
{
public:
SyscallException(const char*, int, int);
- virtual std::string ice_name() const;
+
+#ifndef ICE_CPP11_COMPILER
+ virtual ~SyscallException() throw();
+#endif
+
+ virtual std::string ice_id() const;
virtual void ice_print(std::ostream&) const;
+
+#ifndef ICE_CPP11_MAPPING
virtual SyscallException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
int error() const;
private:
const int _error;
- static const char* _name;
};
-class ICE_UTIL_API FileLockException : public Exception
+
+#ifdef ICE_CPP11_MAPPING
+
+template<typename E>
+using SyscallExceptionHelper = ExceptionHelper<E, SyscallException>;
+
+#else // C++98 mapping
+
+template<typename E>
+class SyscallExceptionHelper : public SyscallException
+{
+public:
+
+ SyscallExceptionHelper(const char* file, int line, int errorCode) :
+ SyscallException(file, line, errorCode)
+ {
+ }
+
+ virtual void ice_throw() const
+ {
+ throw static_cast<const E&>(*this);
+ }
+};
+
+#endif
+
+
+class ICE_API FileLockException : public ExceptionHelper<FileLockException>
{
public:
FileLockException(const char*, int, int, const std::string&);
+
+#ifndef ICE_CPP11_COMPILER
virtual ~FileLockException() throw();
- virtual std::string ice_name() const;
+#endif
+
+ virtual std::string ice_id() const;
virtual void ice_print(std::ostream&) const;
+
+#ifndef ICE_CPP11_MAPPING
virtual FileLockException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
std::string path() const;
int error() const;
@@ -140,45 +251,29 @@ public:
private:
const int _error;
- static const char* _name;
std::string _path;
};
-class ICE_UTIL_API OptionalNotSetException : public Exception
+class ICE_API OptionalNotSetException : public ExceptionHelper<OptionalNotSetException>
{
public:
-
- OptionalNotSetException(const char*, int);
- virtual ~OptionalNotSetException() throw();
- virtual std::string ice_name() const;
- virtual OptionalNotSetException* ice_clone() const;
- virtual void ice_throw() const;
-private:
+ OptionalNotSetException(const char*, int);
+ virtual std::string ice_id() const;
- static const char* _name;
+#ifndef ICE_CPP11_MAPPING
+ virtual OptionalNotSetException* ice_clone() const;
+#endif
};
-#ifndef _WIN32
-class ICE_UTIL_API IconvInitializationException : public Exception
-{
-public:
-
- IconvInitializationException(const char*, int, const std::string&);
- virtual ~IconvInitializationException() throw();
- virtual std::string ice_name() const;
- virtual void ice_print(std::ostream&) const;
- virtual IconvInitializationException* ice_clone() const;
- virtual void ice_throw() const;
+}
- std::string reason() const;
+namespace IceUtilInternal
+{
-private:
+enum StackTraceImpl { STNone, STDbghelp, STLibbacktrace, STLibbacktracePlus, STBacktrace };
- static const char* _name;
- std::string _reason;
-};
-#endif
+ICE_API StackTraceImpl stackTraceImpl();
}
diff --git a/cpp/include/IceUtil/FileUtil.h b/cpp/include/IceUtil/FileUtil.h
new file mode 100644
index 00000000000..86a57adb7a5
--- /dev/null
+++ b/cpp/include/IceUtil/FileUtil.h
@@ -0,0 +1,148 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_FILE_UTIL_H
+#define ICE_FILE_UTIL_H
+
+#include <IceUtil/Config.h>
+#include <IceUtil/Shared.h>
+#include <IceUtil/Handle.h>
+
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+namespace IceUtilInternal
+{
+
+extern const ICE_API std::string pathsep;
+extern const ICE_API std::string separator;
+
+//
+// Detemine if path is an absolute path.
+//
+ICE_API bool isAbsolutePath(const std::string&);
+
+//
+// Determine if a file exists.
+//
+ICE_API bool fileExists(const std::string&);
+
+//
+// Determine if a directory exists.
+//
+ICE_API bool directoryExists(const std::string&);
+
+//
+// Determine if a directory exists and is empty.
+//
+ICE_API bool isEmptyDirectory(const std::string&);
+
+#ifdef _WIN32
+
+#if defined(__MINGW32__)
+typedef struct _stat structstat;
+#else
+typedef struct _stat64i32 structstat;
+#endif
+
+#ifdef _MSC_VER
+#ifndef O_RDONLY
+# define O_RDONLY _O_RDONLY
+#endif
+
+#ifndef O_BINARY
+# define O_BINARY _O_BINARY
+#endif
+
+#ifndef S_ISDIR
+# define S_ISDIR(mode) ((mode) & _S_IFDIR)
+#endif
+
+#ifndef S_ISREG
+# define S_ISREG(mode) ((mode) & _S_IFREG)
+#endif
+#endif
+
+#else
+
+typedef struct stat structstat;
+# define O_BINARY 0
+
+#endif
+
+//
+// OS stat
+//
+ICE_API int stat(const std::string&, structstat*);
+ICE_API int remove(const std::string&);
+ICE_API int rename(const std::string&, const std::string&);
+ICE_API int rmdir(const std::string&);
+
+ICE_API int mkdir(const std::string&, int);
+ICE_API FILE* fopen(const std::string&, const std::string&);
+ICE_API FILE* freopen(const std::string&, const std::string&, FILE*);
+ICE_API int open(const std::string&, int);
+
+#ifndef ICE_OS_UWP
+ICE_API int getcwd(std::string&);
+#endif
+
+ICE_API int unlink(const std::string&);
+ICE_API int close(int);
+
+//
+// This class is used to implement process file locking. This class
+// is not intended to do file locking within the same process.
+//
+class ICE_API FileLock : public IceUtil::Shared, public IceUtil::noncopyable
+{
+public:
+ //
+ // The constructor opens the given file (eventually creating it)
+ // and acquires a lock on the file or throws FileLockException if
+ // the file couldn't be locked.
+ //
+ // If the lock can be acquired, the process pid is written to the
+ // file.
+ //
+ FileLock(const std::string&);
+
+ //
+ // The destructor releases the lock and removes the file.
+ //
+ virtual ~FileLock();
+
+private:
+
+#ifdef _WIN32
+ HANDLE _fd;
+#else
+ int _fd;
+#endif
+ std::string _path;
+};
+
+typedef IceUtil::Handle<FileLock> FileLockPtr;
+
+//
+// Use streamFilename to construct the filename given to std stream classes
+// like ifstream and ofstream.
+//
+#if defined(_WIN32) && !defined(__MINGW32__)
+ICE_API std::wstring streamFilename(const std::string&);
+#else
+inline std::string streamFilename(const std::string& filename)
+{
+ return filename;
+}
+#endif
+
+}
+#endif
diff --git a/cpp/include/IceUtil/IceUtil.h b/cpp/include/IceUtil/IceUtil.h
index e5e803ae567..1d29150ef83 100644
--- a/cpp/include/IceUtil/IceUtil.h
+++ b/cpp/include/IceUtil/IceUtil.h
@@ -18,10 +18,9 @@
//
#include <IceUtil/Config.h>
-#include <IceUtil/AbstractMutex.h>
-#include <IceUtil/Cache.h>
#include <IceUtil/Cond.h>
-#if !defined(__APPLE__) && !defined(ICE_OS_WINRT)
+#include <IceUtil/ConsoleUtil.h>
+#if !defined(__APPLE__) && !defined(ICE_OS_UWP)
# include <IceUtil/CtrlCHandler.h>
#endif
#include <IceUtil/Exception.h>
@@ -41,11 +40,6 @@
#include <IceUtil/Time.h>
#include <IceUtil/Timer.h>
#include <IceUtil/UUID.h>
-#include <IceUtil/UniquePtr.h>
-
-#ifndef _WIN32
-# include <IceUtil/IconvStringConverter.h>
-#endif
#include <IceUtil/PopDisableWarnings.h>
#endif
diff --git a/cpp/include/IceUtil/InputUtil.h b/cpp/include/IceUtil/InputUtil.h
index 5dab658c7e1..7c7665853fe 100644
--- a/cpp/include/IceUtil/InputUtil.h
+++ b/cpp/include/IceUtil/InputUtil.h
@@ -19,7 +19,7 @@ namespace IceUtilInternal
//
// Portable strtoll/_strtoi64
//
-ICE_UTIL_API IceUtil::Int64 strToInt64(const char*, char**, int);
+ICE_API IceUtil::Int64 strToInt64(const char*, char**, int);
//
// stringToInt64 converts a string into a signed 64-bit integer.
@@ -40,7 +40,7 @@ ICE_UTIL_API IceUtil::Int64 strToInt64(const char*, char**, int);
// - result == 0 indicates that no digits were available for conversion
// - result == "Int64 Min" or result == "Int64 Max" indicate underflow or overflow.
//
-ICE_UTIL_API bool stringToInt64(const std::string&, IceUtil::Int64&);
+ICE_API bool stringToInt64(const std::string&, IceUtil::Int64&);
}
diff --git a/cpp/include/IceUtil/Makefile b/cpp/include/IceUtil/Makefile
deleted file mode 100644
index 2763cbe0fdd..00000000000
--- a/cpp/include/IceUtil/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ../..
-
-include $(top_srcdir)/config/Make.rules
-
-install::
- @if test ! -d $(DESTDIR)$(install_includedir)/IceUtil ; \
- then \
- echo "Creating $(DESTDIR)$(install_includedir)/IceUtil..." ; \
- $(call mkdir,$(DESTDIR)$(install_includedir)/IceUtil) ; \
- fi
-
- @for i in *.h ; \
- do \
- echo "Installing $$i" ; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(install_includedir)/IceUtil/$$i ; \
- chmod a+r $(DESTDIR)$(install_includedir)/IceUtil/$$i ; \
- done
diff --git a/cpp/include/IceUtil/Makefile.mak b/cpp/include/IceUtil/Makefile.mak
deleted file mode 100644
index fc315942717..00000000000
--- a/cpp/include/IceUtil/Makefile.mak
+++ /dev/null
@@ -1,33 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..\..
-INCLUDE_DIR = IceUtil
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-!if "$(WINRT)" != "yes"
-install::
- @if not exist "$(install_includedir)\IceUtil" \
- @echo "Creating $(install_includedir)\IceUtil..." && \
- $(MKDIR) "$(install_includedir)\IceUtil"
-
- @for %i in ( *.h ) do \
- @echo Installing %i && \
- copy %i "$(install_includedir)\IceUtil"
-
-!else
-
-!include .headers
-
-all:: $(SDK_HEADERS)
-
-install:: all
-
-!endif
diff --git a/cpp/include/IceUtil/Mutex.h b/cpp/include/IceUtil/Mutex.h
index 62fbd9869b8..01bb41b23c1 100644
--- a/cpp/include/IceUtil/Mutex.h
+++ b/cpp/include/IceUtil/Mutex.h
@@ -33,7 +33,7 @@ class Cond;
// `IceUtil::noncopyable' inaccessible in `IceInternal::Outgoing' due
// to ambiguity
//
-class ICE_UTIL_API Mutex
+class ICE_API Mutex
{
public:
@@ -141,7 +141,7 @@ Mutex::Mutex(MutexProtocol protocol)
inline void
Mutex::init(MutexProtocol)
{
-#ifdef ICE_OS_WINRT
+#ifdef ICE_OS_UWP
InitializeCriticalSectionEx(&_mutex, 0, 0);
#else
InitializeCriticalSection(&_mutex);
diff --git a/cpp/include/IceUtil/MutexProtocol.h b/cpp/include/IceUtil/MutexProtocol.h
index 5f561d4818d..f27e2b74e75 100644
--- a/cpp/include/IceUtil/MutexProtocol.h
+++ b/cpp/include/IceUtil/MutexProtocol.h
@@ -21,7 +21,7 @@ enum MutexProtocol
PrioNone
};
-ICE_UTIL_API MutexProtocol getDefaultMutexProtocol();
+ICE_API MutexProtocol getDefaultMutexProtocol();
} // End namespace IceUtil
diff --git a/cpp/include/IceUtil/Optional.h b/cpp/include/IceUtil/Optional.h
index 28e6bf5719a..73b898c72f6 100644
--- a/cpp/include/IceUtil/Optional.h
+++ b/cpp/include/IceUtil/Optional.h
@@ -10,6 +10,8 @@
#ifndef ICE_UTIL_OPTIONAL_H
#define ICE_UTIL_OPTIONAL_H
+#ifndef ICE_CPP11_MAPPING
+
#include <IceUtil/Config.h>
namespace IceUtilInternal
@@ -85,33 +87,44 @@ public:
return *this;
}
- const T& get() const
+ const T& value() const
{
checkIsSet();
return _value;
}
- T& get()
+
+ T& value()
{
checkIsSet();
return _value;
}
+ const T& get() const
+ {
+ return value();
+ }
+
+ T& get()
+ {
+ return value();
+ }
+
const T* operator->() const
{
- return &get();
+ return &value();
}
T* operator->()
{
- return &get();
+ return &value();
}
const T& operator*() const
{
- return get();
+ return value();
}
T& operator*()
{
- return get();
+ return value();
}
operator bool() const
@@ -320,3 +333,4 @@ inline bool operator>=(const Y& lhs, const Optional<T>& rhs)
}
#endif
+#endif
diff --git a/cpp/include/IceUtil/Options.h b/cpp/include/IceUtil/Options.h
index a9902c1216b..47df02d2228 100644
--- a/cpp/include/IceUtil/Options.h
+++ b/cpp/include/IceUtil/Options.h
@@ -22,47 +22,46 @@
namespace IceUtilInternal
{
-class ICE_UTIL_API APIException : public IceUtil::Exception
+class ICE_API APIException : public IceUtil::ExceptionHelper<APIException>
{
public:
APIException(const char*, int, const ::std::string&);
+#ifndef ICE_CPP11_COMPILER
virtual ~APIException() throw();
- virtual ::std::string ice_name() const;
+#endif
+ virtual ::std::string ice_id() const;
virtual void ice_print(std::ostream&) const;
+#ifndef ICE_CPP11_MAPPING
virtual APIException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
::std::string reason;
-
-private:
-
- static const char* _name;
};
-ICE_UTIL_API ::std::ostream& operator<<(::std::ostream&, const APIException&);
+ICE_API ::std::ostream& operator<<(::std::ostream&, const APIException&);
-class ICE_UTIL_API BadOptException : public IceUtil::Exception
+class ICE_API BadOptException : public IceUtil::ExceptionHelper<BadOptException>
{
public:
BadOptException(const char*, int, const ::std::string&);
+#ifndef ICE_CPP11_COMPILER
virtual ~BadOptException() throw();
- virtual ::std::string ice_name() const;
+#endif
+ virtual ::std::string ice_id() const;
virtual void ice_print(std::ostream&) const;
+
+#ifndef ICE_CPP11_MAPPING
virtual BadOptException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
::std::string reason;
-
-private:
-
- static const char* _name;
};
-ICE_UTIL_API ::std::ostream& operator<<(::std::ostream&, const BadOptException&);
+ICE_API ::std::ostream& operator<<(::std::ostream&, const BadOptException&);
-class ICE_UTIL_API Options
+class ICE_API Options
{
public:
diff --git a/cpp/include/IceUtil/OutputUtil.h b/cpp/include/IceUtil/OutputUtil.h
index 58d1bbeed5e..28edcdb036c 100644
--- a/cpp/include/IceUtil/OutputUtil.h
+++ b/cpp/include/IceUtil/OutputUtil.h
@@ -18,7 +18,7 @@
namespace IceUtilInternal
{
-ICE_UTIL_API std::string int64ToString(IceUtil::Int64);
+ICE_API std::string int64ToString(IceUtil::Int64);
// ----------------------------------------------------------------------
// OutputBase
@@ -31,7 +31,7 @@ ICE_UTIL_API std::string int64ToString(IceUtil::Int64);
// manually I've decided to leave them as virtual.
//
-class ICE_UTIL_API OutputBase : private ::IceUtil::noncopyable
+class ICE_API OutputBase : private ::IceUtil::noncopyable
{
public:
@@ -74,21 +74,21 @@ protected:
bool _separator;
};
-class ICE_UTIL_API NextLine
+class ICE_API NextLine
{
};
-extern ICE_UTIL_API NextLine nl;
+extern ICE_API NextLine nl;
-class ICE_UTIL_API Separator
+class ICE_API Separator
{
};
-extern ICE_UTIL_API Separator sp;
+extern ICE_API Separator sp;
// ----------------------------------------------------------------------
// Output
// ----------------------------------------------------------------------
-class ICE_UTIL_API Output : public OutputBase
+class ICE_API Output : public OutputBase
{
public:
@@ -101,8 +101,8 @@ public:
void sb(); // Start a block.
void eb(); // End a block.
- void spar(); // Start a paramater list.
- void epar(); // End a paramater list.
+ void spar(char = '('); // Start a paramater list.
+ void epar(char = ')'); // End a paramater list.
private:
@@ -148,10 +148,10 @@ operator<<(Output& o, const Separator&)
return o;
}
-class ICE_UTIL_API StartBlock
+class ICE_API StartBlock
{
};
-extern ICE_UTIL_API StartBlock sb;
+extern ICE_API StartBlock sb;
template<>
inline Output&
@@ -161,10 +161,10 @@ operator<<(Output& o, const StartBlock&)
return o;
}
-class ICE_UTIL_API EndBlock
+class ICE_API EndBlock
{
};
-extern ICE_UTIL_API EndBlock eb;
+extern ICE_API EndBlock eb;
template<>
inline Output&
@@ -174,10 +174,10 @@ operator<<(Output& o, const EndBlock&)
return o;
}
-class ICE_UTIL_API StartPar
+class ICE_API StartPar
{
};
-extern ICE_UTIL_API StartPar spar;
+extern ICE_API StartPar spar;
template<>
inline Output&
@@ -187,10 +187,10 @@ operator<<(Output& o, const StartPar&)
return o;
}
-class ICE_UTIL_API EndPar
+class ICE_API EndPar
{
};
-extern ICE_UTIL_API EndPar epar;
+extern ICE_API EndPar epar;
template<>
inline Output&
@@ -200,13 +200,39 @@ operator<<(Output& o, const EndPar&)
return o;
}
-ICE_UTIL_API Output& operator<<(Output&, std::ios_base& (*)(std::ios_base&));
+class ICE_API StartAbrk
+{
+};
+extern ICE_API StartAbrk sabrk;
+
+template<>
+inline Output&
+operator<<(Output& o, const StartAbrk&)
+{
+ o.spar('<');
+ return o;
+}
+
+class ICE_API EndAbrk
+{
+};
+extern ICE_API EndAbrk eabrk;
+
+template<>
+inline Output&
+operator<<(Output& o, const EndAbrk&)
+{
+ o.epar('>');
+ return o;
+}
+
+ICE_API Output& operator<<(Output&, std::ios_base& (*)(std::ios_base&));
// ----------------------------------------------------------------------
// XMLOutput
// ----------------------------------------------------------------------
-class ICE_UTIL_API XMLOutput : public OutputBase
+class ICE_API XMLOutput : public OutputBase
{
public:
@@ -265,10 +291,10 @@ operator<<(XMLOutput& o, const Separator&)
return o;
}
-class ICE_UTIL_API EndElement
+class ICE_API EndElement
{
};
-extern ICE_UTIL_API EndElement ee;
+extern ICE_API EndElement ee;
template<>
inline XMLOutput&
@@ -278,7 +304,7 @@ operator<<(XMLOutput& o, const EndElement&)
return o;
}
-class ICE_UTIL_API StartElement
+class ICE_API StartElement
{
public:
@@ -301,7 +327,7 @@ operator<<(XMLOutput& o, const StartElement& e)
return o;
}
-class ICE_UTIL_API Attribute
+class ICE_API Attribute
{
public:
@@ -326,15 +352,15 @@ operator<<(XMLOutput& o, const Attribute& e)
return o;
}
-class ICE_UTIL_API StartEscapes
+class ICE_API StartEscapes
{
};
-extern ICE_UTIL_API StartEscapes startEscapes;
+extern ICE_API StartEscapes startEscapes;
-class ICE_UTIL_API EndEscapes
+class ICE_API EndEscapes
{
};
-extern ICE_UTIL_API EndEscapes endEscapes;
+extern ICE_API EndEscapes endEscapes;
template<>
inline XMLOutput&
@@ -352,7 +378,7 @@ operator<<(XMLOutput& o, const EndEscapes&)
return o;
}
-ICE_UTIL_API XMLOutput& operator<<(XMLOutput&, std::ios_base& (*)(std::ios_base&));
+ICE_API XMLOutput& operator<<(XMLOutput&, std::ios_base& (*)(std::ios_base&));
}
diff --git a/cpp/include/IceUtil/PopDisableWarnings.h b/cpp/include/IceUtil/PopDisableWarnings.h
index 9381bf5f34d..498a77e116f 100644
--- a/cpp/include/IceUtil/PopDisableWarnings.h
+++ b/cpp/include/IceUtil/PopDisableWarnings.h
@@ -10,10 +10,10 @@
// No pragma once as this file can be included several times in a translation
// unit
-#ifdef _MSC_VER
+#if defined(_MSC_VER)
# pragma warning(pop)
-#endif
-
-#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+#elif defined(__clang__)
+# pragma clang diagnostic pop
+#elif defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
diff --git a/cpp/include/IceUtil/PushDisableWarnings.h b/cpp/include/IceUtil/PushDisableWarnings.h
index f8cd4bffb90..4dcff0ae560 100644
--- a/cpp/include/IceUtil/PushDisableWarnings.h
+++ b/cpp/include/IceUtil/PushDisableWarnings.h
@@ -10,7 +10,7 @@
// No pragma once as this file can be included several times in a translation
// unit
-#ifdef _MSC_VER
+#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable:4250) // ... : inherits ... via dominance
# pragma warning(disable:4251) // class ... needs to have dll-interface to be used by clients of class ...
@@ -19,12 +19,13 @@
# if _MSC_VER >= 1900
# pragma warning(disable:4275) // non dll-interface class ... used as base for dll-interface class ...
# endif
-#endif
-#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
-//
-// Expected when using forward Slice declarations
-//
+#elif defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wredundant-decls" // expected when using forward Slice declarations
+
+#elif defined(__GNUC__)
# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wredundant-decls"
+# pragma GCC diagnostic ignored "-Wredundant-decls" // expected when using forward Slice declarations
+# pragma GCC diagnostic ignored "-Wshadow" // expected in some generated header files
#endif
diff --git a/cpp/include/IceUtil/Random.h b/cpp/include/IceUtil/Random.h
index 10deb7e0724..e4eb0a1c241 100644
--- a/cpp/include/IceUtil/Random.h
+++ b/cpp/include/IceUtil/Random.h
@@ -16,8 +16,8 @@
namespace IceUtilInternal
{
-ICE_UTIL_API void generateRandom(char*, size_t);
-ICE_UTIL_API unsigned int random(int = 0);
+ICE_API void generateRandom(char*, size_t);
+ICE_API unsigned int random(int = 0);
}
diff --git a/cpp/include/IceUtil/RecMutex.h b/cpp/include/IceUtil/RecMutex.h
index 52ccae78722..2aae35187ff 100644
--- a/cpp/include/IceUtil/RecMutex.h
+++ b/cpp/include/IceUtil/RecMutex.h
@@ -26,7 +26,7 @@ class Cond;
//
// Recursive Mutex implementation.
//
-class ICE_UTIL_API RecMutex
+class ICE_API RecMutex
{
public:
diff --git a/cpp/include/IceUtil/ResourceConfig.h b/cpp/include/IceUtil/ResourceConfig.h
new file mode 100644
index 00000000000..f68dd6e157e
--- /dev/null
+++ b/cpp/include/IceUtil/ResourceConfig.h
@@ -0,0 +1,58 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_UTIL_RESOURCE_CONFIG_H
+#define ICE_UTIL_RESOURCE_CONFIG_H
+
+#include "winver.h"
+
+#define ICE_VERSION 3,7,54,0
+#define ICE_STRING_VERSION "3.7a4\0"
+#define ICE_SO_VERSION "37a4\0"
+#define ICE_COMPANY_NAME "ZeroC, Inc.\0"
+#define ICE_COPYRIGHT "\251 2003-2016 ZeroC, Inc.\0"
+#define ICE_PRODUCT_NAME "Ice\0"
+
+#ifdef ICE_CPP11_MAPPING
+# if defined(_DEBUG)
+# if defined(ICE_OS_UWP)
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "uwp++11D"
+# else
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "++11D"
+# endif
+# else
+# if defined(ICE_OS_UWP)
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "uwp++11"
+# else
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "++11"
+# endif
+# endif
+#else
+# if defined(_DEBUG)
+# if defined(ICE_OS_UWP)
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "uwpD"
+# else
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "D"
+# endif
+# else
+# if defined(ICE_OS_UWP)
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION "uwp"
+# else
+# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION ""
+# endif
+# endif
+#endif
+
+#ifndef DEBUG
+# define VER_DEBUG 0
+#else
+# define VER_DEBUG VS_FF_DEBUG
+#endif
+
+#endif
diff --git a/cpp/include/IceUtil/ScopedArray.h b/cpp/include/IceUtil/ScopedArray.h
index 8c0e1e142a1..21aa7e7702e 100644
--- a/cpp/include/IceUtil/ScopedArray.h
+++ b/cpp/include/IceUtil/ScopedArray.h
@@ -12,6 +12,12 @@
#include <IceUtil/Config.h>
+#ifndef ICE_CPP11_MAPPING
+
+//
+// Only for the C++98 mapping
+//
+
namespace IceUtil
{
@@ -95,3 +101,4 @@ private:
} // End of namespace IceUtil
#endif
+#endif
diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h
index 65742da9c7a..2e2a4bbc080 100644
--- a/cpp/include/IceUtil/Shared.h
+++ b/cpp/include/IceUtil/Shared.h
@@ -31,16 +31,14 @@
namespace IceUtil
{
-class ICE_UTIL_API SimpleShared
+class ICE_API SimpleShared
{
public:
SimpleShared();
SimpleShared(const SimpleShared&);
- virtual ~SimpleShared()
- {
- }
+ virtual ~SimpleShared();
SimpleShared& operator=(const SimpleShared&)
{
@@ -81,7 +79,7 @@ private:
bool _noDelete;
};
-class ICE_UTIL_API Shared
+class ICE_API Shared
{
public:
diff --git a/cpp/include/IceUtil/StopWatch.h b/cpp/include/IceUtil/StopWatch.h
new file mode 100644
index 00000000000..2c6215c7795
--- /dev/null
+++ b/cpp/include/IceUtil/StopWatch.h
@@ -0,0 +1,54 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_UTIL_STOPWATCH_H
+#define ICE_UTIL_STOPWATCH_H
+
+#include <IceUtil/Time.h>
+
+namespace IceUtilInternal
+{
+
+class StopWatch
+{
+public:
+
+ StopWatch() { }
+
+ void start()
+ {
+ _s = IceUtil::Time::now(IceUtil::Time::Monotonic);
+ }
+
+ IceUtil::Int64 stop()
+ {
+ assert(isStarted());
+ IceUtil::Int64 d = (IceUtil::Time::now(IceUtil::Time::Monotonic) - _s).toMicroSeconds();
+ _s = IceUtil::Time();
+ return d;
+ }
+
+ bool isStarted() const
+ {
+ return _s != IceUtil::Time();
+ }
+
+ IceUtil::Int64 delay()
+ {
+ return (IceUtil::Time::now(IceUtil::Time::Monotonic) - _s).toMicroSeconds();
+ }
+
+private:
+
+ IceUtil::Time _s;
+};
+
+} // End namespace IceUtilInternal
+
+#endif
diff --git a/cpp/include/IceUtil/StringConverter.h b/cpp/include/IceUtil/StringConverter.h
index 1849412427d..23c26158f20 100644
--- a/cpp/include/IceUtil/StringConverter.h
+++ b/cpp/include/IceUtil/StringConverter.h
@@ -1,3 +1,6 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
@@ -17,27 +20,16 @@
namespace IceUtil
{
-enum ConversionFlags
-{
- strictConversion = 0,
- lenientConversion
-};
-
-typedef unsigned char Byte;
-
-ICE_UTIL_API bool
-isLegalUTF8Sequence(const Byte* source, const Byte* end);
-
//
-// Provides bytes to toUTF8. Can raise std::bad_alloc or Ice::MemoryLimitException
+// Provides bytes to toUTF8. Can raise std::bad_alloc or Ice::MemoryLimitException
// when too many bytes are requested.
//
-class ICE_UTIL_API UTF8Buffer
+class ICE_API UTF8Buffer
{
public:
virtual Byte* getMoreBytes(size_t howMany, Byte* firstUnused) = 0;
-
- virtual ~UTF8Buffer() {}
+
+ virtual ~UTF8Buffer();
};
//
@@ -46,8 +38,12 @@ public:
// It report errors by raising IllegalConversionException or an exception raised
// by UTF8Buffer
//
+
template<typename charT>
-class BasicStringConverter : public IceUtil::Shared
+class BasicStringConverter
+#ifndef ICE_CPP11_MAPPING
+ : public IceUtil::Shared
+#endif
{
public:
//
@@ -62,96 +58,80 @@ public:
//
virtual void fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
std::basic_string<charT>& target) const = 0;
-};
-
-typedef BasicStringConverter<char> StringConverter;
-typedef IceUtil::Handle<StringConverter> StringConverterPtr;
-typedef BasicStringConverter<wchar_t> WstringConverter;
-typedef IceUtil::Handle<WstringConverter> WstringConverterPtr;
+ virtual ~BasicStringConverter()
+ {
+ }
+};
+#ifdef __clang__
//
-// Converts to and from UTF-16 or UTF-32 depending on sizeof(wchar_t)
+// Explicit template instantiation so that dynamic_cast of derived exported
+// classes works well with clang, see ICE-7473.
//
-class ICE_UTIL_API UnicodeWstringConverter : public WstringConverter
-{
-public:
-
- UnicodeWstringConverter(ConversionFlags = lenientConversion);
-
- virtual Byte* toUTF8(const wchar_t*, const wchar_t*, UTF8Buffer&) const;
-
- virtual void fromUTF8(const Byte*, const Byte*, std::wstring&) const;
+template class ICE_API BasicStringConverter<char>;
+template class ICE_API BasicStringConverter<wchar_t>;
+#endif
-private:
- const ConversionFlags _conversionFlags;
-};
+typedef BasicStringConverter<char> StringConverter;
+ICE_DEFINE_PTR(StringConverterPtr, StringConverter);
-#ifdef _WIN32
+typedef BasicStringConverter<wchar_t> WstringConverter;
+ICE_DEFINE_PTR(WstringConverterPtr, WstringConverter);
//
-// Converts to/from UTF-8 using MultiByteToWideChar and WideCharToMultiByte
+// Create a WstringConverter that converts to and from UTF-16 or UTF-32
+// depending on sizeof(wchar_t).
//
-class ICE_UTIL_API WindowsStringConverter : public StringConverter
-{
-public:
-
- explicit WindowsStringConverter(unsigned int);
-
- virtual Byte* toUTF8(const char*, const char*, UTF8Buffer&) const;
-
- virtual void fromUTF8(const Byte*, const Byte*, std::string& target) const;
-
-private:
- unsigned int _cp;
- UnicodeWstringConverter _unicodeWstringConverter;
-};
-#endif
+//
+ICE_API WstringConverterPtr createUnicodeWstringConverter();
//
// Retrieve the per process narrow string converter.
//
-ICE_UTIL_API StringConverterPtr getProcessStringConverter();
+ICE_API StringConverterPtr getProcessStringConverter();
//
// Set the per process narrow string converter.
//
-ICE_UTIL_API void setProcessStringConverter(const StringConverterPtr&);
+ICE_API void setProcessStringConverter(const StringConverterPtr&);
//
// Retrieve the per process wide string converter.
//
-ICE_UTIL_API WstringConverterPtr getProcessWstringConverter();
+ICE_API WstringConverterPtr getProcessWstringConverter();
//
// Set the per process wide string converter.
//
-ICE_UTIL_API void setProcessWstringConverter(const WstringConverterPtr&);
+ICE_API void setProcessWstringConverter(const WstringConverterPtr&);
//
// Converts the given wide string to a narrow string
//
-// If the StringConverter parameter is null, the result's narrow
-// string encoding is UTF-8.
-// If the WstringConverter parameter is null, the input's wstring
+// If the StringConverter parameter is null, the result's narrow
+// string encoding is UTF-8.
+// If the WstringConverter parameter is null, the input's wstring
// encoding is UTF-16 or UTF-32 depending on the size of wchar_t.
//
-ICE_UTIL_API std::string
-wstringToString(const std::wstring&, const StringConverterPtr& = 0,
- const WstringConverterPtr& = 0, ConversionFlags = lenientConversion);
+ICE_API std::string
+wstringToString(const std::wstring&,
+ const StringConverterPtr& = 0,
+ const WstringConverterPtr& = 0);
//
// Converts the given narrow string to a wide string
//
-// If the StringConverter parameter is null, the input's narrow string
-// encoding is UTF-8.
-// If the WstringConverter parameter is null, the result's wstring
+// If the StringConverter parameter is null, the input's narrow string
+// encoding is UTF-8.
+// If the WstringConverter parameter is null, the result's wstring
// encoding is UTF-16 or UTF-32 depending on the size of wchar_t.
//
-ICE_UTIL_API std::wstring
-stringToWstring(const std::string&, const StringConverterPtr& = 0,
- const WstringConverterPtr& = 0, ConversionFlags = lenientConversion);
+ICE_API std::wstring
+stringToWstring(const std::string&,
+ const StringConverterPtr& = 0,
+ const WstringConverterPtr& = 0);
//
@@ -159,7 +139,7 @@ stringToWstring(const std::string&, const StringConverterPtr& = 0,
// UTF-8 using the given converter. If the converter is null, returns
// the given string.
//
-ICE_UTIL_API std::string
+ICE_API std::string
nativeToUTF8(const std::string&, const StringConverterPtr&);
//
@@ -167,9 +147,36 @@ nativeToUTF8(const std::string&, const StringConverterPtr&);
// encoding using the given converter. If the converter is null,
// returns the given string.
//
-ICE_UTIL_API std::string
+ICE_API std::string
UTF8ToNative(const std::string&, const StringConverterPtr&);
}
+namespace IceUtilInternal
+{
+//
+// Convert from UTF-8 to UTF-16/32
+//
+ICE_API std::vector<unsigned short> toUTF16(const std::vector<IceUtil::Byte>&);
+ICE_API std::vector<unsigned int> toUTF32(const std::vector<IceUtil::Byte>&);
+
+//
+// Convert from UTF-32 to UTF-8
+//
+ICE_API std::vector<IceUtil::Byte> fromUTF32(const std::vector<unsigned int>&);
+
+}
+
+#ifdef _WIN32
+namespace IceUtil
+{
+//
+// Create a StringConverter that converts to and from narrow chars
+// in the given code page, using MultiByteToWideChar and WideCharToMultiByte
+//
+ICE_API StringConverterPtr createWindowsStringConverter(unsigned int);
+
+}
+#endif
+
#endif
diff --git a/cpp/include/IceUtil/StringUtil.h b/cpp/include/IceUtil/StringUtil.h
index 1cd3ee5fe98..cb0da8b7a06 100644
--- a/cpp/include/IceUtil/StringUtil.h
+++ b/cpp/include/IceUtil/StringUtil.h
@@ -7,8 +7,8 @@
//
// **********************************************************************
-#ifndef ICE_STRING_UTIL_H
-#define ICE_STRING_UTIL_H
+#ifndef ICE_UTIL_STRING_UTIL_H
+#define ICE_UTIL_STRING_UTIL_H
#include <IceUtil/Config.h>
#include <vector>
@@ -17,32 +17,43 @@ namespace IceUtilInternal
{
//
-// Add escape sequences (like "\n", or "\0xxx") to make a string
-// readable in ASCII.
+// Must be kept in sync with Ice::ToStringMode
//
-ICE_UTIL_API std::string escapeString(const std::string&, const std::string&);
+#ifdef ICE_CPP11_MAPPING
+enum class ToStringMode : unsigned char
+#else
+enum ToStringMode
+#endif
+{ Unicode, ASCII, Compat };
+
+//
+// Add escape sequences (like "\n", or "\123") to the input string
+// (first parameter).
+// The second parameter adds characters to escape, and can be empty.
+//
+ICE_API std::string escapeString(const std::string&, const std::string&, ToStringMode);
//
// Remove escape sequences added by escapeString. Throws IllegalArgumentException
// for an invalid input string.
//
-ICE_UTIL_API std::string unescapeString(const std::string&, std::string::size_type, std::string::size_type);
+ICE_API std::string unescapeString(const std::string&, std::string::size_type, std::string::size_type, const std::string&);
//
// Split a string using the given delimiters. Considers single and double quotes;
// returns false for unbalanced quote, true otherwise.
//
-ICE_UTIL_API bool splitString(const std::string&, const std::string&, std::vector<std::string>&);
+ICE_API bool splitString(const std::string&, const std::string&, std::vector<std::string>&);
//
-// Join a list of strings using the given delimiter.
+// Join a list of strings using the given delimiter.
//
-ICE_UTIL_API std::string joinString(const std::vector<std::string>&, const std::string&);
+ICE_API std::string joinString(const std::vector<std::string>&, const std::string&);
//
// Trim white space
//
-ICE_UTIL_API std::string trim(const std::string&);
+ICE_API std::string trim(const std::string&);
//
// If a single or double quotation mark is found at the start
@@ -51,7 +62,7 @@ ICE_UTIL_API std::string trim(const std::string&);
// 0 is returned. If no matching closing quote is found, then
// std::string::npos is returned.
//
-ICE_UTIL_API std::string::size_type checkQuote(const std::string&, std::string::size_type = 0);
+ICE_API std::string::size_type checkQuote(const std::string&, std::string::size_type = 0);
//
// Match `s' against the pattern `pat'. A * in the pattern acts
@@ -59,16 +70,16 @@ ICE_UTIL_API std::string::size_type checkQuote(const std::string&, std::string::
// other than a period (`.'). We match by hand here because
// it's portable across platforms (whereas regex() isn't).
//
-ICE_UTIL_API bool match(const std::string&, const std::string&, bool = false);
+ICE_API bool match(const std::string&, const std::string&, bool = false);
//
// Get the error message for the last error code or given error code.
//
-ICE_UTIL_API std::string lastErrorToString();
+ICE_API std::string lastErrorToString();
#ifdef _WIN32
-ICE_UTIL_API std::string errorToString(int, LPCVOID = NULL);
+ICE_API std::string errorToString(int, LPCVOID = ICE_NULLPTR);
#else
-ICE_UTIL_API std::string errorToString(int);
+ICE_API std::string errorToString(int);
#endif
//
@@ -76,15 +87,15 @@ ICE_UTIL_API std::string errorToString(int);
// UTF8 string/characters but ignore non ASCII characters. Unlike, the
// C methods, these methods are not local dependent.
//
-ICE_UTIL_API std::string toLower(const std::string&);
-ICE_UTIL_API std::string toUpper(const std::string&);
-ICE_UTIL_API bool isAlpha(char);
-ICE_UTIL_API bool isDigit(char);
+ICE_API std::string toLower(const std::string&);
+ICE_API std::string toUpper(const std::string&);
+ICE_API bool isAlpha(char);
+ICE_API bool isDigit(char);
//
// Remove all whitespace from a string
//
-ICE_UTIL_API std::string removeWhitespace(const std::string&);
+ICE_API std::string removeWhitespace(const std::string&);
}
diff --git a/cpp/include/IceUtil/Thread.h b/cpp/include/IceUtil/Thread.h
index 8219cb06a4f..304a0b5a8e2 100644
--- a/cpp/include/IceUtil/Thread.h
+++ b/cpp/include/IceUtil/Thread.h
@@ -15,7 +15,7 @@
#include <IceUtil/Handle.h>
#include <IceUtil/Mutex.h>
-#ifdef ICE_OS_WINRT
+#ifdef ICE_OS_UWP
# include <memory>
# include <thread>
#endif
@@ -25,7 +25,7 @@ namespace IceUtil
class Time;
-class ICE_UTIL_API ThreadControl
+class ICE_API ThreadControl
{
public:
@@ -35,7 +35,7 @@ public:
//
ThreadControl();
-#ifdef ICE_OS_WINRT
+#ifdef ICE_OS_UWP
ThreadControl(const std::shared_ptr<std::thread>&);
#elif defined(_WIN32)
ThreadControl(HANDLE, DWORD);
@@ -80,7 +80,7 @@ public:
// id() returns the Thread ID on Windows and the underlying pthread_t
// on POSIX platforms.
//
-#ifdef ICE_OS_WINRT
+#ifdef ICE_OS_UWP
typedef std::thread::id ID;
#elif defined(_WIN32)
typedef DWORD ID;
@@ -94,7 +94,7 @@ public:
private:
-#ifdef ICE_OS_WINRT
+#ifdef ICE_OS_UWP
std::shared_ptr<std::thread> _thread;
std::thread::id _id;
#elif defined(_WIN32)
@@ -112,7 +112,7 @@ private:
#endif
};
-class ICE_UTIL_API Thread : virtual public IceUtil::Shared
+class ICE_API Thread : public virtual IceUtil::Shared
{
public:
@@ -128,7 +128,6 @@ public:
ThreadControl getThreadControl() const;
bool operator==(const Thread&) const;
- bool operator!=(const Thread&) const;
bool operator<(const Thread&) const;
//
@@ -153,7 +152,7 @@ protected:
bool _started;
bool _running;
-#ifdef ICE_OS_WINRT
+#ifdef ICE_OS_UWP
std::shared_ptr<std::thread> _thread;
#elif defined(_WIN32)
HANDLE _handle;
diff --git a/cpp/include/IceUtil/ThreadException.h b/cpp/include/IceUtil/ThreadException.h
index ea4804fb1a6..2652805ff81 100644
--- a/cpp/include/IceUtil/ThreadException.h
+++ b/cpp/include/IceUtil/ThreadException.h
@@ -16,90 +16,82 @@
namespace IceUtil
{
-class ICE_UTIL_API ThreadSyscallException : public SyscallException
+class ICE_API ThreadSyscallException : public SyscallExceptionHelper<ThreadSyscallException>
{
public:
ThreadSyscallException(const char*, int, int);
- virtual std::string ice_name() const;
- virtual ThreadSyscallException* ice_clone() const;
- virtual void ice_throw() const;
-
-private:
+ virtual std::string ice_id() const;
- static const char* _name;
+#ifndef ICE_CPP11_MAPPING
+ virtual ThreadSyscallException* ice_clone() const;
+#endif
};
-class ICE_UTIL_API ThreadLockedException : public Exception
+class ICE_API ThreadLockedException : public ExceptionHelper<ThreadLockedException>
{
public:
ThreadLockedException(const char*, int);
- virtual std::string ice_name() const;
- virtual ThreadLockedException* ice_clone() const;
- virtual void ice_throw() const;
-
-private:
+ virtual std::string ice_id() const;
- static const char* _name;
+#ifndef ICE_CPP11_MAPPING
+ virtual ThreadLockedException* ice_clone() const;
+#endif
};
-class ICE_UTIL_API ThreadStartedException : public Exception
+class ICE_API ThreadStartedException : public ExceptionHelper<ThreadStartedException>
{
public:
ThreadStartedException(const char*, int);
- virtual std::string ice_name() const;
- virtual ThreadStartedException* ice_clone() const;
- virtual void ice_throw() const;
+ virtual std::string ice_id() const;
-private:
+#ifndef ICE_CPP11_MAPPING
+ virtual ThreadStartedException* ice_clone() const;
+#endif
- static const char* _name;
};
-class ICE_UTIL_API ThreadNotStartedException : public Exception
+class ICE_API ThreadNotStartedException : public ExceptionHelper<ThreadNotStartedException>
{
public:
ThreadNotStartedException(const char*, int);
- virtual std::string ice_name() const;
- virtual ThreadNotStartedException* ice_clone() const;
- virtual void ice_throw() const;
-
-private:
+ virtual std::string ice_id() const;
- static const char* _name;
+#ifndef ICE_CPP11_MAPPING
+ virtual ThreadNotStartedException* ice_clone() const;
+#endif
};
-class ICE_UTIL_API BadThreadControlException : public Exception
+class ICE_API BadThreadControlException : public ExceptionHelper<BadThreadControlException>
{
public:
BadThreadControlException(const char*, int);
- virtual std::string ice_name() const;
- virtual BadThreadControlException* ice_clone() const;
- virtual void ice_throw() const;
-
-private:
+ virtual std::string ice_id() const;
- static const char* _name;
+#ifndef ICE_CPP11_MAPPING
+ virtual BadThreadControlException* ice_clone() const;
+#endif
};
-class ICE_UTIL_API InvalidTimeoutException : public Exception
+class ICE_API InvalidTimeoutException : public ExceptionHelper<InvalidTimeoutException>
{
public:
InvalidTimeoutException(const char*, int, const Time&);
- virtual std::string ice_name() const;
+ virtual std::string ice_id() const;
virtual void ice_print(std::ostream&) const;
+
+#ifndef ICE_CPP11_MAPPING
virtual InvalidTimeoutException* ice_clone() const;
- virtual void ice_throw() const;
+#endif
private:
-
+
Time _timeout;
- static const char* _name;
};
}
diff --git a/cpp/include/IceUtil/Time.h b/cpp/include/IceUtil/Time.h
index 897c95f17f7..98e14017c26 100644
--- a/cpp/include/IceUtil/Time.h
+++ b/cpp/include/IceUtil/Time.h
@@ -19,7 +19,7 @@
namespace IceUtil
{
-class ICE_UTIL_API Time
+class ICE_API Time
{
public:
@@ -203,7 +203,7 @@ private:
Int64 _usec;
};
-ICE_UTIL_API std::ostream& operator<<(std::ostream&, const Time&);
+ICE_API std::ostream& operator<<(std::ostream&, const Time&);
} // End namespace IceUtil
diff --git a/cpp/include/IceUtil/Timer.h b/cpp/include/IceUtil/Timer.h
index 1d6f81936af..925e4dd291f 100644
--- a/cpp/include/IceUtil/Timer.h
+++ b/cpp/include/IceUtil/Timer.h
@@ -28,22 +28,25 @@ typedef IceUtil::Handle<Timer> TimerPtr;
// Extend the TimerTask class and override the runTimerTask() method to execute
// code at a specific time or repeatedly.
//
-class ICE_UTIL_API TimerTask : virtual public IceUtil::Shared
+class ICE_API TimerTask
+#ifndef ICE_CPP11_MAPPING
+ : public virtual IceUtil::Shared
+#endif
{
public:
- virtual ~TimerTask() { }
+ virtual ~TimerTask();
virtual void runTimerTask() = 0;
};
-typedef IceUtil::Handle<TimerTask> TimerTaskPtr;
+ICE_DEFINE_PTR(TimerTaskPtr, TimerTask);
//
// The timer class is used to schedule tasks for one-time execution or
// repeated execution. Tasks are executed by the dedicated timer thread
// sequentially.
//
-class ICE_UTIL_API Timer : virtual public IceUtil::Shared, private IceUtil::Thread
+class ICE_API Timer : public virtual IceUtil::Shared, private IceUtil::Thread
{
public:
diff --git a/cpp/include/IceUtil/UUID.h b/cpp/include/IceUtil/UUID.h
index e0aa74c62f7..1cf4f397d4e 100644
--- a/cpp/include/IceUtil/UUID.h
+++ b/cpp/include/IceUtil/UUID.h
@@ -15,7 +15,7 @@
namespace IceUtil
{
-ICE_UTIL_API std::string generateUUID();
+ICE_API std::string generateUUID();
}
diff --git a/cpp/include/Makefile b/cpp/include/Makefile
deleted file mode 100644
index 812a1e01a40..00000000000
--- a/cpp/include/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..
-
-include $(top_srcdir)/config/Make.rules
-
-SUBDIRS = Ice \
- IceSSL \
- IceUtil \
- Slice
-
-ifeq ($(findstring MINGW,$(UNAME)),)
-SUBDIRS := $(SUBDIRS) \
- Freeze \
- Glacier2 \
- IceBox \
- IceGrid \
- IcePatch2 \
- IceStorm
-endif
-
-
-$(EVERYTHING)::
- @for subdir in $(SUBDIRS); \
- do \
- echo "making $@ in $$subdir"; \
- ( cd $$subdir && $(MAKE) $@ ) || exit 1; \
- done
diff --git a/cpp/include/Makefile.mak b/cpp/include/Makefile.mak
deleted file mode 100644
index 71ed442dc7d..00000000000
--- a/cpp/include/Makefile.mak
+++ /dev/null
@@ -1,43 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-!if "$(WINRT)" == "yes"
-SUBDIRS = IceUtil \
- Ice \
- IceSSL \
- Glacier2 \
- IceStorm \
- IceGrid \
-!elseif "$(CPP_COMPILER)" == "VC100"
-SUBDIRS = IceUtil \
- Slice \
- Ice \
- IceSSL
-!else
-SUBDIRS = Glacier2 \
- Ice \
- IceSSL \
- IceGrid \
- IceStorm \
- IceUtil \
- Freeze \
- IceBox \
- IcePatch2 \
- IceSSL \
- Slice
-!endif
-
-$(EVERYTHING)::
- @for %i in ( $(SUBDIRS) ) do \
- @echo "making $@ in %i" && \
- cmd /c "cd %i && $(MAKE) -nologo -f Makefile.mak $@" || exit 1
diff --git a/cpp/include/Slice/CPlusPlusUtil.h b/cpp/include/Slice/CPlusPlusUtil.h
deleted file mode 100644
index bb8b0dc167c..00000000000
--- a/cpp/include/Slice/CPlusPlusUtil.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef C_PLUS_PLUS_UTIL_H
-#define C_PLUS_PLUS_UTIL_H
-
-#include <Slice/Parser.h>
-#include <IceUtil/OutputUtil.h>
-
-namespace Slice
-{
-
-SLICE_API extern FeatureProfile featureProfile;
-SLICE_API extern std::string paramPrefix;
-
-struct ToIfdef
-{
- SLICE_API char operator()(char);
-};
-
-SLICE_API void printHeader(::IceUtilInternal::Output&);
-SLICE_API void printVersionCheck(::IceUtilInternal::Output&);
-SLICE_API void printDllExportStuff(::IceUtilInternal::Output&, const std::string&);
-
-const int TypeContextInParam = 1;
-const int TypeContextAMIEnd = 2;
-const int TypeContextAMIPrivateEnd = 4;
-const int TypeContextAMICallPrivateEnd = 8;
-
-const int TypeContextUseWstring = 16;
-
-SLICE_API std::string typeToString(const TypePtr&, const StringList& = StringList(), int = 0);
-SLICE_API std::string typeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
-SLICE_API std::string returnTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
-SLICE_API std::string inputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
-SLICE_API std::string outputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
-SLICE_API std::string operationModeToString(Operation::Mode);
-SLICE_API std::string opFormatTypeToString(const OperationPtr&);
-
-SLICE_API std::string fixKwd(const std::string&);
-
-SLICE_API void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, bool, int, const std::string&,
- bool, const StringList& = StringList(), int = 0, const std::string& = "",
- bool = true);
-
-SLICE_API void writeMarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0);
-SLICE_API void writeUnmarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0);
-SLICE_API void writeAllocateCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0);
-
-SLICE_API std::string getEndArg(const TypePtr&, const StringList&, const std::string&);
-SLICE_API void writeEndCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool = false);
-
-SLICE_API std::string findMetaData(const StringList&, int = 0);
-SLICE_API bool inWstringModule(const SequencePtr&);
-
-SLICE_API std::string getDataMemberRef(const DataMemberPtr&);
-}
-
-#endif
diff --git a/cpp/include/Slice/Checksum.h b/cpp/include/Slice/Checksum.h
deleted file mode 100644
index d4b29c94717..00000000000
--- a/cpp/include/Slice/Checksum.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef SLICE_CHECKSUM_H
-#define SLICE_CHECKSUM_H
-
-#include <Slice/Parser.h>
-#include <map>
-#include <vector>
-
-namespace Slice
-{
-
-typedef std::map<std::string, std::vector<unsigned char> > ChecksumMap;
-
-SLICE_API ChecksumMap createChecksums(const UnitPtr&);
-
-}
-
-#endif
diff --git a/cpp/include/Slice/CsUtil.h b/cpp/include/Slice/CsUtil.h
deleted file mode 100644
index 947c502ac8a..00000000000
--- a/cpp/include/Slice/CsUtil.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef CS_UTIL_H
-#define CS_UTIL_H
-
-#include <Slice/Parser.h>
-#include <IceUtil/OutputUtil.h>
-
-namespace Slice
-{
-
-class SLICE_API CsGenerator : private ::IceUtil::noncopyable
-{
-public:
-
- virtual ~CsGenerator() {};
-
- //
- // Convert a dimension-less array declaration to one with a dimension.
- //
- static std::string toArrayAlloc(const std::string& decl, const std::string& sz);
-
- //
- // Validate all metadata in the unit with a "cs:" prefix.
- //
- static void validateMetaData(const UnitPtr&);
-
-protected:
- static std::string fixId(const std::string&, int = 0, bool = false);
- static std::string fixId(const ContainedPtr&, int = 0, bool = false);
- static std::string getOptionalFormat(const TypePtr&);
- static std::string getStaticId(const TypePtr&);
- static std::string typeToString(const TypePtr&, bool = false);
- static bool isValueType(const TypePtr&);
- static bool isSerializable(const TypePtr&);
-
- //
- // Generate code to marshal or unmarshal a type
- //
- void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, bool);
- void writeOptionalMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int, bool,
- bool);
- void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&,
- bool, bool, bool);
- void writeOptionalSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&,
- int, bool, bool);
-
- void writeSerializeDeserializeCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, int, bool);
-
-private:
-
- class MetaDataVisitor : public ParserVisitor
- {
- public:
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual void visitExceptionEnd(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitStructEnd(const StructPtr&);
- virtual void visitOperation(const OperationPtr&);
- virtual void visitParamDecl(const ParamDeclPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitConst(const ConstPtr&);
-
- private:
-
- void validate(const ContainedPtr&);
-
- std::string _fileName;
- StringSet _history;
- };
-};
-
-}
-
-#endif
diff --git a/cpp/include/Slice/DotNetNames.h b/cpp/include/Slice/DotNetNames.h
deleted file mode 100644
index 9bb2381d21b..00000000000
--- a/cpp/include/Slice/DotNetNames.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef DOTNETNAMES_H
-#define DOTNETNAMES_H
-
-#include <string>
-
-namespace Slice
-{
-
-namespace DotNet
-{
-
-enum BaseType
-{
- Object=1, ICloneable=2, Exception=4, END=8
-};
-
-extern const char * manglePrefix;
-
-std::string mangleName(const std::string&, int baseTypes = 0);
-
-}
-
-}
-
-#endif
diff --git a/cpp/include/Slice/FileTracker.h b/cpp/include/Slice/FileTracker.h
deleted file mode 100644
index 2b9d4388134..00000000000
--- a/cpp/include/Slice/FileTracker.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef FILE_TRACKER_H
-#define FILE_TRACKER_H
-
-#include <IceUtil/Shared.h>
-#include <Slice/Parser.h>
-
-namespace Slice
-{
-
-class SLICE_API FileException : public ::IceUtil::Exception
-{
-public:
-
- FileException(const char*, int, const std::string&);
- ~FileException() throw();
- virtual std::string ice_name() const;
- virtual void ice_print(std::ostream&) const;
- virtual FileException* ice_clone() const;
- virtual void ice_throw() const;
-
- std::string reason() const;
-
-private:
-
- static const char* _name;
- const std::string _reason;
-};
-
-class FileTracker;
-typedef IceUtil::Handle<FileTracker> FileTrackerPtr;
-
-class SLICE_API FileTracker : public ::IceUtil::SimpleShared
-{
-public:
-
- FileTracker();
- ~FileTracker();
-
- static FileTrackerPtr instance();
-
- void setSource(const std::string&);
- void setOutput(const std::string&, bool);
- void addFile(const std::string&);
- void addDirectory(const std::string&);
-
- void cleanup();
- void dumpxml();
-
-private:
-
- std::string escape(const std::string&) const;
-
- std::list<std::pair< std::string, bool> > _files;
- std::string _source;
- std::map<std::string, std::string> _errors;
- std::map<std::string, std::list<std::string> > _generated;
- std::map<std::string, std::list<std::string> >::iterator _curr;
-};
-
-}
-
-#endif
diff --git a/cpp/include/Slice/JavaUtil.h b/cpp/include/Slice/JavaUtil.h
deleted file mode 100644
index 952f732ca4a..00000000000
--- a/cpp/include/Slice/JavaUtil.h
+++ /dev/null
@@ -1,279 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef JAVA_UTIL_H
-#define JAVA_UTIL_H
-
-#include <Slice/Parser.h>
-#include <IceUtil/OutputUtil.h>
-
-namespace Slice
-{
-
-//
-// Compute Java serialVersionUID for a Slice class
-//
-SLICE_API long
-computeSerialVersionUUID(const ClassDefPtr&);
-
-//
-// Compute Java serialVersionUID for a Slice class
-//
-SLICE_API long
-computeSerialVersionUUID(const ExceptionPtr&);
-
-//
-// Compute Java serialVersionUID for a Slice struct
-//
-SLICE_API long
-computeSerialVersionUUID(const StructPtr&);
-
-class SLICE_API JavaOutput : public ::IceUtilInternal::Output
-{
-public:
-
- JavaOutput();
- JavaOutput(std::ostream&);
- JavaOutput(const char*);
-
- //
- // Open a file to hold the source for a Java class. The first
- // argument is the class name (including an optional leading
- // package). Intermediate directories will be created as
- // necessary to open the file in the package. The second
- // argument specifies a directory prefix in which to locate
- // the class.
- //
- // After successfully opening the file, the function invokes
- // printHeader() and then emits a "package" statement if
- // necessary.
- //
- void openClass(const std::string&, const std::string&, const std::string& = std::string());
-
- virtual void printHeader();
-};
-
-class SLICE_API JavaGenerator : private ::IceUtil::noncopyable
-{
-public:
-
- virtual ~JavaGenerator();
-
- //
- // Validate all metadata in the unit with a "java:" prefix.
- //
- static void validateMetaData(const UnitPtr&);
-
- void close();
-
-protected:
-
- JavaGenerator(const std::string&);
-
- //
- // Given the fully-scoped Java class name, create any intermediate
- // package directories and open the class file,
- //
- void open(const std::string&, const std::string&);
-
- ::IceUtilInternal::Output& output() const;
-
- //
- // Check a symbol against any of the Java keywords. If a
- // match is found, return the symbol with a leading underscore.
- //
- std::string fixKwd(const std::string&) const;
-
- //
- // Convert a Slice scoped name into a Java name.
- //
- std::string convertScopedName(const std::string&,
- const std::string& = std::string(),
- const std::string& = std::string()) const;
-
-
- //
- // Returns the package prefix for a give Slice file.
- //
- std::string getPackagePrefix(const ContainedPtr&) const;
-
- //
- // Returns the Java package of a Contained entity.
- //
- std::string getPackage(const ContainedPtr&) const;
-
- //
- // Returns the Java name for a Contained entity. If the optional
- // package argument matches the entity's package name, then the
- // package is removed from the result.
- //
- std::string getAbsolute(const ContainedPtr&,
- const std::string& = std::string(),
- const std::string& = std::string(),
- const std::string& = std::string()) const;
-
- //
- // Return the method call necessary to obtain the static type ID for an object type.
- //
- std::string getStaticId(const TypePtr&, const std::string&) const;
-
- //
- // Determines whether an operation should use the optional mapping.
- //
- bool useOptionalMapping(const OperationPtr&);
-
- //
- // Returns the optional type corresponding to the given Slice type.
- //
- std::string getOptionalFormat(const TypePtr&);
-
- //
- // Get the Java name for a type. If an optional scope is provided,
- // the scope will be removed from the result if possible.
- //
- enum TypeMode
- {
- TypeModeIn,
- TypeModeOut,
- TypeModeMember,
- TypeModeReturn
- };
- std::string typeToString(const TypePtr&, TypeMode, const std::string& = std::string(),
- const StringList& = StringList(), bool = true, bool = false) const;
-
- //
- // Get the Java object name for a type. For primitive types, this returns the
- // Java class type (e.g., Integer). For all other types, this function delegates
- // to typeToString.
- //
- std::string typeToObjectString(const TypePtr&, TypeMode, const std::string& = std::string(),
- const StringList& = StringList(), bool = true) const;
-
- //
- // Generate code to marshal or unmarshal a type.
- //
- enum OptionalMode
- {
- OptionalNone,
- OptionalInParam,
- OptionalOutParam,
- OptionalReturnParam,
- OptionalMember
- };
-
- void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const TypePtr&, OptionalMode,
- bool, int, const std::string&, bool, int&, bool = false,
- const StringList& = StringList(), const std::string& patchParams = "");
-
- //
- // Generate code to marshal or unmarshal a dictionary type.
- //
- void writeDictionaryMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const DictionaryPtr&,
- const std::string&, bool, int&, bool,
- const StringList& = StringList());
-
- //
- // Generate code to marshal or unmarshal a sequence type.
- //
- void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const SequencePtr&,
- const std::string&, bool, int&, bool, const StringList& = StringList());
-
- //
- // Generate code to marshal or unmarshal a type using the public stream API.
- //
- void writeStreamMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const TypePtr&, bool, int,
- const std::string&, bool, int&, bool = false,
- const StringList& = StringList(), const std::string& patchParams = "");
-
- //
- // Generate code to marshal or unmarshal a dictionary type using the public stream API.
- //
- void writeStreamDictionaryMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const DictionaryPtr&,
- const std::string&, bool, int&, bool,
- const StringList& = StringList());
-
- //
- // Generate code to marshal or unmarshal a sequence type using the public stream API.
- //
- void writeStreamSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const SequencePtr&,
- const std::string&, bool, int&, bool,
- const StringList& = StringList());
-
- //
- // Search metadata for an entry with the given prefix and return the entire string.
- //
- static bool findMetaData(const std::string&, const StringList&, std::string&);
-
- //
- // Get custom type metadata. If metadata is found, the abstract and
- // concrete types are extracted and the function returns true. If an
- // abstract type is not specified, it is set to an empty string.
- //
- static bool getTypeMetaData(const StringList&, std::string&, std::string&);
-
- //
- // Determine whether a custom type is defined. The function checks the
- // metadata of the type's original definition, as well as any optional
- // metadata that typically represents a data member or parameter.
- //
- static bool hasTypeMetaData(const TypePtr&, const StringList& = StringList());
-
- //
- // Obtain the concrete and abstract types for a dictionary or sequence type.
- // The functions return true if a custom type was defined and false to indicate
- // the default mapping was used.
- //
- bool getDictionaryTypes(const DictionaryPtr&, const std::string&, const StringList&,
- std::string&, std::string&) const;
- bool getSequenceTypes(const SequencePtr&, const std::string&, const StringList&, std::string&, std::string&) const;
-
- bool sequenceHasHolder(const SequencePtr&) const;
-
- virtual JavaOutput* createOutput();
-
- static const std::string _getSetMetaData;
-
-private:
-
- class MetaDataVisitor : public ParserVisitor
- {
- public:
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitOperation(const OperationPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitConst(const ConstPtr&);
-
- private:
-
- StringList getMetaData(const ContainedPtr&);
- void validateType(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&);
- void validateGetSet(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&);
-
- StringSet _history;
- };
-
- friend class JavaGenerator::MetaDataVisitor;
-
- std::string _dir;
- ::IceUtilInternal::Output* _out;
- mutable std::map<std::string, std::string> _filePackagePrefix;
-};
-
-}
-
-#endif
diff --git a/cpp/include/Slice/Makefile.mak b/cpp/include/Slice/Makefile.mak
deleted file mode 100644
index 09b8a9c83d2..00000000000
--- a/cpp/include/Slice/Makefile.mak
+++ /dev/null
@@ -1,21 +0,0 @@
-# **********************************************************************
-#
-# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-top_srcdir = ..\..
-
-!include $(top_srcdir)/config/Make.rules.mak
-
-install::
- @if not exist "$(install_includedir)\Slice" \
- @echo "Creating $(install_includedir)\Slice..." && \
- $(MKDIR) "$(install_includedir)\Slice"
-
- @for %i in ( *.h ) do \
- @echo Installing %i && \
- copy %i "$(install_includedir)\Slice"
diff --git a/cpp/include/Slice/ObjCUtil.h b/cpp/include/Slice/ObjCUtil.h
deleted file mode 100644
index 756e8584469..00000000000
--- a/cpp/include/Slice/ObjCUtil.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef OBJC_UTIL_H
-#define OBJC_UTIL_H
-
-#include <Slice/Parser.h>
-#include <IceUtil/OutputUtil.h>
-
-namespace Slice
-{
-
-enum BaseType
-{
- BaseTypeNone,
- BaseTypeObject,
- BaseTypeException
-};
-
-class SLICE_API ObjCGenerator : private ::IceUtil::noncopyable
-{
-public:
-
- virtual ~ObjCGenerator() {};
-
- //
- // Validate all metadata in the unit with an "objc:" prefix.
- //
- static void validateMetaData(const UnitPtr&);
-
-protected:
- struct ModulePrefix
- {
- ModulePtr m;
- std::string name;
- };
-
- static bool addModule(const ModulePtr&, const std::string&);
- static ModulePrefix modulePrefix(const ModulePtr&);
- static std::string moduleName(const ModulePtr&);
- static ModulePtr findModule(const ContainedPtr&, int = 0, bool = false);
- static void modulePrefixError(const ModulePtr&, const std::string&);
- static std::string fixId(const std::string&, int = 0, bool = false);
- static std::string fixId(const ContainedPtr&, int = 0, bool = false);
- static std::string fixName(const ContainedPtr&, int = 0, bool = false);
- static std::string fixScoped(const ContainedPtr&, int = 0, bool = false);
- static std::string getParamId(const ContainedPtr&);
- static std::string getFactoryMethod(const ContainedPtr&, bool);
- static std::string typeToString(const TypePtr&);
- static std::string inTypeToString(const TypePtr&, bool, bool = false, bool = false);
- static std::string outTypeToString(const TypePtr&, bool, bool = false, bool = false);
- static std::string typeToObjCTypeString(const TypePtr&);
- static bool isValueType(const TypePtr&);
- static bool isString(const TypePtr&);
- static bool isClass(const TypePtr&);
- static bool mapsToPointerType(const TypePtr&);
- static std::string getBuiltinName(const BuiltinPtr&);
- static std::string getBuiltinSelector(const BuiltinPtr&, bool);
- static std::string getOptionalHelperGetter(const TypePtr&);
- static std::string getOptionalStreamHelper(const TypePtr&);
- static StringList splitScopedName(const std::string&);
- static std::string getOptionalFormat(const TypePtr&);
-
- //
- // Generate code to marshal or unmarshal a type
- //
- void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, bool) const;
- void writeOptMemberMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool) const;
- void writeOptParamMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int,
- bool) const;
-
-private:
-
- class MetaDataVisitor : public ParserVisitor
- {
- public:
- MetaDataVisitor();
-
- virtual bool visitUnitStart(const UnitPtr&);
- virtual bool visitModuleStart(const ModulePtr&);
- virtual void visitModuleEnd(const ModulePtr&);
- virtual void visitClassDecl(const ClassDeclPtr&);
- virtual bool visitClassDefStart(const ClassDefPtr&);
- virtual void visitClassDefEnd(const ClassDefPtr&);
- virtual bool visitExceptionStart(const ExceptionPtr&);
- virtual void visitExceptionEnd(const ExceptionPtr&);
- virtual bool visitStructStart(const StructPtr&);
- virtual void visitStructEnd(const StructPtr&);
- virtual void visitOperation(const OperationPtr&);
- virtual void visitParamDecl(const ParamDeclPtr&);
- virtual void visitDataMember(const DataMemberPtr&);
- virtual void visitSequence(const SequencePtr&);
- virtual void visitDictionary(const DictionaryPtr&);
- virtual void visitEnum(const EnumPtr&);
- virtual void visitConst(const ConstPtr&);
-
- private:
-
- void validate(const ContainedPtr&);
-
- static Slice::StringList getMetaData(const ContainedPtr&);
- static void modulePrefixError(const ModulePtr&, const std::string&);
-
- static const std::string _objcPrefix; // "objc:"
- static const std::string _msg; // "ignoring invalid metadata"
-
- StringSet _history;
- };
-
-
- //
- // Map of module scoped name to ModulePtr. Used to verify that objc:prefix metadata directives are consistent.
- //
-
- typedef std::map<std::string, ModulePrefix> ModuleMap;
- static ModuleMap _modules;
-};
-
-}
-
-#endif
diff --git a/cpp/include/Slice/PHPUtil.h b/cpp/include/Slice/PHPUtil.h
deleted file mode 100644
index 391b1b440ab..00000000000
--- a/cpp/include/Slice/PHPUtil.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef SLICE_PHP_UTIL_H
-#define SLICE_PHP_UTIL_H
-
-#include <Slice/Parser.h>
-
-namespace Slice
-{
-namespace PHP
-{
-
-//
-// Convert a scoped name into a PHP name.
-//
-SLICE_API std::string scopedToName(const std::string&, bool);
-
-//
-// Check the given identifier against PHP's list of reserved words. If it matches
-// a reserved word, then an escaped version is returned with a leading underscore.
-//
-SLICE_API std::string fixIdent(const std::string&);
-
-//
-// Get the fully-qualified name of the given definition. If a suffix is provided,
-// it is prepended to the definition's unqualified name. If the nameSuffix
-// is provided, it is appended to the container's name.
-//
-// COMPILERFIX: MSVC 6 seems to have a problem with const std::string
-// = std::string(), const std::string = std::string().
-//
-SLICE_API std::string getAbsolute(const Slice::ContainedPtr&, bool, const std::string& = "", const std::string& = "");
-
-//
-// Since PHP uses the backslash character as the namespace separator, we have
-// to escape backslash characters when they appear in a string literal.
-//
-SLICE_API std::string escapeName(const std::string&);
-
-}
-}
-
-#endif
diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h
deleted file mode 100644
index 85d7341ce27..00000000000
--- a/cpp/include/Slice/Parser.h
+++ /dev/null
@@ -1,1122 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef SLICE_PARSER_H
-#define SLICE_PARSER_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Handle.h>
-#include <string>
-#include <vector>
-#include <list>
-#include <stack>
-#include <map>
-#include <set>
-#include <stdio.h>
-
-//
-// Automatically link Slice[D].lib with Visual C++
-//
-
-#if !defined(ICE_BUILDING_SLICE) && defined(SLICE_API_EXPORTS)
-# define ICE_BUILDING_SLICE
-#endif
-
-#if defined(_MSC_VER)
-# if !defined(ICE_BUILDING_SLICE)
-# if defined(_DEBUG) && !defined(ICE_OS_WINRT)
-# pragma comment(lib, "SliceD.lib")
-# else
-# pragma comment(lib, "Slice.lib")
-# endif
-# endif
-#endif
-
-#ifndef SLICE_API
-# ifdef SLICE_API_EXPORTS
-# define SLICE_API ICE_DECLSPEC_EXPORT
-# elif defined(ICE_STATIC_LIBS)
-# define SLICE_API /**/
-# else
-# define SLICE_API ICE_DECLSPEC_IMPORT
-# endif
-#endif
-
-namespace Slice
-{
-
-#if defined(_WIN32) && !defined(__MINGW32__)
-
-const IceUtil::Int64 Int32Max = 0x7fffffffi64;
-const IceUtil::Int64 Int32Min = -Int32Max - 1i64;
-
-#else
-
-# if defined(INT32_MIN) && defined(INT32_MAX)
-
-const IceUtil::Int64 Int32Max = INT32_MAX;
-const IceUtil::Int64 Int32Min = INT32_MIN;
-
-# else
-
-const IceUtil::Int64 Int32Max = 0x7fffffffLL;
-const IceUtil::Int64 Int32Min = -Int32Max - 1LL;
-
-# endif
-
-#endif
-
-const IceUtil::Int64 Int16Max = 0x7fff;
-const IceUtil::Int64 Int16Min = -Int16Max - 1;
-const IceUtil::Int64 ByteMax = 0xff;
-const IceUtil::Int64 ByteMin = 0x00;
-
-enum FeatureProfile
-{
- Ice,
- IceE
-};
-
-enum NodeType
-{
- Dummy,
- Real
-};
-
-//
-// Format preference for classes and exceptions.
-//
-enum FormatType
-{
- DefaultFormat, // No preference was specified.
- CompactFormat, // Minimal format.
- SlicedFormat // Full format.
-};
-
-class GrammarBase;
-class SyntaxTreeBase;
-class Type;
-class Builtin;
-class Contained;
-class Container;
-class Module;
-class Constructed;
-class ClassDecl;
-class ClassDef;
-class Proxy;
-class Exception;
-class Struct;
-class Operation;
-class ParamDecl;
-class DataMember;
-class Sequence;
-class Dictionary;
-class Enum;
-class Enumerator;
-class Const;
-class Unit;
-class CICompare;
-class DerivedToBaseCompare;
-class ModulePartialCompare;
-
-typedef ::IceUtil::Handle<GrammarBase> GrammarBasePtr;
-typedef ::IceUtil::Handle<SyntaxTreeBase> SyntaxTreeBasePtr;
-typedef ::IceUtil::Handle<Type> TypePtr;
-typedef ::IceUtil::Handle<Builtin> BuiltinPtr;
-typedef ::IceUtil::Handle<Contained> ContainedPtr;
-typedef ::IceUtil::Handle<Container> ContainerPtr;
-typedef ::IceUtil::Handle<Module> ModulePtr;
-typedef ::IceUtil::Handle<Constructed> ConstructedPtr;
-typedef ::IceUtil::Handle<ClassDecl> ClassDeclPtr;
-typedef ::IceUtil::Handle<ClassDef> ClassDefPtr;
-typedef ::IceUtil::Handle<Proxy> ProxyPtr;
-typedef ::IceUtil::Handle<Exception> ExceptionPtr;
-typedef ::IceUtil::Handle<Struct> StructPtr;
-typedef ::IceUtil::Handle<Operation> OperationPtr;
-typedef ::IceUtil::Handle<ParamDecl> ParamDeclPtr;
-typedef ::IceUtil::Handle<DataMember> DataMemberPtr;
-typedef ::IceUtil::Handle<Sequence> SequencePtr;
-typedef ::IceUtil::Handle<Dictionary> DictionaryPtr;
-typedef ::IceUtil::Handle<Enum> EnumPtr;
-typedef ::IceUtil::Handle<Enumerator> EnumeratorPtr;
-typedef ::IceUtil::Handle<Const> ConstPtr;
-typedef ::IceUtil::Handle<Unit> UnitPtr;
-
-typedef std::list<TypePtr> TypeList;
-typedef std::list<ExceptionPtr> ExceptionList;
-typedef std::set<std::string> StringSet;
-typedef std::list<std::string> StringList;
-typedef std::pair<TypePtr, std::string> TypeString;
-typedef std::list<TypeString> TypeStringList;
-typedef std::list<ContainedPtr> ContainedList;
-typedef std::list<ModulePtr> ModuleList;
-typedef std::list<ConstructedPtr> ConstructedList;
-typedef std::list<ClassDefPtr> ClassList;
-typedef std::list<ExceptionPtr> ExceptionList;
-typedef std::list<StructPtr> StructList;
-typedef std::list<SequencePtr> SequenceList;
-typedef std::list<DictionaryPtr> DictionaryList;
-typedef std::list<EnumPtr> EnumList;
-typedef std::list<ConstPtr> ConstList;
-typedef std::list<OperationPtr> OperationList;
-typedef std::list<DataMemberPtr> DataMemberList;
-typedef std::list<ParamDeclPtr> ParamDeclList;
-typedef std::list<EnumeratorPtr> EnumeratorList;
-
-struct ConstDef
-{
- TypePtr type;
- SyntaxTreeBasePtr value;
- std::string valueAsString;
- std::string valueAsLiteral;
-};
-
-struct OptionalDef
-{
- TypePtr type;
- std::string name;
- bool optional;
- int tag;
-};
-
-// ----------------------------------------------------------------------
-// CICompare -- function object to do case-insensitive string comparison.
-// ----------------------------------------------------------------------
-
-class SLICE_API CICompare : public std::binary_function<std::string, std::string, bool>
-{
-public:
-
- bool operator()(const std::string&, const std::string&) const;
-};
-
-#if defined(__SUNPRO_CC)
-SLICE_API bool cICompare(const std::string&, const std::string&);
-#endif
-
-// ----------------------------------------------------------------------
-// DerivedToBaseCompare -- function object to do sort exceptions into
-// most-derived to least-derived order.
-// ----------------------------------------------------------------------
-
-class SLICE_API DerivedToBaseCompare : public std::binary_function<std::string, std::string, bool>
-{
-public:
-
- bool operator()(const ExceptionPtr&, const ExceptionPtr&) const;
-};
-
-#if defined(__SUNPRO_CC)
-SLICE_API bool derivedToBaseCompare(const ExceptionPtr&, const ExceptionPtr&);
-#endif
-
-// ----------------------------------------------------------------------
-// ParserVisitor
-// ----------------------------------------------------------------------
-
-class SLICE_API ParserVisitor
-{
-public:
-
- virtual ~ParserVisitor() { }
- virtual bool visitUnitStart(const UnitPtr&) { return true; }
- virtual void visitUnitEnd(const UnitPtr&) { }
- virtual bool visitModuleStart(const ModulePtr&) { return true; }
- virtual void visitModuleEnd(const ModulePtr&) { }
- virtual void visitClassDecl(const ClassDeclPtr&) { }
- virtual bool visitClassDefStart(const ClassDefPtr&) { return true; }
- virtual void visitClassDefEnd(const ClassDefPtr&) { }
- virtual bool visitExceptionStart(const ExceptionPtr&) { return true; }
- virtual void visitExceptionEnd(const ExceptionPtr&) { }
- virtual bool visitStructStart(const StructPtr&) { return true; }
- virtual void visitStructEnd(const StructPtr&) { }
- virtual void visitOperation(const OperationPtr&) { }
- virtual void visitParamDecl(const ParamDeclPtr&) { }
- virtual void visitDataMember(const DataMemberPtr&) { }
- virtual void visitSequence(const SequencePtr&) { }
- virtual void visitDictionary(const DictionaryPtr&) { }
- virtual void visitEnum(const EnumPtr&) { }
- virtual void visitConst(const ConstPtr&) { }
-};
-
-// ----------------------------------------------------------------------
-// DefinitionContext
-// ----------------------------------------------------------------------
-
-class SLICE_API DefinitionContext : public ::IceUtil::SimpleShared
-{
-public:
-
- DefinitionContext(int, const StringList&);
-
- std::string filename() const;
- int includeLevel() const;
- bool seenDefinition() const;
-
- void setFilename(const std::string&);
- void setSeenDefinition();
-
- bool hasMetaData() const;
- void setMetaData(const StringList&);
- std::string findMetaData(const std::string&) const;
- StringList getMetaData() const;
-
-private:
-
- int _includeLevel;
- StringList _metaData;
- std::string _filename;
- bool _seenDefinition;
-};
-typedef ::IceUtil::Handle<DefinitionContext> DefinitionContextPtr;
-
-// ----------------------------------------------------------------------
-// GrammarBase
-// ----------------------------------------------------------------------
-
-class SLICE_API GrammarBase : public ::IceUtil::SimpleShared
-{
-};
-
-// ----------------------------------------------------------------------
-// SyntaxTreeBase
-// ----------------------------------------------------------------------
-
-class SLICE_API SyntaxTreeBase : public GrammarBase
-{
-public:
-
- virtual void destroy();
- UnitPtr unit() const;
- DefinitionContextPtr definitionContext() const; // May be nil
- virtual void visit(ParserVisitor*, bool);
-
-protected:
-
- SyntaxTreeBase(const UnitPtr&);
-
- UnitPtr _unit;
- DefinitionContextPtr _definitionContext;
-};
-
-// ----------------------------------------------------------------------
-// Type
-// ----------------------------------------------------------------------
-
-class SLICE_API Type : virtual public SyntaxTreeBase
-{
-public:
-
- virtual bool isLocal() const = 0;
- virtual std::string typeId() const = 0;
- virtual bool usesClasses() const = 0;
- virtual size_t minWireSize() const = 0;
- virtual bool isVariableLength() const = 0;
-
-protected:
-
- Type(const UnitPtr&);
-};
-
-// ----------------------------------------------------------------------
-// Builtin
-// ----------------------------------------------------------------------
-
-class SLICE_API Builtin : virtual public Type
-{
-public:
-
- enum Kind
- {
- KindByte,
- KindBool,
- KindShort,
- KindInt,
- KindLong,
- KindFloat,
- KindDouble,
- KindString,
- KindObject,
- KindObjectProxy,
- KindLocalObject
- };
-
- virtual bool isLocal() const;
- virtual std::string typeId() const;
- virtual bool usesClasses() const;
- virtual size_t minWireSize() const;
- virtual bool isVariableLength() const;
-
- Kind kind() const;
- std::string kindAsString() const;
-
- static const char* builtinTable[];
-
-protected:
-
- Builtin(const UnitPtr&, Kind);
- friend class Unit;
-
- Kind _kind;
-};
-
-// ----------------------------------------------------------------------
-// Contained
-// ----------------------------------------------------------------------
-
-class SLICE_API Contained : virtual public SyntaxTreeBase
-{
-public:
-
- ContainerPtr container() const;
- std::string name() const;
- std::string scoped() const;
- std::string scope() const;
- std::string flattenedScope() const;
- std::string file() const;
- std::string line() const;
- std::string comment() const;
-
- int includeLevel() const;
- void updateIncludeLevel();
-
- bool hasMetaData(const std::string&) const;
- bool findMetaData(const std::string&, std::string&) const;
- std::list<std::string> getMetaData() const;
- void setMetaData(const std::list<std::string>&);
- void addMetaData(const std::string&); // TODO: remove this method once "cs:" and "vb:" are hard errors.
-
- static FormatType parseFormatMetaData(const std::list<std::string>&);
-
- enum ContainedType
- {
- ContainedTypeSequence,
- ContainedTypeDictionary,
- ContainedTypeEnum,
- ContainedTypeEnumerator,
- ContainedTypeModule,
- ContainedTypeClass,
- ContainedTypeException,
- ContainedTypeStruct,
- ContainedTypeOperation,
- ContainedTypeParamDecl,
- ContainedTypeDataMember,
- ContainedTypeConstant
- };
- virtual ContainedType containedType() const = 0;
-
- virtual bool uses(const ContainedPtr&) const = 0;
- virtual std::string kindOf() const = 0;
-
- bool operator<(const Contained&) const;
- bool operator==(const Contained&) const;
- bool operator!=(const Contained&) const;
-
-protected:
-
- Contained(const ContainerPtr&, const std::string&);
- friend class Container;
-
- ContainerPtr _container;
- std::string _name;
- std::string _scoped;
- std::string _file;
- std::string _line;
- std::string _comment;
- int _includeLevel;
- std::list<std::string> _metaData;
-};
-
-// ----------------------------------------------------------------------
-// Container
-// ----------------------------------------------------------------------
-
-class SLICE_API Container : virtual public SyntaxTreeBase
-{
-public:
-
- virtual void destroy();
- ModulePtr createModule(const std::string&);
- ClassDefPtr createClassDef(const std::string&, int, bool, const ClassList&, bool);
- ClassDeclPtr createClassDecl(const std::string&, bool, bool, bool = true);
- ExceptionPtr createException(const std::string&, const ExceptionPtr&, bool, NodeType = Real);
- StructPtr createStruct(const std::string&, bool, NodeType = Real);
- SequencePtr createSequence(const std::string&, const TypePtr&, const StringList&, bool, NodeType = Real);
- DictionaryPtr createDictionary(const std::string&, const TypePtr&, const StringList&, const TypePtr&,
- const StringList&, bool, NodeType = Real);
- EnumPtr createEnum(const std::string&, bool, NodeType = Real);
- EnumeratorPtr createEnumerator(const std::string&);
- EnumeratorPtr createEnumerator(const std::string&, int);
- ConstPtr createConst(const std::string, const TypePtr&, const StringList&, const SyntaxTreeBasePtr&,
- const std::string&, const std::string&, NodeType = Real);
- TypeList lookupType(const std::string&, bool = true);
- TypeList lookupTypeNoBuiltin(const std::string&, bool = true);
- ContainedList lookupContained(const std::string&, bool = true);
- ExceptionPtr lookupException(const std::string&, bool = true);
- UnitPtr unit() const;
- ModuleList modules() const;
- ClassList classes() const;
- ExceptionList exceptions() const;
- StructList structs() const;
- SequenceList sequences() const;
- DictionaryList dictionaries() const;
- EnumList enums() const;
- ConstList consts() const;
- ContainedList contents() const;
- bool hasNonLocalClassDecls() const;
- bool hasNonLocalClassDefs() const;
- bool hasLocalClassDefsWithAsync() const;
- bool hasNonLocalSequences() const;
- bool hasNonLocalExceptions() const;
- bool hasDictionaries() const;
- bool hasOnlyDictionaries(DictionaryList&) const;
- bool hasClassDecls() const;
- bool hasClassDefs() const;
- bool hasOnlyClassDecls() const;
- bool hasAbstractClassDefs() const;
- bool hasNonLocalDataOnlyClasses() const;
- bool hasOtherConstructedOrExceptions() const; // Exceptions or constructed types other than classes.
- bool hasContentsWithMetaData(const std::string&) const;
- bool hasAsyncOps() const;
- bool hasNonLocalContained(Contained::ContainedType) const;
- std::string thisScope() const;
- void mergeModules();
- void sort();
- void sortContents(bool);
- virtual void visit(ParserVisitor*, bool);
- void containerRecDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
-
- bool checkIntroduced(const std::string&, ContainedPtr = 0);
- bool nameIsLegal(const std::string&, const char *);
- bool checkForGlobalDef(const std::string&, const char *);
-
-protected:
-
- Container(const UnitPtr&);
-
- void checkIdentifier(const std::string&) const;
- bool checkInterfaceAndLocal(const std::string&, bool, bool, bool, bool, bool);
- bool checkGlobalMetaData(const StringList&, const StringList&);
- bool validateConstant(const std::string&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&, bool);
- EnumeratorPtr validateEnumerator(const std::string&);
-
- ContainedList _contents;
- std::map<std::string, ContainedPtr, CICompare> _introducedMap;
-};
-
-// ----------------------------------------------------------------------
-// Module
-// ----------------------------------------------------------------------
-
-class SLICE_API Module : virtual public Container, virtual public Contained
-{
-public:
-
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
-
-protected:
-
- Module(const ContainerPtr&, const std::string&);
- friend class Container;
-};
-
-// ----------------------------------------------------------------------
-// Constructed
-// ----------------------------------------------------------------------
-
-class SLICE_API Constructed : virtual public Type, virtual public Contained
-{
-public:
-
- virtual bool isLocal() const;
- virtual std::string typeId() const;
- virtual bool isVariableLength() const = 0;
- ConstructedList dependencies();
- virtual void recDependencies(std::set<ConstructedPtr>&) = 0; // Internal operation, don't use directly.
-
-protected:
-
- Constructed(const ContainerPtr&, const std::string&, bool);
-
- bool _local;
-};
-
-// ----------------------------------------------------------------------
-// ClassDecl
-// ----------------------------------------------------------------------
-
-class SLICE_API ClassDecl : virtual public Constructed
-{
-public:
-
- virtual void destroy();
- ClassDefPtr definition() const;
- bool isInterface() const;
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual bool usesClasses() const;
- virtual size_t minWireSize() const;
- virtual bool isVariableLength() const;
- virtual void visit(ParserVisitor*, bool);
- virtual std::string kindOf() const;
- virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
-
- static void checkBasesAreLegal(const std::string&, bool, bool, const ClassList&, const UnitPtr&);
-
-protected:
-
- ClassDecl(const ContainerPtr&, const std::string&, bool, bool);
- friend class Container;
- friend class ClassDef;
-
- ClassDefPtr _definition;
- bool _interface;
-
-private:
-
- typedef std::list<ClassList> GraphPartitionList;
- typedef std::list<StringList> StringPartitionList;
-
- static bool isInList(const GraphPartitionList&, const ClassDefPtr);
- static void addPartition(GraphPartitionList&, GraphPartitionList::reverse_iterator, const ClassDefPtr);
- static StringPartitionList toStringPartitionList(const GraphPartitionList&);
- static void checkPairIntersections(const StringPartitionList&, const std::string&, const UnitPtr&);
-};
-
-// ----------------------------------------------------------------------
-// Operation
-// ----------------------------------------------------------------------
-
-class SLICE_API Operation : virtual public Contained, virtual public Container
-{
-public:
-
- //
- // Note: The order of definitions here *must* match the order of
- // definitions of ::Ice::OperationMode in slice/Ice/Current.ice!
- //
- enum Mode
- {
- Normal,
- Nonmutating,
- Idempotent
- };
-
- TypePtr returnType() const;
- bool returnIsOptional() const;
- int returnTag() const;
- Mode mode() const;
- Mode sendMode() const;
- ParamDeclPtr createParamDecl(const std::string&, const TypePtr&, bool, bool, int);
- ParamDeclList parameters() const;
- ExceptionList throws() const;
- void setExceptionList(const ExceptionList&);
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- bool sendsClasses(bool) const;
- bool returnsClasses(bool) const;
- bool returnsData() const;
- bool sendsOptionals() const;
- int attributes() const;
- FormatType format() const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
-
-protected:
-
- Operation(const ContainerPtr&, const std::string&, const TypePtr&, bool, int, Mode);
- friend class ClassDef;
-
- TypePtr _returnType;
- bool _returnIsOptional;
- int _returnTag;
- ExceptionList _throws;
- Mode _mode;
-};
-
-// ----------------------------------------------------------------------
-// ClassDef
-// ----------------------------------------------------------------------
-
-//
-// Note: For the purpose of this parser, a class definition is not
-// considered to be a type, but a class declaration is. And each class
-// definition has at least one class declaration (but not vice versa),
-// so if you need the class as a "constructed type", use the
-// declaration() operation to navigate to the class declaration.
-//
-class SLICE_API ClassDef : virtual public Container, virtual public Contained
-{
-public:
-
- virtual void destroy();
- OperationPtr createOperation(const std::string&, const TypePtr&, bool, int, Operation::Mode = Operation::Normal);
- DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&,
- const std::string&, const std::string&);
- ClassDeclPtr declaration() const;
- ClassList bases() const;
- ClassList allBases() const;
- OperationList operations() const;
- OperationList allOperations() const;
- DataMemberList dataMembers() const;
- DataMemberList orderedOptionalDataMembers() const;
- DataMemberList allDataMembers() const;
- DataMemberList classDataMembers() const;
- DataMemberList allClassDataMembers() const;
- bool canBeCyclic() const;
- bool isAbstract() const;
- bool isInterface() const;
- bool isA(const std::string&) const;
- virtual bool isLocal() const;
- bool hasDataMembers() const;
- bool hasOperations() const;
- bool hasDefaultValues() const;
- bool inheritsMetaData(const std::string&) const;
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
- int compactId() const;
-
-protected:
-
- ClassDef(const ContainerPtr&, const std::string&, int, bool, const ClassList&, bool);
- friend class Container;
-
- ClassDeclPtr _declaration;
- bool _interface;
- bool _hasDataMembers;
- bool _hasOperations;
- ClassList _bases;
- bool _local;
- int _compactId;
-};
-
-// ----------------------------------------------------------------------
-// Proxy
-// ----------------------------------------------------------------------
-
-class SLICE_API Proxy : virtual public Type
-{
-public:
-
- virtual bool isLocal() const;
- virtual std::string typeId() const;
- virtual bool usesClasses() const;
- virtual size_t minWireSize() const;
- virtual bool isVariableLength() const;
-
- ClassDeclPtr _class() const;
-
- Proxy(const ClassDeclPtr&);
-
-protected:
-
- ClassDeclPtr __class;
-};
-
-// ----------------------------------------------------------------------
-// Exception
-// ----------------------------------------------------------------------
-
-// No inheritance from Constructed, as this is not a Type
-class SLICE_API Exception : virtual public Container, virtual public Contained
-{
-public:
-
- virtual void destroy();
- DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&,
- const std::string&, const std::string&);
- DataMemberList dataMembers() const;
- DataMemberList orderedOptionalDataMembers() const;
- DataMemberList allDataMembers() const;
- DataMemberList classDataMembers() const;
- DataMemberList allClassDataMembers() const;
- ExceptionPtr base() const;
- ExceptionList allBases() const;
- virtual bool isBaseOf(const ExceptionPtr&) const;
- virtual bool isLocal() const;
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- bool usesClasses(bool) const;
- bool hasDefaultValues() const;
- bool inheritsMetaData(const std::string&) const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
-
-protected:
-
- Exception(const ContainerPtr&, const std::string&, const ExceptionPtr&, bool);
- friend class Container;
-
- ExceptionPtr _base;
- bool _local;
-};
-
-// ----------------------------------------------------------------------
-// Struct
-// ----------------------------------------------------------------------
-
-class SLICE_API Struct : virtual public Container, virtual public Constructed
-{
-public:
-
- DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&,
- const std::string&, const std::string&);
- DataMemberList dataMembers() const;
- DataMemberList classDataMembers() const;
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual bool usesClasses() const;
- virtual size_t minWireSize() const;
- virtual bool isVariableLength() const;
- bool hasDefaultValues() const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
- virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
-
-protected:
-
- Struct(const ContainerPtr&, const std::string&, bool);
- friend class Container;
-};
-
-// ----------------------------------------------------------------------
-// Sequence
-// ----------------------------------------------------------------------
-
-class SLICE_API Sequence : virtual public Constructed
-{
-public:
-
- TypePtr type() const;
- StringList typeMetaData() const;
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual bool usesClasses() const;
- virtual size_t minWireSize() const;
- virtual bool isVariableLength() const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
- virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
-
-protected:
-
- Sequence(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, bool);
- friend class Container;
-
- TypePtr _type;
- StringList _typeMetaData;
-};
-
-// ----------------------------------------------------------------------
-// Dictionary
-// ----------------------------------------------------------------------
-
-class SLICE_API Dictionary : virtual public Constructed
-{
-public:
-
- TypePtr keyType() const;
- TypePtr valueType() const;
- StringList keyMetaData() const;
- StringList valueMetaData() const;
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual bool usesClasses() const;
- virtual size_t minWireSize() const;
- virtual bool isVariableLength() const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
- virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
-
- static bool legalKeyType(const TypePtr&, bool&);
-
-protected:
-
- Dictionary(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, const TypePtr&,
- const StringList&, bool);
- friend class Container;
-
- TypePtr _keyType;
- TypePtr _valueType;
- StringList _keyMetaData;
- StringList _valueMetaData;
-};
-
-// ----------------------------------------------------------------------
-// Enum
-// ----------------------------------------------------------------------
-
-class SLICE_API Enum : virtual public Constructed
-{
-public:
-
- virtual void destroy();
- EnumeratorList getEnumerators();
- void setEnumerators(const EnumeratorList&);
- bool explicitValue() const;
- int minValue() const;
- int maxValue() const;
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual bool usesClasses() const;
- virtual size_t minWireSize() const;
- virtual bool isVariableLength() const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
- virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
-
-protected:
-
- Enum(const ContainerPtr&, const std::string&, bool);
- friend class Container;
-
- EnumeratorList _enumerators;
- bool _explicitValue;
- IceUtil::Int64 _minValue;
- IceUtil::Int64 _maxValue;
-};
-
-// ----------------------------------------------------------------------
-// Enumerator
-// ----------------------------------------------------------------------
-
-class SLICE_API Enumerator : virtual public Contained
-{
-public:
-
- EnumPtr type() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual ContainedType containedType() const;
- virtual std::string kindOf() const;
-
- bool explicitValue() const;
- int value() const;
-
-protected:
-
- Enumerator(const ContainerPtr&, const std::string&);
- Enumerator(const ContainerPtr&, const std::string&, int);
- friend class Container;
- friend class Enum;
-
- EnumPtr _type;
- bool _explicitValue;
- int _value;
-};
-
-// ----------------------------------------------------------------------
-// Const
-// ----------------------------------------------------------------------
-
-class SLICE_API Const : virtual public Contained
-{
-public:
-
- TypePtr type() const;
- StringList typeMetaData() const;
- SyntaxTreeBasePtr valueType() const;
- std::string value() const;
- std::string literal() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual ContainedType containedType() const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
-
-protected:
-
- Const(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, const SyntaxTreeBasePtr&,
- const std::string&, const std::string&);
- friend class Container;
-
- TypePtr _type;
- StringList _typeMetaData;
- SyntaxTreeBasePtr _valueType;
- std::string _value;
- std::string _literal;
-};
-
-// ----------------------------------------------------------------------
-// ParamDecl
-// ----------------------------------------------------------------------
-
-class SLICE_API ParamDecl : virtual public Contained
-{
-public:
-
- TypePtr type() const;
- bool isOutParam() const;
- bool optional() const;
- int tag() const;
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
-
-protected:
-
- ParamDecl(const ContainerPtr&, const std::string&, const TypePtr&, bool, bool, int);
- friend class Operation;
-
- TypePtr _type;
- bool _isOutParam;
- bool _optional;
- int _tag;
-};
-
-// ----------------------------------------------------------------------
-// DataMember
-// ----------------------------------------------------------------------
-
-class SLICE_API DataMember : virtual public Contained
-{
-public:
-
- TypePtr type() const;
- bool optional() const;
- int tag() const;
- std::string defaultValue() const;
- std::string defaultLiteral() const;
- SyntaxTreeBasePtr defaultValueType() const;
- virtual ContainedType containedType() const;
- virtual bool uses(const ContainedPtr&) const;
- virtual std::string kindOf() const;
- virtual void visit(ParserVisitor*, bool);
-
-
-protected:
-
- DataMember(const ContainerPtr&, const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&,
- const std::string&, const std::string&);
- friend class ClassDef;
- friend class Struct;
- friend class Exception;
-
- TypePtr _type;
- bool _optional;
- int _tag;
- SyntaxTreeBasePtr _defaultValueType;
- std::string _defaultValue;
- std::string _defaultLiteral;
-};
-
-// ----------------------------------------------------------------------
-// Unit
-// ----------------------------------------------------------------------
-
-class SLICE_API Unit : virtual public Container
-{
-public:
-
- static UnitPtr createUnit(bool, bool, bool, bool, const StringList& = StringList());
-
- bool ignRedefs() const;
- bool allowIcePrefix() const;
- bool allowUnderscore() const;
-
- void setComment(const std::string&);
- std::string currentComment(); // Not const, as this function removes the current comment.
- std::string currentFile() const;
- std::string topLevelFile() const;
- int currentLine() const;
-
- void nextLine();
- bool scanPosition(const char*);
- int currentIncludeLevel() const;
-
- void addGlobalMetaData(const StringList&);
-
- void setSeenDefinition();
-
- void error(const char*); // Not const, because error count is increased.
- void error(const std::string&); // Ditto.
-
- void warning(const char*) const;
- void warning(const std::string&) const;
-
- ContainerPtr currentContainer() const;
- void pushContainer(const ContainerPtr&);
- void popContainer();
-
- DefinitionContextPtr currentDefinitionContext() const;
- void pushDefinitionContext();
- void popDefinitionContext();
- DefinitionContextPtr findDefinitionContext(const std::string&) const;
-
- void addContent(const ContainedPtr&);
- void removeContent(const ContainedPtr&);
- ContainedList findContents(const std::string&) const;
- ClassList findDerivedClasses(const ClassDefPtr&) const;
- ExceptionList findDerivedExceptions(const ExceptionPtr&) const;
- ContainedList findUsedBy(const ContainedPtr&) const;
-
- void addTypeId(int, const std::string&);
- std::string getTypeId(int);
-
- bool usesNonLocals() const;
- bool usesConsts() const;
-
- FeatureProfile profile() const;
-
- //
- // Returns the path names of the files included directly by the top-level file.
- //
- StringList includeFiles() const;
-
- //
- // Returns the path names of all files parsed by this unit.
- //
- StringList allFiles() const;
-
- int parse(const std::string&, FILE*, bool, FeatureProfile profile = Ice);
-
- virtual void destroy();
- virtual void visit(ParserVisitor*, bool);
-
- BuiltinPtr builtin(Builtin::Kind); // Not const, as builtins are created on the fly. (Lazy initialization.)
-
- void addTopLevelModule(const std::string&, const std::string&);
- std::set<std::string> getTopLevelModules(const std::string&) const;
-
-private:
-
- Unit(bool, bool, bool, bool, const StringList&);
- static void eraseWhiteSpace(::std::string&);
-
- bool _ignRedefs;
- bool _all;
- bool _allowIcePrefix;
- bool _allowUnderscore;
- StringList _defaultGlobalMetaData;
- int _errors;
- std::string _currentComment;
- int _currentLine;
- int _currentIncludeLevel;
- std::string _currentFile;
- std::string _topLevelFile;
- std::stack<DefinitionContextPtr> _definitionContextStack;
- StringList _includeFiles;
- std::stack<ContainerPtr> _containerStack;
- std::map<Builtin::Kind, BuiltinPtr> _builtins;
- std::map<std::string, ContainedList> _contentMap;
- FeatureProfile _featureProfile;
- std::map<std::string, DefinitionContextPtr> _definitionContextMap;
- std::map<int, std::string> _typeIds;
- std::map< std::string, std::set<std::string> > _fileTopLevelModules;
-};
-
-extern SLICE_API Unit* unit; // The current parser for bison/flex
-
-}
-
-#endif
diff --git a/cpp/include/Slice/Preprocessor.h b/cpp/include/Slice/Preprocessor.h
deleted file mode 100644
index ee7f2c3945f..00000000000
--- a/cpp/include/Slice/Preprocessor.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef PREPROCESSOR_H
-#define PREPROCESSOR_H
-
-#include <IceUtil/Shared.h>
-#include <IceUtil/Handle.h>
-#include <vector>
-
-#ifndef SLICE_API
-# ifdef SLICE_API_EXPORTS
-# define SLICE_API ICE_DECLSPEC_EXPORT
-# elif defined(ICE_STATIC_LIBS)
-# define SLICE_API /**/
-# else
-# define SLICE_API ICE_DECLSPEC_IMPORT
-# endif
-#endif
-
-namespace Slice
-{
-
-class Preprocessor;
-typedef IceUtil::Handle<Preprocessor> PreprocessorPtr;
-
-class SLICE_API Preprocessor : public IceUtil::SimpleShared
-{
-public:
-
- static PreprocessorPtr create(const std::string&, const std::string&, const std::vector<std::string>&);
-
- ~Preprocessor();
-
- FILE* preprocess(bool, const std::string& = "");
- bool close();
-
- enum Language { CPlusPlus, Java, CSharp, Python, Ruby, PHP, JavaScript, JavaScriptJSON, ObjC, SliceXML };
-
- bool printMakefileDependencies(std::ostream&, Language, const std::vector<std::string>&, const std::string& = "",
- const std::string& = "cpp", const std::string& = "");
-
- std::string getBaseName();
-
- static std::string addQuotes(const std::string&);
- static std::string normalizeIncludePath(const std::string&);
-
-private:
-
- Preprocessor(const std::string&, const std::string&, const std::vector<std::string>&);
-
- bool checkInputFile();
-
- const std::string _path;
- const std::string _fileName;
- const std::string _shortFileName;
- const std::vector<std::string> _args;
- std::string _cppFile;
- FILE* _cppHandle;
-};
-
-}
-
-#endif
diff --git a/cpp/include/Slice/PythonUtil.h b/cpp/include/Slice/PythonUtil.h
deleted file mode 100644
index 39569e8f2c7..00000000000
--- a/cpp/include/Slice/PythonUtil.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef SLICE_PYTHON_UTIL_H
-#define SLICE_PYTHON_UTIL_H
-
-#include <Slice/Parser.h>
-#include <IceUtil/OutputUtil.h>
-
-namespace Slice
-{
-namespace Python
-{
-
-//
-// Generate Python code for a translation unit.
-//
-SLICE_API void generate(const Slice::UnitPtr&, bool, bool, const std::vector<std::string>&, IceUtilInternal::Output&);
-
-//
-// Convert a scoped name into a Python name.
-//
-SLICE_API std::string scopedToName(const std::string&);
-
-//
-// Check the given identifier against Python's list of reserved words. If it matches
-// a reserved word, then an escaped version is returned with a leading underscore.
-//
-SLICE_API std::string fixIdent(const std::string&);
-
-//
-// Return the package specified in the global metadata for the given definition,
-// or an empty string if no metadata was found.
-//
-SLICE_API std::string getPackageMetadata(const Slice::ContainedPtr&);
-
-//
-// Get the fully-qualified name of the given definition, including any
-// package defined via metadata. If a suffix is provided, it is
-// prepended to the definition's unqualified name. If the nameSuffix
-// is provided, it is appended to the containers name.
-//
-// COMPILERFIX: MSVC 6 seems to have a problem with const std::string
-// = std::string(), const std::string = std::string().
-//
-SLICE_API std::string getAbsolute(const Slice::ContainedPtr&, const std::string& = "", const std::string& = "");
-
-//
-// Emit a comment header.
-//
-SLICE_API void printHeader(IceUtilInternal::Output&);
-
-SLICE_API int compile(const std::vector<std::string>&);
-
-}
-}
-
-#endif
diff --git a/cpp/include/Slice/RubyUtil.h b/cpp/include/Slice/RubyUtil.h
deleted file mode 100644
index 6b569783e65..00000000000
--- a/cpp/include/Slice/RubyUtil.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef SLICE_RUBY_UTIL_H
-#define SLICE_RUBY_UTIL_H
-
-#include <Slice/Parser.h>
-#include <IceUtil/OutputUtil.h>
-
-namespace Slice
-{
-namespace Ruby
-{
-
-//
-// Generate Ruby code for a translation unit.
-//
-SLICE_API void generate(const Slice::UnitPtr&, bool, bool, const std::vector<std::string>&, IceUtilInternal::Output&);
-
-//
-// Check the given identifier against Ruby's list of reserved words. If it matches
-// a reserved word, then an escaped version is returned with a leading underscore.
-//
-enum IdentStyle
-{
- IdentNormal,
- IdentToUpper, // Mapped identifier must begin with an upper-case letter.
- IdentToLower // Mapped identifier must begin with a lower-case letter.
-};
-SLICE_API std::string fixIdent(const std::string&, IdentStyle);
-
-//
-// Get the fully-qualified name of the given definition. If a prefix is provided,
-// it is prepended to the definition's unqualified name.
-//
-SLICE_API std::string getAbsolute(const Slice::ContainedPtr&, IdentStyle, const std::string& = std::string());
-
-//
-// Emit a comment header.
-//
-SLICE_API void printHeader(IceUtilInternal::Output&);
-
-SLICE_API int compile(const std::vector<std::string>&);
-
-}
-}
-
-#endif
diff --git a/cpp/include/Slice/Util.h b/cpp/include/Slice/Util.h
deleted file mode 100644
index d393bf8e249..00000000000
--- a/cpp/include/Slice/Util.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-#ifndef SLICE_UTIL_H
-#define SLICE_UTIL_H
-
-#include <Slice/Parser.h>
-#include <IceUtil/OutputUtil.h>
-
-#include <ostream>
-#include <fstream>
-
-namespace Slice
-{
-
-SLICE_API std::string fullPath(const std::string&);
-SLICE_API std::string changeInclude(const std::string&, const std::vector<std::string>&);
-SLICE_API void setErrorStream(std::ostream&);
-SLICE_API std::ostream& getErrorStream();
-SLICE_API void emitError(const std::string&, int, const std::string&);
-SLICE_API void emitWarning(const std::string&, int, const std::string&);
-SLICE_API void emitError(const std::string&, const std::string&, const std::string&);
-SLICE_API void emitWarning(const std::string&, const std::string&, const std::string&);
-SLICE_API void emitRaw(const char*);
-SLICE_API std::vector<std::string> filterMcppWarnings(const std::string&);
-SLICE_API void printGeneratedHeader(IceUtilInternal::Output& out, const std::string&, const std::string& commentStyle = "//");
-#ifdef _WIN32
-SLICE_API std::vector<std::string> argvToArgs(int argc, wchar_t* argv[]);
-#else
-SLICE_API std::vector<std::string> argvToArgs(int argc, char* argv[]);
-#endif
-
-class SLICE_API DependOutputUtil : IceUtil::noncopyable
-{
-public:
-
- DependOutputUtil(std::string& file);
- ~DependOutputUtil();
- void cleanup();
- std::ostream& os();
-
-private:
-
- const std::string _file;
- std::ofstream _os;
-};
-
-}
-
-#endif