mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
replaced plain pointers with smart pointers in various interfaces
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPRequestHandlerFactory.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/HTTPRequestHandlerFactory.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/HTTPRequestHandlerFactory.h#4 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -58,6 +59,8 @@ class Net_API HTTPRequestHandlerFactory
|
||||
/// method.
|
||||
{
|
||||
public:
|
||||
typedef Poco::SharedPtr<HTTPRequestHandlerFactory> Ptr;
|
||||
|
||||
HTTPRequestHandlerFactory();
|
||||
/// Creates the HTTPRequestHandlerFactory.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServer.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/HTTPServer.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/HTTPServer.h#3 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@@ -42,16 +42,14 @@
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/TCPServer.h"
|
||||
#include "Poco/Net/HTTPRequestHandlerFactory.h"
|
||||
#include "Poco/Net/HTTPServerParams.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
class HTTPRequestHandlerFactory;
|
||||
class HTTPServerParams;
|
||||
|
||||
|
||||
class Net_API HTTPServer: public TCPServer
|
||||
/// A subclass of TCPServer that implements a
|
||||
/// full-featured multithreaded HTTP server.
|
||||
@@ -75,7 +73,7 @@ class Net_API HTTPServer: public TCPServer
|
||||
/// information about the HTTP protocol.
|
||||
{
|
||||
public:
|
||||
HTTPServer(HTTPRequestHandlerFactory* pFactory, const ServerSocket& socket, HTTPServerParams* pParams);
|
||||
HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& socket, HTTPServerParams::Ptr pParams);
|
||||
/// Creates the HTTPServer, using the given ServerSocket.
|
||||
///
|
||||
/// The server takes ownership of the HTTPRequstHandlerFactory
|
||||
@@ -85,7 +83,7 @@ public:
|
||||
///
|
||||
/// News threads are taken from the default thread pool.
|
||||
|
||||
HTTPServer(HTTPRequestHandlerFactory* pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams* pParams);
|
||||
HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams::Ptr pParams);
|
||||
/// Creates the HTTPServer, using the given ServerSocket.
|
||||
///
|
||||
/// The server takes ownership of the HTTPRequstHandlerFactory
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerConnection.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/HTTPServerConnection.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/HTTPServerConnection.h#4 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@@ -43,14 +43,14 @@
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/TCPServerConnection.h"
|
||||
#include "Poco/Net/HTTPResponse.h"
|
||||
#include "Poco/Net/HTTPRequestHandlerFactory.h"
|
||||
#include "Poco/Net/HTTPServerParams.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
class HTTPServerParams;
|
||||
class HTTPRequestHandlerFactory;
|
||||
class HTTPServerSession;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class Net_API HTTPServerConnection: public TCPServerConnection
|
||||
/// connections.
|
||||
{
|
||||
public:
|
||||
HTTPServerConnection(const StreamSocket& socket, HTTPServerParams* pParams, HTTPRequestHandlerFactory* pFactory);
|
||||
HTTPServerConnection(const StreamSocket& socket, HTTPServerParams::Ptr pParams, HTTPRequestHandlerFactory::Ptr pFactory);
|
||||
/// Creates the HTTPServerConnection.
|
||||
|
||||
virtual ~HTTPServerConnection();
|
||||
@@ -72,8 +72,8 @@ protected:
|
||||
void sendErrorResponse(HTTPServerSession& session, HTTPResponse::HTTPStatus status);
|
||||
|
||||
private:
|
||||
HTTPServerParams* _pParams;
|
||||
HTTPRequestHandlerFactory* _pFactory;
|
||||
HTTPServerParams::Ptr _pParams;
|
||||
HTTPRequestHandlerFactory::Ptr _pFactory;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerConnectionFactory.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/HTTPServerConnectionFactory.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/HTTPServerConnectionFactory.h#3 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@@ -42,22 +42,20 @@
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/TCPServerConnectionFactory.h"
|
||||
#include "Poco/Net/HTTPRequestHandlerFactory.h"
|
||||
#include "Poco/Net/HTTPServerParams.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
class HTTPServerParams;
|
||||
class HTTPRequestHandlerFactory;
|
||||
|
||||
|
||||
class Net_API HTTPServerConnectionFactory: public TCPServerConnectionFactory
|
||||
/// This implementation of a TCPServerConnectionFactory
|
||||
/// is used by HTTPServer to create HTTPServerConnection objects.
|
||||
{
|
||||
public:
|
||||
HTTPServerConnectionFactory(HTTPServerParams* pParams, HTTPRequestHandlerFactory* pFactory);
|
||||
HTTPServerConnectionFactory(HTTPServerParams::Ptr pParams, HTTPRequestHandlerFactory::Ptr pFactory);
|
||||
/// Creates the HTTPServerConnectionFactory.
|
||||
|
||||
~HTTPServerConnectionFactory();
|
||||
@@ -68,8 +66,8 @@ public:
|
||||
/// using the given StreamSocket.
|
||||
|
||||
private:
|
||||
HTTPServerParams* _pParams;
|
||||
HTTPRequestHandlerFactory* _pFactory;
|
||||
HTTPServerParams::Ptr _pParams;
|
||||
HTTPRequestHandlerFactory::Ptr _pFactory;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerParams.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/HTTPServerParams.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/HTTPServerParams.h#3 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@@ -55,6 +55,8 @@ class Net_API HTTPServerParams: public TCPServerParams
|
||||
/// Subclasses may add new parameters to the class.
|
||||
{
|
||||
public:
|
||||
typedef Poco::AutoPtr<HTTPServerParams> Ptr;
|
||||
|
||||
HTTPServerParams();
|
||||
/// Creates the HTTPServerParams.
|
||||
///
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// NetworkInterface.h
|
||||
//
|
||||
// $Id: //poco/1.3/Net/include/Poco/Net/NetworkInterface.h#7 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/NetworkInterface.h#5 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: Sockets
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TCPServer.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/TCPServer.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/TCPServer.h#4 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: TCPServer
|
||||
@@ -42,6 +42,8 @@
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/ServerSocket.h"
|
||||
#include "Poco/Net/TCPServerConnectionFactory.h"
|
||||
#include "Poco/Net/TCPServerParams.h"
|
||||
#include "Poco/Runnable.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/ThreadPool.h"
|
||||
@@ -51,9 +53,7 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
class TCPServerParams;
|
||||
class TCPServerDispatcher;
|
||||
class TCPServerConnectionFactory;
|
||||
|
||||
|
||||
class Net_API TCPServer: public Poco::Runnable
|
||||
@@ -98,7 +98,7 @@ class Net_API TCPServer: public Poco::Runnable
|
||||
/// Already served connections, however, will continue being served.
|
||||
{
|
||||
public:
|
||||
TCPServer(TCPServerConnectionFactory* pFactory, const ServerSocket& socket, TCPServerParams* pParams = 0);
|
||||
TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& socket, TCPServerParams::Ptr pParams = 0);
|
||||
/// Creates the TCPServer, using the given ServerSocket.
|
||||
///
|
||||
/// The server takes ownership of the TCPServerConnectionFactory
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
///
|
||||
/// News threads are taken from the default thread pool.
|
||||
|
||||
TCPServer(TCPServerConnectionFactory* pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams* pParams = 0);
|
||||
TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, TCPServerParams::Ptr pParams = 0);
|
||||
/// Creates the TCPServer, using the given ServerSocket.
|
||||
///
|
||||
/// The server takes ownership of the TCPServerConnectionFactory
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TCPServerConnectionFactory.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/TCPServerConnectionFactory.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/TCPServerConnectionFactory.h#3 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: TCPServer
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/TCPServerConnection.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -64,6 +65,8 @@ class Net_API TCPServerConnectionFactory
|
||||
/// of TCPServerConnection.
|
||||
{
|
||||
public:
|
||||
typedef Poco::SharedPtr<TCPServerConnectionFactory> Ptr;
|
||||
|
||||
virtual ~TCPServerConnectionFactory();
|
||||
/// Destroys the TCPServerConnectionFactory.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TCPServerDispatcher.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/TCPServerDispatcher.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/TCPServerDispatcher.h#3 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: TCPServer
|
||||
@@ -42,6 +42,8 @@
|
||||
|
||||
#include "Poco/Net/Net.h"
|
||||
#include "Poco/Net/StreamSocket.h"
|
||||
#include "Poco/Net/TCPServerConnectionFactory.h"
|
||||
#include "Poco/Net/TCPServerParams.h"
|
||||
#include "Poco/Runnable.h"
|
||||
#include "Poco/NotificationQueue.h"
|
||||
#include "Poco/ThreadPool.h"
|
||||
@@ -52,16 +54,12 @@ namespace Poco {
|
||||
namespace Net {
|
||||
|
||||
|
||||
class TCPServerParams;
|
||||
class TCPServerConnectionFactory;
|
||||
|
||||
|
||||
class Net_API TCPServerDispatcher: public Poco::Runnable
|
||||
/// A helper class for TCPServer that dispatches
|
||||
/// connections to server connection threads.
|
||||
{
|
||||
public:
|
||||
TCPServerDispatcher(TCPServerConnectionFactory* pFactory, Poco::ThreadPool& threadPool, TCPServerParams* pParams);
|
||||
TCPServerDispatcher(TCPServerConnectionFactory::Ptr pFactory, Poco::ThreadPool& threadPool, TCPServerParams::Ptr pParams);
|
||||
/// Creates the TCPServerDispatcher.
|
||||
///
|
||||
/// The dispatcher takes ownership of the TCPServerParams object.
|
||||
@@ -122,17 +120,17 @@ private:
|
||||
TCPServerDispatcher& operator = (const TCPServerDispatcher&);
|
||||
|
||||
int _rc;
|
||||
TCPServerParams* _pParams;
|
||||
TCPServerParams::Ptr _pParams;
|
||||
int _currentThreads;
|
||||
int _totalConnections;
|
||||
int _currentConnections;
|
||||
int _maxConcurrentConnections;
|
||||
int _refusedConnections;
|
||||
bool _stopped;
|
||||
Poco::NotificationQueue _queue;
|
||||
TCPServerConnectionFactory* _pConnectionFactory;
|
||||
Poco::ThreadPool& _threadPool;
|
||||
mutable Poco::FastMutex _mutex;
|
||||
Poco::NotificationQueue _queue;
|
||||
TCPServerConnectionFactory::Ptr _pConnectionFactory;
|
||||
Poco::ThreadPool& _threadPool;
|
||||
mutable Poco::FastMutex _mutex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// TCPServerParams.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/TCPServerParams.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/TCPServerParams.h#4 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: TCPServer
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "Poco/RefCountedObject.h"
|
||||
#include "Poco/Timespan.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/AutoPtr.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -57,6 +58,8 @@ class Net_API TCPServerParams: public Poco::RefCountedObject
|
||||
/// Subclasses may add new parameters to the class.
|
||||
{
|
||||
public:
|
||||
typedef Poco::AutoPtr<TCPServerParams> Ptr;
|
||||
|
||||
TCPServerParams();
|
||||
/// Creates the TCPServerParams.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user