DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
// // handler_alloc_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef BOOST_ASIO_DETAIL_HANDLER_ALLOC_HELPERS_HPP #define BOOST_ASIO_DETAIL_HANDLER_ALLOC_HELPERS_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include
#include
#include
#include
#include
#include
// Calls to asio_handler_allocate and asio_handler_deallocate must be made from // a namespace that does not contain any overloads of these functions. The // boost_asio_handler_alloc_helpers namespace is defined here for that purpose. namespace boost_asio_handler_alloc_helpers { template
inline void* allocate(std::size_t s, Handler* h) { #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) return ::operator new(s); #else using namespace boost::asio; return asio_handler_allocate(s, h); #endif } template
inline void deallocate(void* p, std::size_t s, Handler* h) { #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) ::operator delete(p); #else using namespace boost::asio; asio_handler_deallocate(p, s, h); #endif } } // namespace boost_asio_handler_alloc_helpers namespace boost { namespace asio { namespace detail { // Traits for handler allocation. template
struct handler_alloc_traits { typedef Handler handler_type; typedef Object value_type; typedef Object* pointer_type; BOOST_STATIC_CONSTANT(std::size_t, value_size = sizeof(Object)); }; template
class handler_ptr; // Helper class to provide RAII on uninitialised handler memory. template
class raw_handler_ptr : private noncopyable { public: typedef typename Alloc_Traits::handler_type handler_type; typedef typename Alloc_Traits::value_type value_type; typedef typename Alloc_Traits::pointer_type pointer_type; BOOST_STATIC_CONSTANT(std::size_t, value_size = Alloc_Traits::value_size); // Constructor allocates the memory. raw_handler_ptr(handler_type& handler) : handler_(handler), pointer_(static_cast
( boost_asio_handler_alloc_helpers::allocate(value_size, &handler_))) { } // Destructor automatically deallocates memory, unless it has been stolen by // a handler_ptr object. ~raw_handler_ptr() { if (pointer_) boost_asio_handler_alloc_helpers::deallocate( pointer_, value_size, &handler_); } private: friend class handler_ptr
; handler_type& handler_; pointer_type pointer_; }; // Helper class to provide RAII on uninitialised handler memory. template
class handler_ptr : private noncopyable { public: typedef typename Alloc_Traits::handler_type handler_type; typedef typename Alloc_Traits::value_type value_type; typedef typename Alloc_Traits::pointer_type pointer_type; BOOST_STATIC_CONSTANT(std::size_t, value_size = Alloc_Traits::value_size); typedef raw_handler_ptr
raw_ptr_type; // Take ownership of existing memory. handler_ptr(handler_type& handler, pointer_type pointer) : handler_(handler), pointer_(pointer) { } // Construct object in raw memory and take ownership if construction succeeds. handler_ptr(raw_ptr_type& raw_ptr) : handler_(raw_ptr.handler_), pointer_(new (raw_ptr.pointer_) value_type) { raw_ptr.pointer_ = 0; } // Construct object in raw memory and take ownership if construction succeeds. template
handler_ptr(raw_ptr_type& raw_ptr, Arg1& a1) : handler_(raw_ptr.handler_), pointer_(new (raw_ptr.pointer_) value_type(a1)) { raw_ptr.pointer_ = 0; } // Construct object in raw memory and take ownership if construction succeeds. template
handler_ptr(raw_ptr_type& raw_ptr, Arg1& a1, Arg2& a2) : handler_(raw_ptr.handler_), pointer_(new (raw_ptr.pointer_) value_type(a1, a2)) { raw_ptr.pointer_ = 0; } // Construct object in raw memory and take ownership if construction succeeds. template
handler_ptr(raw_ptr_type& raw_ptr, Arg1& a1, Arg2& a2, Arg3& a3) : handler_(raw_ptr.handler_), pointer_(new (raw_ptr.pointer_) value_type(a1, a2, a3)) { raw_ptr.pointer_ = 0; } // Construct object in raw memory and take ownership if construction succeeds. template
handler_ptr(raw_ptr_type& raw_ptr, Arg1& a1, Arg2& a2, Arg3& a3, Arg4& a4) : handler_(raw_ptr.handler_), pointer_(new (raw_ptr.pointer_) value_type(a1, a2, a3, a4)) { raw_ptr.pointer_ = 0; } // Construct object in raw memory and take ownership if construction succeeds. template
handler_ptr(raw_ptr_type& raw_ptr, Arg1& a1, Arg2& a2, Arg3& a3, Arg4& a4, Arg5& a5) : handler_(raw_ptr.handler_), pointer_(new (raw_ptr.pointer_) value_type(a1, a2, a3, a4, a5)) { raw_ptr.pointer_ = 0; } // Construct object in raw memory and take ownership if construction succeeds. template
handler_ptr(raw_ptr_type& raw_ptr, Arg1& a1, Arg2& a2, Arg3& a3, Arg4& a4, Arg5& a5, Arg6& a6) : handler_(raw_ptr.handler_), pointer_(new (raw_ptr.pointer_) value_type(a1, a2, a3, a4, a5, a6)) { raw_ptr.pointer_ = 0; } // Construct object in raw memory and take ownership if construction succeeds. template
handler_ptr(raw_ptr_type& raw_ptr, Arg1& a1, Arg2& a2, Arg3& a3, Arg4& a4, Arg5& a5, Arg6& a6, Arg7& a7) : handler_(raw_ptr.handler_), pointer_(new (raw_ptr.pointer_) value_type(a1, a2, a3, a4, a5, a6, a7)) { raw_ptr.pointer_ = 0; } // Construct object in raw memory and take ownership if construction succeeds. template
handler_ptr(raw_ptr_type& raw_ptr, Arg1& a1, Arg2& a2, Arg3& a3, Arg4& a4, Arg5& a5, Arg6& a6, Arg7& a7, Arg8& a8) : handler_(raw_ptr.handler_), pointer_(new (raw_ptr.pointer_) value_type( a1, a2, a3, a4, a5, a6, a7, a8)) { raw_ptr.pointer_ = 0; } // Destructor automatically deallocates memory, unless it has been released. ~handler_ptr() { reset(); } // Get the memory. pointer_type get() const { return pointer_; } // Release ownership of the memory. pointer_type release() { pointer_type tmp = pointer_; pointer_ = 0; return tmp; } // Explicitly destroy and deallocate the memory. void reset() { if (pointer_) { pointer_->value_type::~value_type(); boost_asio_handler_alloc_helpers::deallocate( pointer_, value_size, &handler_); pointer_ = 0; } } private: handler_type& handler_; pointer_type pointer_; }; } // namespace detail } // namespace asio } // namespace boost #include
#endif // BOOST_ASIO_DETAIL_HANDLER_ALLOC_HELPERS_HPP
handler_alloc_helpers.hpp
Page URL
File URL
Prev
14/76
Next
Download
( 7 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.