| 1 | // |
| 2 | // HTTPBufferAllocator.h |
| 3 | // |
| 4 | // Library: Net |
| 5 | // Package: HTTP |
| 6 | // Module: HTTPBufferAllocator |
| 7 | // |
| 8 | // Definition of the HTTPBufferAllocator class. |
| 9 | // |
| 10 | // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef Net_HTTPBufferAllocator_INCLUDED |
| 18 | #define Net_HTTPBufferAllocator_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/Net/Net.h" |
| 22 | #include "Poco/MemoryPool.h" |
| 23 | #include <ios> |
| 24 | |
| 25 | |
| 26 | namespace Poco { |
| 27 | namespace Net { |
| 28 | |
| 29 | |
| 30 | class Net_API HTTPBufferAllocator |
| 31 | /// A BufferAllocator for HTTP streams. |
| 32 | { |
| 33 | public: |
| 34 | static char* allocate(std::streamsize size); |
| 35 | static void deallocate(char* ptr, std::streamsize size); |
| 36 | |
| 37 | enum |
| 38 | { |
| 39 | BUFFER_SIZE = 4096 |
| 40 | }; |
| 41 | |
| 42 | private: |
| 43 | static Poco::MemoryPool _pool; |
| 44 | }; |
| 45 | |
| 46 | |
| 47 | } } // namespace Poco::Net |
| 48 | |
| 49 | |
| 50 | #endif // Net_HTTPBufferAllocator_INCLUDED |
| 51 | |