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
// // service_registry.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_SERVICE_REGISTRY_HPP #define BOOST_ASIO_DETAIL_SERVICE_REGISTRY_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace asio { namespace detail { class service_registry : private noncopyable { public: // Constructor. service_registry(boost::asio::io_service& o) : owner_(o), first_service_(0) { } // Destructor. ~service_registry() { // Shutdown all services. This must be done in a separate loop before the // services are destroyed since the destructors of user-defined handler // objects may try to access other service objects. boost::asio::io_service::service* service = first_service_; while (service) { service->shutdown_service(); service = service->next_; } // Destroy all services. while (first_service_) { boost::asio::io_service::service* next_service = first_service_->next_; delete first_service_; first_service_ = next_service; } } // Get the service object corresponding to the specified service type. Will // create a new service object automatically if no such object already // exists. Ownership of the service object is not transferred to the caller. template
Service& use_service() { boost::asio::detail::mutex::scoped_lock lock(mutex_); // First see if there is an existing service object for the given type. boost::asio::io_service::service* service = first_service_; while (service) { if (service_id_matches(*service, Service::id)) return *static_cast
(service); service = service->next_; } // Create a new service object. The service registry's mutex is not locked // at this time to allow for nested calls into this function from the new // service's constructor. lock.unlock(); std::auto_ptr
new_service(new Service(owner_)); init_service_id(*new_service, Service::id); Service& new_service_ref = *new_service; lock.lock(); // Check that nobody else created another service object of the same type // while the lock was released. service = first_service_; while (service) { if (service_id_matches(*service, Service::id)) return *static_cast
(service); service = service->next_; } // Service was successfully initialised, pass ownership to registry. new_service->next_ = first_service_; first_service_ = new_service.release(); return new_service_ref; } // Add a service object. Returns false on error, in which case ownership of // the object is retained by the caller. template
bool add_service(Service* new_service) { boost::asio::detail::mutex::scoped_lock lock(mutex_); // Check if there is an existing service object for the given type. boost::asio::io_service::service* service = first_service_; while (service) { if (service_id_matches(*service, Service::id)) return false; service = service->next_; } // Take ownership of the service object. init_service_id(*new_service, Service::id); new_service->next_ = first_service_; first_service_ = new_service; return true; } // Check whether a service object of the specified type already exists. template
bool has_service() const { boost::asio::detail::mutex::scoped_lock lock(mutex_); boost::asio::io_service::service* service = first_service_; while (service) { if (service_id_matches(*service, Service::id)) return true; service = service->next_; } return false; } private: // Set a service's id. void init_service_id(boost::asio::io_service::service& service, const boost::asio::io_service::id& id) { service.type_info_ = 0; service.id_ = &id; } // Set a service's id. template
void init_service_id(boost::asio::io_service::service& service, const boost::asio::detail::service_id
& /*id*/) { service.type_info_ = &typeid(Service); service.id_ = 0; } // Check if a service matches the given id. static bool service_id_matches( const boost::asio::io_service::service& service, const boost::asio::io_service::id& id) { return service.id_ == &id; } // Check if a service matches the given id. template
static bool service_id_matches( const boost::asio::io_service::service& service, const boost::asio::detail::service_id
& /*id*/) { return service.type_info_ != 0 && *service.type_info_ == typeid(Service); } // Mutex to protect access to internal data. mutable boost::asio::detail::mutex mutex_; // The owner of this service registry and the services it contains. boost::asio::io_service& owner_; // The first service in the list of contained services. boost::asio::io_service::service* first_service_; }; } // namespace detail } // namespace asio } // namespace boost #include
#endif // BOOST_ASIO_DETAIL_SERVICE_REGISTRY_HPP
service_registry.hpp
Page URL
File URL
Prev
48/76
Next
Download
( 5 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.