From 5babceb239130e883c7ce90593d39c09a5b8dedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Offringa?= Date: Thu, 3 Aug 2023 18:21:27 +0200 Subject: [PATCH 1/2] Replace auto_ptr by unique_ptr Solve also all ambiguous constructor std::unique_ptr(NULL) calls and fix the linting warnings produces after the find-and-replace of (std::)auto_ptr by (std::)unique_ptr. --- common/http/OlaHTTPServer.cpp | 6 +- common/io/IOQueueTest.cpp | 4 +- common/io/OutputStreamTest.cpp | 2 +- common/io/SelectServerTest.cpp | 4 +- common/network/AdvancedTCPConnectorTest.cpp | 4 +- common/network/IPV4AddressTest.cpp | 6 +- common/network/InterfacePickerTest.cpp | 6 +- common/network/MACAddressTest.cpp | 8 +-- common/network/NetworkUtils.cpp | 2 +- common/network/TCPConnectorTest.cpp | 2 +- common/rdm/CommandPrinter.cpp | 4 +- common/rdm/MessageDeserializerTest.cpp | 32 +++++----- common/rdm/MessageSerializerTest.cpp | 16 ++--- common/rdm/NetworkManager.h | 2 +- common/rdm/NetworkResponder.cpp | 2 +- common/rdm/PidStoreLoader.cpp | 5 +- common/rdm/PidStoreTest.cpp | 8 +-- common/rdm/QueueingRDMControllerTest.cpp | 12 ++-- common/rdm/RDMCommandSerializerTest.cpp | 10 ++-- common/rdm/RDMCommandTest.cpp | 18 +++--- common/rdm/RDMMessageInterationTest.cpp | 20 +++---- common/rdm/RDMReplyTest.cpp | 6 +- common/rdm/StringMessageBuilder.cpp | 4 +- common/rdm/StringMessageBuilderTest.cpp | 23 ++++---- common/rdm/SubDeviceDispatcher.cpp | 2 +- common/rdm/UIDAllocatorTest.cpp | 8 +-- common/rpc/RpcChannel.cpp | 12 ++-- common/rpc/RpcChannel.h | 4 +- common/rpc/RpcChannelTest.cpp | 10 ++-- common/rpc/RpcServer.cpp | 4 +- common/rpc/RpcServer.h | 2 +- common/rpc/RpcServerTest.cpp | 8 +-- common/rpc/TestService.h | 6 +- common/web/JsonLexer.cpp | 2 +- common/web/JsonSchema.cpp | 4 +- common/web/JsonTest.cpp | 2 +- common/web/ParserTest.cpp | 18 +++--- common/web/PatchParserTest.cpp | 6 +- common/web/PatchTest.cpp | 10 ++-- common/web/SchemaParseContext.cpp | 8 +-- common/web/SchemaParseContext.h | 44 +++++++------- common/web/SchemaParser.h | 6 +- common/web/SchemaParserTest.cpp | 14 ++--- common/web/SchemaTest.cpp | 58 +++++++++---------- data/rdm/PidDataTest.cpp | 2 +- examples/ola-rdm.cpp | 6 +- examples/ola-recorder.cpp | 2 +- include/ola/client/ClientWrapper.h | 6 +- include/ola/client/OlaClient.h | 2 +- include/ola/e133/DeviceManager.h | 2 +- include/ola/e133/E133Receiver.h | 12 ++-- include/ola/http/HTTPServer.h | 3 +- include/ola/http/OlaHTTPServer.h | 1 + include/ola/io/SelectServer.h | 4 +- include/ola/io/StdinHandler.h | 2 +- include/ola/network/SocketCloser.h | 2 +- include/ola/rdm/AckTimerResponder.h | 3 +- include/ola/rdm/DimmerResponder.h | 2 +- include/ola/rdm/DiscoveryAgent.h | 8 +-- include/ola/rdm/DummyResponder.h | 2 +- include/ola/rdm/NetworkResponder.h | 2 +- include/ola/rdm/PidStore.h | 2 +- include/ola/rdm/QueueingRDMController.h | 5 +- include/ola/rdm/RDMReply.h | 2 +- include/ola/rdm/ResponderOpsPrivate.h | 2 +- include/ola/util/Backoff.h | 2 +- include/ola/util/Watchdog.h | 2 +- include/ola/web/JsonData.h | 2 +- include/ola/web/JsonParser.h | 2 +- include/ola/web/JsonPatch.h | 6 +- include/ola/web/JsonPatchParser.h | 2 +- include/ola/web/JsonSchema.h | 30 +++++----- libs/acn/DMPE131Inflator.cpp | 2 +- libs/acn/E131DiscoveryInflator.h | 2 +- libs/acn/E131Node.cpp | 5 +- libs/acn/E131TestFramework.cpp | 2 +- libs/acn/E131TestFramework.h | 2 +- libs/acn/E133HealthCheckedConnection.h | 2 +- libs/acn/E133StatusInflator.h | 2 +- libs/acn/RDMInflator.h | 5 +- libs/acn/RootInflator.h | 2 +- libs/acn/RootSenderTest.cpp | 2 +- libs/acn/TCPTransport.cpp | 2 +- libs/acn/TCPTransport.h | 2 +- libs/acn/TCPTransportTest.cpp | 12 ++-- libs/acn/UDPTransportTest.cpp | 2 +- libs/usb/HotplugAgent.cpp | 2 +- libs/usb/HotplugAgent.h | 8 +-- libs/usb/JaRulePortHandle.h | 2 +- libs/usb/JaRulePortHandleImpl.cpp | 12 ++-- libs/usb/JaRuleWidget.cpp | 4 +- libs/usb/JaRuleWidgetPort.cpp | 6 +- ola/OlaCallbackClient.h | 6 +- ola/OlaClientCore.cpp | 50 ++++++++-------- ola/OlaClientCore.h | 6 +- ola/StreamingClientTest.cpp | 6 +- olad/BonjourDiscoveryAgent.cpp | 4 +- olad/BonjourDiscoveryAgent.h | 2 +- olad/OlaDaemon.cpp | 6 +- olad/OlaDaemon.h | 4 +- olad/OlaServer.cpp | 32 +++++----- olad/OlaServer.h | 26 ++++----- olad/OlaServerServiceImpl.h | 2 +- olad/Olad.cpp | 2 +- olad/plugin_api/Client.h | 2 +- olad/plugin_api/Port.cpp | 6 +- olad/plugin_api/Preferences.cpp | 4 +- olad/plugin_api/TestCommon.h | 2 +- olad/plugin_api/Universe.cpp | 4 +- plugins/artnet/ArtNetDevice.cpp | 4 +- plugins/artnet/ArtNetNode.cpp | 10 ++-- plugins/artnet/ArtNetNode.h | 2 +- plugins/artnet/artnet_loadtest.cpp | 4 +- plugins/dummy/DummyPlugin.cpp | 3 +- plugins/dummy/DummyPort.cpp | 8 +-- plugins/e131/E131Device.h | 2 +- plugins/gpio/GPIOPlugin.cpp | 4 +- plugins/gpio/GPIOPort.h | 3 +- plugins/kinet/KiNetDevice.cpp | 2 +- plugins/kinet/KiNetNode.cpp | 4 +- plugins/kinet/KiNetNode.h | 2 +- plugins/milinst/MilInstDevice.h | 2 +- plugins/nanoleaf/NanoleafDevice.cpp | 2 +- plugins/nanoleaf/NanoleafNode.cpp | 4 +- plugins/nanoleaf/NanoleafNode.h | 2 +- plugins/openpixelcontrol/OPCClient.h | 6 +- plugins/openpixelcontrol/OPCClientTest.cpp | 4 +- plugins/openpixelcontrol/OPCDevice.h | 4 +- plugins/openpixelcontrol/OPCPlugin.cpp | 2 +- plugins/openpixelcontrol/OPCServer.cpp | 2 +- plugins/openpixelcontrol/OPCServer.h | 2 +- plugins/openpixelcontrol/OPCServerTest.cpp | 6 +- plugins/osc/OSCDevice.h | 2 +- plugins/osc/OSCNode.h | 4 +- plugins/osc/OSCNodeTest.cpp | 4 +- plugins/osc/OSCPlugin.cpp | 2 +- plugins/renard/RenardDevice.h | 2 +- plugins/shownet/ShowNetNodeTest.cpp | 2 +- plugins/spi/SPIDevice.cpp | 4 +- plugins/spi/SPIDevice.h | 4 +- plugins/spi/SPIOutput.h | 6 +- plugins/spi/SPIPlugin.cpp | 4 +- plugins/spidmx/SPIDMXDevice.h | 4 +- plugins/spidmx/SPIDMXThread.h | 2 +- plugins/stageprofi/StageProfiDetector.h | 2 +- plugins/stageprofi/StageProfiDevice.h | 2 +- plugins/stageprofi/StageProfiPlugin.cpp | 4 +- plugins/stageprofi/StageProfiPlugin.h | 2 +- plugins/stageprofi/StageProfiWidget.h | 2 +- plugins/uartdmx/UartDmxDevice.h | 2 +- plugins/uartdmx/UartDmxPlugin.cpp | 2 +- plugins/usbdmx/AVLdiyD512.cpp | 2 +- plugins/usbdmx/AVLdiyD512.h | 4 +- plugins/usbdmx/AnymauDMX.cpp | 2 +- plugins/usbdmx/AnymauDMX.h | 4 +- plugins/usbdmx/AsyncPluginImpl.cpp | 4 +- plugins/usbdmx/AsyncPluginImpl.h | 2 +- plugins/usbdmx/AsyncUsbReceiver.h | 2 +- plugins/usbdmx/DMXCProjectsNodleU1.cpp | 4 +- plugins/usbdmx/DMXCProjectsNodleU1.h | 8 +-- plugins/usbdmx/DMXCProjectsNodleU1Device.h | 4 +- plugins/usbdmx/DMXCreator512Basic.cpp | 2 +- plugins/usbdmx/DMXCreator512Basic.h | 4 +- plugins/usbdmx/EurolitePro.cpp | 2 +- plugins/usbdmx/EurolitePro.h | 4 +- plugins/usbdmx/GenericDevice.h | 2 +- plugins/usbdmx/JaRuleDevice.cpp | 4 +- plugins/usbdmx/JaRuleFactory.cpp | 2 +- plugins/usbdmx/ScanlimeFadecandy.cpp | 2 +- plugins/usbdmx/ScanlimeFadecandy.h | 4 +- plugins/usbdmx/ShowJockeyDMXU1.cpp | 4 +- plugins/usbdmx/ShowJockeyDMXU1.h | 4 +- plugins/usbdmx/Sunlite.cpp | 2 +- plugins/usbdmx/Sunlite.h | 4 +- plugins/usbdmx/ThreadedUsbReceiver.cpp | 2 +- plugins/usbdmx/ThreadedUsbReceiver.h | 2 +- plugins/usbdmx/UsbDmxPlugin.cpp | 2 +- plugins/usbdmx/UsbDmxPlugin.h | 2 +- plugins/usbdmx/VellemanK8062.cpp | 2 +- plugins/usbdmx/VellemanK8062.h | 4 +- plugins/usbpro/ArduinoWidget.cpp | 8 +-- plugins/usbpro/ArduinoWidget.h | 2 +- plugins/usbpro/ArduinoWidgetTest.cpp | 10 ++-- plugins/usbpro/BaseRobeWidgetTest.cpp | 4 +- plugins/usbpro/BaseUsbProWidgetTest.cpp | 4 +- plugins/usbpro/CommonWidgetTest.h | 4 +- plugins/usbpro/DmxTriWidget.cpp | 17 +++--- plugins/usbpro/DmxTriWidget.h | 3 +- plugins/usbpro/DmxTriWidgetTest.cpp | 4 +- plugins/usbpro/DmxterWidget.cpp | 8 +-- plugins/usbpro/DmxterWidget.h | 2 +- plugins/usbpro/DmxterWidgetTest.cpp | 8 +-- plugins/usbpro/EnttecUsbProWidget.cpp | 18 +++--- plugins/usbpro/EnttecUsbProWidget.h | 2 +- plugins/usbpro/EnttecUsbProWidgetImpl.h | 4 +- plugins/usbpro/EnttecUsbProWidgetTest.cpp | 20 +++---- plugins/usbpro/RobeWidget.cpp | 22 +++---- plugins/usbpro/RobeWidget.h | 4 +- plugins/usbpro/RobeWidgetDetector.h | 4 +- plugins/usbpro/RobeWidgetDetectorTest.cpp | 4 +- plugins/usbpro/RobeWidgetTest.cpp | 20 +++---- plugins/usbpro/UltraDMXProWidgetTest.cpp | 4 +- plugins/usbpro/UsbProWidgetDetector.h | 4 +- plugins/usbpro/UsbProWidgetDetectorTest.cpp | 4 +- plugins/usbpro/UsbSerialPlugin.cpp | 2 +- plugins/usbpro/WidgetDetectorThreadTest.cpp | 8 +-- protoc/CppFileGenerator.cpp | 2 +- protoc/CppGenerator.cpp | 6 +- tools/e133/DesignatedControllerConnection.cpp | 8 +-- tools/e133/DeviceManagerImpl.cpp | 20 +++---- tools/e133/DeviceManagerImpl.h | 8 +-- tools/e133/E133Device.cpp | 2 +- tools/e133/E133Device.h | 5 +- tools/e133/E133Endpoint.cpp | 4 +- tools/e133/E133Receiver.cpp | 2 +- tools/e133/ManagementEndpoint.cpp | 2 +- tools/e133/SimpleE133Node.h | 2 +- tools/e133/basic-controller.cpp | 27 ++++----- tools/e133/basic-device.cpp | 10 ++-- tools/e133/e133-controller.cpp | 10 ++-- tools/e133/e133-monitor.cpp | 4 +- tools/e133/e133-receiver.cpp | 26 ++++----- tools/ja-rule/USBDeviceManager.cpp | 4 +- tools/ja-rule/USBDeviceManager.h | 4 +- tools/ja-rule/ja-rule-controller.cpp | 4 +- tools/ja-rule/ja-rule.cpp | 14 ++--- tools/logic/logic-rdm-sniffer.cpp | 4 +- tools/rdmpro/rdm-sniffer.cpp | 4 +- 228 files changed, 702 insertions(+), 688 deletions(-) diff --git a/common/http/OlaHTTPServer.cpp b/common/http/OlaHTTPServer.cpp index f8937c8415..619f9efc58 100644 --- a/common/http/OlaHTTPServer.cpp +++ b/common/http/OlaHTTPServer.cpp @@ -30,7 +30,7 @@ namespace ola { namespace http { using ola::ExportMap; -using std::auto_ptr; +using std::unique_ptr; using std::ostringstream; using std::string; using std::vector; @@ -71,7 +71,7 @@ bool OlaHTTPServer::Init() { */ int OlaHTTPServer::DisplayDebug(const HTTPRequest*, HTTPResponse *raw_response) { - auto_ptr response(raw_response); + unique_ptr response(raw_response); ola::TimeStamp now; m_clock.CurrentMonotonicTime(&now); ola::TimeInterval diff = now - m_start_time; @@ -98,7 +98,7 @@ int OlaHTTPServer::DisplayDebug(const HTTPRequest*, */ int OlaHTTPServer::DisplayHandlers(const HTTPRequest*, HTTPResponse *raw_response) { - auto_ptr response(raw_response); + unique_ptr response(raw_response); vector handlers; m_server.Handlers(&handlers); vector::const_iterator iter; diff --git a/common/io/IOQueueTest.cpp b/common/io/IOQueueTest.cpp index 47088db700..9c7352a33f 100644 --- a/common/io/IOQueueTest.cpp +++ b/common/io/IOQueueTest.cpp @@ -31,7 +31,7 @@ using ola::io::IOQueue; using ola::io::IOVec; using ola::io::MemoryBlockPool; -using std::auto_ptr; +using std::unique_ptr; using std::string; @@ -59,7 +59,7 @@ class IOQueueTest: public CppUnit::TestFixture { void testStringRead(); private: - auto_ptr m_buffer; + unique_ptr m_buffer; unsigned int SumLengthOfIOVec(const struct IOVec *iov, int iocnt); }; diff --git a/common/io/OutputStreamTest.cpp b/common/io/OutputStreamTest.cpp index cc7e1978f0..45c5eeff9d 100644 --- a/common/io/OutputStreamTest.cpp +++ b/common/io/OutputStreamTest.cpp @@ -32,7 +32,7 @@ using ola::io::IOQueue; using ola::io::BigEndianOutputStream; using ola::network::HostToNetwork; -using std::auto_ptr; +using std::unique_ptr; using std::string; diff --git a/common/io/SelectServerTest.cpp b/common/io/SelectServerTest.cpp index 6e905c2acc..d4c93ed47a 100644 --- a/common/io/SelectServerTest.cpp +++ b/common/io/SelectServerTest.cpp @@ -53,7 +53,7 @@ using ola::io::SelectServer; using ola::io::UnixSocket; using ola::io::WriteFileDescriptor; using ola::network::UDPSocket; -using std::auto_ptr; +using std::unique_ptr; using std::set; /* @@ -543,7 +543,7 @@ void SelectServerTest::testReadWriteInteraction() { m_ss->RemoveWriteDescriptor(&socket); // now the Write end closes - auto_ptr other_end(socket.OppositeEnd()); + unique_ptr other_end(socket.OppositeEnd()); other_end->CloseClient(); m_ss->RegisterSingleTimeout( diff --git a/common/network/AdvancedTCPConnectorTest.cpp b/common/network/AdvancedTCPConnectorTest.cpp index 86637ed0a1..c9d1dc1635 100644 --- a/common/network/AdvancedTCPConnectorTest.cpp +++ b/common/network/AdvancedTCPConnectorTest.cpp @@ -47,7 +47,7 @@ using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::network::TCPAcceptingSocket; using ola::network::TCPSocket; -using std::auto_ptr; +using std::unique_ptr; using std::string; // used to set a timeout which aborts the tests @@ -90,7 +90,7 @@ class AdvancedTCPConnectorTest: public CppUnit::TestFixture { private: ola::MockClock m_clock; SelectServer *m_ss; - auto_ptr m_tcp_socket_factory; + unique_ptr m_tcp_socket_factory; IPV4Address m_localhost; IPV4SocketAddress m_server_address; ola::thread::timeout_id m_timeout_id; diff --git a/common/network/IPV4AddressTest.cpp b/common/network/IPV4AddressTest.cpp index 044552db13..583bd92a11 100644 --- a/common/network/IPV4AddressTest.cpp +++ b/common/network/IPV4AddressTest.cpp @@ -40,7 +40,7 @@ using ola::network::IPV4Address; using ola::network::HostToNetwork; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -97,11 +97,11 @@ void IPAddressTest::testIPV4Address() { OLA_ASSERT_EQ(string("192.168.1.1"), str.str()); // test from string - auto_ptr string_address(IPV4Address::FromString("10.0.0.1")); + unique_ptr string_address(IPV4Address::FromString("10.0.0.1")); OLA_ASSERT_NOT_NULL(string_address.get()); OLA_ASSERT_EQ(string("10.0.0.1"), string_address->ToString()); - auto_ptr string_address2(IPV4Address::FromString("foo")); + unique_ptr string_address2(IPV4Address::FromString("foo")); OLA_ASSERT_NULL(string_address2.get()); // and the second form diff --git a/common/network/InterfacePickerTest.cpp b/common/network/InterfacePickerTest.cpp index d122332414..28f042caa8 100644 --- a/common/network/InterfacePickerTest.cpp +++ b/common/network/InterfacePickerTest.cpp @@ -36,7 +36,7 @@ using ola::network::IPV4Address; using ola::network::Interface; using ola::network::InterfacePicker; using ola::network::MACAddress; -using std::auto_ptr; +using std::unique_ptr; using std::cout; using std::endl; using std::string; @@ -62,7 +62,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(InterfacePickerTest); * Check that we find at least one candidate interface. */ void InterfacePickerTest::testGetInterfaces() { - auto_ptr picker(InterfacePicker::NewPicker()); + unique_ptr picker(InterfacePicker::NewPicker()); vector interfaces = picker->GetInterfaces(true); #ifndef _WIN32 // If a Windows box is not on a network, and doesn't have it's loopback, there @@ -86,7 +86,7 @@ void InterfacePickerTest::testGetInterfaces() { * Check that we find a loopback interface. */ void InterfacePickerTest::testGetLoopbackInterfaces() { - auto_ptr picker(InterfacePicker::NewPicker()); + unique_ptr picker(InterfacePicker::NewPicker()); vector interfaces = picker->GetInterfaces(true); #ifndef _WIN32 // If a Windows box is not on a network, and doesn't have it's loopback, there diff --git a/common/network/MACAddressTest.cpp b/common/network/MACAddressTest.cpp index 558bc84017..78c4ab68d2 100644 --- a/common/network/MACAddressTest.cpp +++ b/common/network/MACAddressTest.cpp @@ -30,7 +30,7 @@ #include "ola/testing/TestUtils.h" using ola::network::MACAddress; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -76,17 +76,17 @@ void MACAddressTest::testMACAddress() { OLA_ASSERT_EQ(string("01:23:45:67:89:ab"), str.str()); // test from string - auto_ptr string_address( + unique_ptr string_address( MACAddress::FromString("fe:dc:ba:98:76:54")); OLA_ASSERT_NOT_NULL(string_address.get()); OLA_ASSERT_EQ(string("fe:dc:ba:98:76:54"), string_address->ToString()); - auto_ptr string_address2( + unique_ptr string_address2( MACAddress::FromString("98.76.54.fe.dc.ba")); OLA_ASSERT_NOT_NULL(string_address2.get()); OLA_ASSERT_EQ(string("98:76:54:fe:dc:ba"), string_address2->ToString()); - auto_ptr string_address3(MACAddress::FromString("foo")); + unique_ptr string_address3(MACAddress::FromString("foo")); OLA_ASSERT_NULL(string_address3.get()); // and the second form diff --git a/common/network/NetworkUtils.cpp b/common/network/NetworkUtils.cpp index fa1511e23e..43329ee3ea 100644 --- a/common/network/NetworkUtils.cpp +++ b/common/network/NetworkUtils.cpp @@ -663,7 +663,7 @@ static bool GetDefaultRouteWithNetlink(int32_t *if_index, return false; } - std::auto_ptr cb( + std::unique_ptr cb( ola::NewCallback(MessageHandler, if_index, default_gateway)); if (!ReadNetlinkSocket(sd, msg, BUFSIZE, nl_msg->nlmsg_seq, cb.get())) { return false; diff --git a/common/network/TCPConnectorTest.cpp b/common/network/TCPConnectorTest.cpp index 7086901363..29867b34d9 100644 --- a/common/network/TCPConnectorTest.cpp +++ b/common/network/TCPConnectorTest.cpp @@ -45,7 +45,7 @@ using ola::io::SelectServer; using ola::network::TCPConnector; using ola::network::TCPAcceptingSocket; using ola::network::TCPSocket; -using std::auto_ptr; +using std::unique_ptr; using std::string; // used to set a timeout which aborts the tests diff --git a/common/rdm/CommandPrinter.cpp b/common/rdm/CommandPrinter.cpp index 4367ec049c..47a5e34c47 100644 --- a/common/rdm/CommandPrinter.cpp +++ b/common/rdm/CommandPrinter.cpp @@ -35,7 +35,7 @@ using ola::messaging::Descriptor; using ola::messaging::Message; using ola::network::NetworkToHost; using ola::strings::ToHex; -using std::auto_ptr; +using std::unique_ptr; using std::endl; using std::string; @@ -423,7 +423,7 @@ void CommandPrinter::DisplayParamData( } if (descriptor) { - auto_ptr message( + unique_ptr message( m_pid_helper->DeserializeMessage(descriptor, param_data, data_length)); if (message.get()) { diff --git a/common/rdm/MessageDeserializerTest.cpp b/common/rdm/MessageDeserializerTest.cpp index 30e218031c..15452df4d2 100644 --- a/common/rdm/MessageDeserializerTest.cpp +++ b/common/rdm/MessageDeserializerTest.cpp @@ -53,7 +53,7 @@ using ola::messaging::UInt64FieldDescriptor; using ola::messaging::UInt8FieldDescriptor; using ola::messaging::UIDFieldDescriptor; using ola::rdm::MessageDeserializer; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -102,7 +102,7 @@ void MessageDeserializerTest::testEmpty() { vector fields; Descriptor descriptor("Empty Descriptor", fields); - auto_ptr empty_message(m_deserializer.InflateMessage( + unique_ptr empty_message(m_deserializer.InflateMessage( &descriptor, NULL, 0)); @@ -163,7 +163,7 @@ void MessageDeserializerTest::testSimpleBigEndian() { sizeof(big_endian_data) + 1)); // now the correct amount & verify - auto_ptr message(m_deserializer.InflateMessage( + unique_ptr message(m_deserializer.InflateMessage( &descriptor, big_endian_data, sizeof(big_endian_data))); @@ -222,7 +222,7 @@ void MessageDeserializerTest::testSimpleLittleEndian() { sizeof(little_endian_data) + 1)); // now the correct amount & verify - auto_ptr message(m_deserializer.InflateMessage( + unique_ptr message(m_deserializer.InflateMessage( &descriptor, little_endian_data, sizeof(little_endian_data))); @@ -250,7 +250,7 @@ void MessageDeserializerTest::testIPV4() { const uint8_t big_endian_data[] = {10, 0, 0, 1}; // now the correct amount & verify - auto_ptr message(m_deserializer.InflateMessage( + unique_ptr message(m_deserializer.InflateMessage( &descriptor, big_endian_data, sizeof(big_endian_data))); @@ -301,7 +301,7 @@ void MessageDeserializerTest::testMAC() { const uint8_t big_endian_data[] = {1, 35, 69, 103, 137, 171}; // now the correct amount & verify - auto_ptr message(m_deserializer.InflateMessage( + unique_ptr message(m_deserializer.InflateMessage( &descriptor, big_endian_data, sizeof(big_endian_data))); @@ -342,7 +342,7 @@ void MessageDeserializerTest::testString() { 43)); // now to the right amount - auto_ptr message(m_deserializer.InflateMessage( + unique_ptr message(m_deserializer.InflateMessage( &descriptor, data, sizeof(data))); @@ -354,7 +354,7 @@ void MessageDeserializerTest::testString() { OLA_ASSERT_EQ(expected, m_printer.AsString(message.get())); // now try with different sizes - auto_ptr message2(m_deserializer.InflateMessage( + unique_ptr message2(m_deserializer.InflateMessage( &descriptor, data, 19)); @@ -380,7 +380,7 @@ void MessageDeserializerTest::testUID() { const uint8_t big_endian_data[] = {0x70, 0x7a, 0, 0, 0, 1}; // now the correct amount & verify - auto_ptr message(m_deserializer.InflateMessage( + unique_ptr message(m_deserializer.InflateMessage( &descriptor, big_endian_data, sizeof(big_endian_data))); @@ -409,7 +409,7 @@ void MessageDeserializerTest::testWithGroups() { const uint8_t data[] = {0, 10, 1, 3, 0, 20, 1, 40}; // an empty message - auto_ptr message(m_deserializer.InflateMessage( + unique_ptr message(m_deserializer.InflateMessage( &descriptor, data, 0)); @@ -423,7 +423,7 @@ void MessageDeserializerTest::testWithGroups() { 1)); // a single instance of a group - auto_ptr message2(m_deserializer.InflateMessage( + unique_ptr message2(m_deserializer.InflateMessage( &descriptor, data, 2)); @@ -441,7 +441,7 @@ void MessageDeserializerTest::testWithGroups() { 3)); // two instances of the group - auto_ptr message3(m_deserializer.InflateMessage( + unique_ptr message3(m_deserializer.InflateMessage( &descriptor, data, 4)); @@ -454,7 +454,7 @@ void MessageDeserializerTest::testWithGroups() { OLA_ASSERT_EQ(expected2, m_printer.AsString(message3.get())); // trhee instances of the group - auto_ptr message4(m_deserializer.InflateMessage( + unique_ptr message4(m_deserializer.InflateMessage( &descriptor, data, 6)); @@ -491,7 +491,7 @@ void MessageDeserializerTest::testWithNestedFixedGroups() { const uint8_t data[] = {0, 0, 0, 1, 0, 1, 2, 1, 0, 3, 1, 1}; // an empty message - auto_ptr message(m_deserializer.InflateMessage( + unique_ptr message(m_deserializer.InflateMessage( &descriptor, data, 0)); @@ -509,7 +509,7 @@ void MessageDeserializerTest::testWithNestedFixedGroups() { 2)); // a single instance of a group - auto_ptr message2(m_deserializer.InflateMessage( + unique_ptr message2(m_deserializer.InflateMessage( &descriptor, data, 3)); @@ -522,7 +522,7 @@ void MessageDeserializerTest::testWithNestedFixedGroups() { OLA_ASSERT_EQ(expected, m_printer.AsString(message2.get())); // four instances - auto_ptr message3(m_deserializer.InflateMessage( + unique_ptr message3(m_deserializer.InflateMessage( &descriptor, data, sizeof(data))); diff --git a/common/rdm/MessageSerializerTest.cpp b/common/rdm/MessageSerializerTest.cpp index cc07156ac6..6254cb6097 100644 --- a/common/rdm/MessageSerializerTest.cpp +++ b/common/rdm/MessageSerializerTest.cpp @@ -53,7 +53,7 @@ using ola::messaging::UInt8FieldDescriptor; using ola::messaging::UIDFieldDescriptor; using ola::rdm::StringMessageBuilder; using ola::rdm::MessageSerializer; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -137,7 +137,7 @@ void MessageSerializerTest::testSimple() { inputs.push_back("01:23:45:67:89:ab"); inputs.push_back("foo"); - auto_ptr message(BuildMessage(descriptor, inputs)); + unique_ptr message(BuildMessage(descriptor, inputs)); // verify OLA_ASSERT_NOT_NULL(message.get()); @@ -176,7 +176,7 @@ void MessageSerializerTest::testString() { inputs.push_back("foo bar"); // this is shorter than the min size inputs.push_back("long long foo bar baz"); - auto_ptr message(BuildMessage(descriptor, inputs)); + unique_ptr message(BuildMessage(descriptor, inputs)); // verify OLA_ASSERT_NOT_NULL(message.get()); @@ -207,7 +207,7 @@ void MessageSerializerTest::testUID() { vector inputs; inputs.push_back("7a70:00000001"); - auto_ptr message(BuildMessage(descriptor, inputs)); + unique_ptr message(BuildMessage(descriptor, inputs)); // verify OLA_ASSERT_NOT_NULL(message.get()); @@ -250,7 +250,7 @@ void MessageSerializerTest::testLittleEndian() { inputs.push_back("77000000000"); inputs.push_back("-77000000000"); - auto_ptr message(BuildMessage(descriptor, inputs)); + unique_ptr message(BuildMessage(descriptor, inputs)); // verify OLA_ASSERT_NOT_NULL(message.get()); @@ -289,7 +289,7 @@ void MessageSerializerTest::testWithGroups() { inputs.push_back("true"); inputs.push_back("10"); - auto_ptr message(BuildMessage(descriptor, inputs)); + unique_ptr message(BuildMessage(descriptor, inputs)); // verify OLA_ASSERT_NOT_NULL(message.get()); @@ -312,7 +312,7 @@ void MessageSerializerTest::testWithGroups() { inputs2.push_back("false"); inputs2.push_back("240"); - auto_ptr message2(BuildMessage(descriptor, inputs2)); + unique_ptr message2(BuildMessage(descriptor, inputs2)); data = serializer.SerializeMessage(message2.get(), &packed_length); OLA_ASSERT_NOT_NULL(data); OLA_ASSERT_EQ(6u, packed_length); @@ -345,7 +345,7 @@ void MessageSerializerTest::testWithNestedGroups() { inputs.push_back("true"); inputs.push_back("false"); - auto_ptr message(BuildMessage(descriptor, inputs)); + unique_ptr message(BuildMessage(descriptor, inputs)); OLA_ASSERT_NOT_NULL(message.get()); MessageSerializer serializer; diff --git a/common/rdm/NetworkManager.h b/common/rdm/NetworkManager.h index f2921fe344..b406699dd1 100644 --- a/common/rdm/NetworkManager.h +++ b/common/rdm/NetworkManager.h @@ -58,7 +58,7 @@ class NetworkManager : public NetworkManagerInterface { std::vector *name_servers) const; private: - std::auto_ptr m_interface_picker; + std::unique_ptr m_interface_picker; }; } // namespace rdm } // namespace ola diff --git a/common/rdm/NetworkResponder.cpp b/common/rdm/NetworkResponder.cpp index d1ff156810..e44f3747cb 100644 --- a/common/rdm/NetworkResponder.cpp +++ b/common/rdm/NetworkResponder.cpp @@ -49,7 +49,7 @@ using ola::network::MACAddress; using ola::network::NetworkToHost; using std::string; using std::vector; -using std::auto_ptr; +using std::unique_ptr; NetworkResponder::RDMOps *NetworkResponder::RDMOps::instance = NULL; diff --git a/common/rdm/PidStoreLoader.cpp b/common/rdm/PidStoreLoader.cpp index c1424260d9..b5e8d59f18 100644 --- a/common/rdm/PidStoreLoader.cpp +++ b/common/rdm/PidStoreLoader.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -42,7 +43,7 @@ namespace rdm { using ola::messaging::Descriptor; using ola::messaging::FieldDescriptor; -using std::auto_ptr; +using std::unique_ptr; using std::map; using std::ostringstream; using std::set; @@ -193,7 +194,7 @@ const RootPidStore *PidStoreLoader::BuildStore( // Now we need to convert the data structure into a format that the PidStore // understands. - auto_ptr esta_store; + unique_ptr esta_store; RootPidStore::ManufacturerMap manufacturer_map; ManufacturerMap::iterator iter = pid_data.begin(); diff --git a/common/rdm/PidStoreTest.cpp b/common/rdm/PidStoreTest.cpp index 52d5e3f1a9..92b922d5a6 100644 --- a/common/rdm/PidStoreTest.cpp +++ b/common/rdm/PidStoreTest.cpp @@ -42,7 +42,7 @@ using ola::rdm::PidDescriptor; using ola::rdm::PidStore; using ola::rdm::PidStoreLoader; using ola::rdm::RootPidStore; -using std::auto_ptr; +using std::unique_ptr; using std::endl; using std::string; using std::stringstream; @@ -223,7 +223,7 @@ void PidStoreTest::testPidStoreLoad() { "}" << endl << "version: 1" << endl; - auto_ptr root_store(loader.LoadFromStream(&str)); + unique_ptr root_store(loader.LoadFromStream(&str)); OLA_ASSERT_TRUE(root_store.get()); // check version @@ -325,7 +325,7 @@ void PidStoreTest::testPidStoreLoad() { void PidStoreTest::testPidStoreFileLoad() { PidStoreLoader loader; - auto_ptr root_store( + unique_ptr root_store( loader.LoadFromFile(GetTestDataFile("test_pids.proto"))); OLA_ASSERT_NOT_NULL(root_store.get()); // check version @@ -397,7 +397,7 @@ void PidStoreTest::testPidStoreFileLoad() { void PidStoreTest::testPidStoreDirectoryLoad() { PidStoreLoader loader; - auto_ptr root_store(loader.LoadFromDirectory( + unique_ptr root_store(loader.LoadFromDirectory( GetTestDataFile("pids"))); OLA_ASSERT_NOT_NULL(root_store.get()); // check version diff --git a/common/rdm/QueueingRDMControllerTest.cpp b/common/rdm/QueueingRDMControllerTest.cpp index fbdd09a16a..8f1697dc5b 100644 --- a/common/rdm/QueueingRDMControllerTest.cpp +++ b/common/rdm/QueueingRDMControllerTest.cpp @@ -46,7 +46,7 @@ using ola::rdm::RDMResponse; using ola::rdm::RDM_ACK; using ola::rdm::UID; using ola::rdm::UIDSet; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -589,7 +589,7 @@ void QueueingRDMControllerTest::testPauseAndResume() { */ void QueueingRDMControllerTest::testQueueOverflow() { MockRDMController mock_controller; - auto_ptr controller( + unique_ptr controller( new ola::rdm::QueueingRDMController(&mock_controller, 1)); controller->Pause(); @@ -621,7 +621,7 @@ void QueueingRDMControllerTest::testQueueOverflow() { */ void QueueingRDMControllerTest::testDiscovery() { MockRDMController mock_controller; - auto_ptr controller( + unique_ptr controller( new ola::rdm::DiscoverableQueueingRDMController(&mock_controller, 1)); UIDSet uids, uids2; @@ -695,7 +695,7 @@ void QueueingRDMControllerTest::testDiscovery() { */ void QueueingRDMControllerTest::testMultipleDiscovery() { MockRDMController mock_controller; - auto_ptr controller( + unique_ptr controller( new ola::rdm::DiscoverableQueueingRDMController(&mock_controller, 1)); UIDSet uids, uids2; @@ -754,7 +754,7 @@ void QueueingRDMControllerTest::testMultipleDiscovery() { */ void QueueingRDMControllerTest::testReentrantDiscovery() { MockRDMController mock_controller; - auto_ptr controller( + unique_ptr controller( new ola::rdm::DiscoverableQueueingRDMController(&mock_controller, 1)); UIDSet uids; @@ -793,7 +793,7 @@ void QueueingRDMControllerTest::testReentrantDiscovery() { */ void QueueingRDMControllerTest::testRequestAndDiscovery() { MockRDMController mock_controller; - auto_ptr controller( + unique_ptr controller( new ola::rdm::DiscoverableQueueingRDMController(&mock_controller, 1)); UIDSet uids; diff --git a/common/rdm/RDMCommandSerializerTest.cpp b/common/rdm/RDMCommandSerializerTest.cpp index 9141c86489..51177e2b58 100644 --- a/common/rdm/RDMCommandSerializerTest.cpp +++ b/common/rdm/RDMCommandSerializerTest.cpp @@ -45,7 +45,7 @@ using ola::rdm::RDMGetRequest; using ola::rdm::RDMRequest; using ola::rdm::RDMSetRequest; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; void UpdateChecksum(uint8_t *expected, unsigned int expected_length) { unsigned int checksum = ola::rdm::START_CODE; @@ -263,7 +263,7 @@ void RDMCommandSerializerTest::testDUB() { UID lower(0x0102, 0x0304); UID upper(0x0506, 0x0708); - auto_ptr request( + unique_ptr request( NewDiscoveryUniqueBranchRequest(m_source, lower, upper, 1)); OLA_ASSERT_EQ(RDMCommand::DISCOVER_COMMAND, request->CommandClass()); @@ -290,7 +290,7 @@ void RDMCommandSerializerTest::testDUB() { } void RDMCommandSerializerTest::testMuteRequest() { - auto_ptr request( + unique_ptr request( NewMuteRequest(m_source, m_destination, 1)); OLA_ASSERT_EQ(RDMCommand::DISCOVER_COMMAND, request->CommandClass()); @@ -313,7 +313,7 @@ void RDMCommandSerializerTest::testMuteRequest() { } void RDMCommandSerializerTest::testUnMuteRequest() { - auto_ptr request( + unique_ptr request( NewUnMuteRequest(m_source, m_destination, 1)); OLA_ASSERT_EQ(RDMCommand::DISCOVER_COMMAND, request->CommandClass()); @@ -351,7 +351,7 @@ void RDMCommandSerializerTest::testPackAndInflate() { uint8_t *data = new uint8_t[length]; OLA_ASSERT_TRUE(RDMCommandSerializer::Pack(get_command, data, &length)); - auto_ptr command(RDMRequest::InflateFromData(data, length)); + unique_ptr command(RDMRequest::InflateFromData(data, length)); OLA_ASSERT_NOT_NULL(command.get()); OLA_ASSERT_EQ(m_source, command->SourceUID()); diff --git a/common/rdm/RDMCommandTest.cpp b/common/rdm/RDMCommandTest.cpp index 91b16efe47..bac8a352bd 100644 --- a/common/rdm/RDMCommandTest.cpp +++ b/common/rdm/RDMCommandTest.cpp @@ -51,7 +51,7 @@ using ola::rdm::RDMSetRequest; using ola::rdm::RDMSetResponse; using ola::rdm::UID; using ola::utils::SplitUInt16; -using std::auto_ptr; +using std::unique_ptr; using std::ostringstream; using std::string; @@ -392,7 +392,7 @@ void RDMCommandTest::testRequestMutation() { void RDMCommandTest::testRequestInflation() { UID source(1, 2); UID destination(3, 4); - auto_ptr command(RDMRequest::InflateFromData(NULL, 10)); + unique_ptr command(RDMRequest::InflateFromData(NULL, 10)); OLA_ASSERT_NULL(command.get()); // now try a proper command but with no length @@ -618,7 +618,7 @@ void RDMCommandTest::testNackWithReason() { NULL, // data 0); // data length - auto_ptr response( + unique_ptr response( NackWithReason(&get_command, ola::rdm::NR_UNKNOWN_PID)); OLA_ASSERT_NOT_NULL(response.get()); OLA_ASSERT_EQ(destination, response->SourceUID()); @@ -960,7 +960,7 @@ void RDMCommandTest::testDiscoveryCommand() { 5, 6, 0, 0, 7, 8 }; - auto_ptr request( + unique_ptr request( NewDiscoveryUniqueBranchRequest(m_source, lower, upper, 1)); OLA_ASSERT_EQ(RDMCommand::DISCOVER_COMMAND, request->CommandClass()); @@ -987,7 +987,7 @@ void RDMCommandTest::testDiscoveryCommand() { * Check the mute command */ void RDMCommandTest::testMuteRequest() { - auto_ptr request( + unique_ptr request( NewMuteRequest(m_source, m_destination, 1)); OLA_ASSERT_EQ(ola::rdm::SUB_START_CODE, request->SubStartCode()); @@ -1012,7 +1012,7 @@ void RDMCommandTest::testMuteRequest() { * Check the UnMute Command */ void RDMCommandTest::testUnMuteRequest() { - auto_ptr request( + unique_ptr request( NewUnMuteRequest(m_source, m_destination, 1)); OLA_ASSERT_EQ(ola::rdm::SUB_START_CODE, request->SubStartCode()); @@ -1042,7 +1042,7 @@ void RDMCommandTest::testCommandInflation() { const UID destination(3, 4); const UID lower(0x0102, 0x0304); const UID upper(0x0506, 0x0708); - auto_ptr command(RDMCommand::Inflate(NULL, 10)); + unique_ptr command(RDMCommand::Inflate(NULL, 10)); OLA_ASSERT_NULL(command.get()); command.reset(RDMCommand::Inflate(EXPECTED_GET_BUFFER, 0)); @@ -1095,7 +1095,7 @@ void RDMCommandTest::testCommandInflation() { command.reset(RDMCommand::Inflate(EXPECTED_DISCOVERY_REQUEST, sizeof(EXPECTED_DISCOVERY_REQUEST))); OLA_ASSERT_NOT_NULL(command.get()); - auto_ptr discovery_request( + unique_ptr discovery_request( NewDiscoveryUniqueBranchRequest(source, lower, upper, 1)); OLA_ASSERT_TRUE(*discovery_request == *command); @@ -1115,7 +1115,7 @@ void RDMCommandTest::testCommandInflation() { } void RDMCommandTest::testDiscoveryResponseInflation() { - auto_ptr command; + unique_ptr command; command.reset(RDMRequest::Inflate(MUTE_RESPONSE, arraysize(MUTE_RESPONSE))); OLA_ASSERT_NOT_NULL(command.get()); diff --git a/common/rdm/RDMMessageInterationTest.cpp b/common/rdm/RDMMessageInterationTest.cpp index f34959fc98..b5a65b096e 100644 --- a/common/rdm/RDMMessageInterationTest.cpp +++ b/common/rdm/RDMMessageInterationTest.cpp @@ -39,7 +39,7 @@ using ola::messaging::Message; using ola::rdm::PidDescriptor; using ola::rdm::PidStore; using ola::rdm::StringMessageBuilder; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -68,7 +68,7 @@ class RDMMessageInterationTest: public CppUnit::TestFixture { } private: - std::auto_ptr m_store; + std::unique_ptr m_store; const ola::rdm::PidStore *m_esta_store; ola::rdm::StringMessageBuilder m_builder; ola::messaging::GenericMessagePrinter m_printer; @@ -97,7 +97,7 @@ void RDMMessageInterationTest::testProxiedDevices() { inputs.push_back("21324"); // manufacturer ID inputs.push_back("1"); // device id - auto_ptr message(m_builder.GetMessage(inputs, descriptor)); + unique_ptr message(m_builder.GetMessage(inputs, descriptor)); OLA_ASSERT_TRUE(message.get()); unsigned int data_length; @@ -106,7 +106,7 @@ void RDMMessageInterationTest::testProxiedDevices() { OLA_ASSERT_TRUE(data); OLA_ASSERT_EQ(18u, data_length); - auto_ptr inflated_message( + unique_ptr inflated_message( m_deserializer.InflateMessage(descriptor, data, data_length)); OLA_ASSERT_TRUE(inflated_message.get()); @@ -145,7 +145,7 @@ void RDMMessageInterationTest::testDeviceInfoRequest() { inputs.push_back("0"); // sub device count inputs.push_back("6"); // sensor count - auto_ptr message(m_builder.GetMessage(inputs, descriptor)); + unique_ptr message(m_builder.GetMessage(inputs, descriptor)); OLA_ASSERT_TRUE(message.get()); unsigned int data_length; @@ -154,7 +154,7 @@ void RDMMessageInterationTest::testDeviceInfoRequest() { OLA_ASSERT_TRUE(data); OLA_ASSERT_EQ(19u, data_length); - auto_ptr inflated_message( + unique_ptr inflated_message( m_deserializer.InflateMessage(descriptor, data, data_length)); OLA_ASSERT_TRUE(inflated_message.get()); @@ -184,7 +184,7 @@ void RDMMessageInterationTest::testDeviceModelDescription() { vector inputs; inputs.push_back("wigglelight 2000"); // description - auto_ptr message(m_builder.GetMessage(inputs, descriptor)); + unique_ptr message(m_builder.GetMessage(inputs, descriptor)); OLA_ASSERT_TRUE(message.get()); unsigned int data_length; @@ -193,7 +193,7 @@ void RDMMessageInterationTest::testDeviceModelDescription() { OLA_ASSERT_TRUE(data); OLA_ASSERT_EQ(16u, data_length); - auto_ptr inflated_message( + unique_ptr inflated_message( m_deserializer.InflateMessage(descriptor, data, data_length)); OLA_ASSERT_TRUE(inflated_message.get()); @@ -229,7 +229,7 @@ void RDMMessageInterationTest::testParameterDescription() { inputs.push_back("0"); // default value inputs.push_back("room temp"); // description - auto_ptr message(m_builder.GetMessage(inputs, descriptor)); + unique_ptr message(m_builder.GetMessage(inputs, descriptor)); OLA_ASSERT_TRUE(message.get()); unsigned int data_length; @@ -238,7 +238,7 @@ void RDMMessageInterationTest::testParameterDescription() { OLA_ASSERT_TRUE(data); OLA_ASSERT_EQ(29u, data_length); - auto_ptr inflated_message( + unique_ptr inflated_message( m_deserializer.InflateMessage(descriptor, data, data_length)); OLA_ASSERT_TRUE(inflated_message.get()); diff --git a/common/rdm/RDMReplyTest.cpp b/common/rdm/RDMReplyTest.cpp index 6c13a5c4da..89eb061d9c 100644 --- a/common/rdm/RDMReplyTest.cpp +++ b/common/rdm/RDMReplyTest.cpp @@ -36,7 +36,7 @@ using ola::rdm::RDMGetResponse; using ola::rdm::RDMReply; using ola::rdm::RDMResponse; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; class RDMReplyTest: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(RDMReplyTest); @@ -151,7 +151,7 @@ void RDMReplyTest::testFromFrameHelper() { frame.timing.break_time = 8000; frame.timing.data_time = 45000; - auto_ptr reply(RDMReply::FromFrame(frame)); + unique_ptr reply(RDMReply::FromFrame(frame)); OLA_ASSERT_NOT_NULL(reply.get()); OLA_ASSERT_EQ(ola::rdm::RDM_COMPLETED_OK, reply->StatusCode()); @@ -183,7 +183,7 @@ void RDMReplyTest::testDUBHelper() { frame.timing.response_time = 10000; frame.timing.data_time = 45000; - auto_ptr reply(RDMReply::DUBReply(frame)); + unique_ptr reply(RDMReply::DUBReply(frame)); OLA_ASSERT_NOT_NULL(reply.get()); OLA_ASSERT_EQ(ola::rdm::RDM_DUB_RESPONSE, reply->StatusCode()); diff --git a/common/rdm/StringMessageBuilder.cpp b/common/rdm/StringMessageBuilder.cpp index 00daaac9aa..55087ea6ba 100644 --- a/common/rdm/StringMessageBuilder.cpp +++ b/common/rdm/StringMessageBuilder.cpp @@ -39,7 +39,7 @@ namespace rdm { using ola::messaging::MessageFieldInterface; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -240,7 +240,7 @@ void StringMessageBuilder::Visit( } string token = m_inputs[m_offset++]; - auto_ptr uid(UID::FromString(token)); + unique_ptr uid(UID::FromString(token)); if (!uid.get()) { SetError(descriptor->Name()); diff --git a/common/rdm/StringMessageBuilderTest.cpp b/common/rdm/StringMessageBuilderTest.cpp index 187cf64af1..64fd492cc0 100644 --- a/common/rdm/StringMessageBuilderTest.cpp +++ b/common/rdm/StringMessageBuilderTest.cpp @@ -51,7 +51,7 @@ using ola::messaging::UInt32FieldDescriptor; using ola::messaging::UInt64FieldDescriptor; using ola::messaging::UInt8FieldDescriptor; using ola::rdm::StringMessageBuilder; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -175,7 +175,7 @@ void StringBuilderTest::testSimpleBuilder() { inputs.push_back("foo"); inputs.push_back("0x400"); - auto_ptr message(BuildMessage(descriptor, inputs)); + unique_ptr message(BuildMessage(descriptor, inputs)); // verify OLA_ASSERT_TRUE(message.get()); @@ -209,7 +209,7 @@ void StringBuilderTest::testBuilderWithLabels() { // now setup the inputs vector inputs; inputs.push_back("dozen"); - auto_ptr message(BuildMessage(descriptor, inputs)); + unique_ptr message(BuildMessage(descriptor, inputs)); // verify OLA_ASSERT_NOT_NULL(message.get()); @@ -223,7 +223,7 @@ void StringBuilderTest::testBuilderWithLabels() { // setup the inputs vector inputs2; inputs2.push_back("half_dozen"); - auto_ptr message2(BuildMessage(descriptor, inputs2)); + unique_ptr message2(BuildMessage(descriptor, inputs2)); // verify OLA_ASSERT_NULL(message2.get()); @@ -244,7 +244,7 @@ void StringBuilderTest::testBuilderWithIntervals() { fields.push_back(new UInt8FieldDescriptor("uint8", intervals, labels)); Descriptor descriptor("Test Descriptor", fields); - auto_ptr message(BuildMessageSingleInput(descriptor, "2")); + unique_ptr message(BuildMessageSingleInput(descriptor, "2")); // verify OLA_ASSERT_NOT_NULL(message.get()); @@ -256,7 +256,7 @@ void StringBuilderTest::testBuilderWithIntervals() { // Test an invalid case - auto_ptr message2(BuildMessageSingleInput(descriptor, + unique_ptr message2(BuildMessageSingleInput(descriptor, "dozen")); // verify @@ -299,7 +299,8 @@ void StringBuilderTest::testBuilderWithLabelsAndIntervals() { fields.push_back(new UInt8FieldDescriptor("uint8", intervals, labels)); Descriptor descriptor("Test Descriptor", fields); - auto_ptr message(BuildMessageSingleInput(descriptor, "dozen")); + unique_ptr message(BuildMessageSingleInput( + descriptor, "dozen")); // verify OLA_ASSERT_NOT_NULL(message.get()); @@ -311,7 +312,7 @@ void StringBuilderTest::testBuilderWithLabelsAndIntervals() { // Test an invalid case - auto_ptr message2(BuildMessageSingleInput(descriptor, + unique_ptr message2(BuildMessageSingleInput(descriptor, "half_dozen")); // verify @@ -356,7 +357,7 @@ void StringBuilderTest::testBuilderWithGroups() { inputs.push_back("true"); inputs.push_back("10"); - auto_ptr message(BuildMessage(descriptor, inputs)); + unique_ptr message(BuildMessage(descriptor, inputs)); // verify OLA_ASSERT_TRUE(message.get()); @@ -375,7 +376,7 @@ void StringBuilderTest::testBuilderWithGroups() { inputs2.push_back("false"); inputs2.push_back("240"); - auto_ptr message2(BuildMessage(descriptor, inputs2)); + unique_ptr message2(BuildMessage(descriptor, inputs2)); // verify OLA_ASSERT_NOT_NULL(message2.get()); @@ -423,7 +424,7 @@ void StringBuilderTest::testBuilderWithNestedGroups() { inputs.push_back("true"); inputs.push_back("true"); - auto_ptr message(BuildMessage(descriptor, inputs)); + unique_ptr message(BuildMessage(descriptor, inputs)); // verify OLA_ASSERT_NOT_NULL(message.get()); diff --git a/common/rdm/SubDeviceDispatcher.cpp b/common/rdm/SubDeviceDispatcher.cpp index 3b63bebf60..2d2b0b3533 100644 --- a/common/rdm/SubDeviceDispatcher.cpp +++ b/common/rdm/SubDeviceDispatcher.cpp @@ -102,7 +102,7 @@ void SubDeviceDispatcher::NackIfNotBroadcast( const RDMRequest *request_ptr, RDMCallback *callback, rdm_nack_reason nack_reason) { - std::auto_ptr request(request_ptr); + std::unique_ptr request(request_ptr); if (request->DestinationUID().IsBroadcast()) { RunRDMCallback(callback, RDM_WAS_BROADCAST); } else { diff --git a/common/rdm/UIDAllocatorTest.cpp b/common/rdm/UIDAllocatorTest.cpp index 690a17548d..d10dc5e764 100644 --- a/common/rdm/UIDAllocatorTest.cpp +++ b/common/rdm/UIDAllocatorTest.cpp @@ -28,7 +28,7 @@ using ola::rdm::UID; using ola::rdm::UIDAllocator; -using std::auto_ptr; +using std::unique_ptr; class UIDAllocatorTest: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(UIDAllocatorTest); @@ -50,7 +50,7 @@ void UIDAllocatorTest::testAllocator() { UIDAllocator allocator(uid); for (unsigned int i = 0xffffff00; i < 0xffffffff; i++) { - auto_ptr uid(allocator.AllocateNext()); + unique_ptr uid(allocator.AllocateNext()); OLA_ASSERT_NOT_NULL(uid.get()); OLA_ASSERT_EQ(i, uid->DeviceId()); } @@ -62,7 +62,7 @@ void UIDAllocatorTest::testAllocator() { // try another allocator that has a custom upper bound UIDAllocator bounded_allocator(uid, 0xffffff10); for (unsigned int i = 0xffffff00; i <= 0xffffff10; i++) { - auto_ptr uid(bounded_allocator.AllocateNext()); + unique_ptr uid(bounded_allocator.AllocateNext()); OLA_ASSERT_NOT_NULL(uid.get()); OLA_ASSERT_EQ(i, uid->DeviceId()); } @@ -74,7 +74,7 @@ void UIDAllocatorTest::testAllocator() { UID uid2(1, 0xfffffff0); UIDAllocator bounded_allocator2(uid2, 0xffffffff); for (unsigned int i = 0xfffffff0; i < 0xffffffff; i++) { - auto_ptr uid(bounded_allocator2.AllocateNext()); + unique_ptr uid(bounded_allocator2.AllocateNext()); OLA_ASSERT_NOT_NULL(uid.get()); OLA_ASSERT_EQ(i, uid->DeviceId()); } diff --git a/common/rpc/RpcChannel.cpp b/common/rpc/RpcChannel.cpp index 10b5211e93..4bbf9aa090 100644 --- a/common/rpc/RpcChannel.cpp +++ b/common/rpc/RpcChannel.cpp @@ -43,7 +43,7 @@ namespace rpc { using google::protobuf::Message; using google::protobuf::MethodDescriptor; using google::protobuf::ServiceDescriptor; -using std::auto_ptr; +using std::unique_ptr; using std::string; const char RpcChannel::K_RPC_RECEIVED_TYPE_VAR[] = "rpc-received-type"; @@ -244,7 +244,7 @@ void RpcChannel::CallMethod(const MethodDescriptor *method, OutstandingResponse *response = new OutstandingResponse( message.id(), controller, done, reply); - auto_ptr old_response( + unique_ptr old_response( STLReplacePtr(&m_responses, message.id(), response)); if (old_response.get()) { @@ -569,7 +569,7 @@ void RpcChannel::DeleteOutstandingRequest(OutstandingRequest *request) { * Handle a RPC response by invoking the callback. */ void RpcChannel::HandleResponse(RpcMessage *msg) { - auto_ptr response( + unique_ptr response( STLLookupAndRemovePtr(&m_responses, msg->id())); if (response.get()) { if (!response->reply->ParseFromString(msg->buffer())) { @@ -585,7 +585,7 @@ void RpcChannel::HandleResponse(RpcMessage *msg) { * Handle a RPC response by invoking the callback. */ void RpcChannel::HandleFailedResponse(RpcMessage *msg) { - auto_ptr response( + unique_ptr response( STLLookupAndRemovePtr(&m_responses, msg->id())); if (response.get()) { response->controller->SetFailed(msg->buffer()); @@ -599,7 +599,7 @@ void RpcChannel::HandleFailedResponse(RpcMessage *msg) { */ void RpcChannel::HandleCanceledResponse(RpcMessage *msg) { OLA_INFO << "Received a canceled response"; - auto_ptr response( + unique_ptr response( STLLookupAndRemovePtr(&m_responses, msg->id())); if (response.get()) { response->controller->SetFailed(msg->buffer()); @@ -613,7 +613,7 @@ void RpcChannel::HandleCanceledResponse(RpcMessage *msg) { */ void RpcChannel::HandleNotImplemented(RpcMessage *msg) { OLA_INFO << "Received a non-implemented response"; - auto_ptr response( + unique_ptr response( STLLookupAndRemovePtr(&m_responses, msg->id())); if (response.get()) { response->controller->SetFailed("Not Implemented"); diff --git a/common/rpc/RpcChannel.h b/common/rpc/RpcChannel.h index 4199e49199..3e6f9753a5 100644 --- a/common/rpc/RpcChannel.h +++ b/common/rpc/RpcChannel.h @@ -139,9 +139,9 @@ class RpcChannel { typedef HASH_NAMESPACE::HASH_MAP_CLASS ResponseMap; - std::auto_ptr m_session; + std::unique_ptr m_session; RpcService *m_service; // service to dispatch requests to - std::auto_ptr m_on_close; + std::unique_ptr m_on_close; // the descriptor to read/write to. class ola::io::ConnectedDescriptor *m_descriptor; SequenceNumber m_sequence; diff --git a/common/rpc/RpcChannelTest.cpp b/common/rpc/RpcChannelTest.cpp index d177b4c0b1..815c185188 100644 --- a/common/rpc/RpcChannelTest.cpp +++ b/common/rpc/RpcChannelTest.cpp @@ -45,7 +45,7 @@ using ola::rpc::STREAMING_NO_RESPONSE; using ola::rpc::RpcController; using ola::rpc::TestService; using ola::rpc::TestService_Stub; -using std::auto_ptr; +using std::unique_ptr; using std::string; class RpcChannelTest: public CppUnit::TestFixture { @@ -70,10 +70,10 @@ class RpcChannelTest: public CppUnit::TestFixture { EchoReply m_reply; SelectServer m_ss; - auto_ptr m_service; - auto_ptr m_channel; - auto_ptr m_stub; - auto_ptr m_socket; + unique_ptr m_service; + unique_ptr m_channel; + unique_ptr m_stub; + unique_ptr m_socket; }; diff --git a/common/rpc/RpcServer.cpp b/common/rpc/RpcServer.cpp index 702f30aad3..64f467b879 100644 --- a/common/rpc/RpcServer.cpp +++ b/common/rpc/RpcServer.cpp @@ -31,7 +31,7 @@ namespace ola { namespace rpc { -using std::auto_ptr; +using std::unique_ptr; using ola::io::ConnectedDescriptor; using ola::network::GenericSocketAddress; using ola::network::IPV4Address; @@ -88,7 +88,7 @@ bool RpcServer::Init() { return false; } - auto_ptr accepting_socket; + unique_ptr accepting_socket; if (m_options.listen_socket) { accepting_socket.reset(m_options.listen_socket); diff --git a/common/rpc/RpcServer.h b/common/rpc/RpcServer.h index fa11e71627..e9a9dfd0c7 100644 --- a/common/rpc/RpcServer.h +++ b/common/rpc/RpcServer.h @@ -122,7 +122,7 @@ class RpcServer { const Options m_options; ola::network::TCPSocketFactory m_tcp_socket_factory; - std::auto_ptr m_accepting_socket; + std::unique_ptr m_accepting_socket; ClientDescriptors m_connected_sockets; void NewTCPConnection(ola::network::TCPSocket *socket); diff --git a/common/rpc/RpcServerTest.cpp b/common/rpc/RpcServerTest.cpp index 4c9161577b..7cd1d37f7b 100644 --- a/common/rpc/RpcServerTest.cpp +++ b/common/rpc/RpcServerTest.cpp @@ -31,7 +31,7 @@ using ola::io::SelectServer; using ola::rpc::RpcSession; using ola::rpc::RpcServer; -using std::auto_ptr; +using std::unique_ptr; class RpcServerTest: public CppUnit::TestFixture, public ola::rpc::RpcSessionHandlerInterface { @@ -53,9 +53,9 @@ class RpcServerTest: public CppUnit::TestFixture, private: SelectServer m_ss; - auto_ptr m_service; - auto_ptr m_server; - auto_ptr m_client; + unique_ptr m_service; + unique_ptr m_server; + unique_ptr m_client; uint8_t ptr_data; }; diff --git a/common/rpc/TestService.h b/common/rpc/TestService.h index c5fc93f5cc..14f6cdde78 100644 --- a/common/rpc/TestService.h +++ b/common/rpc/TestService.h @@ -77,8 +77,8 @@ class TestClient { private: ola::io::SelectServer *m_ss; const ola::network::GenericSocketAddress m_server_addr; - std::auto_ptr m_socket; - std::auto_ptr m_stub; - std::auto_ptr m_channel; + std::unique_ptr m_socket; + std::unique_ptr m_stub; + std::unique_ptr m_channel; }; #endif // COMMON_RPC_TESTSERVICE_H_ diff --git a/common/web/JsonLexer.cpp b/common/web/JsonLexer.cpp index bab5ef65d4..91ae26310f 100644 --- a/common/web/JsonLexer.cpp +++ b/common/web/JsonLexer.cpp @@ -36,7 +36,7 @@ namespace ola { namespace web { -using std::auto_ptr; +using std::unique_ptr; using std::string; static bool ParseTrimmedInput(const char **input, diff --git a/common/web/JsonSchema.cpp b/common/web/JsonSchema.cpp index db5f5716b0..10f1d6fbf1 100644 --- a/common/web/JsonSchema.cpp +++ b/common/web/JsonSchema.cpp @@ -35,7 +35,7 @@ namespace ola { namespace web { -using std::auto_ptr; +using std::unique_ptr; using std::set; using std::string; using std::vector; @@ -491,7 +491,7 @@ void ArrayValidator::Visit(const JsonArray &array) { } - auto_ptr element_validator( + unique_ptr element_validator( ConstructElementValidator()); for (unsigned int i = 0; i < array.Size(); i++) { diff --git a/common/web/JsonTest.cpp b/common/web/JsonTest.cpp index 75ecf32c06..df39116be0 100644 --- a/common/web/JsonTest.cpp +++ b/common/web/JsonTest.cpp @@ -674,7 +674,7 @@ void JsonTest::testClone() { all_values.push_back(&array); for (unsigned int i = 0; i < all_values.size(); ++i) { - std::auto_ptr value(all_values[i]->Clone()); + std::unique_ptr value(all_values[i]->Clone()); OLA_ASSERT(*(value.get()) == *(all_values[i])); } } diff --git a/common/web/ParserTest.cpp b/common/web/ParserTest.cpp index d2ec6380dc..dca6b2e1a0 100644 --- a/common/web/ParserTest.cpp +++ b/common/web/ParserTest.cpp @@ -39,7 +39,7 @@ using ola::web::JsonString; using ola::web::JsonUInt; using ola::web::JsonValue; using ola::web::JsonWriter; -using std::auto_ptr; +using std::unique_ptr; using std::string; class JsonParserTest: public CppUnit::TestFixture { @@ -70,7 +70,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION(JsonParserTest); void JsonParserTest::testParseBool() { string error; - auto_ptr value(JsonParser::Parse(" true ", &error)); + unique_ptr value(JsonParser::Parse(" true ", &error)); OLA_ASSERT_NOT_NULL(value.get()); OLA_ASSERT_EQ(string("true"), JsonWriter::AsString(*value.get())); @@ -92,14 +92,14 @@ void JsonParserTest::testParseBool() { void JsonParserTest::testParseNull() { string error; - auto_ptr value(JsonParser::Parse(" null ", &error)); + unique_ptr value(JsonParser::Parse(" null ", &error)); OLA_ASSERT_NOT_NULL(value.get()); OLA_ASSERT_EQ(string("null"), JsonWriter::AsString(*value.get())); } void JsonParserTest::testParseString() { string error; - auto_ptr value(JsonParser::Parse("\"test\"", &error)); + unique_ptr value(JsonParser::Parse("\"test\"", &error)); OLA_ASSERT_NOT_NULL(value.get()); OLA_ASSERT_EQ(string("\"test\""), JsonWriter::AsString(*value.get())); @@ -123,7 +123,7 @@ void JsonParserTest::testParseString() { void JsonParserTest::testParseNumber() { string error; - auto_ptr value(JsonParser::Parse(" 0", &error)); + unique_ptr value(JsonParser::Parse(" 0", &error)); OLA_ASSERT_NOT_NULL(value.get()); OLA_ASSERT_EQ(string("0"), JsonWriter::AsString(*value.get())); @@ -281,7 +281,7 @@ void JsonParserTest::testParseNumber() { void JsonParserTest::testArray() { string error; - auto_ptr value(JsonParser::Parse(" [ ]", &error)); + unique_ptr value(JsonParser::Parse(" [ ]", &error)); OLA_ASSERT_NOT_NULL(value.get()); OLA_ASSERT_EQ(string("[]"), JsonWriter::AsString(*value.get())); @@ -327,7 +327,7 @@ void JsonParserTest::testArray() { void JsonParserTest::testObject() { string error; - auto_ptr value(JsonParser::Parse("{}", &error)); + unique_ptr value(JsonParser::Parse("{}", &error)); OLA_ASSERT_NOT_NULL(value.get()); OLA_ASSERT_EQ(string("{}"), JsonWriter::AsString(*value.get())); @@ -406,7 +406,7 @@ void JsonParserTest::testObject() { void JsonParserTest::testInvalidInput() { string error; - auto_ptr value(JsonParser::Parse(" ", &error)); + unique_ptr value(JsonParser::Parse(" ", &error)); OLA_ASSERT_NULL(value.get()); value.reset(JsonParser::Parse("TRUE", &error)); @@ -425,7 +425,7 @@ void JsonParserTest::testInvalidInput() { */ void JsonParserTest::testStressTests() { string error; - auto_ptr value(JsonParser::Parse("{}", &error)); + unique_ptr value(JsonParser::Parse("{}", &error)); OLA_ASSERT_NOT_NULL(value.get()); OLA_ASSERT_EQ(string("{}"), JsonWriter::AsString(*value.get())); diff --git a/common/web/PatchParserTest.cpp b/common/web/PatchParserTest.cpp index 6f89d60631..0b6f2163e4 100644 --- a/common/web/PatchParserTest.cpp +++ b/common/web/PatchParserTest.cpp @@ -45,7 +45,7 @@ using ola::web::JsonPatchTestOp; using ola::web::JsonData; using ola::web::JsonValue; using ola::web::JsonWriter; -using std::auto_ptr; +using std::unique_ptr; using std::string; class JsonPatchParserTest: public CppUnit::TestFixture { @@ -78,7 +78,7 @@ class JsonPatchParserTest: public CppUnit::TestFixture { void JsonPatchParserTest::CheckValuesMatch(const std::string &input, const JsonValue *actual) { string error; - auto_ptr expected_value(JsonParser::Parse(input, &error)); + unique_ptr expected_value(JsonParser::Parse(input, &error)); if (expected_value.get()) { if (*actual != *expected_value.get()) { OLA_ASSERT_EQ(JsonWriter::AsString(*(expected_value.get())), @@ -90,7 +90,7 @@ void JsonPatchParserTest::CheckValuesMatch(const std::string &input, } void JsonPatchParserTest::BuildSampleText(JsonData *text) { - auto_ptr object(new JsonObject()); + unique_ptr object(new JsonObject()); object->Add("foo", "bar"); object->Add("baz", false); diff --git a/common/web/PatchTest.cpp b/common/web/PatchTest.cpp index c3021dd0f5..57469d0ba9 100644 --- a/common/web/PatchTest.cpp +++ b/common/web/PatchTest.cpp @@ -48,7 +48,7 @@ using ola::web::JsonString; using ola::web::JsonData; using ola::web::JsonValue; using ola::web::JsonWriter; -using std::auto_ptr; +using std::unique_ptr; using std::string; class JsonPatchTest: public CppUnit::TestFixture { @@ -79,7 +79,7 @@ class JsonPatchTest: public CppUnit::TestFixture { void JsonPatchTest::CheckValuesMatch(const std::string &input, const JsonValue *actual) { string error; - auto_ptr expected_value(JsonParser::Parse(input, &error)); + unique_ptr expected_value(JsonParser::Parse(input, &error)); if (expected_value.get()) { if (*actual != *expected_value.get()) { OLA_ASSERT_EQ(JsonWriter::AsString(*(expected_value.get())), @@ -91,7 +91,7 @@ void JsonPatchTest::CheckValuesMatch(const std::string &input, } void JsonPatchTest::BuildSampleText(JsonData *text) { - auto_ptr object(new JsonObject()); + unique_ptr object(new JsonObject()); object->Add("foo", "bar"); object->Add("baz", false); @@ -859,12 +859,12 @@ void JsonPatchTest::testCopyOp() { } void JsonPatchTest::testTestOp() { - auto_ptr object(new JsonObject()); + unique_ptr object(new JsonObject()); object->Add("foo", "bar"); object->Add("baz", true); object->Add("bat", false); - auto_ptr original_object(object->Clone()); + unique_ptr original_object(object->Clone()); JsonData text(object.release()); JsonPointer pointer1(""); diff --git a/common/web/SchemaParseContext.cpp b/common/web/SchemaParseContext.cpp index c0d78cfe8d..0c44c5238c 100644 --- a/common/web/SchemaParseContext.cpp +++ b/common/web/SchemaParseContext.cpp @@ -58,7 +58,7 @@ struct positive{ }; } // namespace -using std::auto_ptr; +using std::unique_ptr; using std::pair; using std::set; using std::string; @@ -153,7 +153,7 @@ ValidatorInterface* SchemaParseContext::GetValidator( } BaseValidator *validator = NULL; - auto_ptr int_validator; + unique_ptr int_validator; switch (m_type) { case JSON_UNDEFINED: break; @@ -592,8 +592,8 @@ BaseValidator* SchemaParseContext::BuildArrayValidator( options.unique_items = m_unique_items.Value(); } - auto_ptr items; - auto_ptr additional_items; + unique_ptr items; + unique_ptr additional_items; // items if (m_items_single_context.get() && m_items_context_array.get()) { diff --git a/common/web/SchemaParseContext.h b/common/web/SchemaParseContext.h index 0e3e6c566d..508b0aef28 100644 --- a/common/web/SchemaParseContext.h +++ b/common/web/SchemaParseContext.h @@ -159,7 +159,7 @@ class DefinitionsParseContext : public StrictTypedParseContext { private: SchemaDefinitions *m_schema_defs; - std::auto_ptr m_current_schema; + std::unique_ptr m_current_schema; DISALLOW_COPY_AND_ASSIGN(DefinitionsParseContext); }; @@ -219,9 +219,9 @@ class SchemaParseContext : public SchemaParseContextInterface { // 5.1 Number / integer keywords OptionalItem m_exclusive_maximum; OptionalItem m_exclusive_minimum; - std::auto_ptr m_maximum; - std::auto_ptr m_minimum; - std::auto_ptr m_multiple_of; + std::unique_ptr m_maximum; + std::unique_ptr m_minimum; + std::unique_ptr m_multiple_of; // 5.2 String keywords // TODO(simon): Implement pattern support? @@ -232,11 +232,11 @@ class SchemaParseContext : public SchemaParseContextInterface { // 5.3 Array keywords // 'additionalItems' can be either a bool or a schema OptionalItem m_additional_items; - std::auto_ptr m_additional_items_context; + std::unique_ptr m_additional_items_context; // 'items' can be either a json schema, or an array of json schema. - std::auto_ptr m_items_single_context; - std::auto_ptr m_items_context_array; + std::unique_ptr m_items_single_context; + std::unique_ptr m_items_context_array; OptionalItem m_max_items; OptionalItem m_min_items; @@ -245,32 +245,32 @@ class SchemaParseContext : public SchemaParseContextInterface { // 5.4 Object keywords OptionalItem m_max_properties; OptionalItem m_min_properties; - std::auto_ptr m_required_items; - std::auto_ptr m_dependency_context; + std::unique_ptr m_required_items; + std::unique_ptr m_dependency_context; // 5.5 Keywords for multiple instance types JsonType m_type; - std::auto_ptr m_enum_context; - std::auto_ptr m_allof_context; - std::auto_ptr m_anyof_context; - std::auto_ptr m_oneof_context; - std::auto_ptr m_not_context; + std::unique_ptr m_enum_context; + std::unique_ptr m_allof_context; + std::unique_ptr m_anyof_context; + std::unique_ptr m_oneof_context; + std::unique_ptr m_not_context; // 6. Metadata keywords OptionalItem m_description; OptionalItem m_title; - std::auto_ptr m_default_value; - std::auto_ptr m_default_value_context; + std::unique_ptr m_default_value; + std::unique_ptr m_default_value_context; OptionalItem m_ref_schema; // TODO(simon): Implement format support? OptionalItem m_format; - std::auto_ptr m_definitions_context; - std::auto_ptr m_properties_context; + std::unique_ptr m_definitions_context; + std::unique_ptr m_properties_context; OptionalItem m_additional_properties; - std::auto_ptr m_additional_properties_context; + std::unique_ptr m_additional_properties_context; void ProcessPositiveInt(SchemaErrorLogger *logger, uint64_t value); @@ -446,7 +446,7 @@ class ArrayOfJsonValuesContext : public SchemaParseContextInterface { private: std::vector m_enums; - std::auto_ptr m_value_context; + std::unique_ptr m_value_context; void CheckForDuplicateAndAdd(SchemaErrorLogger *logger, const JsonValue *value); @@ -482,8 +482,8 @@ class DependencyParseContext : public StrictTypedParseContext { SchemaDefinitions *m_schema_defs; - std::auto_ptr m_property_context; - std::auto_ptr m_schema_context; + std::unique_ptr m_property_context; + std::unique_ptr m_schema_context; PropertyDependencies m_property_dependencies; SchemaDependencies m_schema_dependencies; diff --git a/common/web/SchemaParser.h b/common/web/SchemaParser.h index ba49dba29e..7407d5671b 100644 --- a/common/web/SchemaParser.h +++ b/common/web/SchemaParser.h @@ -103,10 +103,10 @@ class SchemaParser : public JsonParserInterface { SchemaDefinitions* ClaimSchemaDefs(); private: - std::auto_ptr m_schema_defs; - std::auto_ptr m_root_context; + std::unique_ptr m_schema_defs; + std::unique_ptr m_root_context; - std::auto_ptr m_root_validator; + std::unique_ptr m_root_validator; std::stack m_context_stack; JsonPointer m_pointer; diff --git a/common/web/SchemaParserTest.cpp b/common/web/SchemaParserTest.cpp index 12d4a0c12f..db44d8a39e 100644 --- a/common/web/SchemaParserTest.cpp +++ b/common/web/SchemaParserTest.cpp @@ -33,7 +33,7 @@ using ola::web::JsonObject; using ola::web::JsonSchema; -using std::auto_ptr; +using std::unique_ptr; using std::ostringstream; using std::string; using std::vector; @@ -197,11 +197,11 @@ void JsonSchemaParserTest::ReadTestCases(const string& filename, void JsonSchemaParserTest::ParseSchemaAndConvertToJson(const string &input, const string &expected) { string error; - auto_ptr schema(JsonSchema::FromString(input, &error)); + unique_ptr schema(JsonSchema::FromString(input, &error)); OLA_ASSERT_EQ(string(""), error); OLA_ASSERT_NOT_NULL(schema.get()); - auto_ptr schema_json(schema->AsJson()); + unique_ptr schema_json(schema->AsJson()); string actual = ola::web::JsonWriter::AsString(*schema_json); actual.push_back('\n'); OLA_ASSERT_EQ(expected, actual); @@ -212,7 +212,7 @@ void JsonSchemaParserTest::ParseSchemaAndConvertToJson(const string &input, */ void JsonSchemaParserTest::VerifyFailure(const string &input) { string error; - auto_ptr schema(JsonSchema::FromString(input, &error)); + unique_ptr schema(JsonSchema::FromString(input, &error)); bool failed = !error.empty(); if (!failed) { ostringstream str; @@ -241,7 +241,7 @@ void JsonSchemaParserTest::RunTestsInFile(const string &test_file) { void JsonSchemaParserTest::testPrimitiveTypes() { string error; - auto_ptr schema(JsonSchema::FromString("null", &error)); + unique_ptr schema(JsonSchema::FromString("null", &error)); OLA_ASSERT_NULL(schema.get()); OLA_ASSERT_FALSE(error.empty()); @@ -272,12 +272,12 @@ void JsonSchemaParserTest::testPrimitiveTypes() { void JsonSchemaParserTest::testEmptySchema() { string error; - auto_ptr schema(JsonSchema::FromString("{}", &error)); + unique_ptr schema(JsonSchema::FromString("{}", &error)); OLA_ASSERT_NOT_NULL(schema.get()); OLA_ASSERT_TRUE(error.empty()); - auto_ptr value(schema->AsJson()); + unique_ptr value(schema->AsJson()); OLA_ASSERT_NOT_NULL(value.get()); OLA_ASSERT_EQ(string("{}"), ola::web::JsonWriter::AsString(*value)); } diff --git a/common/web/SchemaTest.cpp b/common/web/SchemaTest.cpp index cfcdff4156..1f2428a0aa 100644 --- a/common/web/SchemaTest.cpp +++ b/common/web/SchemaTest.cpp @@ -59,7 +59,7 @@ using ola::web::SchemaDefinitions; using ola::web::StringValidator; using ola::web::WildcardValidator; -using std::auto_ptr; +using std::unique_ptr; using std::set; using std::string; using std::vector; @@ -100,15 +100,15 @@ class JsonSchemaTest: public CppUnit::TestFixture { void testEnums(); private: - auto_ptr m_bool_value; - auto_ptr m_empty_array; - auto_ptr m_empty_object; - auto_ptr m_int_value; - auto_ptr m_long_string_value; - auto_ptr m_null_value; - auto_ptr m_number_value; - auto_ptr m_string_value; - auto_ptr m_uint_value; + unique_ptr m_bool_value; + unique_ptr m_empty_array; + unique_ptr m_empty_object; + unique_ptr m_int_value; + unique_ptr m_long_string_value; + unique_ptr m_null_value; + unique_ptr m_number_value; + unique_ptr m_string_value; + unique_ptr m_uint_value; }; CPPUNIT_TEST_SUITE_REGISTRATION(JsonSchemaTest); @@ -292,10 +292,10 @@ void JsonSchemaTest::testIntegerValidator() { exclusive_max_int_validator.AddConstraint(new MaximumConstraint( new JsonInt(4), true)); - auto_ptr int_value1(new JsonInt(3)); - auto_ptr int_value2(new JsonInt(-11)); - auto_ptr int_value3(new JsonInt(-13)); - auto_ptr uint_value1(new JsonInt(5)); + unique_ptr int_value1(new JsonInt(3)); + unique_ptr int_value2(new JsonInt(-11)); + unique_ptr int_value3(new JsonInt(-13)); + unique_ptr uint_value1(new JsonInt(5)); // closed maximum int_value1->Accept(&max_int_validator); @@ -374,9 +374,9 @@ void JsonSchemaTest::testIntegerValidator() { m_uint_value->Accept(&multiple_of_validator); OLA_ASSERT_TRUE(multiple_of_validator.IsValid()); - auto_ptr int_value4(new JsonInt(4)); - auto_ptr int_value5(new JsonInt(8)); - auto_ptr int_value6(new JsonInt(-4)); + unique_ptr int_value4(new JsonInt(4)); + unique_ptr int_value5(new JsonInt(8)); + unique_ptr int_value6(new JsonInt(-4)); int_value4->Accept(&multiple_of_validator); OLA_ASSERT_TRUE(multiple_of_validator.IsValid()); @@ -430,14 +430,14 @@ void JsonSchemaTest::testObjectValidator() { OLA_ASSERT_FALSE(object_validator.IsValid()); string error; - auto_ptr object1(JsonParser::Parse("{\"a\": 1}", &error)); - auto_ptr object2( + unique_ptr object1(JsonParser::Parse("{\"a\": 1}", &error)); + unique_ptr object2( JsonParser::Parse("{\"a\": 1, \"b\": 2}", &error)); - auto_ptr object3( + unique_ptr object3( JsonParser::Parse("{\"a\": 1, \"b\": 2, \"c\": 3}", &error)); - auto_ptr object4( + unique_ptr object4( JsonParser::Parse("{\"a\": 1, \"b\": true, \"c\": 3}", &error)); - auto_ptr object5( + unique_ptr object5( JsonParser::Parse("{\"a\": 1, \"b\": 2, \"c\": false}", &error)); // test maxProperties @@ -618,10 +618,10 @@ void JsonSchemaTest::testArrayValidator() { OLA_ASSERT_FALSE(array_validator.IsValid()); string error; - auto_ptr small_array(JsonParser::Parse("[1]", &error)); - auto_ptr medium_array(JsonParser::Parse("[1, 2]", &error)); - auto_ptr large_array(JsonParser::Parse("[1, 2, 3]", &error)); - auto_ptr duplicate_items_array( + unique_ptr small_array(JsonParser::Parse("[1]", &error)); + unique_ptr medium_array(JsonParser::Parse("[1, 2]", &error)); + unique_ptr large_array(JsonParser::Parse("[1, 2, 3]", &error)); + unique_ptr duplicate_items_array( JsonParser::Parse("[1, 2, 1]", &error)); // test maxItems @@ -780,9 +780,9 @@ void JsonSchemaTest::testOneOfValidator() { m_uint_value->Accept(&one_of_validator); OLA_ASSERT_FALSE(one_of_validator.IsValid()); - auto_ptr int_value1(new JsonInt(3)); - auto_ptr int_value2(new JsonInt(5)); - auto_ptr int_value3(new JsonInt(6)); + unique_ptr int_value1(new JsonInt(3)); + unique_ptr int_value2(new JsonInt(5)); + unique_ptr int_value3(new JsonInt(6)); int_value1->Accept(&one_of_validator); OLA_ASSERT_TRUE(one_of_validator.IsValid()); diff --git a/data/rdm/PidDataTest.cpp b/data/rdm/PidDataTest.cpp index d92a4530d3..36e44e96a2 100644 --- a/data/rdm/PidDataTest.cpp +++ b/data/rdm/PidDataTest.cpp @@ -48,7 +48,7 @@ void PidDataTest::setUp() { * Check we can load the data. */ void PidDataTest::testDataLoad() { - std::auto_ptr store( + std::unique_ptr store( RootPidStore::LoadFromDirectory(DATADIR)); OLA_ASSERT_NOT_NULL(store.get()); diff --git a/examples/ola-rdm.cpp b/examples/ola-rdm.cpp index fad5bf8f17..df9b6f0c50 100644 --- a/examples/ola-rdm.cpp +++ b/examples/ola-rdm.cpp @@ -48,7 +48,7 @@ using ola::network::NetworkToHost; using ola::rdm::PidStoreHelper; using ola::rdm::PidDescriptor; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::cerr; using std::cout; using std::endl; @@ -465,7 +465,7 @@ int RDMController::PerformRequestAndWait(unsigned int universe, } // attempt to build the message - auto_ptr message(m_pid_helper.BuildMessage( + unique_ptr message(m_pid_helper.BuildMessage( descriptor, inputs)); @@ -574,7 +574,7 @@ void RDMController::HandleAckResponse(uint16_t manufacturer_id, return; } - auto_ptr message( + unique_ptr message( m_pid_helper.DeserializeMessage(descriptor, data, length)); if (!message.get()) { diff --git a/examples/ola-recorder.cpp b/examples/ola-recorder.cpp index f0d8467f5d..8620be757c 100644 --- a/examples/ola-recorder.cpp +++ b/examples/ola-recorder.cpp @@ -40,7 +40,7 @@ // needs to be after WinSock2.h, hence this order #include // NOLINT(build/include_order) -using std::auto_ptr; +using std::unique_ptr; using std::cout; using std::endl; using std::map; diff --git a/include/ola/client/ClientWrapper.h b/include/ola/client/ClientWrapper.h index b26ac09c2c..7321a88e1a 100644 --- a/include/ola/client/ClientWrapper.h +++ b/include/ola/client/ClientWrapper.h @@ -92,11 +92,11 @@ class BaseClientWrapper { void SocketClosed(); protected: - std::auto_ptr m_socket; + std::unique_ptr m_socket; private: ola::io::SelectServer m_ss; - std::auto_ptr m_close_callback; + std::unique_ptr m_close_callback; virtual void CreateClient() = 0; virtual bool StartupClient() = 0; @@ -122,7 +122,7 @@ class GenericClientWrapper: public BaseClientWrapper { ClientClass *GetClient() const { return m_client.get(); } private: - std::auto_ptr m_client; + std::unique_ptr m_client; bool m_auto_start; void CreateClient() { diff --git a/include/ola/client/OlaClient.h b/include/ola/client/OlaClient.h index 35e7801d13..1948560e0f 100644 --- a/include/ola/client/OlaClient.h +++ b/include/ola/client/OlaClient.h @@ -317,7 +317,7 @@ class OlaClient { SetCallback *callback); private: - std::auto_ptr m_core; + std::unique_ptr m_core; DISALLOW_COPY_AND_ASSIGN(OlaClient); }; diff --git a/include/ola/e133/DeviceManager.h b/include/ola/e133/DeviceManager.h index 023e8d9f1b..74e1c7c8dd 100644 --- a/include/ola/e133/DeviceManager.h +++ b/include/ola/e133/DeviceManager.h @@ -37,7 +37,7 @@ namespace e133 { using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; diff --git a/include/ola/e133/E133Receiver.h b/include/ola/e133/E133Receiver.h index 2e9d17a88b..4e2021be42 100644 --- a/include/ola/e133/E133Receiver.h +++ b/include/ola/e133/E133Receiver.h @@ -31,7 +31,7 @@ #include using std::string; -using std::auto_ptr; +using std::unique_ptr; using ola::network::IPV4Address; namespace ola { @@ -125,11 +125,11 @@ class E133Receiver { StatusCallback *m_status_callback; RDMCallback *m_rdm_callback; - auto_ptr m_root_inflator; - auto_ptr m_e133_inflator; - auto_ptr m_rdm_inflator; - auto_ptr m_e133_status_inflator; - auto_ptr m_incoming_udp_transport; + unique_ptr m_root_inflator; + unique_ptr m_e133_inflator; + unique_ptr m_rdm_inflator; + unique_ptr m_e133_status_inflator; + unique_ptr m_incoming_udp_transport; void HandleStatusMessage( const ola::acn::TransportHeader *transport_header, diff --git a/include/ola/http/HTTPServer.h b/include/ola/http/HTTPServer.h index 1e06ac2b58..15095df7b3 100644 --- a/include/ola/http/HTTPServer.h +++ b/include/ola/http/HTTPServer.h @@ -41,6 +41,7 @@ #endif // _WIN32 #include #include +#include #include #include #include @@ -255,7 +256,7 @@ class HTTPServer: public ola::thread::Thread { typedef std::set SocketSet; struct MHD_Daemon *m_httpd; - std::auto_ptr m_select_server; + std::unique_ptr m_select_server; SocketSet m_sockets; std::map m_handlers; diff --git a/include/ola/http/OlaHTTPServer.h b/include/ola/http/OlaHTTPServer.h index 20fbdf7949..616bbb5496 100644 --- a/include/ola/http/OlaHTTPServer.h +++ b/include/ola/http/OlaHTTPServer.h @@ -26,6 +26,7 @@ #include #include #include +#include #include namespace ola { diff --git a/include/ola/io/SelectServer.h b/include/ola/io/SelectServer.h index 1d07c7a047..c485e5e45b 100644 --- a/include/ola/io/SelectServer.h +++ b/include/ola/io/SelectServer.h @@ -198,8 +198,8 @@ class SelectServer: public SelectServerInterface { ExportMap *m_export_map; bool m_terminate, m_is_running; TimeInterval m_poll_interval; - std::auto_ptr m_timeout_manager; - std::auto_ptr m_poller; + std::unique_ptr m_timeout_manager; + std::unique_ptr m_poller; Clock *m_clock; bool m_free_clock; diff --git a/include/ola/io/StdinHandler.h b/include/ola/io/StdinHandler.h index e3acecd18b..48f3d9d77e 100644 --- a/include/ola/io/StdinHandler.h +++ b/include/ola/io/StdinHandler.h @@ -75,7 +75,7 @@ class StdinHandler { termios m_old_tc; #endif // _WIN32 SelectServerInterface *m_ss; - std::auto_ptr m_callback; + std::unique_ptr m_callback; // stdin void HandleData(); diff --git a/include/ola/network/SocketCloser.h b/include/ola/network/SocketCloser.h index ff307dc309..d00b6ce148 100644 --- a/include/ola/network/SocketCloser.h +++ b/include/ola/network/SocketCloser.h @@ -44,7 +44,7 @@ namespace network { * @brief Automatically close a socket when it goes out of scope. * * This class is useful if you need to temporarily open a socket and want to - * make sure it's cleaned up. Think of it as an auto_ptr for file descriptors. + * make sure it's cleaned up. Think of it as an unique_ptr for file descriptors. */ class SocketCloser { public: diff --git a/include/ola/rdm/AckTimerResponder.h b/include/ola/rdm/AckTimerResponder.h index a95674ec9f..210d581fd9 100644 --- a/include/ola/rdm/AckTimerResponder.h +++ b/include/ola/rdm/AckTimerResponder.h @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -99,7 +100,7 @@ class AckTimerResponder: public RDMControllerInterface { ResponseQueue m_queued_messages; PendingResponses m_upcoming_queued_messages; - std::auto_ptr m_last_queued_message; + std::unique_ptr m_last_queued_message; ola::Clock m_clock; uint16_t Footprint() const { diff --git a/include/ola/rdm/DimmerResponder.h b/include/ola/rdm/DimmerResponder.h index e2fcdfa25f..4a0ceb38b4 100644 --- a/include/ola/rdm/DimmerResponder.h +++ b/include/ola/rdm/DimmerResponder.h @@ -54,7 +54,7 @@ class DimmerResponder: public RDMControllerInterface { private: SubDeviceDispatcher m_dispatcher; - std::auto_ptr m_root_device; + std::unique_ptr m_root_device; std::map m_sub_devices; }; } // namespace rdm diff --git a/include/ola/rdm/DiscoveryAgent.h b/include/ola/rdm/DiscoveryAgent.h index ece7b75b75..2ced83c45e 100644 --- a/include/ola/rdm/DiscoveryAgent.h +++ b/include/ola/rdm/DiscoveryAgent.h @@ -202,13 +202,13 @@ class DiscoveryAgent { // uids to mute during incremental discovery std::queue m_uids_to_mute; // Callbacks used by the DiscoveryTarget - std::auto_ptr + std::unique_ptr m_unmute_callback; - std::auto_ptr + std::unique_ptr m_incremental_mute_callback; - std::auto_ptr + std::unique_ptr m_branch_mute_callback; - std::auto_ptr m_branch_callback; + std::unique_ptr m_branch_callback; // The stack of UIDRanges UIDRanges m_uid_ranges; diff --git a/include/ola/rdm/DummyResponder.h b/include/ola/rdm/DummyResponder.h index c721198f80..9ef5985547 100644 --- a/include/ola/rdm/DummyResponder.h +++ b/include/ola/rdm/DummyResponder.h @@ -92,7 +92,7 @@ class DummyResponder: public RDMControllerInterface { uint32_t m_lamp_strikes; PersonalityManager m_personality_manager; Sensors m_sensors; - std::auto_ptr m_network_manager; + std::unique_ptr m_network_manager; RDMResponse *GetParamDescription(const RDMRequest *request); RDMResponse *GetDeviceInfo(const RDMRequest *request); diff --git a/include/ola/rdm/NetworkResponder.h b/include/ola/rdm/NetworkResponder.h index 717b83861f..62d3013b6d 100644 --- a/include/ola/rdm/NetworkResponder.h +++ b/include/ola/rdm/NetworkResponder.h @@ -72,7 +72,7 @@ class NetworkResponder: public RDMControllerInterface { const UID m_uid; bool m_identify_mode; - std::auto_ptr m_network_manager; + std::unique_ptr m_network_manager; RDMResponse *GetDeviceInfo(const RDMRequest *request); RDMResponse *GetProductDetailList(const RDMRequest *request); diff --git a/include/ola/rdm/PidStore.h b/include/ola/rdm/PidStore.h index 16dd70aa6a..80fa0ff821 100644 --- a/include/ola/rdm/PidStore.h +++ b/include/ola/rdm/PidStore.h @@ -169,7 +169,7 @@ class RootPidStore { static const std::string DataLocation(); private: - std::auto_ptr m_esta_store; + std::unique_ptr m_esta_store; ManufacturerMap m_manufacturer_store; uint64_t m_version; diff --git a/include/ola/rdm/QueueingRDMController.h b/include/ola/rdm/QueueingRDMController.h index 8311b7122a..9469adcc7d 100644 --- a/include/ola/rdm/QueueingRDMController.h +++ b/include/ola/rdm/QueueingRDMController.h @@ -30,6 +30,7 @@ #define INCLUDE_OLA_RDM_QUEUEINGRDMCONTROLLER_H_ #include +#include #include #include #include @@ -65,8 +66,8 @@ class QueueingRDMController: public RDMControllerInterface { std::queue m_pending_requests; bool m_rdm_request_pending; // true if a request is in progress bool m_active; // true if the controller is active - std::auto_ptr m_callback; - std::auto_ptr m_response; + std::unique_ptr m_callback; + std::unique_ptr m_response; std::vector m_frames; virtual void TakeNextAction(); diff --git a/include/ola/rdm/RDMReply.h b/include/ola/rdm/RDMReply.h index 928794caf6..eb3b39d486 100644 --- a/include/ola/rdm/RDMReply.h +++ b/include/ola/rdm/RDMReply.h @@ -144,7 +144,7 @@ struct RDMReply { private: RDMStatusCode m_status_code; - std::auto_ptr m_response; + std::unique_ptr m_response; RDMFrames m_frames; DISALLOW_COPY_AND_ASSIGN(RDMReply); diff --git a/include/ola/rdm/ResponderOpsPrivate.h b/include/ola/rdm/ResponderOpsPrivate.h index ea418fa60e..cbf43a3ee8 100644 --- a/include/ola/rdm/ResponderOpsPrivate.h +++ b/include/ola/rdm/ResponderOpsPrivate.h @@ -71,7 +71,7 @@ void ResponderOps::HandleRDMRequest(Target *target, const RDMRequest *raw_request, RDMCallback *on_complete) { // Take ownership of the request object, so the targets don't have to. - std::auto_ptr request(raw_request); + std::unique_ptr request(raw_request); if (!on_complete) { OLA_WARN << "Null callback passed!"; diff --git a/include/ola/util/Backoff.h b/include/ola/util/Backoff.h index 7cd19abf81..9caaee9102 100644 --- a/include/ola/util/Backoff.h +++ b/include/ola/util/Backoff.h @@ -136,7 +136,7 @@ class BackoffGenerator { } private: - std::auto_ptr m_policy; + std::unique_ptr m_policy; unsigned int m_failures; }; } // namespace ola diff --git a/include/ola/util/Watchdog.h b/include/ola/util/Watchdog.h index 7e9cab4310..a960bd2e02 100644 --- a/include/ola/util/Watchdog.h +++ b/include/ola/util/Watchdog.h @@ -104,7 +104,7 @@ class Watchdog { private: const unsigned int m_limit; - std::auto_ptr > m_callback; + std::unique_ptr > m_callback; ola::thread::Mutex m_mu; bool m_enabled; // GUARDED_BY(m_mu); unsigned int m_count; // GUARDED_BY(m_mu); diff --git a/include/ola/web/JsonData.h b/include/ola/web/JsonData.h index 4354c7b77f..9d458bcacc 100644 --- a/include/ola/web/JsonData.h +++ b/include/ola/web/JsonData.h @@ -94,7 +94,7 @@ class JsonData { const ValidatorInterface* GetSchema() const { return m_schema; } private: - std::auto_ptr m_value; + std::unique_ptr m_value; ValidatorInterface *m_schema; bool IsValid(const JsonValue *value); diff --git a/include/ola/web/JsonParser.h b/include/ola/web/JsonParser.h index a7c0af1398..b9ad535d3a 100644 --- a/include/ola/web/JsonParser.h +++ b/include/ola/web/JsonParser.h @@ -111,7 +111,7 @@ class JsonParser : public JsonParserInterface { }; std::string m_error; - std::auto_ptr m_root; + std::unique_ptr m_root; std::string m_key; std::stack m_container_stack; diff --git a/include/ola/web/JsonPatch.h b/include/ola/web/JsonPatch.h index 190859c1b3..9f412000cd 100644 --- a/include/ola/web/JsonPatch.h +++ b/include/ola/web/JsonPatch.h @@ -81,7 +81,7 @@ class JsonPatchAddOp : public JsonPatchOp { private: JsonPointer m_pointer; - std::auto_ptr m_value; + std::unique_ptr m_value; DISALLOW_COPY_AND_ASSIGN(JsonPatchAddOp); }; @@ -126,7 +126,7 @@ class JsonPatchReplaceOp : public JsonPatchOp { private: const JsonPointer m_pointer; - std::auto_ptr m_value; + std::unique_ptr m_value; DISALLOW_COPY_AND_ASSIGN(JsonPatchReplaceOp); }; @@ -193,7 +193,7 @@ class JsonPatchTestOp : public JsonPatchOp { private: JsonPointer m_pointer; - std::auto_ptr m_value; + std::unique_ptr m_value; DISALLOW_COPY_AND_ASSIGN(JsonPatchTestOp); }; diff --git a/include/ola/web/JsonPatchParser.h b/include/ola/web/JsonPatchParser.h index 60a7208581..d0fded3636 100644 --- a/include/ola/web/JsonPatchParser.h +++ b/include/ola/web/JsonPatchParser.h @@ -118,7 +118,7 @@ class JsonPatchParser : public JsonParserInterface { std::string m_op; OptionalItem m_path; OptionalItem m_from; - std::auto_ptr m_value; + std::unique_ptr m_value; template void HandleNumber(const T &value); diff --git a/include/ola/web/JsonSchema.h b/include/ola/web/JsonSchema.h index bc009deee0..acfd0a896a 100644 --- a/include/ola/web/JsonSchema.h +++ b/include/ola/web/JsonSchema.h @@ -221,7 +221,7 @@ class BaseValidator : public ValidatorInterface { std::string m_id; std::string m_title; std::string m_description; - std::auto_ptr m_default_value; + std::unique_ptr m_default_value; std::vector m_enums; bool CheckEnums(const JsonValue &value); @@ -378,7 +378,7 @@ class MultipleOfConstraint : public NumberConstraint { } private: - std::auto_ptr m_multiple_of; + std::unique_ptr m_multiple_of; }; /** @@ -420,7 +420,7 @@ class MaximumConstraint : public NumberConstraint { } private: - std::auto_ptr m_limit; + std::unique_ptr m_limit; bool m_has_exclusive, m_is_exclusive; }; @@ -463,7 +463,7 @@ class MinimumConstraint : public NumberConstraint { } private: - std::auto_ptr m_limit; + std::unique_ptr m_limit; bool m_has_exclusive, m_is_exclusive; }; @@ -606,7 +606,7 @@ class ObjectValidator : public BaseValidator, JsonObjectPropertyVisitor { const Options m_options; PropertyValidators m_property_validators; - std::auto_ptr m_additional_property_validator; + std::unique_ptr m_additional_property_validator; PropertyDependencies m_property_dependencies; SchemaDependencies m_schema_dependencies; @@ -633,7 +633,7 @@ class ArrayValidator : public BaseValidator { } explicit Items(ValidatorList *validators) - : m_validator(NULL), + : m_validator(), m_validator_list(*validators) { } @@ -645,7 +645,7 @@ class ArrayValidator : public BaseValidator { const ValidatorList& Validators() const { return m_validator_list; } private: - std::auto_ptr m_validator; + std::unique_ptr m_validator; ValidatorList m_validator_list; DISALLOW_COPY_AND_ASSIGN(Items); @@ -658,7 +658,7 @@ class ArrayValidator : public BaseValidator { public: explicit AdditionalItems(bool allow_additional) : m_allowed(allow_additional), - m_validator(NULL) { + m_validator() { } explicit AdditionalItems(ValidatorInterface *validator) @@ -671,7 +671,7 @@ class ArrayValidator : public BaseValidator { private: bool m_allowed; - std::auto_ptr m_validator; + std::unique_ptr m_validator; DISALLOW_COPY_AND_ASSIGN(AdditionalItems); }; @@ -705,12 +705,12 @@ class ArrayValidator : public BaseValidator { private: typedef std::deque ValidatorQueue; - const std::auto_ptr m_items; - const std::auto_ptr m_additional_items; + const std::unique_ptr m_items; + const std::unique_ptr m_additional_items; const Options m_options; // This is used if items is missing, or if additionalItems is true. - std::auto_ptr m_wildcard_validator; + std::unique_ptr m_wildcard_validator; class ArrayElementValidator : public BaseValidator { public: @@ -934,7 +934,7 @@ class NotValidator : public BaseValidator { } private: - std::auto_ptr m_validator; + std::unique_ptr m_validator; void Validate(const JsonValue &value); @@ -995,8 +995,8 @@ class JsonSchema { private: std::string m_schema_uri; - std::auto_ptr m_root_validator; - std::auto_ptr m_schema_defs; + std::unique_ptr m_root_validator; + std::unique_ptr m_schema_defs; JsonSchema(const std::string &schema_url, ValidatorInterface *root_validator, diff --git a/libs/acn/DMPE131Inflator.cpp b/libs/acn/DMPE131Inflator.cpp index ed011161d8..2ce19728d8 100644 --- a/libs/acn/DMPE131Inflator.cpp +++ b/libs/acn/DMPE131Inflator.cpp @@ -92,7 +92,7 @@ bool DMPE131Inflator::HandlePDUData(uint32_t vector, } unsigned int available_length = pdu_len; - std::auto_ptr address( + std::unique_ptr address( DecodeAddress(dmp_header.Size(), dmp_header.Type(), data, diff --git a/libs/acn/E131DiscoveryInflator.h b/libs/acn/E131DiscoveryInflator.h index cd3c48056d..7dc58e7bfc 100644 --- a/libs/acn/E131DiscoveryInflator.h +++ b/libs/acn/E131DiscoveryInflator.h @@ -59,7 +59,7 @@ class E131DiscoveryInflator: public InflatorInterface { private: - std::auto_ptr m_page_callback; + std::unique_ptr m_page_callback; }; } // namespace acn } // namespace ola diff --git a/libs/acn/E131Node.cpp b/libs/acn/E131Node.cpp index 58e8f5578f..be902161d3 100644 --- a/libs/acn/E131Node.cpp +++ b/libs/acn/E131Node.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -39,7 +40,7 @@ using ola::DmxBuffer; using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::network::HostToNetwork; -using std::auto_ptr; +using std::unique_ptr; using std::map; using std::string; using std::set; @@ -160,7 +161,7 @@ E131Node::~E131Node() { bool E131Node::Start() { - auto_ptr picker( + unique_ptr picker( ola::network::InterfacePicker::NewPicker()); if (!picker->ChooseInterface(&m_interface, m_preferred_ip)) { OLA_INFO << "Failed to find an interface"; diff --git a/libs/acn/E131TestFramework.cpp b/libs/acn/E131TestFramework.cpp index 4974a49146..5691de9056 100644 --- a/libs/acn/E131TestFramework.cpp +++ b/libs/acn/E131TestFramework.cpp @@ -56,7 +56,7 @@ StateManager::StateManager(const std::vector &states, m_node1(NULL), m_node2(NULL), m_ss(NULL), - m_stdin_handler(NULL), + m_stdin_handler(), m_states(states) { } diff --git a/libs/acn/E131TestFramework.h b/libs/acn/E131TestFramework.h index b1b064f923..b99a983822 100644 --- a/libs/acn/E131TestFramework.h +++ b/libs/acn/E131TestFramework.h @@ -320,7 +320,7 @@ class StateManager { ola::acn::CID m_cid1, m_cid2; ola::acn::E131Node *m_local_node, *m_node1, *m_node2; ola::io::SelectServer *m_ss; - std::auto_ptr m_stdin_handler; + std::unique_ptr m_stdin_handler; std::vector m_states; ola::DmxBuffer m_recv_buffer; std::vector m_failed_tests; diff --git a/libs/acn/E133HealthCheckedConnection.h b/libs/acn/E133HealthCheckedConnection.h index 1008edfcaf..32f2c78e31 100644 --- a/libs/acn/E133HealthCheckedConnection.h +++ b/libs/acn/E133HealthCheckedConnection.h @@ -65,7 +65,7 @@ class E133HealthCheckedConnection private: ola::e133::MessageBuilder *m_message_builder; ola::io::NonBlockingSender *m_message_queue; - std::auto_ptr > m_on_timeout; + std::unique_ptr > m_on_timeout; ola::thread::SchedulingExecutorInterface *m_executor; // The default interval in seconds for sending heartbeat messages. diff --git a/libs/acn/E133StatusInflator.h b/libs/acn/E133StatusInflator.h index ab3cbb6027..77f26757a9 100644 --- a/libs/acn/E133StatusInflator.h +++ b/libs/acn/E133StatusInflator.h @@ -69,7 +69,7 @@ class E133StatusInflator: public BaseInflator { unsigned int pdu_len); private: - std::auto_ptr m_handler; + std::unique_ptr m_handler; }; } // namespace acn } // namespace ola diff --git a/libs/acn/RDMInflator.h b/libs/acn/RDMInflator.h index aa2cb73add..ec09a3e794 100644 --- a/libs/acn/RDMInflator.h +++ b/libs/acn/RDMInflator.h @@ -20,6 +20,7 @@ #ifndef LIBS_ACN_RDMINFLATOR_H_ #define LIBS_ACN_RDMINFLATOR_H_ +#include #include #include "ola/Callback.h" #include "ola/acn/ACNVectors.h" @@ -70,8 +71,8 @@ class RDMInflator: public BaseInflator { unsigned int pdu_len); private: - std::auto_ptr m_rdm_handler; - std::auto_ptr m_generic_rdm_handler; + std::unique_ptr m_rdm_handler; + std::unique_ptr m_generic_rdm_handler; unsigned int m_vector; }; } // namespace acn diff --git a/libs/acn/RootInflator.h b/libs/acn/RootInflator.h index ea09bdc177..cd01a35c93 100644 --- a/libs/acn/RootInflator.h +++ b/libs/acn/RootInflator.h @@ -71,7 +71,7 @@ class RootInflator: public BaseInflator { private : NullInflator m_null_inflator; RootHeader m_last_hdr; - std::auto_ptr m_on_data; + std::unique_ptr m_on_data; }; } // namespace acn } // namespace ola diff --git a/libs/acn/RootSenderTest.cpp b/libs/acn/RootSenderTest.cpp index 52961f4e81..0815b7a7ba 100644 --- a/libs/acn/RootSenderTest.cpp +++ b/libs/acn/RootSenderTest.cpp @@ -97,7 +97,7 @@ void RootSenderTest::testRootSenderWithCustomCID() { void RootSenderTest::testRootSenderWithCIDs(const CID &root_cid, const CID &send_cid) { - std::auto_ptr > stop_closure( + std::unique_ptr > stop_closure( NewCallback(this, &RootSenderTest::Stop)); // inflators diff --git a/libs/acn/TCPTransport.cpp b/libs/acn/TCPTransport.cpp index 4060df25fa..83e7bdffb8 100644 --- a/libs/acn/TCPTransport.cpp +++ b/libs/acn/TCPTransport.cpp @@ -316,7 +316,7 @@ void IncomingStreamTransport::EnterWaitingForPDU() { */ IncomingTCPTransport::IncomingTCPTransport(BaseInflator *inflator, ola::network::TCPSocket *socket) - : m_transport(NULL) { + : m_transport() { ola::network::GenericSocketAddress address = socket->GetPeerAddress(); if (address.Family() == AF_INET) { ola::network::IPV4SocketAddress v4_addr = address.V4Addr(); diff --git a/libs/acn/TCPTransport.h b/libs/acn/TCPTransport.h index bbc30391ab..93b0b2dddd 100644 --- a/libs/acn/TCPTransport.h +++ b/libs/acn/TCPTransport.h @@ -137,7 +137,7 @@ class IncomingTCPTransport { bool Receive() { return m_transport->Receive(); } private: - std::auto_ptr m_transport; + std::unique_ptr m_transport; }; } // namespace acn } // namespace ola diff --git a/libs/acn/TCPTransportTest.cpp b/libs/acn/TCPTransportTest.cpp index 47da5488a7..9f1c6b4ce8 100644 --- a/libs/acn/TCPTransportTest.cpp +++ b/libs/acn/TCPTransportTest.cpp @@ -41,7 +41,7 @@ using ola::acn::CID; using ola::io::IOQueue; using ola::io::IOStack; using ola::network::IPV4SocketAddress; -using std::auto_ptr; +using std::unique_ptr; using std::string; class TCPTransportTest: public CppUnit::TestFixture { @@ -55,7 +55,7 @@ class TCPTransportTest: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - TCPTransportTest(): TestFixture(), m_ss(NULL) {} + TCPTransportTest(): TestFixture(), m_ss() {} void testSinglePDU(); void testShortPreamble(); void testBadPreamble(); @@ -75,12 +75,12 @@ class TCPTransportTest: public CppUnit::TestFixture { unsigned int m_pdus_received; bool m_stream_ok; ola::network::IPV4SocketAddress m_localhost; - auto_ptr m_ss; + unique_ptr m_ss; ola::io::LoopbackDescriptor m_loopback; CID m_cid; - auto_ptr > m_rx_callback; - auto_ptr m_inflator; - auto_ptr m_transport; + unique_ptr > m_rx_callback; + unique_ptr m_inflator; + unique_ptr m_transport; void SendEmptyPDUBLock(const ola::testing::SourceLine &source_line); void SendPDU(const ola::testing::SourceLine &source_line); diff --git a/libs/acn/UDPTransportTest.cpp b/libs/acn/UDPTransportTest.cpp index c534caf369..334aabe0d0 100644 --- a/libs/acn/UDPTransportTest.cpp +++ b/libs/acn/UDPTransportTest.cpp @@ -77,7 +77,7 @@ void UDPTransportTest::Stop() { */ void UDPTransportTest::testUDPTransport() { CID cid; - std::auto_ptr > stop_closure( + std::unique_ptr > stop_closure( NewCallback(this, &UDPTransportTest::Stop)); MockInflator inflator(cid, stop_closure.get()); diff --git a/libs/usb/HotplugAgent.cpp b/libs/usb/HotplugAgent.cpp index 9834b10638..6f747e1f82 100644 --- a/libs/usb/HotplugAgent.cpp +++ b/libs/usb/HotplugAgent.cpp @@ -41,7 +41,7 @@ namespace usb { using ola::usb::AsynchronousLibUsbAdaptor; using ola::usb::LibUsbAdaptor; -using std::auto_ptr; +using std::unique_ptr; using std::pair; namespace { diff --git a/libs/usb/HotplugAgent.h b/libs/usb/HotplugAgent.h index 7882d09829..fa267e3c3f 100644 --- a/libs/usb/HotplugAgent.h +++ b/libs/usb/HotplugAgent.h @@ -132,13 +132,13 @@ class HotplugAgent { private: typedef std::map DeviceMap; - std::auto_ptr const m_notification_cb; + std::unique_ptr const m_notification_cb; const int m_debug_level; bool m_use_hotplug; libusb_context *m_context; - std::auto_ptr m_usb_thread; - std::auto_ptr m_usb_adaptor; - std::auto_ptr m_scanner_thread; + std::unique_ptr m_usb_thread; + std::unique_ptr m_usb_adaptor; + std::unique_ptr m_scanner_thread; ola::thread::Mutex m_mutex; bool m_suppress_hotplug_events; // GUARDED_BY(m_mutex); diff --git a/libs/usb/JaRulePortHandle.h b/libs/usb/JaRulePortHandle.h index bb59a175bb..1b6cb003b1 100644 --- a/libs/usb/JaRulePortHandle.h +++ b/libs/usb/JaRulePortHandle.h @@ -70,7 +70,7 @@ class JaRulePortHandle : public ola::rdm::DiscoverableRDMControllerInterface { private: // Order of destruction is important. - std::auto_ptr m_impl; + std::unique_ptr m_impl; ola::rdm::DiscoverableQueueingRDMController m_queueing_controller; static const unsigned int RDM_QUEUE_SIZE = 50; diff --git a/libs/usb/JaRulePortHandleImpl.cpp b/libs/usb/JaRulePortHandleImpl.cpp index a7387cec36..b81458315a 100644 --- a/libs/usb/JaRulePortHandleImpl.cpp +++ b/libs/usb/JaRulePortHandleImpl.cpp @@ -61,7 +61,7 @@ using ola::rdm::UID; using ola::rdm::UIDSet; using ola::rdm::RDMStatusCode; using ola::strings::ToHex; -using std::auto_ptr; +using std::unique_ptr; using std::vector; JaRulePortHandleImpl::JaRulePortHandleImpl(JaRuleWidgetPort *parent_port, @@ -120,7 +120,7 @@ void JaRulePortHandleImpl::SendRDMRequest(RDMRequest *request, void JaRulePortHandleImpl::MuteDevice(const UID &target, MuteDeviceCallback *mute_complete) { - auto_ptr request( + unique_ptr request( ola::rdm::NewMuteRequest(m_uid, target, m_transaction_number.Next(), m_physical_port + 1)); @@ -134,7 +134,7 @@ void JaRulePortHandleImpl::MuteDevice(const UID &target, } void JaRulePortHandleImpl::UnMuteAll(UnMuteDeviceCallback *unmute_complete) { - auto_ptr request( + unique_ptr request( ola::rdm::NewUnMuteRequest(m_uid, UID::AllDevices(), m_transaction_number.Next(), m_physical_port + 1)); @@ -150,7 +150,7 @@ void JaRulePortHandleImpl::UnMuteAll(UnMuteDeviceCallback *unmute_complete) { void JaRulePortHandleImpl::Branch(const UID &lower, const UID &upper, BranchCallback *branch_complete) { - auto_ptr request( + unique_ptr request( ola::rdm::NewDiscoveryUniqueBranchRequest(m_uid, lower, upper, m_transaction_number.Next())); @@ -219,7 +219,7 @@ void JaRulePortHandleImpl::MuteDeviceComplete( payload.size() > sizeof(GetSetTiming)) { // Skip the timing data & the start code. ola::rdm::RDMStatusCode status_code = rdm::RDM_INVALID_RESPONSE; - auto_ptr response(RDMResponse::InflateFromData( + unique_ptr response(RDMResponse::InflateFromData( payload.substr(sizeof(GetSetTiming) + 1), &status_code)); // TODO(simon): I guess we could ack timer the MUTE. Handle this case @@ -275,7 +275,7 @@ void JaRulePortHandleImpl::RDMComplete(const ola::rdm::RDMRequest *request_ptr, uint8_t status_flags, const ola::io::ByteString &payload) { CheckStatusFlags(status_flags); - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); ola::rdm::RDMFrames frames; if (result != COMMAND_RESULT_OK) { diff --git a/libs/usb/JaRuleWidget.cpp b/libs/usb/JaRuleWidget.cpp index b92243eddf..bc66f036e6 100644 --- a/libs/usb/JaRuleWidget.cpp +++ b/libs/usb/JaRuleWidget.cpp @@ -43,7 +43,7 @@ namespace usb { using ola::io::ByteString; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::string; namespace { @@ -226,7 +226,7 @@ bool JaRuleWidget::InternalInit() { return false; } - auto_ptr uid(UID::FromString(device_info.serial)); + unique_ptr uid(UID::FromString(device_info.serial)); if (!uid.get() || uid->IsBroadcast()) { OLA_WARN << "Invalid JaRule serial number: " << device_info.serial; return false; diff --git a/libs/usb/JaRuleWidgetPort.cpp b/libs/usb/JaRuleWidgetPort.cpp index c130732f82..7ec69f7eca 100644 --- a/libs/usb/JaRuleWidgetPort.cpp +++ b/libs/usb/JaRuleWidgetPort.cpp @@ -43,7 +43,7 @@ using ola::utils::JoinUInt8; using ola::utils::SplitUInt16; using std::cerr; using std::string; -using std::auto_ptr; +using std::unique_ptr; namespace { @@ -160,7 +160,7 @@ void JaRuleWidgetPort::CancelAll() { } while (!queued_commands.empty()) { - auto_ptr command(queued_commands.front()); + unique_ptr command(queued_commands.front()); if (command->callback) { command->callback->Run(COMMAND_RESULT_CANCELLED, RC_UNKNOWN, 0, ByteString()); @@ -224,7 +224,7 @@ void JaRuleWidgetPort::SendCommand( payload.push_back(0); } - auto_ptr command(new PendingCommand( + unique_ptr command(new PendingCommand( command_class, callback, payload)); OLA_INFO << "Adding new command " << ToHex(command_class); diff --git a/ola/OlaCallbackClient.h b/ola/OlaCallbackClient.h index 7bfa6854d9..c47d52ad35 100644 --- a/ola/OlaCallbackClient.h +++ b/ola/OlaCallbackClient.h @@ -247,9 +247,9 @@ class OlaCallbackClient: public ola::rdm::RDMAPIImplInterface { const ola::timecode::TimeCode &timecode); private: - std::auto_ptr m_core; - std::auto_ptr m_dmx_callback; - std::auto_ptr m_priority_dmx_callback; + std::unique_ptr m_core; + std::unique_ptr m_dmx_callback; + std::unique_ptr m_priority_dmx_callback; void HandlePluginList( SingleUseCallback2&, diff --git a/ola/OlaClientCore.cpp b/ola/OlaClientCore.cpp index 8dc7439f9a..f5a5c5a056 100644 --- a/ola/OlaClientCore.cpp +++ b/ola/OlaClientCore.cpp @@ -49,7 +49,7 @@ using ola::rdm::UID; using ola::rdm::UIDSet; using ola::rpc::RpcChannel; using ola::rpc::RpcController; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -653,8 +653,8 @@ void OlaClientCore::ChannelClosed(ClosedCallback *callback, void OlaClientCore::HandlePluginList(RpcController *controller_ptr, ola::proto::PluginListReply *reply_ptr, PluginListCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -682,8 +682,8 @@ void OlaClientCore::HandlePluginDescription( RpcController *controller_ptr, ola::proto::PluginDescriptionReply *reply_ptr, PluginDescriptionCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -706,8 +706,8 @@ void OlaClientCore::HandlePluginState( RpcController *controller_ptr, ola::proto::PluginStateReply *reply_ptr, PluginStateCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -738,8 +738,8 @@ void OlaClientCore::HandlePluginState( void OlaClientCore::HandleDeviceInfo(RpcController *controller_ptr, ola::proto::DeviceInfoReply *reply_ptr, DeviceInfoCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -762,8 +762,8 @@ void OlaClientCore::HandleDeviceInfo(RpcController *controller_ptr, void OlaClientCore::HandleDeviceConfig(RpcController *controller_ptr, ola::proto::DeviceConfigReply *reply_ptr, ConfigureDeviceCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -781,8 +781,8 @@ void OlaClientCore::HandleDeviceConfig(RpcController *controller_ptr, void OlaClientCore::HandleAck(RpcController *controller_ptr, ola::proto::Ack *reply_ptr, SetCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -795,8 +795,8 @@ void OlaClientCore::HandleAck(RpcController *controller_ptr, void OlaClientCore::HandleGeneralAck(RpcController *controller_ptr, ola::proto::Ack *reply_ptr, GeneralSetCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -809,8 +809,8 @@ void OlaClientCore::HandleGeneralAck(RpcController *controller_ptr, void OlaClientCore::HandleUniverseList(RpcController *controller_ptr, ola::proto::UniverseInfoReply *reply_ptr, UniverseListCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -832,8 +832,8 @@ void OlaClientCore::HandleUniverseList(RpcController *controller_ptr, void OlaClientCore::HandleUniverseInfo(RpcController *controller_ptr, ola::proto::UniverseInfoReply *reply_ptr, UniverseInfoCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -867,8 +867,8 @@ void OlaClientCore::HandleUniverseInfo(RpcController *controller_ptr, void OlaClientCore::HandleGetDmx(RpcController *controller_ptr, ola::proto::DmxData *reply_ptr, DMXCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -889,8 +889,8 @@ void OlaClientCore::HandleGetDmx(RpcController *controller_ptr, void OlaClientCore::HandleUIDList(RpcController *controller_ptr, ola::proto::UIDListReply *reply_ptr, DiscoveryCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; @@ -912,8 +912,8 @@ void OlaClientCore::HandleUIDList(RpcController *controller_ptr, void OlaClientCore::HandleRDM(RpcController *controller_ptr, ola::proto::RDMResponse *reply_ptr, RDMCallback *callback) { - auto_ptr controller(controller_ptr); - auto_ptr reply(reply_ptr); + unique_ptr controller(controller_ptr); + unique_ptr reply(reply_ptr); if (!callback) { return; diff --git a/ola/OlaClientCore.h b/ola/OlaClientCore.h index 2e3d5d661d..9213260ecb 100644 --- a/ola/OlaClientCore.h +++ b/ola/OlaClientCore.h @@ -324,9 +324,9 @@ class OlaClientCore: public ola::proto::OlaClientService { private: ola::io::ConnectedDescriptor *m_descriptor; - std::auto_ptr m_dmx_callback; - std::auto_ptr m_channel; - std::auto_ptr m_stub; + std::unique_ptr m_dmx_callback; + std::unique_ptr m_channel; + std::unique_ptr m_stub; int m_connected; void ChannelClosed(ClosedCallback *callback, ola::rpc::RpcSession *session); diff --git a/ola/StreamingClientTest.cpp b/ola/StreamingClientTest.cpp index 05fdccb5c8..dce7a5c29f 100644 --- a/ola/StreamingClientTest.cpp +++ b/ola/StreamingClientTest.cpp @@ -40,7 +40,7 @@ using ola::StreamingClient; using ola::network::GenericSocketAddress; using ola::thread::ConditionVariable; using ola::thread::Mutex; -using std::auto_ptr; +using std::unique_ptr; class StreamingClientTest: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(StreamingClientTest); @@ -77,7 +77,7 @@ class OlaServerThread: public ola::thread::Thread { GenericSocketAddress RPCAddress() const; private: - auto_ptr m_olad; + unique_ptr m_olad; bool m_is_running; Mutex m_mutex; ConditionVariable m_condition; @@ -96,7 +96,7 @@ bool OlaServerThread::Setup() { ola_options.http_data_dir = ""; // pick an unused port - auto_ptr olad(new OlaDaemon(ola_options, NULL)); + unique_ptr olad(new OlaDaemon(ola_options, NULL)); if (olad->Init()) { m_olad.reset(olad.release()); return true; diff --git a/olad/BonjourDiscoveryAgent.cpp b/olad/BonjourDiscoveryAgent.cpp index 808b4c0e93..1709fc73fe 100644 --- a/olad/BonjourDiscoveryAgent.cpp +++ b/olad/BonjourDiscoveryAgent.cpp @@ -35,7 +35,7 @@ namespace ola { using ola::network::HostToNetwork; using ola::thread::Thread; -using std::auto_ptr; +using std::unique_ptr; using std::string; static void RegisterCallback(OLA_UNUSED DNSServiceRef service, @@ -124,7 +124,7 @@ void BonjourDiscoveryAgent::RegisterService(const string &service_name, void BonjourDiscoveryAgent::InternalRegisterService(RegisterArgs *args_ptr) { - auto_ptr args(args_ptr); + unique_ptr args(args_ptr); OLA_INFO << "Adding " << args->service_name << ", " << args->type; diff --git a/olad/BonjourDiscoveryAgent.h b/olad/BonjourDiscoveryAgent.h index e31f6d090a..8423da6e24 100644 --- a/olad/BonjourDiscoveryAgent.h +++ b/olad/BonjourDiscoveryAgent.h @@ -74,7 +74,7 @@ class BonjourDiscoveryAgent : public DiscoveryAgentInterface { typedef std::vector ServiceRefs; ola::io::SelectServer m_ss; - std::auto_ptr m_thread; + std::unique_ptr m_thread; ServiceRefs m_refs; void InternalRegisterService(RegisterArgs *args); diff --git a/olad/OlaDaemon.cpp b/olad/OlaDaemon.cpp index 6c171217db..77695e6fec 100644 --- a/olad/OlaDaemon.cpp +++ b/olad/OlaDaemon.cpp @@ -58,7 +58,7 @@ using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::network::TCPAcceptingSocket; using ola::thread::MutexLocker; -using std::auto_ptr; +using std::unique_ptr; using std::string; const char OlaDaemon::OLA_CONFIG_DIR[] = ".ola"; @@ -122,13 +122,13 @@ bool OlaDaemon::Init() { if (m_export_map) { m_export_map->GetStringVar(CONFIG_DIR_KEY)->Set(config_dir); } - auto_ptr preferences_factory( + unique_ptr preferences_factory( new FileBackedPreferencesFactory(config_dir)); // Order is important here as we won't load the same plugin twice. m_plugin_loaders.push_back(new DynamicPluginLoader()); - auto_ptr server( + unique_ptr server( new OlaServer(m_plugin_loaders, preferences_factory.get(), &m_ss, m_options, NULL, m_export_map)); diff --git a/olad/OlaDaemon.h b/olad/OlaDaemon.h index 622d09fac9..e9740943b9 100644 --- a/olad/OlaDaemon.h +++ b/olad/OlaDaemon.h @@ -93,8 +93,8 @@ class OlaDaemon { std::vector m_plugin_loaders; // Populated in Init() - std::auto_ptr m_preferences_factory; - std::auto_ptr m_server; + std::unique_ptr m_preferences_factory; + std::unique_ptr m_server; std::string DefaultConfigDir(); bool InitConfigDir(const std::string &path); diff --git a/olad/OlaServer.cpp b/olad/OlaServer.cpp index 1050a0bc69..ef1ec8454f 100644 --- a/olad/OlaServer.cpp +++ b/olad/OlaServer.cpp @@ -75,7 +75,7 @@ using ola::rdm::RootPidStore; using ola::rpc::RpcChannel; using ola::rpc::RpcSession; using ola::rpc::RpcServer; -using std::auto_ptr; +using std::unique_ptr; using std::pair; using std::vector; @@ -167,7 +167,7 @@ bool OlaServer::Init() { return false; } - auto_ptr pid_store( + unique_ptr pid_store( RootPidStore::LoadFromDirectory(m_options.pid_data_dir)); if (!pid_store.get()) { OLA_WARN << "No PID definitions loaded"; @@ -180,7 +180,7 @@ bool OlaServer::Init() { // fetch the interface info ola::network::Interface iface; { - auto_ptr picker( + unique_ptr picker( ola::network::InterfacePicker::NewPicker()); if (!picker->ChooseInterface(&iface, m_options.network_interface)) { OLA_WARN << "No network interface found"; @@ -209,28 +209,28 @@ bool OlaServer::Init() { UNIVERSE_PREFERENCES); universe_preferences->Load(); - auto_ptr universe_store( + unique_ptr universe_store( new UniverseStore(universe_preferences, m_export_map)); - auto_ptr port_broker(new PortBroker()); + unique_ptr port_broker(new PortBroker()); - auto_ptr port_manager( + unique_ptr port_manager( new PortManager(universe_store.get(), port_broker.get())); - auto_ptr broker(new ClientBroker()); + unique_ptr broker(new ClientBroker()); - auto_ptr device_manager( + unique_ptr device_manager( new DeviceManager(m_preferences_factory, port_manager.get())); - auto_ptr plugin_adaptor( + unique_ptr plugin_adaptor( new PluginAdaptor(device_manager.get(), m_ss, m_export_map, m_preferences_factory, port_broker.get(), &m_instance_name, &m_default_uid)); - auto_ptr plugin_manager( + unique_ptr plugin_manager( new PluginManager(m_plugin_loaders, plugin_adaptor.get())); - auto_ptr service_impl(new OlaServerServiceImpl( + unique_ptr service_impl(new OlaServerServiceImpl( universe_store.get(), device_manager.get(), plugin_manager.get(), @@ -245,7 +245,7 @@ bool OlaServer::Init() { rpc_options.listen_port = FLAGS_rpc_port; rpc_options.export_map = m_export_map; - auto_ptr rpc_server( + unique_ptr rpc_server( new RpcServer(m_ss, service_impl.get(), this, rpc_options)); if (!rpc_server->Init()) { @@ -254,7 +254,7 @@ bool OlaServer::Init() { } // Discovery - auto_ptr discovery_agent; + unique_ptr discovery_agent; if (FLAGS_register_with_dns_sd) { DiscoveryAgentFactory discovery_agent_factory; discovery_agent.reset(discovery_agent_factory.New()); @@ -362,7 +362,7 @@ void OlaServer::NewClient(RpcSession *session) { } void OlaServer::ClientRemoved(RpcSession *session) { - auto_ptr client(reinterpret_cast(session->GetData())); + unique_ptr client(reinterpret_cast(session->GetData())); session->SetData(NULL); m_broker->RemoveClient(client.get()); @@ -412,7 +412,7 @@ bool OlaServer::StartHttpServer(ola::rpc::RpcServer *server, // create a pipe for the HTTP server to communicate with the main // server on. - auto_ptr pipe_descriptor( + unique_ptr pipe_descriptor( new ola::io::PipeDescriptor()); if (!pipe_descriptor->Init()) { return false; @@ -425,7 +425,7 @@ bool OlaServer::StartHttpServer(ola::rpc::RpcServer *server, m_options.http_data_dir); options.enable_quit = m_options.http_enable_quit; - auto_ptr httpd( + unique_ptr httpd( new OladHTTPServer(m_export_map, options, pipe_descriptor->OppositeEnd(), this, iface)); diff --git a/olad/OlaServer.h b/olad/OlaServer.h index 7858c437f6..942b155d95 100644 --- a/olad/OlaServer.h +++ b/olad/OlaServer.h @@ -178,27 +178,27 @@ class OlaServer : public ola::rpc::RpcSessionHandlerInterface { ola::network::TCPAcceptingSocket *m_accepting_socket; class ExportMap *m_export_map; - std::auto_ptr m_our_export_map; + std::unique_ptr m_our_export_map; ola::rdm::UID m_default_uid; // These are all populated in Init. - std::auto_ptr m_device_manager; - std::auto_ptr m_plugin_manager; - std::auto_ptr m_plugin_adaptor; - std::auto_ptr m_universe_store; - std::auto_ptr m_port_manager; - std::auto_ptr m_service_impl; - std::auto_ptr m_broker; - std::auto_ptr m_port_broker; - std::auto_ptr m_pid_store; - std::auto_ptr m_discovery_agent; - std::auto_ptr m_rpc_server; + std::unique_ptr m_device_manager; + std::unique_ptr m_plugin_manager; + std::unique_ptr m_plugin_adaptor; + std::unique_ptr m_universe_store; + std::unique_ptr m_port_manager; + std::unique_ptr m_service_impl; + std::unique_ptr m_broker; + std::unique_ptr m_port_broker; + std::unique_ptr m_pid_store; + std::unique_ptr m_discovery_agent; + std::unique_ptr m_rpc_server; class Preferences *m_server_preferences; class Preferences *m_universe_preferences; std::string m_instance_name; ola::thread::timeout_id m_housekeeping_timeout; - std::auto_ptr m_httpd; + std::unique_ptr m_httpd; bool RunHousekeeping(); diff --git a/olad/OlaServerServiceImpl.h b/olad/OlaServerServiceImpl.h index 3e7350c217..4006887cdc 100644 --- a/olad/OlaServerServiceImpl.h +++ b/olad/OlaServerServiceImpl.h @@ -296,7 +296,7 @@ class OlaServerServiceImpl : public ola::proto::OlaServerService { class PortManager *m_port_manager; class ClientBroker *m_broker; const class TimeStamp *m_wake_up_time; - std::auto_ptr m_reload_plugins_callback; + std::unique_ptr m_reload_plugins_callback; }; } // namespace ola #endif // OLAD_OLASERVERSERVICEIMPL_H_ diff --git a/olad/Olad.cpp b/olad/Olad.cpp index cf1927a285..4038bde062 100644 --- a/olad/Olad.cpp +++ b/olad/Olad.cpp @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) { options.network_interface = FLAGS_interface.str(); options.pid_data_dir = FLAGS_pid_location.str(); - std::auto_ptr olad(new OlaDaemon(options, &export_map)); + std::unique_ptr olad(new OlaDaemon(options, &export_map)); if (!olad.get()) { return ola::EXIT_UNAVAILABLE; } diff --git a/olad/plugin_api/Client.h b/olad/plugin_api/Client.h index 5c1cddc523..0c98060b5c 100644 --- a/olad/plugin_api/Client.h +++ b/olad/plugin_api/Client.h @@ -99,7 +99,7 @@ class Client { void SendDMXCallback(ola::rpc::RpcController *controller, ola::proto::Ack *ack); - std::auto_ptr m_client_stub; + std::unique_ptr m_client_stub; std::map m_data_map; ola::rdm::UID m_uid; diff --git a/olad/plugin_api/Port.cpp b/olad/plugin_api/Port.cpp index b377db0aca..4ffd1375d1 100644 --- a/olad/plugin_api/Port.cpp +++ b/olad/plugin_api/Port.cpp @@ -31,7 +31,7 @@ namespace ola { -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -94,7 +94,7 @@ void BasicInputPort::DmxChanged() { void BasicInputPort::HandleRDMRequest(ola::rdm::RDMRequest *request_ptr, ola::rdm::RDMCallback *callback) { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); if (m_universe) { m_plugin_adaptor->GetPortBroker()->SendRDMRequest( this, @@ -167,7 +167,7 @@ bool BasicOutputPort::SetPriority(uint8_t priority) { void BasicOutputPort::SendRDMRequest(ola::rdm::RDMRequest *request_ptr, ola::rdm::RDMCallback *callback) { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); // broadcasts go to every port if (request->DestinationUID().IsBroadcast()) { diff --git a/olad/plugin_api/Preferences.cpp b/olad/plugin_api/Preferences.cpp index 32441b40d4..f3cd8d4add 100644 --- a/olad/plugin_api/Preferences.cpp +++ b/olad/plugin_api/Preferences.cpp @@ -72,8 +72,8 @@ namespace { void SavePreferencesToFile( const string *filename_ptr, const FilePreferenceSaverThread::PreferencesMap *pref_map_ptr) { - std::auto_ptr filename(filename_ptr); - std::auto_ptr pref_map( + std::unique_ptr filename(filename_ptr); + std::unique_ptr pref_map( pref_map_ptr); FilePreferenceSaverThread::PreferencesMap::const_iterator iter; diff --git a/olad/plugin_api/TestCommon.h b/olad/plugin_api/TestCommon.h index ea53c940a3..cff43e755d 100644 --- a/olad/plugin_api/TestCommon.h +++ b/olad/plugin_api/TestCommon.h @@ -163,7 +163,7 @@ class TestMockRDMOutputPort: public TestMockOutputPort { private: ola::rdm::UIDSet *m_uids; - std::auto_ptr m_rdm_handler; + std::unique_ptr m_rdm_handler; }; diff --git a/olad/plugin_api/Universe.cpp b/olad/plugin_api/Universe.cpp index 460c7a84a2..68ac5be650 100644 --- a/olad/plugin_api/Universe.cpp +++ b/olad/plugin_api/Universe.cpp @@ -59,7 +59,7 @@ using ola::rdm::RDMRequest; using ola::rdm::RunRDMCallback; using ola::rdm::UID; using ola::strings::ToHex; -using std::auto_ptr; +using std::unique_ptr; using std::map; using std::ostringstream; using std::set; @@ -455,7 +455,7 @@ void Universe::CleanStaleSourceClients() { */ void Universe::SendRDMRequest(RDMRequest *request_ptr, ola::rdm::RDMCallback *callback) { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); OLA_INFO << "Universe " << UniverseId() << ", RDM request to " << request->DestinationUID() << ", SD: " << request->SubDevice() diff --git a/plugins/artnet/ArtNetDevice.cpp b/plugins/artnet/ArtNetDevice.cpp index 22d898474f..61938cd040 100644 --- a/plugins/artnet/ArtNetDevice.cpp +++ b/plugins/artnet/ArtNetDevice.cpp @@ -51,7 +51,7 @@ using ola::StringToInt; using ola::network::IPV4Address; using ola::plugin::artnet::Reply; using ola::plugin::artnet::Request; -using std::auto_ptr; +using std::unique_ptr; using std::ostringstream; using std::string; using std::vector; @@ -88,7 +88,7 @@ bool ArtNetDevice::StartHook() { m_preferences->GetValue(K_NET_KEY), K_ARTNET_NET); ola::network::Interface iface; - auto_ptr picker( + unique_ptr picker( ola::network::InterfacePicker::NewPicker()); ola::network::InterfacePicker::Options options; options.include_loopback = m_preferences->GetValueAsBool(K_LOOPBACK_KEY); diff --git a/plugins/artnet/ArtNetNode.cpp b/plugins/artnet/ArtNetNode.cpp index 0cea8f9302..730ae924cc 100644 --- a/plugins/artnet/ArtNetNode.cpp +++ b/plugins/artnet/ArtNetNode.cpp @@ -66,7 +66,7 @@ using ola::rdm::UID; using ola::rdm::UIDSet; using ola::strings::CopyToFixedLengthBuffer; using ola::strings::ToHex; -using std::auto_ptr; +using std::unique_ptr; using std::map; using std::pair; using std::set; @@ -93,7 +93,7 @@ class ArtNetNodeImpl::InputPort { pending_request(NULL), rdm_send_timeout(ola::thread::INVALID_TIMEOUT), m_port_address(0), - m_tod_callback(NULL) { + m_tod_callback() { } ~InputPort() {} @@ -180,7 +180,7 @@ class ArtNetNodeImpl::InputPort { uint8_t m_port_address; // The callback to run if we receive an TOD and the discovery process // isn't running - auto_ptr m_tod_callback; + unique_ptr m_tod_callback; void RunRDMCallbackWithUIDs(const uid_map &uids, RDMDiscoveryCallback *callback) { @@ -659,7 +659,7 @@ void ArtNetNodeImpl::RunIncrementalDiscovery( void ArtNetNodeImpl::SendRDMRequest(uint8_t port_id, RDMRequest *request_ptr, RDMCallback *on_complete) { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); if (request->CommandClass() == RDMCommand::DISCOVER_COMMAND) { RunRDMCallback(on_complete, ola::rdm::RDM_PLUGIN_DISCOVERY_NOT_SUPPORTED); return; @@ -1353,7 +1353,7 @@ void ArtNetNodeImpl::RDMRequestCompletion( void ArtNetNodeImpl::HandleRDMResponse(InputPort *port, const RDMFrame &frame, const IPV4Address &source_address) { - auto_ptr reply(ola::rdm::RDMReply::FromFrame(frame)); + unique_ptr reply(ola::rdm::RDMReply::FromFrame(frame)); // Without a valid response, we don't know which request this matches. This // makes Art-Net rather useless for RDM regression testing diff --git a/plugins/artnet/ArtNetNode.h b/plugins/artnet/ArtNetNode.h index cc497607d0..855c095b6f 100644 --- a/plugins/artnet/ArtNetNode.h +++ b/plugins/artnet/ArtNetNode.h @@ -406,7 +406,7 @@ class ArtNetNodeImpl { InputPorts m_input_ports; OutputPort m_output_ports[ARTNET_MAX_PORTS]; ola::network::Interface m_interface; - std::auto_ptr m_socket; + std::unique_ptr m_socket; /** * @brief Called when there is data on this socket diff --git a/plugins/artnet/artnet_loadtest.cpp b/plugins/artnet/artnet_loadtest.cpp index 1eb065d2c4..65398dc404 100644 --- a/plugins/artnet/artnet_loadtest.cpp +++ b/plugins/artnet/artnet_loadtest.cpp @@ -38,7 +38,7 @@ using ola::network::Interface; using ola::network::InterfacePicker; using ola::plugin::artnet::ArtNetNode; using ola::plugin::artnet::ArtNetNodeOptions; -using std::auto_ptr; +using std::unique_ptr; using std::cout; using std::endl; using std::min; @@ -73,7 +73,7 @@ int main(int argc, char* argv[]) { Interface iface; { - auto_ptr picker(InterfacePicker::NewPicker()); + unique_ptr picker(InterfacePicker::NewPicker()); if (!picker->ChooseInterface(&iface, FLAGS_iface.str())) { return -1; diff --git a/plugins/dummy/DummyPlugin.cpp b/plugins/dummy/DummyPlugin.cpp index 6c257f0312..412fdaf02a 100644 --- a/plugins/dummy/DummyPlugin.cpp +++ b/plugins/dummy/DummyPlugin.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include "ola/StringUtils.h" @@ -100,7 +101,7 @@ bool DummyPlugin::StartHook() { options.number_of_network_responders = DEFAULT_DEVICE_COUNT; } - std::auto_ptr device( + std::unique_ptr device( new DummyDevice(this, DEVICE_NAME, options)); if (!device->Start()) { return false; diff --git a/plugins/dummy/DummyPort.cpp b/plugins/dummy/DummyPort.cpp index 73f4c2338b..26606bd1a0 100644 --- a/plugins/dummy/DummyPort.cpp +++ b/plugins/dummy/DummyPort.cpp @@ -46,7 +46,7 @@ using ola::rdm::DummyResponder; using ola::rdm::RDMDiscoveryCallback; using ola::rdm::RunRDMCallback; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::map; using std::ostringstream; using std::string; @@ -61,7 +61,7 @@ void AddResponders(map *responders, ola::rdm::UIDAllocator *uid_allocator, unsigned int count) { for (unsigned int i = 0; i < count; i++) { - auto_ptr uid(uid_allocator->AllocateNext()); + unique_ptr uid(uid_allocator->AllocateNext()); if (!uid.get()) { OLA_WARN << "Insufficient UIDs to create Dummy RDM devices"; break; @@ -83,7 +83,7 @@ DummyPort::DummyPort(DummyDevice *parent, // This can't be done via AddResponders as we need to also tell it how many // sub devices to add for (unsigned int i = 0; i < options.number_of_dimmers; i++) { - auto_ptr uid(allocator.AllocateNext()); + unique_ptr uid(allocator.AllocateNext()); if (!uid.get()) { OLA_WARN << "Insufficient UIDs to create dummy RDM devices"; break; @@ -130,7 +130,7 @@ void DummyPort::RunIncrementalDiscovery(RDMDiscoveryCallback *callback) { void DummyPort::SendRDMRequest(ola::rdm::RDMRequest *request_ptr, ola::rdm::RDMCallback *callback) { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); UID dest = request->DestinationUID(); if (dest.IsBroadcast()) { diff --git a/plugins/e131/E131Device.h b/plugins/e131/E131Device.h index e819a3144c..b78f826355 100644 --- a/plugins/e131/E131Device.h +++ b/plugins/e131/E131Device.h @@ -70,7 +70,7 @@ class E131Device: public ola::Device { private: class PluginAdaptor *m_plugin_adaptor; - std::auto_ptr m_node; + std::unique_ptr m_node; const E131DeviceOptions m_options; std::vector m_input_ports; std::vector m_output_ports; diff --git a/plugins/gpio/GPIOPlugin.cpp b/plugins/gpio/GPIOPlugin.cpp index 5d9bbfb8d3..61a2d67cd4 100644 --- a/plugins/gpio/GPIOPlugin.cpp +++ b/plugins/gpio/GPIOPlugin.cpp @@ -34,7 +34,7 @@ namespace ola { namespace plugin { namespace gpio { -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -91,7 +91,7 @@ bool GPIOPlugin::StartHook() { return true; } - std::auto_ptr device(new GPIODevice(this, options)); + std::unique_ptr device(new GPIODevice(this, options)); if (!device->Start()) { return false; } diff --git a/plugins/gpio/GPIOPort.h b/plugins/gpio/GPIOPort.h index fc8e45daeb..be3e4eb532 100644 --- a/plugins/gpio/GPIOPort.h +++ b/plugins/gpio/GPIOPort.h @@ -21,6 +21,7 @@ #ifndef PLUGINS_GPIO_GPIOPORT_H_ #define PLUGINS_GPIO_GPIOPORT_H_ +#include #include #include "ola/DmxBuffer.h" #include "olad/Port.h" @@ -60,7 +61,7 @@ class GPIOOutputPort: public BasicOutputPort { bool WriteDMX(const DmxBuffer &buffer, uint8_t priority); private: - std::auto_ptr m_driver; + std::unique_ptr m_driver; DISALLOW_COPY_AND_ASSIGN(GPIOOutputPort); }; diff --git a/plugins/kinet/KiNetDevice.cpp b/plugins/kinet/KiNetDevice.cpp index 391e0f15a6..d977e59e39 100644 --- a/plugins/kinet/KiNetDevice.cpp +++ b/plugins/kinet/KiNetDevice.cpp @@ -41,7 +41,7 @@ namespace plugin { namespace kinet { using ola::network::IPV4Address; -using std::auto_ptr; +using std::unique_ptr; using std::ostringstream; using std::set; using std::string; diff --git a/plugins/kinet/KiNetNode.cpp b/plugins/kinet/KiNetNode.cpp index 895d989ec2..7269e8be3b 100644 --- a/plugins/kinet/KiNetNode.cpp +++ b/plugins/kinet/KiNetNode.cpp @@ -36,7 +36,7 @@ using ola::network::HostToNetwork; using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::network::UDPSocket; -using std::auto_ptr; +using std::unique_ptr; const uint16_t KiNetNode::KINET_PORT = 6038; const uint32_t KiNetNode::KINET_MAGIC_NUMBER = 0x0401dc4a; @@ -208,7 +208,7 @@ void KiNetNode::PopulatePacketHeader(uint16_t msg_type) { * Setup the networking components. */ bool KiNetNode::InitNetwork() { - std::auto_ptr socket(m_socket.release()); + std::unique_ptr socket(m_socket.release()); if (!socket.get()) socket.reset(new UDPSocket()); diff --git a/plugins/kinet/KiNetNode.h b/plugins/kinet/KiNetNode.h index a35d893788..3b08a9f712 100644 --- a/plugins/kinet/KiNetNode.h +++ b/plugins/kinet/KiNetNode.h @@ -62,7 +62,7 @@ class KiNetNode { ola::io::IOQueue m_output_queue; ola::io::BigEndianOutputStream m_output_stream; ola::network::Interface m_interface; - std::auto_ptr m_socket; + std::unique_ptr m_socket; void SocketReady(); void PopulatePacketHeader(uint16_t msg_type); diff --git a/plugins/milinst/MilInstDevice.h b/plugins/milinst/MilInstDevice.h index db7e40c308..878925325a 100644 --- a/plugins/milinst/MilInstDevice.h +++ b/plugins/milinst/MilInstDevice.h @@ -50,7 +50,7 @@ class MilInstDevice: public ola::Device { private: std::string m_path; class Preferences *m_preferences; - std::auto_ptr m_widget; + std::unique_ptr m_widget; static const char MILINST_DEVICE_NAME[]; diff --git a/plugins/nanoleaf/NanoleafDevice.cpp b/plugins/nanoleaf/NanoleafDevice.cpp index fb51a12af7..4d411159f4 100644 --- a/plugins/nanoleaf/NanoleafDevice.cpp +++ b/plugins/nanoleaf/NanoleafDevice.cpp @@ -42,7 +42,7 @@ namespace nanoleaf { using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; diff --git a/plugins/nanoleaf/NanoleafNode.cpp b/plugins/nanoleaf/NanoleafNode.cpp index b421c5528d..da8fe95cd3 100644 --- a/plugins/nanoleaf/NanoleafNode.cpp +++ b/plugins/nanoleaf/NanoleafNode.cpp @@ -35,7 +35,7 @@ namespace nanoleaf { using ola::network::IPV4SocketAddress; using ola::network::UDPSocket; -using std::auto_ptr; +using std::unique_ptr; using std::vector; /* @@ -157,7 +157,7 @@ void NanoleafNode::SocketReady() { * Setup the networking components. */ bool NanoleafNode::InitNetwork() { - std::auto_ptr socket(m_socket.release()); + std::unique_ptr socket(m_socket.release()); if (!socket.get()) { socket.reset(new UDPSocket()); diff --git a/plugins/nanoleaf/NanoleafNode.h b/plugins/nanoleaf/NanoleafNode.h index dc5208e94c..6b7446d010 100644 --- a/plugins/nanoleaf/NanoleafNode.h +++ b/plugins/nanoleaf/NanoleafNode.h @@ -58,7 +58,7 @@ class NanoleafNode { ola::io::IOQueue m_output_queue; ola::io::OutputStream m_output_stream; ola::network::Interface m_interface; - std::auto_ptr m_socket; + std::unique_ptr m_socket; void SocketReady(); bool InitNetwork(); diff --git a/plugins/openpixelcontrol/OPCClient.h b/plugins/openpixelcontrol/OPCClient.h index 0d4dba8cea..a4c39ab2d5 100644 --- a/plugins/openpixelcontrol/OPCClient.h +++ b/plugins/openpixelcontrol/OPCClient.h @@ -94,9 +94,9 @@ class OPCClient { ola::io::MemoryBlockPool m_pool; ola::network::TCPSocketFactory m_socket_factory; ola::network::AdvancedTCPConnector m_tcp_connector; - std::auto_ptr m_client_socket; - std::auto_ptr m_sender; - std::auto_ptr m_socket_callback; + std::unique_ptr m_client_socket; + std::unique_ptr m_sender; + std::unique_ptr m_socket_callback; void SocketConnected(ola::network::TCPSocket *socket); void NewData(); diff --git a/plugins/openpixelcontrol/OPCClientTest.cpp b/plugins/openpixelcontrol/OPCClientTest.cpp index 850c523eee..bd09409d52 100644 --- a/plugins/openpixelcontrol/OPCClientTest.cpp +++ b/plugins/openpixelcontrol/OPCClientTest.cpp @@ -39,7 +39,7 @@ using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::plugin::openpixelcontrol::OPCClient; using ola::plugin::openpixelcontrol::OPCServer; -using std::auto_ptr; +using std::unique_ptr; class OPCClientTest: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(OPCClientTest); @@ -57,7 +57,7 @@ class OPCClientTest: public CppUnit::TestFixture { private: ola::io::SelectServer m_ss; - auto_ptr m_server; + unique_ptr m_server; DmxBuffer m_received_data; uint8_t m_command; diff --git a/plugins/openpixelcontrol/OPCDevice.h b/plugins/openpixelcontrol/OPCDevice.h index a1ff7509e1..beb2a2aad6 100644 --- a/plugins/openpixelcontrol/OPCDevice.h +++ b/plugins/openpixelcontrol/OPCDevice.h @@ -61,7 +61,7 @@ class OPCServerDevice: public ola::Device { PluginAdaptor* const m_plugin_adaptor; Preferences* const m_preferences; const ola::network::IPV4SocketAddress m_listen_addr; - std::auto_ptr m_server; + std::unique_ptr m_server; DISALLOW_COPY_AND_ASSIGN(OPCServerDevice); }; @@ -91,7 +91,7 @@ class OPCClientDevice: public ola::Device { PluginAdaptor* const m_plugin_adaptor; Preferences* const m_preferences; const ola::network::IPV4SocketAddress m_target; - std::auto_ptr m_client; + std::unique_ptr m_client; DISALLOW_COPY_AND_ASSIGN(OPCClientDevice); }; diff --git a/plugins/openpixelcontrol/OPCPlugin.cpp b/plugins/openpixelcontrol/OPCPlugin.cpp index d69e56d568..860fcb1ff2 100644 --- a/plugins/openpixelcontrol/OPCPlugin.cpp +++ b/plugins/openpixelcontrol/OPCPlugin.cpp @@ -90,7 +90,7 @@ void OPCPlugin::AddDevices(const std::string &key) { continue; } - std::auto_ptr device(new DeviceClass( + std::unique_ptr device(new DeviceClass( this, m_plugin_adaptor, m_preferences, target)); if (!device->Start()) { diff --git a/plugins/openpixelcontrol/OPCServer.cpp b/plugins/openpixelcontrol/OPCServer.cpp index 3768f2d722..829e388ae2 100644 --- a/plugins/openpixelcontrol/OPCServer.cpp +++ b/plugins/openpixelcontrol/OPCServer.cpp @@ -82,7 +82,7 @@ OPCServer::~OPCServer() { } bool OPCServer::Init() { - std::auto_ptr listening_socket( + std::unique_ptr listening_socket( new TCPAcceptingSocket(&m_tcp_socket_factory)); if (!listening_socket->Listen(m_listen_addr)) { return false; diff --git a/plugins/openpixelcontrol/OPCServer.h b/plugins/openpixelcontrol/OPCServer.h index 62984f04a4..6ff703a6d6 100644 --- a/plugins/openpixelcontrol/OPCServer.h +++ b/plugins/openpixelcontrol/OPCServer.h @@ -112,7 +112,7 @@ class OPCServer { const ola::network::IPV4SocketAddress m_listen_addr; ola::network::TCPSocketFactory m_tcp_socket_factory; - std::auto_ptr m_listening_socket; + std::unique_ptr m_listening_socket; ClientMap m_clients; std::map m_callbacks; diff --git a/plugins/openpixelcontrol/OPCServerTest.cpp b/plugins/openpixelcontrol/OPCServerTest.cpp index 5c0ec9314d..4a53b214f6 100644 --- a/plugins/openpixelcontrol/OPCServerTest.cpp +++ b/plugins/openpixelcontrol/OPCServerTest.cpp @@ -39,7 +39,7 @@ using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::network::TCPSocket; using ola::plugin::openpixelcontrol::OPCServer; -using std::auto_ptr; +using std::unique_ptr; class OPCServerTest: public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(OPCServerTest); @@ -63,8 +63,8 @@ class OPCServerTest: public CppUnit::TestFixture { private: ola::io::SelectServer m_ss; - auto_ptr m_server; - auto_ptr m_client_socket; + unique_ptr m_server; + unique_ptr m_client_socket; DmxBuffer m_received_data; uint8_t m_command; diff --git a/plugins/osc/OSCDevice.h b/plugins/osc/OSCDevice.h index de47163cc7..fee74547bf 100644 --- a/plugins/osc/OSCDevice.h +++ b/plugins/osc/OSCDevice.h @@ -62,7 +62,7 @@ class OSCDevice: public Device { PluginAdaptor *m_plugin_adaptor; const std::vector m_port_addresses; const PortConfigs m_port_configs; - std::auto_ptr m_osc_node; + std::unique_ptr m_osc_node; bool StartHook(); diff --git a/plugins/osc/OSCNode.h b/plugins/osc/OSCNode.h index 2a2347d2df..850338357e 100644 --- a/plugins/osc/OSCNode.h +++ b/plugins/osc/OSCNode.h @@ -148,7 +148,7 @@ class OSCNode { explicit OSCInputGroup(DMXCallback *callback) : callback(callback) {} DmxBuffer dmx; - std::auto_ptr callback; + std::unique_ptr callback; }; typedef std::map OutputGroupMap; @@ -161,7 +161,7 @@ class OSCNode { ola::io::SelectServerInterface *m_ss; const uint16_t m_listen_port; - std::auto_ptr m_descriptor; + std::unique_ptr m_descriptor; lo_server m_osc_server; OutputGroupMap m_output_map; InputUniverseMap m_input_map; diff --git a/plugins/osc/OSCNodeTest.cpp b/plugins/osc/OSCNodeTest.cpp index ebc11dac42..13026e92c1 100644 --- a/plugins/osc/OSCNodeTest.cpp +++ b/plugins/osc/OSCNodeTest.cpp @@ -41,7 +41,7 @@ using ola::network::IPV4SocketAddress; using ola::network::UDPSocket; using ola::plugin::osc::OSCNode; using ola::plugin::osc::OSCTarget; -using std::auto_ptr; +using std::unique_ptr; /** @@ -79,7 +79,7 @@ class OSCNodeTest: public CppUnit::TestFixture { private: ola::io::SelectServer m_ss; - auto_ptr m_osc_node; + unique_ptr m_osc_node; UDPSocket m_udp_socket; ola::thread::timeout_id m_timeout_id; DmxBuffer m_dmx_data; diff --git a/plugins/osc/OSCPlugin.cpp b/plugins/osc/OSCPlugin.cpp index 681a19147f..1d4c9e271c 100644 --- a/plugins/osc/OSCPlugin.cpp +++ b/plugins/osc/OSCPlugin.cpp @@ -102,7 +102,7 @@ bool OSCPlugin::StartHook() { } // Finally create the new OSCDevice, start it and register the device. - std::auto_ptr device( + std::unique_ptr device( new OSCDevice(this, m_plugin_adaptor, udp_port, port_addresses, port_configs)); if (!device->Start()) { diff --git a/plugins/renard/RenardDevice.h b/plugins/renard/RenardDevice.h index ce0bf44db7..ea5640221b 100644 --- a/plugins/renard/RenardDevice.h +++ b/plugins/renard/RenardDevice.h @@ -48,7 +48,7 @@ class RenardDevice: public ola::Device { void PrePortStop(); private: - std::auto_ptr m_widget; + std::unique_ptr m_widget; const std::string m_dev_path; class Preferences *m_preferences; diff --git a/plugins/shownet/ShowNetNodeTest.cpp b/plugins/shownet/ShowNetNodeTest.cpp index 26e98805b0..6a118a07f6 100644 --- a/plugins/shownet/ShowNetNodeTest.cpp +++ b/plugins/shownet/ShowNetNodeTest.cpp @@ -69,7 +69,7 @@ class ShowNetNodeTest: public CppUnit::TestFixture { void SendAndReceiveForUniverse(unsigned int universe); private: int m_handler_called; - std::auto_ptr m_node; + std::unique_ptr m_node; static const uint8_t EXPECTED_PACKET[]; static const uint8_t EXPECTED_PACKET2[]; diff --git a/plugins/spi/SPIDevice.cpp b/plugins/spi/SPIDevice.cpp index 693cfd2335..8381e5480a 100644 --- a/plugins/spi/SPIDevice.cpp +++ b/plugins/spi/SPIDevice.cpp @@ -39,7 +39,7 @@ namespace plugin { namespace spi { using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::ostringstream; using std::set; using std::string; @@ -115,7 +115,7 @@ SPIDevice::SPIDevice(SPIPlugin *owner, spi_output_options.pixel_count = pixel_count; } - auto_ptr uid(uid_allocator->AllocateNext()); + unique_ptr uid(uid_allocator->AllocateNext()); if (!uid.get()) { OLA_WARN << "Insufficient UIDs remaining to allocate a UID for SPI port " << static_cast(i); diff --git a/plugins/spi/SPIDevice.h b/plugins/spi/SPIDevice.h index 439610eac9..39ea00c9af 100644 --- a/plugins/spi/SPIDevice.h +++ b/plugins/spi/SPIDevice.h @@ -56,8 +56,8 @@ class SPIDevice: public ola::Device { private: typedef std::vector SPIPorts; - std::auto_ptr m_writer; - std::auto_ptr m_backend; + std::unique_ptr m_writer; + std::unique_ptr m_backend; class Preferences *m_preferences; class PluginAdaptor *m_plugin_adaptor; SPIPorts m_spi_ports; diff --git a/plugins/spi/SPIOutput.h b/plugins/spi/SPIOutput.h index ed37e9b3e7..8513f54013 100644 --- a/plugins/spi/SPIOutput.h +++ b/plugins/spi/SPIOutput.h @@ -118,10 +118,10 @@ class SPIOutput: public ola::rdm::DiscoverableRDMControllerInterface { std::string m_device_label; uint16_t m_start_address; // starts from 1 bool m_identify_mode; - std::auto_ptr m_personality_collection; - std::auto_ptr m_personality_manager; + std::unique_ptr m_personality_collection; + std::unique_ptr m_personality_manager; ola::rdm::Sensors m_sensors; - std::auto_ptr m_network_manager; + std::unique_ptr m_network_manager; // DMX methods bool InternalWriteDMX(const DmxBuffer &buffer); diff --git a/plugins/spi/SPIPlugin.cpp b/plugins/spi/SPIPlugin.cpp index 5ea205d130..3ce5a1953d 100644 --- a/plugins/spi/SPIPlugin.cpp +++ b/plugins/spi/SPIPlugin.cpp @@ -38,7 +38,7 @@ namespace plugin { namespace spi { using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -55,7 +55,7 @@ const char SPIPlugin::SPI_DEVICE_PREFIX_KEY[] = "device_prefix"; */ bool SPIPlugin::StartHook() { const string uid_str = m_preferences->GetValue(SPI_BASE_UID_KEY); - auto_ptr base_uid(UID::FromString(uid_str)); + unique_ptr base_uid(UID::FromString(uid_str)); if (!base_uid.get()) { OLA_WARN << "Invalid UID " << uid_str << ", defaulting to " << DEFAULT_BASE_UID; diff --git a/plugins/spidmx/SPIDMXDevice.h b/plugins/spidmx/SPIDMXDevice.h index c35eaef439..820dcba838 100644 --- a/plugins/spidmx/SPIDMXDevice.h +++ b/plugins/spidmx/SPIDMXDevice.h @@ -55,8 +55,8 @@ class SPIDMXDevice : public Device { void SetDefaults(); - std::auto_ptr m_widget; - std::auto_ptr m_thread; + std::unique_ptr m_widget; + std::unique_ptr m_thread; class Preferences *m_preferences; PluginAdaptor *m_plugin_adaptor; const std::string m_name; diff --git a/plugins/spidmx/SPIDMXThread.h b/plugins/spidmx/SPIDMXThread.h index 664c6b7845..11393301f7 100644 --- a/plugins/spidmx/SPIDMXThread.h +++ b/plugins/spidmx/SPIDMXThread.h @@ -67,7 +67,7 @@ class SPIDMXThread : public ola::thread::Thread { std::vector m_spi_tx_buffer; /** called when a new m_dmx_rx_buffer is ready */ - std::auto_ptr > m_receive_callback; + std::unique_ptr > m_receive_callback; ola::thread::Mutex m_term_mutex; ola::thread::Mutex m_buffer_mutex; diff --git a/plugins/stageprofi/StageProfiDetector.h b/plugins/stageprofi/StageProfiDetector.h index 847c2de550..35adcbe275 100644 --- a/plugins/stageprofi/StageProfiDetector.h +++ b/plugins/stageprofi/StageProfiDetector.h @@ -57,7 +57,7 @@ class StageProfiDetector { typedef std::map DescriptorMap; ola::io::SelectServerInterface *m_ss; - std::auto_ptr m_callback; + std::unique_ptr m_callback; ola::thread::timeout_id m_timeout_id; DescriptorMap m_usb_widgets; DescriptorMap m_tcp_widgets; diff --git a/plugins/stageprofi/StageProfiDevice.h b/plugins/stageprofi/StageProfiDevice.h index af94c1c417..4c5230c029 100644 --- a/plugins/stageprofi/StageProfiDevice.h +++ b/plugins/stageprofi/StageProfiDevice.h @@ -61,7 +61,7 @@ class StageProfiDevice: public Device { private: std::string m_path; - std::auto_ptr m_widget; + std::unique_ptr m_widget; }; } // namespace stageprofi } // namespace plugin diff --git a/plugins/stageprofi/StageProfiPlugin.cpp b/plugins/stageprofi/StageProfiPlugin.cpp index 4a0e35e742..8216e2480f 100644 --- a/plugins/stageprofi/StageProfiPlugin.cpp +++ b/plugins/stageprofi/StageProfiPlugin.cpp @@ -41,7 +41,7 @@ namespace plugin { namespace stageprofi { using ola::io::ConnectedDescriptor; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -115,7 +115,7 @@ void StageProfiPlugin::NewWidget(const std::string &widget_path, return; } - auto_ptr device(new StageProfiDevice( + unique_ptr device(new StageProfiDevice( this, new StageProfiWidget( m_plugin_adaptor, descriptor, widget_path, diff --git a/plugins/stageprofi/StageProfiPlugin.h b/plugins/stageprofi/StageProfiPlugin.h index 6bbd58d33c..993194860c 100644 --- a/plugins/stageprofi/StageProfiPlugin.h +++ b/plugins/stageprofi/StageProfiPlugin.h @@ -50,7 +50,7 @@ class StageProfiPlugin: public Plugin { typedef std::map DeviceMap; DeviceMap m_devices; - std::auto_ptr m_detector; + std::unique_ptr m_detector; bool StartHook(); bool StopHook(); diff --git a/plugins/stageprofi/StageProfiWidget.h b/plugins/stageprofi/StageProfiWidget.h index eaa4536d42..ceb2447228 100644 --- a/plugins/stageprofi/StageProfiWidget.h +++ b/plugins/stageprofi/StageProfiWidget.h @@ -68,7 +68,7 @@ class StageProfiWidget { enum { DMX_HEADER_SIZE = 4}; ola::io::SelectServerInterface *m_ss; - std::auto_ptr m_descriptor; + std::unique_ptr m_descriptor; const std::string m_widget_path; DisconnectCallback *m_disconnect_cb; ola::thread::timeout_id m_timeout_id; diff --git a/plugins/uartdmx/UartDmxDevice.h b/plugins/uartdmx/UartDmxDevice.h index b4efbb388e..ccdafbdf86 100644 --- a/plugins/uartdmx/UartDmxDevice.h +++ b/plugins/uartdmx/UartDmxDevice.h @@ -54,7 +54,7 @@ class UartDmxDevice : public Device { std::string DeviceMalfKey() const; void SetDefaults(); - std::auto_ptr m_widget; + std::unique_ptr m_widget; class Preferences *m_preferences; const std::string m_name; const std::string m_path; diff --git a/plugins/uartdmx/UartDmxPlugin.cpp b/plugins/uartdmx/UartDmxPlugin.cpp index d07aa29ab9..986f87b1c2 100644 --- a/plugins/uartdmx/UartDmxPlugin.cpp +++ b/plugins/uartdmx/UartDmxPlugin.cpp @@ -74,7 +74,7 @@ bool UartDmxPlugin::StartHook() { // can open device, so shut the temporary file descriptor close(fd); - std::auto_ptr device(new UartDmxDevice( + std::unique_ptr device(new UartDmxDevice( this, m_preferences, PLUGIN_NAME, *iter)); // got a device, now lets see if we can configure it before we announce diff --git a/plugins/usbdmx/AVLdiyD512.cpp b/plugins/usbdmx/AVLdiyD512.cpp index d20797d7c8..1d41e1f6a6 100644 --- a/plugins/usbdmx/AVLdiyD512.cpp +++ b/plugins/usbdmx/AVLdiyD512.cpp @@ -100,7 +100,7 @@ bool SynchronousAVLdiyD512::Init() { return false; } - std::auto_ptr sender( + std::unique_ptr sender( new AVLdiyThreadedSender(m_adaptor, m_usb_device, usb_handle)); if (!sender->Start()) { return false; diff --git a/plugins/usbdmx/AVLdiyD512.h b/plugins/usbdmx/AVLdiyD512.h index f44de0527f..b34ab9e621 100644 --- a/plugins/usbdmx/AVLdiyD512.h +++ b/plugins/usbdmx/AVLdiyD512.h @@ -88,7 +88,7 @@ class SynchronousAVLdiyD512: public AVLdiyD512 { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(SynchronousAVLdiyD512); }; @@ -113,7 +113,7 @@ class AsynchronousAVLdiyD512 : public AVLdiyD512 { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(AsynchronousAVLdiyD512); }; diff --git a/plugins/usbdmx/AnymauDMX.cpp b/plugins/usbdmx/AnymauDMX.cpp index 240ce2f979..386598260c 100644 --- a/plugins/usbdmx/AnymauDMX.cpp +++ b/plugins/usbdmx/AnymauDMX.cpp @@ -100,7 +100,7 @@ bool SynchronousAnymauDMX::Init() { return false; } - std::auto_ptr sender( + std::unique_ptr sender( new AnymaThreadedSender(m_adaptor, m_usb_device, usb_handle)); if (!sender->Start()) { return false; diff --git a/plugins/usbdmx/AnymauDMX.h b/plugins/usbdmx/AnymauDMX.h index 26bf8cc621..0b75b1d0d1 100644 --- a/plugins/usbdmx/AnymauDMX.h +++ b/plugins/usbdmx/AnymauDMX.h @@ -88,7 +88,7 @@ class SynchronousAnymauDMX: public AnymauDMX { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(SynchronousAnymauDMX); }; @@ -113,7 +113,7 @@ class AsynchronousAnymauDMX : public AnymauDMX { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(AsynchronousAnymauDMX); }; diff --git a/plugins/usbdmx/AsyncPluginImpl.cpp b/plugins/usbdmx/AsyncPluginImpl.cpp index c7bd75bfae..7581814692 100644 --- a/plugins/usbdmx/AsyncPluginImpl.cpp +++ b/plugins/usbdmx/AsyncPluginImpl.cpp @@ -65,7 +65,7 @@ using ola::usb::HotplugAgent; using ola::usb::JaRuleWidget; using ola::usb::USBDeviceID; using ola::NewSingleCallback; -using std::auto_ptr; +using std::unique_ptr; using ola::thread::Future; class DeviceState { @@ -109,7 +109,7 @@ AsyncPluginImpl::~AsyncPluginImpl() { } bool AsyncPluginImpl::Start() { - auto_ptr agent(new HotplugAgent( + unique_ptr agent(new HotplugAgent( NewCallback(this, &AsyncPluginImpl::DeviceEvent), m_debug_level)); if (!agent->Init()) { diff --git a/plugins/usbdmx/AsyncPluginImpl.h b/plugins/usbdmx/AsyncPluginImpl.h index 56282281c9..4342096944 100644 --- a/plugins/usbdmx/AsyncPluginImpl.h +++ b/plugins/usbdmx/AsyncPluginImpl.h @@ -95,7 +95,7 @@ class AsyncPluginImpl: public PluginImplInterface, public WidgetObserver { PluginAdaptor* const m_plugin_adaptor; Plugin* const m_plugin; const unsigned int m_debug_level; - std::auto_ptr m_agent; + std::unique_ptr m_agent; Preferences* const m_preferences; SynchronizedWidgetObserver m_widget_observer; diff --git a/plugins/usbdmx/AsyncUsbReceiver.h b/plugins/usbdmx/AsyncUsbReceiver.h index 18406dd080..91f99e2ed0 100644 --- a/plugins/usbdmx/AsyncUsbReceiver.h +++ b/plugins/usbdmx/AsyncUsbReceiver.h @@ -127,7 +127,7 @@ class AsyncUsbReceiver: public AsyncUsbTransceiverBase { bool m_inited_with_handle; DmxBuffer m_rx_buffer; // GUARDED_BY(m_mutex); - std::auto_ptr > m_receive_callback; + std::unique_ptr > m_receive_callback; DISALLOW_COPY_AND_ASSIGN(AsyncUsbReceiver); }; diff --git a/plugins/usbdmx/DMXCProjectsNodleU1.cpp b/plugins/usbdmx/DMXCProjectsNodleU1.cpp index a2cf0e2c5d..004b3b8389 100644 --- a/plugins/usbdmx/DMXCProjectsNodleU1.cpp +++ b/plugins/usbdmx/DMXCProjectsNodleU1.cpp @@ -282,7 +282,7 @@ bool SynchronousDMXCProjectsNodleU1::Init() { SetInterfaceMode(m_adaptor, usb_handle, m_mode); if (m_mode & OUTPUT_ENABLE_MASK) { // output port active - std::auto_ptr sender( + std::unique_ptr sender( new DMXCProjectsNodleU1ThreadedSender(m_adaptor, m_usb_device, usb_handle)); if (!sender->Start()) { @@ -292,7 +292,7 @@ bool SynchronousDMXCProjectsNodleU1::Init() { } if (m_mode & INPUT_ENABLE_MASK) { // input port active - std::auto_ptr receiver( + std::unique_ptr receiver( new DMXCProjectsNodleU1ThreadedReceiver(m_adaptor, m_usb_device, usb_handle, m_plugin_adaptor)); if (!receiver->Start()) { diff --git a/plugins/usbdmx/DMXCProjectsNodleU1.h b/plugins/usbdmx/DMXCProjectsNodleU1.h index dac59391f2..6c67ebd2b2 100644 --- a/plugins/usbdmx/DMXCProjectsNodleU1.h +++ b/plugins/usbdmx/DMXCProjectsNodleU1.h @@ -117,8 +117,8 @@ class SynchronousDMXCProjectsNodleU1: public DMXCProjectsNodleU1 { private: libusb_device* const m_usb_device; - std::auto_ptr m_sender; - std::auto_ptr m_receiver; + std::unique_ptr m_sender; + std::unique_ptr m_receiver; DISALLOW_COPY_AND_ASSIGN(SynchronousDMXCProjectsNodleU1); }; @@ -150,8 +150,8 @@ class AsynchronousDMXCProjectsNodleU1 : public DMXCProjectsNodleU1 { const DmxBuffer &GetDmxInBuffer(); private: - std::auto_ptr m_sender; - std::auto_ptr m_receiver; + std::unique_ptr m_sender; + std::unique_ptr m_receiver; DmxBuffer m_buffer; DISALLOW_COPY_AND_ASSIGN(AsynchronousDMXCProjectsNodleU1); diff --git a/plugins/usbdmx/DMXCProjectsNodleU1Device.h b/plugins/usbdmx/DMXCProjectsNodleU1Device.h index 842644487c..8b42dbc56e 100644 --- a/plugins/usbdmx/DMXCProjectsNodleU1Device.h +++ b/plugins/usbdmx/DMXCProjectsNodleU1Device.h @@ -61,8 +61,8 @@ class DMXCProjectsNodleU1Device: public Device { private: const std::string m_device_id; - std::auto_ptr m_out_port; - std::auto_ptr m_in_port; + std::unique_ptr m_out_port; + std::unique_ptr m_in_port; DISALLOW_COPY_AND_ASSIGN(DMXCProjectsNodleU1Device); }; diff --git a/plugins/usbdmx/DMXCreator512Basic.cpp b/plugins/usbdmx/DMXCreator512Basic.cpp index 4056886f6b..932fcd4f5a 100644 --- a/plugins/usbdmx/DMXCreator512Basic.cpp +++ b/plugins/usbdmx/DMXCreator512Basic.cpp @@ -166,7 +166,7 @@ bool SynchronousDMXCreator512Basic::Init() { return false; } - std::auto_ptr sender( + std::unique_ptr sender( new DMXCreator512BasicThreadedSender(m_adaptor, m_usb_device, usb_handle)); if (!sender->Start()) { diff --git a/plugins/usbdmx/DMXCreator512Basic.h b/plugins/usbdmx/DMXCreator512Basic.h index ed1fc6d18d..b391a395d0 100644 --- a/plugins/usbdmx/DMXCreator512Basic.h +++ b/plugins/usbdmx/DMXCreator512Basic.h @@ -88,7 +88,7 @@ class SynchronousDMXCreator512Basic: public DMXCreator512Basic { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(SynchronousDMXCreator512Basic); }; @@ -113,7 +113,7 @@ class AsynchronousDMXCreator512Basic : public DMXCreator512Basic { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(AsynchronousDMXCreator512Basic); }; diff --git a/plugins/usbdmx/EurolitePro.cpp b/plugins/usbdmx/EurolitePro.cpp index 1f6e0fcf4f..500e3a7420 100644 --- a/plugins/usbdmx/EurolitePro.cpp +++ b/plugins/usbdmx/EurolitePro.cpp @@ -199,7 +199,7 @@ bool SynchronousEurolitePro::Init() { } } - std::auto_ptr sender( + std::unique_ptr sender( new EuroliteProThreadedSender(m_adaptor, m_usb_device, usb_handle)); if (!sender->Start()) { return false; diff --git a/plugins/usbdmx/EurolitePro.h b/plugins/usbdmx/EurolitePro.h index 8cb572e613..db27de610d 100644 --- a/plugins/usbdmx/EurolitePro.h +++ b/plugins/usbdmx/EurolitePro.h @@ -96,7 +96,7 @@ class SynchronousEurolitePro: public EurolitePro { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(SynchronousEurolitePro); }; @@ -123,7 +123,7 @@ class AsynchronousEurolitePro: public EurolitePro { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(AsynchronousEurolitePro); }; diff --git a/plugins/usbdmx/GenericDevice.h b/plugins/usbdmx/GenericDevice.h index 6a4ac11a0d..3b92377296 100644 --- a/plugins/usbdmx/GenericDevice.h +++ b/plugins/usbdmx/GenericDevice.h @@ -58,7 +58,7 @@ class GenericDevice: public Device { private: const std::string m_device_id; - std::auto_ptr m_port; + std::unique_ptr m_port; DISALLOW_COPY_AND_ASSIGN(GenericDevice); }; diff --git a/plugins/usbdmx/JaRuleDevice.cpp b/plugins/usbdmx/JaRuleDevice.cpp index cd9783d6cc..3a890e2d2b 100644 --- a/plugins/usbdmx/JaRuleDevice.cpp +++ b/plugins/usbdmx/JaRuleDevice.cpp @@ -33,7 +33,7 @@ namespace plugin { namespace usbdmx { using std::set; -using std::auto_ptr; +using std::unique_ptr; JaRuleDevice::JaRuleDevice(ola::AbstractPlugin *owner, ola::usb::JaRuleWidget *widget, @@ -45,7 +45,7 @@ JaRuleDevice::JaRuleDevice(ola::AbstractPlugin *owner, bool JaRuleDevice::StartHook() { for (uint8_t i = 0; i < m_widget->PortCount(); i++) { - auto_ptr port(new JaRuleOutputPort(this, i, m_widget)); + unique_ptr port(new JaRuleOutputPort(this, i, m_widget)); if (!port->Init()) { continue; diff --git a/plugins/usbdmx/JaRuleFactory.cpp b/plugins/usbdmx/JaRuleFactory.cpp index 68e4812a23..68f14943aa 100644 --- a/plugins/usbdmx/JaRuleFactory.cpp +++ b/plugins/usbdmx/JaRuleFactory.cpp @@ -50,7 +50,7 @@ bool JaRuleFactory::DeviceAdded( } OLA_INFO << "Found a new Ja Rule device"; - std::auto_ptr widget( + std::unique_ptr widget( new ola::usb::JaRuleWidget(m_ss, m_adaptor, usb_device)); return AddWidget(observer, widget.release()); } diff --git a/plugins/usbdmx/ScanlimeFadecandy.cpp b/plugins/usbdmx/ScanlimeFadecandy.cpp index 375539cba4..84a2e96837 100644 --- a/plugins/usbdmx/ScanlimeFadecandy.cpp +++ b/plugins/usbdmx/ScanlimeFadecandy.cpp @@ -266,7 +266,7 @@ bool SynchronousScanlimeFadecandy::Init() { return false; } - std::auto_ptr sender( + std::unique_ptr sender( new FadecandyThreadedSender(m_adaptor, m_usb_device, usb_handle)); if (!sender->Start()) { return false; diff --git a/plugins/usbdmx/ScanlimeFadecandy.h b/plugins/usbdmx/ScanlimeFadecandy.h index b88deada4f..57c08b75ba 100644 --- a/plugins/usbdmx/ScanlimeFadecandy.h +++ b/plugins/usbdmx/ScanlimeFadecandy.h @@ -89,7 +89,7 @@ class SynchronousScanlimeFadecandy: public ScanlimeFadecandy { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(SynchronousScanlimeFadecandy); }; @@ -114,7 +114,7 @@ class AsynchronousScanlimeFadecandy : public ScanlimeFadecandy { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(AsynchronousScanlimeFadecandy); }; diff --git a/plugins/usbdmx/ShowJockeyDMXU1.cpp b/plugins/usbdmx/ShowJockeyDMXU1.cpp index 504c2a01d4..f6ef0e44f1 100644 --- a/plugins/usbdmx/ShowJockeyDMXU1.cpp +++ b/plugins/usbdmx/ShowJockeyDMXU1.cpp @@ -238,7 +238,7 @@ bool SynchronousShowJockeyDMXU1::Init() { return false; } - std::auto_ptr sender( + std::unique_ptr sender( new ShowJockeyDMXU1ThreadedSender(m_adaptor, m_usb_device, usb_handle, @@ -347,7 +347,7 @@ bool AsynchronousShowJockeyDMXU1::Init() { return false; } - std::auto_ptr sender( + std::unique_ptr sender( new ShowJockeyDMXU1AsyncUsbSender(m_adaptor, m_usb_device, endpoint, diff --git a/plugins/usbdmx/ShowJockeyDMXU1.h b/plugins/usbdmx/ShowJockeyDMXU1.h index 8fd1088fda..b7bc9dd382 100644 --- a/plugins/usbdmx/ShowJockeyDMXU1.h +++ b/plugins/usbdmx/ShowJockeyDMXU1.h @@ -100,7 +100,7 @@ class SynchronousShowJockeyDMXU1: public ShowJockeyDMXU1 { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(SynchronousShowJockeyDMXU1); }; @@ -125,7 +125,7 @@ class AsynchronousShowJockeyDMXU1: public ShowJockeyDMXU1 { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(AsynchronousShowJockeyDMXU1); }; diff --git a/plugins/usbdmx/Sunlite.cpp b/plugins/usbdmx/Sunlite.cpp index 621ef4462b..b3907e7c07 100644 --- a/plugins/usbdmx/Sunlite.cpp +++ b/plugins/usbdmx/Sunlite.cpp @@ -149,7 +149,7 @@ bool SynchronousSunlite::Init() { return false; } - std::auto_ptr sender( + std::unique_ptr sender( new SunliteThreadedSender(m_adaptor, m_usb_device, usb_handle)); if (!sender->Start()) { return false; diff --git a/plugins/usbdmx/Sunlite.h b/plugins/usbdmx/Sunlite.h index 1db1461d64..afc070666b 100644 --- a/plugins/usbdmx/Sunlite.h +++ b/plugins/usbdmx/Sunlite.h @@ -66,7 +66,7 @@ class SynchronousSunlite: public Sunlite { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(SynchronousSunlite); }; @@ -89,7 +89,7 @@ class AsynchronousSunlite: public Sunlite { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(AsynchronousSunlite); }; diff --git a/plugins/usbdmx/ThreadedUsbReceiver.cpp b/plugins/usbdmx/ThreadedUsbReceiver.cpp index 80be1d495b..bf71af1f67 100644 --- a/plugins/usbdmx/ThreadedUsbReceiver.cpp +++ b/plugins/usbdmx/ThreadedUsbReceiver.cpp @@ -36,7 +36,7 @@ ThreadedUsbReceiver::ThreadedUsbReceiver(libusb_device *usb_device, m_usb_handle(usb_handle), m_interface_number(interface_number), m_plugin_adaptor(plugin_adaptor), - m_receive_callback(NULL) { + m_receive_callback() { libusb_ref_device(usb_device); } diff --git a/plugins/usbdmx/ThreadedUsbReceiver.h b/plugins/usbdmx/ThreadedUsbReceiver.h index 3e18064ad3..53ff756208 100644 --- a/plugins/usbdmx/ThreadedUsbReceiver.h +++ b/plugins/usbdmx/ThreadedUsbReceiver.h @@ -111,7 +111,7 @@ class ThreadedUsbReceiver: private ola::thread::Thread { libusb_device_handle* const m_usb_handle; int const m_interface_number; PluginAdaptor* const m_plugin_adaptor; - std::auto_ptr > m_receive_callback; + std::unique_ptr > m_receive_callback; DmxBuffer m_buffer; ola::thread::Mutex m_data_mutex; ola::thread::Mutex m_term_mutex; diff --git a/plugins/usbdmx/UsbDmxPlugin.cpp b/plugins/usbdmx/UsbDmxPlugin.cpp index 4aa3f7f887..08111b84a7 100644 --- a/plugins/usbdmx/UsbDmxPlugin.cpp +++ b/plugins/usbdmx/UsbDmxPlugin.cpp @@ -63,7 +63,7 @@ bool UsbDmxPlugin::StartHook() { debug_level = LIBUSB_DEFAULT_DEBUG_LEVEL; } - std::auto_ptr impl; + std::unique_ptr impl; if (FLAGS_use_async_libusb) { impl.reset( new AsyncPluginImpl(m_plugin_adaptor, this, debug_level, diff --git a/plugins/usbdmx/UsbDmxPlugin.h b/plugins/usbdmx/UsbDmxPlugin.h index fd86f8a8ca..f480b3e4e7 100644 --- a/plugins/usbdmx/UsbDmxPlugin.h +++ b/plugins/usbdmx/UsbDmxPlugin.h @@ -66,7 +66,7 @@ class UsbDmxPlugin: public ola::Plugin { std::set* conflicting_plugins) const; private: - std::auto_ptr m_impl; + std::unique_ptr m_impl; bool StartHook(); bool StopHook(); diff --git a/plugins/usbdmx/VellemanK8062.cpp b/plugins/usbdmx/VellemanK8062.cpp index 72c8f49426..b2ed2c7517 100644 --- a/plugins/usbdmx/VellemanK8062.cpp +++ b/plugins/usbdmx/VellemanK8062.cpp @@ -310,7 +310,7 @@ bool SynchronousVellemanK8062::Init() { return false; } - std::auto_ptr sender( + std::unique_ptr sender( new VellemanThreadedSender(m_adaptor, m_usb_device, usb_handle, chunk_size)); if (!sender->Start()) { diff --git a/plugins/usbdmx/VellemanK8062.h b/plugins/usbdmx/VellemanK8062.h index c20be290c3..3cd9ee5fa1 100644 --- a/plugins/usbdmx/VellemanK8062.h +++ b/plugins/usbdmx/VellemanK8062.h @@ -66,7 +66,7 @@ class SynchronousVellemanK8062: public VellemanK8062 { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(SynchronousVellemanK8062); }; @@ -89,7 +89,7 @@ class AsynchronousVellemanK8062 : public VellemanK8062 { bool SendDMX(const DmxBuffer &buffer); private: - std::auto_ptr m_sender; + std::unique_ptr m_sender; DISALLOW_COPY_AND_ASSIGN(AsynchronousVellemanK8062); }; diff --git a/plugins/usbpro/ArduinoWidget.cpp b/plugins/usbpro/ArduinoWidget.cpp index fa2b1f557f..8c9e1d5bf7 100644 --- a/plugins/usbpro/ArduinoWidget.cpp +++ b/plugins/usbpro/ArduinoWidget.cpp @@ -40,7 +40,7 @@ using ola::rdm::RDMCommandSerializer; using ola::rdm::RDMReply; using ola::rdm::RDMRequest; using ola::rdm::RunRDMCallback; -using std::auto_ptr; +using std::unique_ptr; using std::ostringstream; using std::string; using std::vector; @@ -99,7 +99,7 @@ void ArduinoWidgetImpl::Stop() { */ void ArduinoWidgetImpl::SendRDMRequest(RDMRequest *request_ptr, ola::rdm::RDMCallback *on_complete) { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); if (request->CommandClass() == ola::rdm::RDMCommand::DISCOVER_COMMAND) { RunRDMCallback(on_complete, ola::rdm::RDM_PLUGIN_DISCOVERY_NOT_SUPPORTED); return; @@ -160,7 +160,7 @@ void ArduinoWidgetImpl::HandleRDMResponse(const uint8_t *data, ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; - std::auto_ptr request( + std::unique_ptr request( m_pending_request.release()); if (length == 0) { @@ -210,7 +210,7 @@ void ArduinoWidgetImpl::HandleRDMResponse(const uint8_t *data, } rdm::RDMFrame frame(data + 1, length - 1); - auto_ptr reply(RDMReply::FromFrame(frame, request.get())); + unique_ptr reply(RDMReply::FromFrame(frame, request.get())); callback->Run(reply.get()); } diff --git a/plugins/usbpro/ArduinoWidget.h b/plugins/usbpro/ArduinoWidget.h index 1c5c45b654..a76c79ed81 100644 --- a/plugins/usbpro/ArduinoWidget.h +++ b/plugins/usbpro/ArduinoWidget.h @@ -62,7 +62,7 @@ class ArduinoWidgetImpl: public BaseUsbProWidget, private: uint8_t m_transaction_id; ola::rdm::UID m_uid; - std::auto_ptr m_pending_request; + std::unique_ptr m_pending_request; ola::rdm::RDMCallback *m_rdm_request_callback; void HandleMessage(uint8_t label, diff --git a/plugins/usbpro/ArduinoWidgetTest.cpp b/plugins/usbpro/ArduinoWidgetTest.cpp index 9d945ddb47..f249cd17ee 100644 --- a/plugins/usbpro/ArduinoWidgetTest.cpp +++ b/plugins/usbpro/ArduinoWidgetTest.cpp @@ -43,7 +43,7 @@ using ola::rdm::RDMReply; using ola::rdm::RDMRequest; using ola::rdm::RDMResponse; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -64,7 +64,7 @@ class ArduinoWidgetTest: public CommonWidgetTest { void testErrorConditions(); private: - auto_ptr m_arduino; + unique_ptr m_arduino; unsigned int m_tod_counter; uint8_t m_transaction_number; @@ -146,7 +146,7 @@ void ArduinoWidgetTest::ValidateResponse(RDMReply *reply) { const ola::rdm::RDMFrame frame = reply->Frames()[0]; ola::rdm::RDMStatusCode raw_code; - auto_ptr raw_response( + unique_ptr raw_response( ola::rdm::RDMResponse::InflateFromData(frame.data.data() + 1, frame.data.size() - 1, &raw_code)); OLA_ASSERT_TRUE(*raw_response.get() == *response); @@ -275,7 +275,7 @@ void ArduinoWidgetTest::testSendRDMRequest() { &expected_request_frame_size); // response - auto_ptr response( + unique_ptr response( GetResponseFromData(rdm_request, TEST_RDM_DATA, sizeof(TEST_RDM_DATA))); unsigned int response_size; uint8_t *response_frame = PackRDMResponse(response.get(), &response_size); @@ -343,7 +343,7 @@ void ArduinoWidgetTest::testErrorCodes() { &expected_request_frame_size); // response - auto_ptr response(GetResponseFromData(rdm_request)); + unique_ptr response(GetResponseFromData(rdm_request)); unsigned int response_size; uint8_t *response_frame = PackRDMResponse(response.get(), &response_size); diff --git a/plugins/usbpro/BaseRobeWidgetTest.cpp b/plugins/usbpro/BaseRobeWidgetTest.cpp index 99138e4845..8599f5d8be 100644 --- a/plugins/usbpro/BaseRobeWidgetTest.cpp +++ b/plugins/usbpro/BaseRobeWidgetTest.cpp @@ -33,7 +33,7 @@ using ola::DmxBuffer; -using std::auto_ptr; +using std::unique_ptr; using std::queue; @@ -52,7 +52,7 @@ class BaseRobeWidgetTest: public CommonWidgetTest { void testRemove(); private: - auto_ptr m_widget; + unique_ptr m_widget; bool m_removed; typedef struct { diff --git a/plugins/usbpro/BaseUsbProWidgetTest.cpp b/plugins/usbpro/BaseUsbProWidgetTest.cpp index fabe4f3448..123c90699b 100644 --- a/plugins/usbpro/BaseUsbProWidgetTest.cpp +++ b/plugins/usbpro/BaseUsbProWidgetTest.cpp @@ -34,7 +34,7 @@ using ola::DmxBuffer; -using std::auto_ptr; +using std::unique_ptr; using std::queue; @@ -55,7 +55,7 @@ class BaseUsbProWidgetTest: public CommonWidgetTest { void testRemove(); private: - auto_ptr m_widget; + unique_ptr m_widget; bool m_removed; typedef struct { diff --git a/plugins/usbpro/CommonWidgetTest.h b/plugins/usbpro/CommonWidgetTest.h index b94880c3e4..e66e71615e 100644 --- a/plugins/usbpro/CommonWidgetTest.h +++ b/plugins/usbpro/CommonWidgetTest.h @@ -38,8 +38,8 @@ class CommonWidgetTest: public CppUnit::TestFixture { protected: ola::io::SelectServer m_ss; ola::io::PipeDescriptor m_descriptor; - std::auto_ptr m_other_end; - std::auto_ptr m_endpoint; + std::unique_ptr m_other_end; + std::unique_ptr m_endpoint; void Terminate() { m_ss.Terminate(); } diff --git a/plugins/usbpro/DmxTriWidget.cpp b/plugins/usbpro/DmxTriWidget.cpp index d8b98461df..6f1d3ab065 100644 --- a/plugins/usbpro/DmxTriWidget.cpp +++ b/plugins/usbpro/DmxTriWidget.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "ola/Constants.h" #include "ola/Logging.h" @@ -54,7 +55,7 @@ using ola::rdm::RunRDMCallback; using ola::rdm::UID; using ola::rdm::UIDSet; using ola::strings::ToHex; -using std::auto_ptr; +using std::unique_ptr; using std::map; using std::string; using std::vector; @@ -75,7 +76,7 @@ DmxTriWidgetImpl::DmxTriWidgetImpl( m_discovery_callback(NULL), m_discovery_state(NO_DISCOVERY_ACTION), m_rdm_request_callback(NULL), - m_pending_rdm_request(NULL), + m_pending_rdm_request(), m_transaction_number(0), m_last_command(RESERVED_COMMAND_ID), m_expected_command(RESERVED_COMMAND_ID) { @@ -135,7 +136,7 @@ bool DmxTriWidgetImpl::SendDMX(const DmxBuffer &buffer) { */ void DmxTriWidgetImpl::SendRDMRequest(RDMRequest *request_ptr, ola::rdm::RDMCallback *on_complete) { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); if (request->CommandClass() == RDMCommand::DISCOVER_COMMAND && !m_use_raw_rdm) { @@ -649,9 +650,8 @@ void DmxTriWidgetImpl::HandleRawRDMResponse(uint8_t return_code, OLA_INFO << "got raw RDM response with code: " << ToHex(return_code) << ", length: " << length; - auto_ptr request(m_pending_rdm_request); + unique_ptr request(std::move(m_pending_rdm_request)); ola::rdm::RDMCallback *callback = m_rdm_request_callback; - m_pending_rdm_request.reset(); m_rdm_request_callback = NULL; if (callback == NULL || request.get() == NULL) { @@ -676,7 +676,7 @@ void DmxTriWidgetImpl::HandleRawRDMResponse(uint8_t return_code, } else if (return_code == EC_NO_ERROR || return_code == EC_RESPONSE_DISCOVERY) { rdm::RDMFrame frame(data, length); - auto_ptr reply(RDMReply::DUBReply(frame)); + unique_ptr reply(RDMReply::DUBReply(frame)); callback->Run(reply.get()); } else { OLA_WARN << "Un-handled DUB response " << ToHex(return_code); @@ -702,7 +702,7 @@ void DmxTriWidgetImpl::HandleRawRDMResponse(uint8_t return_code, rdm::RDMFrame::Options options; options.prepend_start_code = true; - auto_ptr reply(RDMReply::FromFrame( + unique_ptr reply(RDMReply::FromFrame( rdm::RDMFrame(data, length, options))); callback->Run(reply.get()); } @@ -766,7 +766,8 @@ void DmxTriWidgetImpl::HandleGenericRDMResponse(uint8_t return_code, uint16_t pid, const uint8_t *data, unsigned int length) { - auto_ptr request(m_pending_rdm_request.release()); + unique_ptr request( + std::move(m_pending_rdm_request)); ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; diff --git a/plugins/usbpro/DmxTriWidget.h b/plugins/usbpro/DmxTriWidget.h index 1b9f28a346..8388cec9aa 100644 --- a/plugins/usbpro/DmxTriWidget.h +++ b/plugins/usbpro/DmxTriWidget.h @@ -22,6 +22,7 @@ #define PLUGINS_USBPRO_DMXTRIWIDGET_H_ #include +#include #include #include #include "ola/Callback.h" @@ -100,7 +101,7 @@ class DmxTriWidgetImpl: public BaseUsbProWidget, // This holds pointers to the RDMRequest and Callback that is queued or in // flight. ola::rdm::RDMCallback *m_rdm_request_callback; - std::auto_ptr m_pending_rdm_request; + std::unique_ptr m_pending_rdm_request; uint8_t m_transaction_number; // The command id that we expect to see in the response. uint8_t m_last_command, m_expected_command; diff --git a/plugins/usbpro/DmxTriWidgetTest.cpp b/plugins/usbpro/DmxTriWidgetTest.cpp index 563e924dbd..d4d5286b59 100644 --- a/plugins/usbpro/DmxTriWidgetTest.cpp +++ b/plugins/usbpro/DmxTriWidgetTest.cpp @@ -42,7 +42,7 @@ using ola::rdm::RDMReply; using ola::rdm::RDMRequest; using ola::rdm::RDMResponse; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -80,7 +80,7 @@ class DmxTriWidgetTest: public CommonWidgetTest { void testQueuedMessages(); private: - auto_ptr m_widget; + unique_ptr m_widget; unsigned int m_tod_counter; bool m_expect_uids_in_tod; diff --git a/plugins/usbpro/DmxterWidget.cpp b/plugins/usbpro/DmxterWidget.cpp index 5158bd0288..49bf3ab2f0 100644 --- a/plugins/usbpro/DmxterWidget.cpp +++ b/plugins/usbpro/DmxterWidget.cpp @@ -40,7 +40,7 @@ using ola::rdm::RDMRequest; using ola::rdm::RunRDMCallback; using ola::rdm::UID; using ola::rdm::UIDSet; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -108,7 +108,7 @@ void DmxterWidgetImpl::Stop() { */ void DmxterWidgetImpl::SendRDMRequest(RDMRequest *request_ptr, ola::rdm::RDMCallback *on_complete) { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); if (m_rdm_request_callback) { OLA_FATAL << "Previous request hasn't completed yet, dropping request"; RunRDMCallback(on_complete, ola::rdm::RDM_FAILED_TO_SEND); @@ -250,7 +250,7 @@ void DmxterWidgetImpl::HandleRDMResponse(const uint8_t *data, ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; - auto_ptr request(m_pending_request.release()); + unique_ptr request(m_pending_request.release()); if (length < sizeof(ResponseHeader)) { OLA_WARN << "Invalid RDM response from the widget"; @@ -368,7 +368,7 @@ void DmxterWidgetImpl::HandleRDMResponse(const uint8_t *data, data += sizeof(ResponseHeader); length -= sizeof(ResponseHeader); - auto_ptr reply; + unique_ptr reply; if (status_code == ola::rdm::RDM_COMPLETED_OK) { rdm::RDMFrame frame(data, length); reply.reset(RDMReply::FromFrame(frame, request.get())); diff --git a/plugins/usbpro/DmxterWidget.h b/plugins/usbpro/DmxterWidget.h index 8a2355f4d9..422def02d4 100644 --- a/plugins/usbpro/DmxterWidget.h +++ b/plugins/usbpro/DmxterWidget.h @@ -58,7 +58,7 @@ class DmxterWidgetImpl: public BaseUsbProWidget, ola::rdm::UID m_uid; ola::rdm::UIDSet m_uids; ola::rdm::RDMDiscoveryCallback *m_discovery_callback; - std::auto_ptr m_pending_request; + std::unique_ptr m_pending_request; ola::rdm::RDMCallback *m_rdm_request_callback; uint8_t m_transaction_number; diff --git a/plugins/usbpro/DmxterWidgetTest.cpp b/plugins/usbpro/DmxterWidgetTest.cpp index 72d5754fac..c90f29e905 100644 --- a/plugins/usbpro/DmxterWidgetTest.cpp +++ b/plugins/usbpro/DmxterWidgetTest.cpp @@ -43,7 +43,7 @@ using ola::rdm::RDMReply; using ola::rdm::RDMRequest; using ola::rdm::RDMResponse; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -70,7 +70,7 @@ class DmxterWidgetTest: public CommonWidgetTest { void testShutdown(); private: - auto_ptr m_widget; + unique_ptr m_widget; unsigned int m_tod_counter; void Terminate() { @@ -144,7 +144,7 @@ void DmxterWidgetTest::ValidateResponse(RDMReply *reply) { OLA_ASSERT_EQ((size_t) 1, frames.size()); ola::rdm::RDMStatusCode raw_code; - auto_ptr raw_response( + unique_ptr raw_response( ola::rdm::RDMResponse::InflateFromData( frames[0].data.substr(1), &raw_code)); OLA_ASSERT_TRUE(*raw_response == *response); @@ -336,7 +336,7 @@ void DmxterWidgetTest::testSendRDMMute() { // response // to keep things simple here we return the TEST_RDM_DATA. - auto_ptr response( + unique_ptr response( GetResponseFromData(rdm_request, TEST_RDM_DATA, sizeof(TEST_RDM_DATA))); unsigned int response_size = RDMCommandSerializer::RequiredSize( diff --git a/plugins/usbpro/EnttecUsbProWidget.cpp b/plugins/usbpro/EnttecUsbProWidget.cpp index e963f51fd9..d147935093 100644 --- a/plugins/usbpro/EnttecUsbProWidget.cpp +++ b/plugins/usbpro/EnttecUsbProWidget.cpp @@ -54,7 +54,7 @@ using ola::rdm::UID; using ola::rdm::UIDSet; using ola::strings::IntToString; using ola::strings::ToHex; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -103,7 +103,7 @@ EnttecPortImpl::EnttecPortImpl(const OperationLabels &ops, const UID &uid, m_uid(uid), m_transaction_number(0), m_rdm_request_callback(NULL), - m_pending_request(NULL), + m_pending_request(), m_mute_callback(NULL), m_unmute_callback(NULL), m_branch_callback(NULL), @@ -230,7 +230,7 @@ bool EnttecPortImpl::SetParameters(uint8_t break_time, */ void EnttecPortImpl::SendRDMRequest(RDMRequest *request_ptr, ola::rdm::RDMCallback *on_complete) { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); if (m_rdm_request_callback) { OLA_WARN << "Previous request hasn't completed yet, dropping request"; @@ -289,7 +289,7 @@ void EnttecPortImpl::MuteDevice(const ola::rdm::UID &target, MuteDeviceCallback *mute_complete) { OLA_INFO << "Muting " << target << ", TN: " << static_cast(m_transaction_number); - auto_ptr mute_request( + unique_ptr mute_request( ola::rdm::NewMuteRequest(m_uid, target, m_transaction_number++)); if (PackAndSendRDMRequest(m_ops.send_rdm, mute_request.get())) { m_mute_callback = mute_complete; @@ -307,7 +307,7 @@ void EnttecPortImpl::MuteDevice(const ola::rdm::UID &target, void EnttecPortImpl::UnMuteAll(UnMuteDeviceCallback *unmute_complete) { OLA_INFO << "Un-muting all devices, TN: " << static_cast(m_transaction_number); - auto_ptr unmute_request( + unique_ptr unmute_request( ola::rdm::NewUnMuteRequest(m_uid, ola::rdm::UID::AllDevices(), m_transaction_number++)); if (PackAndSendRDMRequest(m_ops.send_rdm, unmute_request.get())) { @@ -325,7 +325,7 @@ void EnttecPortImpl::UnMuteAll(UnMuteDeviceCallback *unmute_complete) { void EnttecPortImpl::Branch(const ola::rdm::UID &lower, const ola::rdm::UID &upper, BranchCallback *callback) { - auto_ptr branch_request( + unique_ptr branch_request( ola::rdm::NewDiscoveryUniqueBranchRequest(m_uid, lower, upper, m_transaction_number++)); OLA_INFO << "Sending DUB packet: " << lower << " - " << upper; @@ -485,8 +485,8 @@ void EnttecPortImpl::HandleIncomingDataMessage(const uint8_t *data, } else if (m_rdm_request_callback) { ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; - auto_ptr request(m_pending_request.release()); - auto_ptr reply; + unique_ptr request(m_pending_request.release()); + unique_ptr reply; if (waiting_for_dub_response) { reply.reset(RDMReply::DUBReply(rdm::RDMFrame(data, length))); } else { @@ -749,7 +749,7 @@ class EnttecUsbProWidgetImpl : public BaseUsbProWidget { vector m_ports; vector m_port_impls; - auto_ptr m_send_cb; + unique_ptr m_send_cb; UID m_uid; PortAssignmentCallbacks m_port_assignment_callbacks; diff --git a/plugins/usbpro/EnttecUsbProWidget.h b/plugins/usbpro/EnttecUsbProWidget.h index db00a36acc..03e1c3fb0c 100644 --- a/plugins/usbpro/EnttecUsbProWidget.h +++ b/plugins/usbpro/EnttecUsbProWidget.h @@ -73,7 +73,7 @@ class EnttecPort private: EnttecPortImpl *m_impl; const bool m_enable_rdm; - std::auto_ptr m_controller; + std::unique_ptr m_controller; }; diff --git a/plugins/usbpro/EnttecUsbProWidgetImpl.h b/plugins/usbpro/EnttecUsbProWidgetImpl.h index b248f40a5b..06c585a144 100644 --- a/plugins/usbpro/EnttecUsbProWidgetImpl.h +++ b/plugins/usbpro/EnttecUsbProWidgetImpl.h @@ -129,7 +129,7 @@ class EnttecPortImpl // RX DMX DmxBuffer m_input_buffer; - std::auto_ptr > m_dmx_callback; + std::unique_ptr > m_dmx_callback; // widget params std::deque m_outstanding_param_callbacks; @@ -139,7 +139,7 @@ class EnttecPortImpl const ola::rdm::UID m_uid; uint8_t m_transaction_number; ola::rdm::RDMCallback *m_rdm_request_callback; - std::auto_ptr m_pending_request; + std::unique_ptr m_pending_request; // RDM Discovery MuteDeviceCallback *m_mute_callback; diff --git a/plugins/usbpro/EnttecUsbProWidgetTest.cpp b/plugins/usbpro/EnttecUsbProWidgetTest.cpp index 415cadf7a1..fda38e20be 100644 --- a/plugins/usbpro/EnttecUsbProWidgetTest.cpp +++ b/plugins/usbpro/EnttecUsbProWidgetTest.cpp @@ -49,7 +49,7 @@ using ola::rdm::RDMRequest; using ola::rdm::RDMResponse; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; using ola::plugin::usbpro::usb_pro_parameters; @@ -82,7 +82,7 @@ class EnttecUsbProWidgetTest: public CommonWidgetTest { void testBranch(); private: - auto_ptr m_widget; + unique_ptr m_widget; uint8_t m_transaction_number; ola::rdm::RDMStatusCode m_received_code; @@ -217,7 +217,7 @@ void EnttecUsbProWidgetTest::ValidateResponse(RDMReply *reply) { const RDMFrames &frames = reply->Frames(); OLA_ASSERT_EQ((size_t) 1, frames.size()); ola::rdm::RDMStatusCode raw_code; - auto_ptr raw_response( + unique_ptr raw_response( ola::rdm::RDMResponse::InflateFromData(frames[0].data.data() + 1, frames[0].data.size() - 1, &raw_code)); @@ -489,7 +489,7 @@ void EnttecUsbProWidgetTest::testSendRDMRequest() { &expected_request_frame_size); // response - auto_ptr response( + unique_ptr response( GetResponseFromData(rdm_request, TEST_RDM_DATA, sizeof(TEST_RDM_DATA))); unsigned int response_size; uint8_t *response_frame = PackRDMResponse(response.get(), &response_size); @@ -569,7 +569,7 @@ void EnttecUsbProWidgetTest::testSendRDMMute() { // response // to keep things simple here we return the TEST_RDM_DATA. - auto_ptr response( + unique_ptr response( GetResponseFromData(rdm_request, TEST_RDM_DATA, sizeof(TEST_RDM_DATA))); unsigned int response_size; uint8_t *response_frame = PackRDMResponse(response.get(), &response_size); @@ -693,7 +693,7 @@ void EnttecUsbProWidgetTest::testMuteDevice() { OLA_ASSERT_NOT_NULL(port); // first test when a device doesn't respond - auto_ptr mute_request( + unique_ptr mute_request( ola::rdm::NewMuteRequest(SOURCE, DESTINATION, m_transaction_number++)); @@ -721,7 +721,7 @@ void EnttecUsbProWidgetTest::testMuteDevice() { delete[] expected_request_frame; // now try an actual mute response - auto_ptr mute_request2( + unique_ptr mute_request2( ola::rdm::NewMuteRequest(SOURCE, DESTINATION, m_transaction_number++)); @@ -763,7 +763,7 @@ void EnttecUsbProWidgetTest::testUnMuteAll() { EnttecPort *port = m_widget->GetPort(0); OLA_ASSERT_NOT_NULL(port); - auto_ptr unmute_request( + unique_ptr unmute_request( ola::rdm::NewUnMuteRequest(SOURCE, UID::AllDevices(), m_transaction_number++)); @@ -797,7 +797,7 @@ void EnttecUsbProWidgetTest::testBranch() { OLA_ASSERT_NOT_NULL(port); // first test when no devices respond - auto_ptr discovery_request( + unique_ptr discovery_request( ola::rdm::NewDiscoveryUniqueBranchRequest( SOURCE, UID(0, 0), @@ -830,7 +830,7 @@ void EnttecUsbProWidgetTest::testBranch() { // now try an actual response, the data doesn't actually have to be valid // because it's just passed straight to the callback. - auto_ptr discovery_request2( + unique_ptr discovery_request2( ola::rdm::NewDiscoveryUniqueBranchRequest( SOURCE, UID(0, 0), diff --git a/plugins/usbpro/RobeWidget.cpp b/plugins/usbpro/RobeWidget.cpp index e0d1ca87a5..b4bfe62a3b 100644 --- a/plugins/usbpro/RobeWidget.cpp +++ b/plugins/usbpro/RobeWidget.cpp @@ -45,7 +45,7 @@ using ola::rdm::RDMRequest; using ola::rdm::RDMResponse; using ola::rdm::UID; using ola::rdm::UIDSet; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -60,8 +60,8 @@ RobeWidgetImpl::RobeWidgetImpl(ola::io::ConnectedDescriptor *descriptor, m_unmute_callback(NULL), m_branch_callback(NULL), m_discovery_agent(this), - m_dmx_callback(NULL), - m_pending_request(NULL), + m_dmx_callback(), + m_pending_request(), m_uid(uid), m_transaction_number(0) { } @@ -102,7 +102,7 @@ bool RobeWidgetImpl::SendDMX(const DmxBuffer &buffer) { */ void RobeWidgetImpl::SendRDMRequest(RDMRequest *request_ptr, ola::rdm::RDMCallback *on_complete) { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); if (m_rdm_request_callback) { OLA_FATAL << "Previous request hasn't completed yet, dropping request"; RunRDMCallback(on_complete, ola::rdm::RDM_FAILED_TO_SEND); @@ -197,7 +197,7 @@ void RobeWidgetImpl::SetDmxCallback(Callback0 *callback) { */ void RobeWidgetImpl::MuteDevice(const UID &target, MuteDeviceCallback *mute_complete) { - auto_ptr mute_request( + unique_ptr mute_request( ola::rdm::NewMuteRequest(m_uid, target, m_transaction_number++)); OLA_DEBUG << "Muting " << target; if (PackAndSendRDMRequest(RDM_REQUEST, mute_request.get())) @@ -213,7 +213,7 @@ void RobeWidgetImpl::MuteDevice(const UID &target, * completes. */ void RobeWidgetImpl::UnMuteAll(UnMuteDeviceCallback *unmute_complete) { - auto_ptr unmute_request( + unique_ptr unmute_request( ola::rdm::NewUnMuteRequest(m_uid, ola::rdm::UID::AllDevices(), m_transaction_number++)); @@ -233,7 +233,7 @@ void RobeWidgetImpl::UnMuteAll(UnMuteDeviceCallback *unmute_complete) { void RobeWidgetImpl::Branch(const UID &lower, const UID &upper, BranchCallback *callback) { - auto_ptr branch_request( + unique_ptr branch_request( ola::rdm::NewDiscoveryUniqueBranchRequest( m_uid, lower, @@ -296,7 +296,7 @@ void RobeWidgetImpl::HandleRDMResponse(const uint8_t *data, } ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; - auto_ptr request(m_pending_request.release()); + unique_ptr request(m_pending_request.release()); // this was a broadcast request if (request->DestinationUID().IsBroadcast()) { @@ -312,7 +312,7 @@ void RobeWidgetImpl::HandleRDMResponse(const uint8_t *data, // The widget response data doesn't contain a start code so we prepend it. rdm::RDMFrame frame(data, length, rdm::RDMFrame::Options(true)); - auto_ptr reply(RDMReply::FromFrame(frame, request.get())); + unique_ptr reply(RDMReply::FromFrame(frame, request.get())); callback->Run(reply.get()); } @@ -333,13 +333,13 @@ void RobeWidgetImpl::HandleDiscoveryResponse(const uint8_t *data, } else if (m_rdm_request_callback) { ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; - auto_ptr request(m_pending_request.release()); + unique_ptr request(m_pending_request.release()); if (length <= RDM_PADDING_BYTES) { // this indicates that no request was received RunRDMCallback(callback, ola::rdm::RDM_TIMEOUT); } else { - auto_ptr reply(RDMReply::DUBReply( + unique_ptr reply(RDMReply::DUBReply( rdm::RDMFrame(data, length - RDM_PADDING_BYTES))); callback->Run(reply.get()); } diff --git a/plugins/usbpro/RobeWidget.h b/plugins/usbpro/RobeWidget.h index cdc98453f1..202cae90eb 100644 --- a/plugins/usbpro/RobeWidget.h +++ b/plugins/usbpro/RobeWidget.h @@ -86,9 +86,9 @@ class RobeWidgetImpl: public BaseRobeWidget, UnMuteDeviceCallback *m_unmute_callback; BranchCallback *m_branch_callback; ola::rdm::DiscoveryAgent m_discovery_agent; - std::auto_ptr > m_dmx_callback; + std::unique_ptr > m_dmx_callback; DmxBuffer m_buffer; - std::auto_ptr m_pending_request; + std::unique_ptr m_pending_request; const ola::rdm::UID m_uid; uint8_t m_transaction_number; diff --git a/plugins/usbpro/RobeWidgetDetector.h b/plugins/usbpro/RobeWidgetDetector.h index e71e95c496..a7d1d65fc8 100644 --- a/plugins/usbpro/RobeWidgetDetector.h +++ b/plugins/usbpro/RobeWidgetDetector.h @@ -107,8 +107,8 @@ class RobeWidgetDetector: public WidgetDetectorInterface { ola::thread::SchedulingExecutorInterface *m_scheduler; const unsigned int m_timeout_ms; - std::auto_ptr m_callback; - std::auto_ptr m_failure_callback; + std::unique_ptr m_callback; + std::unique_ptr m_failure_callback; typedef std::map WidgetStateMap; WidgetStateMap m_widgets; diff --git a/plugins/usbpro/RobeWidgetDetectorTest.cpp b/plugins/usbpro/RobeWidgetDetectorTest.cpp index da9b065134..907a88ae34 100644 --- a/plugins/usbpro/RobeWidgetDetectorTest.cpp +++ b/plugins/usbpro/RobeWidgetDetectorTest.cpp @@ -37,7 +37,7 @@ using ola::plugin::usbpro::RobeWidget; using ola::plugin::usbpro::RobeWidgetDetector; using ola::plugin::usbpro::RobeWidgetInformation; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; class RobeWidgetDetectorTest: public CommonWidgetTest { @@ -61,7 +61,7 @@ class RobeWidgetDetectorTest: public CommonWidgetTest { void testTimeout(); private: - auto_ptr m_detector; + unique_ptr m_detector; RobeWidgetInformation m_device_info; bool m_found_widget; bool m_failed_widget; diff --git a/plugins/usbpro/RobeWidgetTest.cpp b/plugins/usbpro/RobeWidgetTest.cpp index f9fbce0c33..8b53e6eeef 100644 --- a/plugins/usbpro/RobeWidgetTest.cpp +++ b/plugins/usbpro/RobeWidgetTest.cpp @@ -49,7 +49,7 @@ using ola::rdm::RDMReply; using ola::rdm::RDMRequest; using ola::rdm::RDMResponse; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -79,7 +79,7 @@ class RobeWidgetTest: public CommonWidgetTest { void testReceive(); private: - auto_ptr m_widget; + unique_ptr m_widget; uint8_t m_transaction_number; ola::rdm::RDMStatusCode m_received_code; bool m_new_dmx_data; @@ -208,7 +208,7 @@ void RobeWidgetTest::ValidateResponse(RDMReply *reply) { const RDMFrames &frames = reply->Frames(); OLA_ASSERT_EQ((size_t) 1, frames.size()); ola::rdm::RDMStatusCode raw_code; - auto_ptr raw_response( + unique_ptr raw_response( ola::rdm::RDMResponse::InflateFromData(frames[0].data.data() + 1, frames[0].data.size() - 1, &raw_code)); @@ -309,7 +309,7 @@ void RobeWidgetTest::testSendRDMRequest() { &expected_request_frame_size); // response - auto_ptr response( + unique_ptr response( GetResponseFromData(rdm_request, TEST_RDM_DATA, sizeof(TEST_RDM_DATA))); unsigned int response_size; uint8_t *response_frame = PackRDMResponse(response.get(), &response_size); @@ -385,7 +385,7 @@ void RobeWidgetTest::testSendRDMMute() { // response // to keep things simple here we return the TEST_RDM_DATA. - auto_ptr response( + unique_ptr response( GetResponseFromData(rdm_request, TEST_RDM_DATA, sizeof(TEST_RDM_DATA))); unsigned int response_size; uint8_t *response_frame = PackRDMResponse(response.get(), &response_size); @@ -503,7 +503,7 @@ void RobeWidgetTest::testSendRDMDUB() { */ void RobeWidgetTest::testMuteDevice() { // first test when a device doesn't respond - auto_ptr mute_request( + unique_ptr mute_request( ola::rdm::NewMuteRequest(SOURCE, DESTINATION, m_transaction_number++)); unsigned int expected_request_frame_size; uint8_t *expected_request_frame = PackRDMRequest( @@ -533,7 +533,7 @@ void RobeWidgetTest::testMuteDevice() { delete[] expected_request_frame; // now try an actual mute response - auto_ptr mute_request2( + unique_ptr mute_request2( ola::rdm::NewMuteRequest(SOURCE, DESTINATION, m_transaction_number++)); expected_request_frame = PackRDMRequest( mute_request2.get(), @@ -567,7 +567,7 @@ void RobeWidgetTest::testMuteDevice() { * Test the unmute all request works */ void RobeWidgetTest::testUnMuteAll() { - auto_ptr unmute_request( + unique_ptr unmute_request( ola::rdm::NewUnMuteRequest(SOURCE, UID::AllDevices(), m_transaction_number++)); @@ -603,7 +603,7 @@ void RobeWidgetTest::testUnMuteAll() { */ void RobeWidgetTest::testBranch() { // first test when no devices respond - auto_ptr discovery_request( + unique_ptr discovery_request( ola::rdm::NewDiscoveryUniqueBranchRequest( SOURCE, UID(0, 0), @@ -640,7 +640,7 @@ void RobeWidgetTest::testBranch() { // now try an actual response, the data doesn't actually have to be valid // because it's just passed straight to the callback. - auto_ptr discovery_request2( + unique_ptr discovery_request2( ola::rdm::NewDiscoveryUniqueBranchRequest( SOURCE, UID(0, 0), diff --git a/plugins/usbpro/UltraDMXProWidgetTest.cpp b/plugins/usbpro/UltraDMXProWidgetTest.cpp index 781581d09a..53ee5eaf15 100644 --- a/plugins/usbpro/UltraDMXProWidgetTest.cpp +++ b/plugins/usbpro/UltraDMXProWidgetTest.cpp @@ -29,7 +29,7 @@ #include "plugins/usbpro/CommonWidgetTest.h" -using std::auto_ptr; +using std::unique_ptr; using ola::DmxBuffer; @@ -45,7 +45,7 @@ class UltraDMXProWidgetTest: public CommonWidgetTest { void testSecondarySendDMX(); private: - auto_ptr m_widget; + unique_ptr m_widget; void Terminate() { m_ss.Terminate(); } diff --git a/plugins/usbpro/UsbProWidgetDetector.h b/plugins/usbpro/UsbProWidgetDetector.h index a56dad672d..ee3c53de9b 100644 --- a/plugins/usbpro/UsbProWidgetDetector.h +++ b/plugins/usbpro/UsbProWidgetDetector.h @@ -126,8 +126,8 @@ class UsbProWidgetDetector: public WidgetDetectorInterface { }; ola::thread::SchedulingExecutorInterface *m_scheduler; - const std::auto_ptr m_callback; - const std::auto_ptr m_failure_callback; + const std::unique_ptr m_callback; + const std::unique_ptr m_failure_callback; typedef std::map WidgetStateMap; WidgetStateMap m_widgets; diff --git a/plugins/usbpro/UsbProWidgetDetectorTest.cpp b/plugins/usbpro/UsbProWidgetDetectorTest.cpp index 0641707f3d..f91c6e25ab 100644 --- a/plugins/usbpro/UsbProWidgetDetectorTest.cpp +++ b/plugins/usbpro/UsbProWidgetDetectorTest.cpp @@ -32,7 +32,7 @@ using ola::io::ConnectedDescriptor; using ola::plugin::usbpro::UsbProWidgetInformation; using ola::plugin::usbpro::UsbProWidgetDetector; -using std::auto_ptr; +using std::unique_ptr; using std::string; class UsbProWidgetDetectorTest: public CommonWidgetTest { @@ -52,7 +52,7 @@ class UsbProWidgetDetectorTest: public CommonWidgetTest { void testSniffer(); private: - auto_ptr m_detector; + unique_ptr m_detector; UsbProWidgetInformation m_device_info; bool m_found_widget; bool m_failed_widget; diff --git a/plugins/usbpro/UsbSerialPlugin.cpp b/plugins/usbpro/UsbSerialPlugin.cpp index 1ba6ee49a4..b1ff1983b1 100644 --- a/plugins/usbpro/UsbSerialPlugin.cpp +++ b/plugins/usbpro/UsbSerialPlugin.cpp @@ -47,7 +47,7 @@ namespace ola { namespace plugin { namespace usbpro { -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; diff --git a/plugins/usbpro/WidgetDetectorThreadTest.cpp b/plugins/usbpro/WidgetDetectorThreadTest.cpp index 6527b2d384..f28ef78569 100644 --- a/plugins/usbpro/WidgetDetectorThreadTest.cpp +++ b/plugins/usbpro/WidgetDetectorThreadTest.cpp @@ -54,7 +54,7 @@ using ola::plugin::usbpro::UltraDMXProWidget; using ola::plugin::usbpro::UsbProWidgetInformation; using ola::plugin::usbpro::WidgetDetectorThread; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::string; @@ -127,9 +127,9 @@ class WidgetDetectorThreadTest: public CppUnit::TestFixture, } WidgetType; ola::io::SelectServer m_ss; - auto_ptr m_endpoint; - auto_ptr m_thread; - auto_ptr m_other_end; + unique_ptr m_endpoint; + unique_ptr m_thread; + unique_ptr m_other_end; WidgetType m_received_widget_type; bool m_expect_dual_port_enttec_widget; diff --git a/protoc/CppFileGenerator.cpp b/protoc/CppFileGenerator.cpp index a0eb51d0ce..085213b512 100644 --- a/protoc/CppFileGenerator.cpp +++ b/protoc/CppFileGenerator.cpp @@ -51,7 +51,7 @@ namespace ola { using google::protobuf::FileDescriptor; using google::protobuf::ServiceDescriptor; using google::protobuf::io::Printer; -using std::auto_ptr; +using std::unique_ptr; using std::string; diff --git a/protoc/CppGenerator.cpp b/protoc/CppGenerator.cpp index 2730f5de11..de1c66d847 100644 --- a/protoc/CppGenerator.cpp +++ b/protoc/CppGenerator.cpp @@ -36,7 +36,7 @@ using google::protobuf::FileDescriptor; using google::protobuf::ServiceDescriptor; using google::protobuf::compiler::OutputDirectory; using google::protobuf::io::Printer; -using std::auto_ptr; +using std::unique_ptr; using std::string; bool CppGenerator::Generate(const FileDescriptor *file, @@ -49,12 +49,12 @@ bool CppGenerator::Generate(const FileDescriptor *file, string code_name = basename + ".pb.cpp"; FileGenerator file_generator(file, basename); - auto_ptr header_output( + unique_ptr header_output( generator_context->Open(header_name)); Printer header_printer(header_output.get(), '$'); file_generator.GenerateHeader(&header_printer); - auto_ptr code_output( + unique_ptr code_output( generator_context->Open(code_name)); Printer code_printer(code_output.get(), '$'); file_generator.GenerateImplementation(&code_printer); diff --git a/tools/e133/DesignatedControllerConnection.cpp b/tools/e133/DesignatedControllerConnection.cpp index 0683712e91..ac9e94792d 100644 --- a/tools/e133/DesignatedControllerConnection.cpp +++ b/tools/e133/DesignatedControllerConnection.cpp @@ -46,7 +46,7 @@ using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::acn::TransportHeader; using ola::rdm::RDMResponse; -using std::auto_ptr; +using std::unique_ptr; using std::string; @@ -71,7 +71,7 @@ class OutstandingMessage { private: uint16_t m_endpoint; bool m_message_sent; - auto_ptr m_rdm_response; + unique_ptr m_rdm_response; DISALLOW_COPY_AND_ASSIGN(OutstandingMessage); }; @@ -150,7 +150,7 @@ bool DesignatedControllerConnection::Init() { bool DesignatedControllerConnection::SendStatusMessage( uint16_t endpoint, const RDMResponse *raw_response) { - auto_ptr response(raw_response); + unique_ptr response(raw_response); if (m_unacked_messages.size() == m_max_queue_size) { OLA_WARN << "NonBlockingSender limit reached, no further messages will " @@ -197,7 +197,7 @@ bool DesignatedControllerConnection::CloseTCPConnection() { */ void DesignatedControllerConnection::NewTCPConnection( ola::network::TCPSocket *socket_ptr) { - auto_ptr socket(socket_ptr); + unique_ptr socket(socket_ptr); ola::network::GenericSocketAddress addr = socket->GetPeerAddress(); if (addr.Family() != AF_INET) { OLA_WARN << "New TCP connection but failed to determine peer address"; diff --git a/tools/e133/DeviceManagerImpl.cpp b/tools/e133/DeviceManagerImpl.cpp index f063ae441a..86e05e57d6 100644 --- a/tools/e133/DeviceManagerImpl.cpp +++ b/tools/e133/DeviceManagerImpl.cpp @@ -60,7 +60,7 @@ using ola::network::IPV4SocketAddress; using ola::network::TCPSocket; using ola::acn::IncomingTCPTransport; -using std::auto_ptr; +using std::unique_ptr; using std::string; @@ -70,20 +70,20 @@ using std::string; class DeviceState { public: DeviceState() - : socket(NULL), - message_queue(NULL), - health_checked_connection(NULL), - in_transport(NULL), + : socket(), + message_queue(), + health_checked_connection(), + in_transport(), am_designated_controller(false) { } // The following may be NULL. // The socket connected to the E1.33 device - auto_ptr socket; - auto_ptr message_queue; + unique_ptr socket; + unique_ptr message_queue; // The Health Checked connection - auto_ptr health_checked_connection; - auto_ptr in_transport; + unique_ptr health_checked_connection; + unique_ptr in_transport; // True if we're the designated controller. bool am_designated_controller; @@ -224,7 +224,7 @@ void DeviceManagerImpl::ListManagedDevices(vector *devices) const { * connection. */ void DeviceManagerImpl::OnTCPConnect(TCPSocket *socket_ptr) { - auto_ptr socket(socket_ptr); + unique_ptr socket(socket_ptr); GenericSocketAddress address = socket->GetPeerAddress(); if (address.Family() != AF_INET) { OLA_WARN << "Non IPv4 socket " << address; diff --git a/tools/e133/DeviceManagerImpl.h b/tools/e133/DeviceManagerImpl.h index 5f0c7ad1c4..854342cdfc 100644 --- a/tools/e133/DeviceManagerImpl.h +++ b/tools/e133/DeviceManagerImpl.h @@ -54,7 +54,7 @@ using ola::network::TCPSocket; using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -98,9 +98,9 @@ class DeviceManagerImpl { DeviceMap; DeviceMap m_device_map; - auto_ptr m_rdm_callback; - auto_ptr m_acquire_device_cb_; - auto_ptr m_release_device_cb_; + unique_ptr m_rdm_callback; + unique_ptr m_acquire_device_cb_; + unique_ptr m_release_device_cb_; ola::io::SelectServerInterface *m_ss; diff --git a/tools/e133/E133Device.cpp b/tools/e133/E133Device.cpp index 4411d035cd..95220009c8 100644 --- a/tools/e133/E133Device.cpp +++ b/tools/e133/E133Device.cpp @@ -52,7 +52,7 @@ using ola::network::HealthCheckedConnection; using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::acn::RDMPDU; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; diff --git a/tools/e133/E133Device.h b/tools/e133/E133Device.h index d30b22888b..1ab2488f35 100644 --- a/tools/e133/E133Device.h +++ b/tools/e133/E133Device.h @@ -21,6 +21,7 @@ #ifndef TOOLS_E133_E133DEVICE_H_ #define TOOLS_E133_E133DEVICE_H_ +#include #include #include @@ -41,7 +42,7 @@ #include "tools/e133/TCPConnectionStats.h" using std::string; -using std::auto_ptr; +using std::unique_ptr; /** * This encapulates the functionality of an E1.33 Device. @@ -68,7 +69,7 @@ class E133Device { const ola::network::IPV4Address m_ip_address; ola::e133::MessageBuilder m_message_builder; TCPConnectionStats m_tcp_stats; - auto_ptr m_controller_connection; + unique_ptr m_controller_connection; class EndpointManager *m_endpoint_manager; E133EndpointInterface *m_root_endpoint; diff --git a/tools/e133/E133Endpoint.cpp b/tools/e133/E133Endpoint.cpp index 58efa583fa..e8f26e338a 100644 --- a/tools/e133/E133Endpoint.cpp +++ b/tools/e133/E133Endpoint.cpp @@ -29,7 +29,7 @@ using ola::rdm::RDMCallback; using ola::rdm::RDMDiscoveryCallback; using ola::rdm::RDMRequest; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; @@ -91,7 +91,7 @@ void E133Endpoint::SendRDMRequest(RDMRequest *request_ptr, m_controller->SendRDMRequest(request_ptr, on_complete); return; } else { - auto_ptr request(request_ptr); + unique_ptr request(request_ptr); OLA_WARN << "Endpoint " << m_endpoint_label << " has no controller attached"; ola::rdm::RunRDMCallback(on_complete, ola::rdm::RDM_UNKNOWN_UID); diff --git a/tools/e133/E133Receiver.cpp b/tools/e133/E133Receiver.cpp index 2af316ae40..c6a2c7924d 100644 --- a/tools/e133/E133Receiver.cpp +++ b/tools/e133/E133Receiver.cpp @@ -40,7 +40,7 @@ using ola::NewCallback; using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::rdm::RDMResponse; -using std::auto_ptr; +using std::unique_ptr; using std::string; diff --git a/tools/e133/ManagementEndpoint.cpp b/tools/e133/ManagementEndpoint.cpp index 4c1ca18ed6..b1daae0a45 100644 --- a/tools/e133/ManagementEndpoint.cpp +++ b/tools/e133/ManagementEndpoint.cpp @@ -46,7 +46,7 @@ using ola::rdm::RDMResponse; using ola::rdm::ResponderHelper; using ola::rdm::UID; using ola::rdm::UIDSet; -using std::auto_ptr; +using std::unique_ptr; using std::vector; ManagementEndpoint::RDMOps *ManagementEndpoint::RDMOps::instance = NULL; diff --git a/tools/e133/SimpleE133Node.h b/tools/e133/SimpleE133Node.h index df27f26bbe..cdd24bbd34 100644 --- a/tools/e133/SimpleE133Node.h +++ b/tools/e133/SimpleE133Node.h @@ -43,7 +43,7 @@ using ola::acn::CID; using ola::network::IPV4Address; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; /** * A very simple E1.33 node that responds to messages. diff --git a/tools/e133/basic-controller.cpp b/tools/e133/basic-controller.cpp index 02bfd3825e..09b366827c 100644 --- a/tools/e133/basic-controller.cpp +++ b/tools/e133/basic-controller.cpp @@ -66,7 +66,7 @@ using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::network::TCPSocket; using ola::acn::IncomingTCPTransport; -using std::auto_ptr; +using std::unique_ptr; using std::string; class SimpleE133Controller *controller = NULL; @@ -77,19 +77,19 @@ class SimpleE133Controller *controller = NULL; class DeviceState { public: DeviceState() - : socket(NULL), - message_queue(NULL), - health_checked_connection(NULL), - in_transport(NULL) { + : socket(), + message_queue(), + health_checked_connection(), + in_transport() { } // The following may be NULL. // The socket connected to the E1.33 device - auto_ptr socket; - auto_ptr message_queue; + unique_ptr socket; + unique_ptr message_queue; // The Health Checked connection - auto_ptr health_checked_connection; - auto_ptr in_transport; + unique_ptr health_checked_connection; + unique_ptr in_transport; private: DISALLOW_COPY_AND_ASSIGN(DeviceState); @@ -187,7 +187,7 @@ bool SimpleE133Controller::PrintStats() { } void SimpleE133Controller::OnTCPConnect(TCPSocket *socket_ptr) { - auto_ptr socket(socket_ptr); + unique_ptr socket(socket_ptr); GenericSocketAddress generic_peer = socket->GetPeerAddress(); if (generic_peer.Family() != AF_INET) { @@ -198,7 +198,7 @@ void SimpleE133Controller::OnTCPConnect(TCPSocket *socket_ptr) { // OLA_INFO << "Received new TCP connection from: " << peer; - auto_ptr device_state(new DeviceState()); + unique_ptr device_state(new DeviceState()); device_state->in_transport.reset( new IncomingTCPTransport(&m_root_inflator, socket.get())); @@ -211,7 +211,7 @@ void SimpleE133Controller::OnTCPConnect(TCPSocket *socket_ptr) { device_state->message_queue.reset( new NonBlockingSender(socket.get(), &m_ss, m_message_builder.pool())); - auto_ptr health_checked_connection( + unique_ptr health_checked_connection( new E133HealthCheckedConnection( &m_message_builder, device_state->message_queue.get(), @@ -281,7 +281,8 @@ void SimpleE133Controller::SocketUnhealthy(IPV4SocketAddress peer) { void SimpleE133Controller::SocketClosed(IPV4SocketAddress peer) { OLA_INFO << "Connection to " << peer << " was closed"; - auto_ptr device(ola::STLLookupAndRemovePtr(&m_device_map, peer)); + unique_ptr device(ola::STLLookupAndRemovePtr( + &m_device_map, peer)); if (!device.get()) { OLA_WARN << "Can't find device entry"; diff --git a/tools/e133/basic-device.cpp b/tools/e133/basic-device.cpp index 3d30c99a9a..cd8ae0bcbe 100644 --- a/tools/e133/basic-device.cpp +++ b/tools/e133/basic-device.cpp @@ -58,7 +58,7 @@ using ola::network::IPV4Address; using ola::network::IPV4SocketAddress; using ola::network::TCPSocket; using ola::acn::IncomingTCPTransport; -using std::auto_ptr; +using std::unique_ptr; using std::string; /** @@ -93,11 +93,11 @@ class SimpleE133Device { ola::acn::RootInflator m_root_inflator; // Once we have a connection these are filled in. - auto_ptr m_socket; - auto_ptr m_message_queue; + unique_ptr m_socket; + unique_ptr m_message_queue; // The Health Checked connection - auto_ptr m_health_checked_connection; - auto_ptr m_in_transport; + unique_ptr m_health_checked_connection; + unique_ptr m_in_transport; void OnTCPConnect(TCPSocket *socket); void ReceiveTCPData(); diff --git a/tools/e133/e133-controller.cpp b/tools/e133/e133-controller.cpp index 4954f5f7a1..67b23f2216 100644 --- a/tools/e133/e133-controller.cpp +++ b/tools/e133/e133-controller.cpp @@ -77,7 +77,7 @@ using ola::rdm::RDMCommandSerializer; using ola::rdm::RDMRequest; using ola::rdm::RDMResponse; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::cout; using std::endl; using std::string; @@ -283,7 +283,7 @@ void SimpleE133Controller::SendSetRequest(const UID &dst_uid, bool SimpleE133Controller::SendRequest(const UID &uid, uint16_t endpoint, RDMRequest *raw_request) { - auto_ptr request(raw_request); + unique_ptr request(raw_request); IPV4Address *target_address = ola::STLFind(&m_uid_to_ip, uid); if (!target_address) { @@ -353,7 +353,7 @@ void SimpleE133Controller::HandlePacket( } } - auto_ptr message; + unique_ptr message; if (descriptor) message.reset(m_pid_helper->DeserializeMessage(descriptor, response->ParamData(), @@ -429,7 +429,7 @@ int main(int argc, char *argv[]) { exit(ola::EXIT_USAGE); } - auto_ptr uid(UID::FromString(FLAGS_uid)); + unique_ptr uid(UID::FromString(FLAGS_uid)); // Make sure we can load our PIDs if (!pid_helper.Init()) @@ -476,7 +476,7 @@ int main(int argc, char *argv[]) { vector inputs; for (int i = 2; i < argc; i++) inputs.push_back(argv[i]); - auto_ptr message( + unique_ptr message( pid_helper.BuildMessage(descriptor, inputs)); if (!message.get()) { diff --git a/tools/e133/e133-monitor.cpp b/tools/e133/e133-monitor.cpp index dde5ac8448..3b1f3027f6 100644 --- a/tools/e133/e133-monitor.cpp +++ b/tools/e133/e133-monitor.cpp @@ -51,7 +51,7 @@ using ola::network::IPV4SocketAddress; using ola::rdm::PidStoreHelper; using ola::rdm::RDMCommand; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::cout; using std::endl; using std::string; @@ -144,7 +144,7 @@ bool SimpleE133Monitor::EndpointRequest( raw_request.data()); cout << "From " << source << ":" << endpoint << endl; - auto_ptr command( + unique_ptr command( RDMCommand::Inflate(reinterpret_cast(raw_request.data()), raw_request.size())); if (command.get()) { diff --git a/tools/e133/e133-receiver.cpp b/tools/e133/e133-receiver.cpp index 92b708dedc..217a603b09 100644 --- a/tools/e133/e133-receiver.cpp +++ b/tools/e133/e133-receiver.cpp @@ -66,7 +66,7 @@ using ola::DmxBuffer; using ola::acn::CID; using ola::network::IPV4Address; using ola::rdm::UID; -using std::auto_ptr; +using std::unique_ptr; using std::string; using std::vector; using ola::plugin::usbpro::DmxTriWidget; @@ -110,7 +110,7 @@ void HandleSpiDMX(DmxBuffer *buffer, SPIOutput *output) { int main(int argc, char *argv[]) { ola::AppInit(&argc, argv, "[options]", "Run a very simple E1.33 Responder."); - auto_ptr uid(UID::FromString(FLAGS_uid)); + unique_ptr uid(UID::FromString(FLAGS_uid)); if (!uid.get()) { OLA_WARN << "Invalid UID: " << FLAGS_uid; ola::DisplayUsage(); @@ -123,7 +123,7 @@ int main(int argc, char *argv[]) { ola::network::Interface interface; { - auto_ptr picker( + unique_ptr picker( ola::network::InterfacePicker::NewPicker()); if (!picker->ChooseInterface(&interface, FLAGS_listen_ip)) { OLA_INFO << "Failed to find an interface"; @@ -137,19 +137,19 @@ int main(int argc, char *argv[]) { // Optionally attach some other endpoints. vector endpoints; - auto_ptr dummy_responder; - auto_ptr + unique_ptr dummy_responder; + unique_ptr discoverable_dummy_responder; - auto_ptr tri_widget; + unique_ptr tri_widget; ola::rdm::UIDAllocator uid_allocator(*uid); // The first uid is used for the management endpoint so we burn a UID here. { - auto_ptr dummy_uid(uid_allocator.AllocateNext()); + unique_ptr dummy_uid(uid_allocator.AllocateNext()); } // Setup E1.31 if required. - auto_ptr e131_node; + unique_ptr e131_node; if (FLAGS_e131) { e131_node.reset(new ola::acn::E131Node( node.SelectServer(), FLAGS_listen_ip, @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) { } if (FLAGS_dummy) { - auto_ptr dummy_uid(uid_allocator.AllocateNext()); + unique_ptr dummy_uid(uid_allocator.AllocateNext()); OLA_INFO << "Dummy UID is " << *dummy_uid; if (!dummy_uid.get()) { OLA_WARN << "Failed to allocate a UID for the DummyResponder."; @@ -207,13 +207,13 @@ int main(int argc, char *argv[]) { // uber hack for now. // TODO(simon): fix this #ifdef USE_SPI - auto_ptr spi_writer; - auto_ptr spi_backend; - auto_ptr spi_output; + unique_ptr spi_writer; + unique_ptr spi_backend; + unique_ptr spi_output; DmxBuffer spi_buffer; if (FLAGS_spi_device.present() && !FLAGS_spi_device.str().empty()) { - auto_ptr spi_uid(uid_allocator.AllocateNext()); + unique_ptr spi_uid(uid_allocator.AllocateNext()); if (!spi_uid.get()) { OLA_WARN << "Failed to allocate a UID for the SPI device."; exit(ola::EXIT_USAGE); diff --git a/tools/ja-rule/USBDeviceManager.cpp b/tools/ja-rule/USBDeviceManager.cpp index 6dda7184f2..7432562d5d 100644 --- a/tools/ja-rule/USBDeviceManager.cpp +++ b/tools/ja-rule/USBDeviceManager.cpp @@ -45,7 +45,7 @@ using ola::usb::JaRuleWidget; using ola::usb::LibUsbAdaptor; using ola::usb::USBDeviceID; using ola::usb::HotplugAgent; -using std::auto_ptr; +using std::unique_ptr; static const uint16_t kProductId = 0xaced; static const uint16_t kVendorId = 0x1209; @@ -143,7 +143,7 @@ void USBDeviceManager::HotPlugEvent(HotplugAgent::EventType event, return; } - auto_ptr widget( + unique_ptr widget( new JaRuleWidget(m_ss, m_hotplug_agent->GetUSBAdaptor(), usb_device)); if (!widget->Init()) { m_widgets.erase(iter); diff --git a/tools/ja-rule/USBDeviceManager.h b/tools/ja-rule/USBDeviceManager.h index 62a7744c92..00667d87db 100644 --- a/tools/ja-rule/USBDeviceManager.h +++ b/tools/ja-rule/USBDeviceManager.h @@ -110,8 +110,8 @@ class USBDeviceManager { typedef std::map WidgetMap; ola::io::SelectServer* m_ss; - std::auto_ptr const m_notification_cb; - std::auto_ptr m_hotplug_agent; + std::unique_ptr const m_notification_cb; + std::unique_ptr m_hotplug_agent; ola::thread::ExecutorThread m_cleanup_thread; ola::thread::ThreadId m_start_thread_id; bool m_in_start; diff --git a/tools/ja-rule/ja-rule-controller.cpp b/tools/ja-rule/ja-rule-controller.cpp index 27b184b1bb..2858f67141 100644 --- a/tools/ja-rule/ja-rule-controller.cpp +++ b/tools/ja-rule/ja-rule-controller.cpp @@ -49,7 +49,7 @@ using ola::rdm::UID; using ola::rdm::UIDSet; using ola::usb::JaRuleWidget; using ola::usb::JaRulePortHandle; -using std::auto_ptr; +using std::unique_ptr; using std::cerr; using std::cout; using std::endl; @@ -168,7 +168,7 @@ class Controller { SelectServer* m_ss; JaRuleWidget *m_widget; JaRulePortHandle *m_port; - auto_ptr m_stdin_handler; + unique_ptr m_stdin_handler; UIDSet m_uids; Mode m_mode; UID m_selected_uid; diff --git a/tools/ja-rule/ja-rule.cpp b/tools/ja-rule/ja-rule.cpp index 9f478db4d6..0f989ad490 100644 --- a/tools/ja-rule/ja-rule.cpp +++ b/tools/ja-rule/ja-rule.cpp @@ -68,7 +68,7 @@ using ola::usb::JaRuleReturnCode; using ola::usb::JaRuleWidget; using ola::utils::JoinUInt8; using ola::utils::SplitUInt16; -using std::auto_ptr; +using std::unique_ptr; using std::cout; using std::endl; using std::string; @@ -400,7 +400,7 @@ class Controller { if (payload[0] == ola::rdm::START_CODE) { RDMStatusCode status_code; // Skip over the start code. - auto_ptr response(RDMResponse::InflateFromData( + unique_ptr response(RDMResponse::InflateFromData( payload.data() + 1, payload.size() - 1, &status_code)); if (!response.get()) { @@ -523,7 +523,7 @@ class Controller { SelectServer* m_ss; UID m_our_uid, m_target_uid, m_lower_uid, m_upper_uid; - auto_ptr m_stdin_handler; + unique_ptr m_stdin_handler; JaRuleWidget* m_widget; unsigned int m_log_count; uint8_t m_dmx_slot_data; @@ -693,7 +693,7 @@ class Controller { return; } - auto_ptr request( + unique_ptr request( ola::rdm::NewDiscoveryUniqueBranchRequest(m_our_uid, lower, upper, 0)); unsigned int rdm_length = RDMCommandSerializer::RequiredSize(*request); uint8_t data[rdm_length]; @@ -731,7 +731,7 @@ class Controller { return; } - auto_ptr request( + unique_ptr request( ola::rdm::NewMuteRequest(m_our_uid, target, 0)); CommandClass command_class = target.IsBroadcast() ? @@ -751,7 +751,7 @@ class Controller { return; } - auto_ptr request( + unique_ptr request( ola::rdm::NewUnMuteRequest(m_our_uid, target, 0)); CommandClass command_class = target.IsBroadcast() ? @@ -819,7 +819,7 @@ class Controller { }; void ParseUID(const string &uid_str, UID *uid) { - auto_ptr target_uid(UID::FromString(uid_str)); + unique_ptr target_uid(UID::FromString(uid_str)); if (!target_uid.get()) { OLA_WARN << "Invalid UID: '" << uid_str << "'"; exit(ola::EXIT_USAGE); diff --git a/tools/logic/logic-rdm-sniffer.cpp b/tools/logic/logic-rdm-sniffer.cpp index 3319586162..574851d27c 100644 --- a/tools/logic/logic-rdm-sniffer.cpp +++ b/tools/logic/logic-rdm-sniffer.cpp @@ -59,7 +59,7 @@ #include "tools/logic/DMXSignalProcessor.h" -using std::auto_ptr; +using std::unique_ptr; using std::cerr; using std::cout; using std::endl; @@ -280,7 +280,7 @@ void LogicReader::DisplayDMXFrame(const uint8_t *data, unsigned int length) { } void LogicReader::DisplayRDMFrame(const uint8_t *data, unsigned int length) { - auto_ptr command(RDMCommand::Inflate(data, length)); + unique_ptr command(RDMCommand::Inflate(data, length)); if (command.get()) { if (FLAGS_full_rdm) { cout << "---------------------------------------" << endl; diff --git a/tools/rdmpro/rdm-sniffer.cpp b/tools/rdmpro/rdm-sniffer.cpp index c27f47501a..5b4989f12e 100644 --- a/tools/rdmpro/rdm-sniffer.cpp +++ b/tools/rdmpro/rdm-sniffer.cpp @@ -50,7 +50,7 @@ #include "plugins/usbpro/BaseUsbProWidget.h" -using std::auto_ptr; +using std::unique_ptr; using std::cerr; using std::cout; using std::endl; @@ -356,7 +356,7 @@ void RDMSniffer::DisplayAlternateFrame() { void RDMSniffer::DisplayRDMFrame() { unsigned int slot_count = m_frame.Size() - 1; - auto_ptr command( + unique_ptr command( RDMCommand::Inflate(reinterpret_cast(&m_frame[1]), slot_count)); if (command.get()) { From 4e6649c5ad8b94f8be16e2e4de582fda4332d928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Offringa?= Date: Thu, 3 Aug 2023 18:45:27 +0200 Subject: [PATCH 2/2] Avoid unnecessary calls to unique_ptr::release() --- common/rpc/RpcServer.cpp | 3 ++- ola/StreamingClientTest.cpp | 2 +- olad/OlaDaemon.cpp | 5 +++-- olad/OlaServer.cpp | 22 +++++++++++----------- plugins/kinet/KiNetNode.cpp | 5 +++-- plugins/nanoleaf/NanoleafNode.cpp | 5 +++-- plugins/openpixelcontrol/OPCServer.cpp | 3 ++- plugins/usbdmx/AVLdiyD512.cpp | 3 ++- plugins/usbdmx/AnymauDMX.cpp | 3 ++- plugins/usbdmx/AsyncPluginImpl.cpp | 2 +- plugins/usbdmx/DMXCProjectsNodleU1.cpp | 5 +++-- plugins/usbdmx/DMXCreator512Basic.cpp | 3 ++- plugins/usbdmx/EurolitePro.cpp | 3 ++- plugins/usbdmx/ScanlimeFadecandy.cpp | 3 ++- plugins/usbdmx/ShowJockeyDMXU1.cpp | 7 ++++--- plugins/usbdmx/Sunlite.cpp | 3 ++- plugins/usbdmx/UsbDmxPlugin.cpp | 3 ++- plugins/usbdmx/VellemanK8062.cpp | 3 ++- plugins/usbpro/ArduinoWidget.cpp | 5 +++-- plugins/usbpro/DmxTriWidget.cpp | 2 +- plugins/usbpro/DmxterWidget.cpp | 5 +++-- plugins/usbpro/EnttecUsbProWidget.cpp | 6 ++++-- plugins/usbpro/RobeWidget.cpp | 7 ++++--- tools/e133/DeviceManagerImpl.cpp | 3 ++- tools/e133/basic-controller.cpp | 6 +++--- 25 files changed, 69 insertions(+), 48 deletions(-) diff --git a/common/rpc/RpcServer.cpp b/common/rpc/RpcServer.cpp index 64f467b879..01b020c68d 100644 --- a/common/rpc/RpcServer.cpp +++ b/common/rpc/RpcServer.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "common/rpc/RpcChannel.h" #include "common/rpc/RpcSession.h" @@ -114,7 +115,7 @@ bool RpcServer::Init() { return false; } - m_accepting_socket.reset(accepting_socket.release()); + m_accepting_socket = std::move(accepting_socket); return true; } diff --git a/ola/StreamingClientTest.cpp b/ola/StreamingClientTest.cpp index dce7a5c29f..c6a6448416 100644 --- a/ola/StreamingClientTest.cpp +++ b/ola/StreamingClientTest.cpp @@ -98,7 +98,7 @@ bool OlaServerThread::Setup() { // pick an unused port unique_ptr olad(new OlaDaemon(ola_options, NULL)); if (olad->Init()) { - m_olad.reset(olad.release()); + m_olad = std::move(olad); return true; } else { return false; diff --git a/olad/OlaDaemon.cpp b/olad/OlaDaemon.cpp index 77695e6fec..d66b7c9ef2 100644 --- a/olad/OlaDaemon.cpp +++ b/olad/OlaDaemon.cpp @@ -32,6 +32,7 @@ #include #endif // _WIN32 #include +#include #include "ola/ExportMap.h" #include "ola/Logging.h" @@ -136,8 +137,8 @@ bool OlaDaemon::Init() { bool ok = server->Init(); if (ok) { // Set the members - m_preferences_factory.reset(preferences_factory.release()); - m_server.reset(server.release()); + m_preferences_factory = std::move(preferences_factory); + m_server = std::move(server); } else { STLDeleteElements(&m_plugin_loaders); } diff --git a/olad/OlaServer.cpp b/olad/OlaServer.cpp index ef1ec8454f..9543e03b73 100644 --- a/olad/OlaServer.cpp +++ b/olad/OlaServer.cpp @@ -270,7 +270,7 @@ bool OlaServer::Init() { // Initializing the web server causes a call to NewClient. We need to have // the broker in place for the call, otherwise we'll segfault. - m_broker.reset(broker.release()); + m_broker = std::move(broker); #ifdef HAVE_LIBMICROHTTPD if (m_options.http_enable) { @@ -296,15 +296,15 @@ bool OlaServer::Init() { // Ok, we've created and initialized everything correctly by this point. Now // we save all the pointers and schedule the last of the callbacks. - m_device_manager.reset(device_manager.release()); - m_discovery_agent.reset(discovery_agent.release()); - m_plugin_adaptor.reset(plugin_adaptor.release()); - m_plugin_manager.reset(plugin_manager.release()); - m_port_broker.reset(port_broker.release()); - m_port_manager.reset(port_manager.release()); - m_rpc_server.reset(rpc_server.release()); - m_service_impl.reset(service_impl.release()); - m_universe_store.reset(universe_store.release()); + m_device_manager = std::move(device_manager); + m_discovery_agent = std::move(discovery_agent); + m_plugin_adaptor = std::move(plugin_adaptor); + m_plugin_manager = std::move(plugin_manager); + m_port_broker = std::move(port_broker); + m_port_manager = std::move(port_manager); + m_rpc_server = std::move(rpc_server); + m_service_impl = std::move(service_impl); + m_universe_store = std::move(universe_store); UpdatePidStore(pid_store.release()); @@ -434,7 +434,7 @@ bool OlaServer::StartHttpServer(ola::rpc::RpcServer *server, httpd->Start(); // register the pipe descriptor as a client InternalNewConnection(server, pipe_descriptor.release()); - m_httpd.reset(httpd.release()); + m_httpd = std::move(httpd); return true; } else { pipe_descriptor->Close(); diff --git a/plugins/kinet/KiNetNode.cpp b/plugins/kinet/KiNetNode.cpp index 7269e8be3b..c02e0abece 100644 --- a/plugins/kinet/KiNetNode.cpp +++ b/plugins/kinet/KiNetNode.cpp @@ -20,6 +20,7 @@ #include #include +#include #include "ola/Constants.h" #include "ola/Logging.h" @@ -208,7 +209,7 @@ void KiNetNode::PopulatePacketHeader(uint16_t msg_type) { * Setup the networking components. */ bool KiNetNode::InitNetwork() { - std::unique_ptr socket(m_socket.release()); + std::unique_ptr socket(std::move(m_socket)); if (!socket.get()) socket.reset(new UDPSocket()); @@ -224,7 +225,7 @@ bool KiNetNode::InitNetwork() { socket->SetOnData(NewCallback(this, &KiNetNode::SocketReady)); m_ss->AddReadDescriptor(socket.get()); - m_socket.reset(socket.release()); + m_socket = std::move(socket); return true; } } // namespace kinet diff --git a/plugins/nanoleaf/NanoleafNode.cpp b/plugins/nanoleaf/NanoleafNode.cpp index da8fe95cd3..0270991089 100644 --- a/plugins/nanoleaf/NanoleafNode.cpp +++ b/plugins/nanoleaf/NanoleafNode.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include "ola/Constants.h" @@ -157,7 +158,7 @@ void NanoleafNode::SocketReady() { * Setup the networking components. */ bool NanoleafNode::InitNetwork() { - std::unique_ptr socket(m_socket.release()); + std::unique_ptr socket(std::move(m_socket)); if (!socket.get()) { socket.reset(new UDPSocket()); @@ -176,7 +177,7 @@ bool NanoleafNode::InitNetwork() { // Do we need to call this if we don't bind? socket->SetOnData(NewCallback(this, &NanoleafNode::SocketReady)); m_ss->AddReadDescriptor(socket.get()); - m_socket.reset(socket.release()); + m_socket = std::move(socket); return true; } } // namespace nanoleaf diff --git a/plugins/openpixelcontrol/OPCServer.cpp b/plugins/openpixelcontrol/OPCServer.cpp index 829e388ae2..c3aea85662 100644 --- a/plugins/openpixelcontrol/OPCServer.cpp +++ b/plugins/openpixelcontrol/OPCServer.cpp @@ -21,6 +21,7 @@ #include "plugins/openpixelcontrol/OPCServer.h" #include +#include #include "ola/Callback.h" #include "ola/Logging.h" #include "ola/base/Array.h" @@ -88,7 +89,7 @@ bool OPCServer::Init() { return false; } m_ss->AddReadDescriptor(listening_socket.get()); - m_listening_socket.reset(listening_socket.release()); + m_listening_socket = std::move(listening_socket); return true; } diff --git a/plugins/usbdmx/AVLdiyD512.cpp b/plugins/usbdmx/AVLdiyD512.cpp index 1d41e1f6a6..0660dde629 100644 --- a/plugins/usbdmx/AVLdiyD512.cpp +++ b/plugins/usbdmx/AVLdiyD512.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "libs/usb/LibUsbAdaptor.h" #include "ola/Logging.h" @@ -105,7 +106,7 @@ bool SynchronousAVLdiyD512::Init() { if (!sender->Start()) { return false; } - m_sender.reset(sender.release()); + m_sender = std::move(sender); return true; } diff --git a/plugins/usbdmx/AnymauDMX.cpp b/plugins/usbdmx/AnymauDMX.cpp index 386598260c..cc000beafc 100644 --- a/plugins/usbdmx/AnymauDMX.cpp +++ b/plugins/usbdmx/AnymauDMX.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "libs/usb/LibUsbAdaptor.h" #include "ola/Logging.h" @@ -105,7 +106,7 @@ bool SynchronousAnymauDMX::Init() { if (!sender->Start()) { return false; } - m_sender.reset(sender.release()); + m_sender = std::move(sender); return true; } diff --git a/plugins/usbdmx/AsyncPluginImpl.cpp b/plugins/usbdmx/AsyncPluginImpl.cpp index 7581814692..816053f242 100644 --- a/plugins/usbdmx/AsyncPluginImpl.cpp +++ b/plugins/usbdmx/AsyncPluginImpl.cpp @@ -141,7 +141,7 @@ bool AsyncPluginImpl::Start() { return false; } - m_agent.reset(agent.release()); + m_agent = std::move(agent); return true; } diff --git a/plugins/usbdmx/DMXCProjectsNodleU1.cpp b/plugins/usbdmx/DMXCProjectsNodleU1.cpp index 004b3b8389..aebf1d0b30 100644 --- a/plugins/usbdmx/DMXCProjectsNodleU1.cpp +++ b/plugins/usbdmx/DMXCProjectsNodleU1.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "ola/Logging.h" #include "ola/Constants.h" @@ -288,7 +289,7 @@ bool SynchronousDMXCProjectsNodleU1::Init() { if (!sender->Start()) { return false; } - m_sender.reset(sender.release()); + m_sender = std::move(sender); } if (m_mode & INPUT_ENABLE_MASK) { // input port active @@ -298,7 +299,7 @@ bool SynchronousDMXCProjectsNodleU1::Init() { if (!receiver->Start()) { return false; } - m_receiver.reset(receiver.release()); + m_receiver = std::move(receiver); } return true; diff --git a/plugins/usbdmx/DMXCreator512Basic.cpp b/plugins/usbdmx/DMXCreator512Basic.cpp index 932fcd4f5a..cff85b2a31 100644 --- a/plugins/usbdmx/DMXCreator512Basic.cpp +++ b/plugins/usbdmx/DMXCreator512Basic.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "libs/usb/LibUsbAdaptor.h" #include "ola/Logging.h" @@ -172,7 +173,7 @@ bool SynchronousDMXCreator512Basic::Init() { if (!sender->Start()) { return false; } - m_sender.reset(sender.release()); + m_sender = std::move(sender); return true; } diff --git a/plugins/usbdmx/EurolitePro.cpp b/plugins/usbdmx/EurolitePro.cpp index 500e3a7420..2a993706de 100644 --- a/plugins/usbdmx/EurolitePro.cpp +++ b/plugins/usbdmx/EurolitePro.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "libs/usb/LibUsbAdaptor.h" #include "ola/Constants.h" @@ -204,7 +205,7 @@ bool SynchronousEurolitePro::Init() { if (!sender->Start()) { return false; } - m_sender.reset(sender.release()); + m_sender = std::move(sender); return true; } diff --git a/plugins/usbdmx/ScanlimeFadecandy.cpp b/plugins/usbdmx/ScanlimeFadecandy.cpp index 84a2e96837..1d413644a1 100644 --- a/plugins/usbdmx/ScanlimeFadecandy.cpp +++ b/plugins/usbdmx/ScanlimeFadecandy.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "libs/usb/LibUsbAdaptor.h" #include "ola/base/Array.h" @@ -271,7 +272,7 @@ bool SynchronousScanlimeFadecandy::Init() { if (!sender->Start()) { return false; } - m_sender.reset(sender.release()); + m_sender = std::move(sender); return true; } diff --git a/plugins/usbdmx/ShowJockeyDMXU1.cpp b/plugins/usbdmx/ShowJockeyDMXU1.cpp index f6ef0e44f1..b2ea168dc4 100644 --- a/plugins/usbdmx/ShowJockeyDMXU1.cpp +++ b/plugins/usbdmx/ShowJockeyDMXU1.cpp @@ -28,8 +28,9 @@ #include "plugins/usbdmx/ShowJockeyDMXU1.h" #include -#include #include +#include +#include #include "libs/usb/LibUsbAdaptor.h" #include "ola/Constants.h" @@ -248,7 +249,7 @@ bool SynchronousShowJockeyDMXU1::Init() { return false; } - m_sender.reset(sender.release()); + m_sender = std::move(sender); return true; } @@ -353,7 +354,7 @@ bool AsynchronousShowJockeyDMXU1::Init() { endpoint, max_packet_size, usb_handle)); - m_sender.reset(sender.release()); + m_sender = std::move(sender); return true; } diff --git a/plugins/usbdmx/Sunlite.cpp b/plugins/usbdmx/Sunlite.cpp index b3907e7c07..9f4c9a6c5e 100644 --- a/plugins/usbdmx/Sunlite.cpp +++ b/plugins/usbdmx/Sunlite.cpp @@ -21,6 +21,7 @@ #include "plugins/usbdmx/Sunlite.h" #include +#include #include "libs/usb/LibUsbAdaptor.h" #include "ola/Constants.h" @@ -154,7 +155,7 @@ bool SynchronousSunlite::Init() { if (!sender->Start()) { return false; } - m_sender.reset(sender.release()); + m_sender = std::move(sender); return true; } diff --git a/plugins/usbdmx/UsbDmxPlugin.cpp b/plugins/usbdmx/UsbDmxPlugin.cpp index 08111b84a7..5981727002 100644 --- a/plugins/usbdmx/UsbDmxPlugin.cpp +++ b/plugins/usbdmx/UsbDmxPlugin.cpp @@ -21,6 +21,7 @@ #include "plugins/usbdmx/UsbDmxPlugin.h" #include +#include #include "ola/Logging.h" #include "ola/base/Flags.h" @@ -74,7 +75,7 @@ bool UsbDmxPlugin::StartHook() { } if (impl->Start()) { - m_impl.reset(impl.release()); + m_impl = std::move(impl); return true; } else { return false; diff --git a/plugins/usbdmx/VellemanK8062.cpp b/plugins/usbdmx/VellemanK8062.cpp index b2ed2c7517..36f66d444c 100644 --- a/plugins/usbdmx/VellemanK8062.cpp +++ b/plugins/usbdmx/VellemanK8062.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "libs/usb/LibUsbAdaptor.h" #include "ola/Logging.h" @@ -316,7 +317,7 @@ bool SynchronousVellemanK8062::Init() { if (!sender->Start()) { return false; } - m_sender.reset(sender.release()); + m_sender = std::move(sender); return true; } diff --git a/plugins/usbpro/ArduinoWidget.cpp b/plugins/usbpro/ArduinoWidget.cpp index 8c9e1d5bf7..475947cf2a 100644 --- a/plugins/usbpro/ArduinoWidget.cpp +++ b/plugins/usbpro/ArduinoWidget.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "ola/io/ByteString.h" #include "ola/Constants.h" @@ -122,7 +123,7 @@ void ArduinoWidgetImpl::SendRDMRequest(RDMRequest *request_ptr, } m_rdm_request_callback = on_complete; - m_pending_request.reset(request.release()); + m_pending_request = std::move(request); if (SendMessage(RDM_REQUEST_LABEL, data.data(), data.size())) { return; } @@ -161,7 +162,7 @@ void ArduinoWidgetImpl::HandleRDMResponse(const uint8_t *data, ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; std::unique_ptr request( - m_pending_request.release()); + std::move(m_pending_request)); if (length == 0) { // invalid response diff --git a/plugins/usbpro/DmxTriWidget.cpp b/plugins/usbpro/DmxTriWidget.cpp index 6f1d3ab065..1ddab2019a 100644 --- a/plugins/usbpro/DmxTriWidget.cpp +++ b/plugins/usbpro/DmxTriWidget.cpp @@ -151,7 +151,7 @@ void DmxTriWidgetImpl::SendRDMRequest(RDMRequest *request_ptr, } // store pointers - m_pending_rdm_request.reset(request.release()); + m_pending_rdm_request = std::move(request); m_rdm_request_callback = on_complete; MaybeSendNextRequest(); } diff --git a/plugins/usbpro/DmxterWidget.cpp b/plugins/usbpro/DmxterWidget.cpp index 49bf3ab2f0..853cfa19fb 100644 --- a/plugins/usbpro/DmxterWidget.cpp +++ b/plugins/usbpro/DmxterWidget.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include "ola/Constants.h" #include "ola/Logging.h" @@ -135,7 +136,7 @@ void DmxterWidgetImpl::SendRDMRequest(RDMRequest *request_ptr, } m_rdm_request_callback = on_complete; - m_pending_request.reset(request.release()); + m_pending_request = std::move(request); if (SendMessage(label, data.data(), data.size())) { return; } @@ -250,7 +251,7 @@ void DmxterWidgetImpl::HandleRDMResponse(const uint8_t *data, ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; - unique_ptr request(m_pending_request.release()); + unique_ptr request(std::move(m_pending_request)); if (length < sizeof(ResponseHeader)) { OLA_WARN << "Invalid RDM response from the widget"; diff --git a/plugins/usbpro/EnttecUsbProWidget.cpp b/plugins/usbpro/EnttecUsbProWidget.cpp index d147935093..29bc853e14 100644 --- a/plugins/usbpro/EnttecUsbProWidget.cpp +++ b/plugins/usbpro/EnttecUsbProWidget.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "ola/Callback.h" #include "ola/Constants.h" @@ -242,7 +243,7 @@ void EnttecPortImpl::SendRDMRequest(RDMRequest *request_ptr, request->SetTransactionNumber(m_transaction_number++); request->SetPortId(PORT_ID); - m_pending_request.reset(request.release()); + m_pending_request = std::move(request); m_rdm_request_callback = on_complete; bool ok = PackAndSendRDMRequest( @@ -485,7 +486,8 @@ void EnttecPortImpl::HandleIncomingDataMessage(const uint8_t *data, } else if (m_rdm_request_callback) { ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; - unique_ptr request(m_pending_request.release()); + unique_ptr request( + std::move(m_pending_request)); unique_ptr reply; if (waiting_for_dub_response) { reply.reset(RDMReply::DUBReply(rdm::RDMFrame(data, length))); diff --git a/plugins/usbpro/RobeWidget.cpp b/plugins/usbpro/RobeWidget.cpp index b4bfe62a3b..7508f5b5cd 100644 --- a/plugins/usbpro/RobeWidget.cpp +++ b/plugins/usbpro/RobeWidget.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "ola/Constants.h" #include "ola/Logging.h" @@ -135,7 +136,7 @@ void RobeWidgetImpl::SendRDMRequest(RDMRequest *request_ptr, << this_transaction_number; m_rdm_request_callback = on_complete; - m_pending_request.reset(request.release()); + m_pending_request = std::move(request); const uint8_t label = m_pending_request->IsDUB() ? RDM_DISCOVERY : RDM_REQUEST; @@ -296,7 +297,7 @@ void RobeWidgetImpl::HandleRDMResponse(const uint8_t *data, } ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; - unique_ptr request(m_pending_request.release()); + unique_ptr request(std::move(m_pending_request)); // this was a broadcast request if (request->DestinationUID().IsBroadcast()) { @@ -333,7 +334,7 @@ void RobeWidgetImpl::HandleDiscoveryResponse(const uint8_t *data, } else if (m_rdm_request_callback) { ola::rdm::RDMCallback *callback = m_rdm_request_callback; m_rdm_request_callback = NULL; - unique_ptr request(m_pending_request.release()); + unique_ptr request(std::move(m_pending_request)); if (length <= RDM_PADDING_BYTES) { // this indicates that no request was received diff --git a/tools/e133/DeviceManagerImpl.cpp b/tools/e133/DeviceManagerImpl.cpp index 86e05e57d6..f92551684c 100644 --- a/tools/e133/DeviceManagerImpl.cpp +++ b/tools/e133/DeviceManagerImpl.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include "libs/acn/E133HealthCheckedConnection.h" @@ -240,7 +241,7 @@ void DeviceManagerImpl::OnTCPConnect(TCPSocket *socket_ptr) { // setup the incoming transport, we don't need to setup the outgoing one // until we've got confirmation that we're the designated controller. - device_state->socket.reset(socket.release()); + device_state->socket = std::move(socket); device_state->in_transport.reset(new IncomingTCPTransport(&m_root_inflator, socket_ptr)); diff --git a/tools/e133/basic-controller.cpp b/tools/e133/basic-controller.cpp index 09b366827c..2fc693a857 100644 --- a/tools/e133/basic-controller.cpp +++ b/tools/e133/basic-controller.cpp @@ -223,9 +223,9 @@ void SimpleE133Controller::OnTCPConnect(TCPSocket *socket_ptr) { return; } - device_state->health_checked_connection.reset( - health_checked_connection.release()); - device_state->socket.reset(socket.release()); + device_state->health_checked_connection = std::move( + health_checked_connection); + device_state->socket = std::move(socket); m_ss.AddReadDescriptor(socket_ptr);