Skip to content

Commit

Permalink
Remove Ice::optional and IceUtil::Optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed Feb 4, 2024
1 parent ce157e5 commit dc78b63
Show file tree
Hide file tree
Showing 85 changed files with 633 additions and 733 deletions.
40 changes: 3 additions & 37 deletions CHANGELOG-3.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,13 @@ Ice 3.7. You can still define proxies with the usual syntax, `Greeter*`, where `

## C++ Changes

- The C++98 mapping is now called the Original mapping.

- The C++11 mapping is now called the New mapping.

- (Original mapping) The base class for mapped class instances is now Ice::Value, like in the new mapping. Previously,
Ice::Object was the base class for both mapped class instances and servants.

- (Original mapping) Ice::Value does not derive from IceUtil::Shared and the generated Ptr for mapped classed is now an
Ice::SharedPtr that behaves mostly like the previous IceUtil (and IceInternal) Handle by wrapping a std::shared_ptr.
The important differences are:
- the comparison operators of Ice::SharedPtr compare pointers like std::shared_ptr but unlike IceUtil::Handle.
- the pointed-to object no longer holds the reference count, and as result you must be careful and avoid creating
multiple SharedPtr managing the same object. For example:
```
MyClassPtr c1 = new MyClass(); // SharedPtr to class instance
MyClassPtr c2 = c1; // c1 and c2 point to the same instance
MyClassPtr c3 = c1.get(); // c3 points to the same instance. With Ice 3.7 and before, it's ok as it simply adds a
// a reference count to the shared instance. As of Ice 3.8, it's incorrect since c3 is a new
// independent SharedPtr with its own reference count.
```

- (Original mapping) Removed all support for garbage collection (GC) of class instances. If you create or receive a
graph of class instances with a cycle, you must break this cycle to avoid a leak.

- (New mapping) Ice::optional is now an alias for std::optional.

- (Original mapping) IceUtil::Optional is now an alias for std::optional. When upgrading from Ice 3.7 or earlier, you
need to replace calls to `get()` on IceUtil::Optional by calls to `value()`.
- There is now a single C++ mapping, based on the C++11 mapping provided by Ice 3.7. This new C++ mapping requires a
C++ compiler with support for std=c++17 or higher.

## Objective-C Changes

- The base class for class instances is now Ice::Value. Previously, Ice::Object was the base class for both mapped class
instances and servants.

- The slice compiler no longer generates an Objective-C protocol for Slice classes. It generates only an Objective-C
class (interface).
- The Objective-C mapping was removed.

## PHP Changes

- Removed the flattened mapping deprecated in 3.7.

## Ice Service Changes

- The implementations of Glacier2, IceGrid, IceStorm and IcePatch2 were updated to use the new C++ mapping.
2 changes: 1 addition & 1 deletion cpp/include/Ice/Communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <Ice/Incoming.h>
#include <Ice/IncomingAsync.h>
#include <Ice/FactoryTableInit.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/ExceptionHelpers.h>
#include <Ice/LoggerF.h>
#include <Ice/InstrumentationF.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/CommunicatorF.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <IceUtil/UndefSysMacros.h>

#ifndef ICE_API
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/Ice/Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/OutgoingAsync.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/ObjectAdapterF.h>
#include <Ice/Identity.h>
#include <Ice/Endpoint.h>
Expand Down Expand Up @@ -409,7 +409,7 @@ class ICE_CLASS(ICE_API) Connection
* @param close The close condition
* @param heartbeat The hertbeat condition
*/
virtual void setACM(const Ice::optional<int>& timeout, const Ice::optional<ACMClose>& close, const Ice::optional<ACMHeartbeat>& heartbeat) = 0;
virtual void setACM(const std::optional<int>& timeout, const std::optional<ACMClose>& close, const std::optional<ACMHeartbeat>& heartbeat) = 0;

/**
* Get the ACM parameters.
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/ConnectionF.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <IceUtil/UndefSysMacros.h>

#ifndef ICE_API
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/Current.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/ObjectAdapterF.h>
#include <Ice/ConnectionF.h>
#include <Ice/Context.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/Endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/Version.h>
#include <Ice/BuiltinSequences.h>
#include <Ice/EndpointF.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/EndpointF.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <IceUtil/UndefSysMacros.h>

#ifndef ICE_API
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/EndpointSelectionType.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <IceUtil/UndefSysMacros.h>

#ifndef ICE_API
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/Ice.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/Proxy.h>
#include <Ice/Current.h>
#include <Ice/LocalException.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/Object.h>
#include <Ice/SlicedData.h>
#include <Ice/OutgoingAsync.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/ImplicitContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/ExceptionHelpers.h>
#include <Ice/LocalException.h>
#include <Ice/Current.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/ImplicitContextF.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <IceUtil/UndefSysMacros.h>

namespace Ice
Expand Down
8 changes: 4 additions & 4 deletions cpp/include/Ice/InputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ class ICE_API InputStream : public IceInternal::Buffer
* @param tag The tag ID.
* @param v Holds the extracted data (if any).
*/
template<typename T> void read(Int tag, IceUtil::Optional<T>& v)
template<typename T> void read(Int tag, std::optional<T>& v)
{
if(readOptional(tag, StreamOptionalHelper<T,
StreamableTraits<T>::helper,
Expand All @@ -645,7 +645,7 @@ class ICE_API InputStream : public IceInternal::Buffer
}
else
{
v = IceUtil::None;
v = std::nullopt;
}
}

Expand Down Expand Up @@ -691,7 +691,7 @@ class ICE_API InputStream : public IceInternal::Buffer
* Reads a list of optional data values.
*/
template<typename T>
void readAll(std::initializer_list<int> tags, IceUtil::Optional<T>& v)
void readAll(std::initializer_list<int> tags, std::optional<T>& v)
{
read(*(tags.begin() + tags.size() - 1), v);
}
Expand All @@ -700,7 +700,7 @@ class ICE_API InputStream : public IceInternal::Buffer
* Reads a list of optional data values.
*/
template<typename T, typename... Te>
void readAll(std::initializer_list<int> tags, IceUtil::Optional<T>& v, IceUtil::Optional<Te>&... ve)
void readAll(std::initializer_list<int> tags, std::optional<T>& v, std::optional<Te>&... ve)
{
size_t index = tags.size() - sizeof...(ve) - 1;
read(*(tags.begin() + index), v);
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/LocalException.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/ExceptionHelpers.h>
#include <Ice/Identity.h>
#include <Ice/Version.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <IceUtil/UndefSysMacros.h>

#ifndef ICE_API
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/LoggerF.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <IceUtil/UndefSysMacros.h>

#ifndef ICE_API
Expand Down
66 changes: 0 additions & 66 deletions cpp/include/Ice/Optional.h

This file was deleted.

6 changes: 3 additions & 3 deletions cpp/include/Ice/OutputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class ICE_API OutputStream : public IceInternal::Buffer
* @param tag The tag ID.
* @param v The data value to be written (if any).
*/
template<typename T> void write(Int tag, const IceUtil::Optional<T>& v)
template<typename T> void write(Int tag, const std::optional<T>& v)
{
if(!v)
{
Expand Down Expand Up @@ -489,7 +489,7 @@ class ICE_API OutputStream : public IceInternal::Buffer
* Writes a list of optional data values.
*/
template<typename T>
void writeAll(std::initializer_list<int> tags, const IceUtil::Optional<T>& v)
void writeAll(std::initializer_list<int> tags, const std::optional<T>& v)
{
write(*(tags.begin() + tags.size() - 1), v);
}
Expand All @@ -498,7 +498,7 @@ class ICE_API OutputStream : public IceInternal::Buffer
* Writes a list of optional data values.
*/
template<typename T, typename... Te>
void writeAll(std::initializer_list<int> tags, const IceUtil::Optional<T>& v, const IceUtil::Optional<Te>&... ve)
void writeAll(std::initializer_list<int> tags, const std::optional<T>& v, const std::optional<Te>&... ve)
{
size_t index = tags.size() - sizeof...(ve) - 1;
write(*(tags.begin() + index), v);
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/LoggerF.h>
#include <Ice/BuiltinSequences.h>
#include <IceUtil/UndefSysMacros.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/PluginF.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <IceUtil/UndefSysMacros.h>

#ifndef ICE_API
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/Properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <Ice/Value.h>
#include <Ice/Incoming.h>
#include <Ice/FactoryTableInit.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/PropertyDict.h>
#include <IceUtil/UndefSysMacros.h>

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/Ice/PropertiesF.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Proxy.h>
#include <Ice/Optional.h>
#include <optional>
#include <IceUtil/UndefSysMacros.h>

#ifndef ICE_API
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/Ice/Proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ class ICE_API ObjectPrx : public ::std::enable_shared_from_this<ObjectPrx>
* @return The compression override setting. If nullopt is returned, no override is set. Otherwise, true
* if compression is enabled, false otherwise.
*/
::Ice::optional<bool> ice_getCompress() const;
::std::optional<bool> ice_getCompress() const;

/**
* Obtains a proxy that is identical to this proxy, except for its connection timeout setting
Expand All @@ -941,7 +941,7 @@ class ICE_API ObjectPrx : public ::std::enable_shared_from_this<ObjectPrx>
* @return The timeout override. If nullopt is returned, no override is set. Otherwise, returns
* the timeout override value.
*/
::Ice::optional<int> ice_getTimeout() const;
::std::optional<int> ice_getTimeout() const;

/**
* Obtains a proxy that is identical to this proxy, except for its connection ID.
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/IceBT/ConnectionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/OutgoingAsync.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/Connection.h>
#include <IceUtil/UndefSysMacros.h>

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/IceBT/EndpointInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/Endpoint.h>
#include <IceUtil/UndefSysMacros.h>

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/IceBT/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <Ice/LocalObject.h>
#include <Ice/StreamHelpers.h>
#include <Ice/Comparable.h>
#include <Ice/Optional.h>
#include <optional>
#include <Ice/ExceptionHelpers.h>
#include <IceUtil/UndefSysMacros.h>

Expand Down
Loading

0 comments on commit dc78b63

Please sign in to comment.