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
/* Copyright 2003-2005 Joaqu�n M L�pez Mu�oz. * 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) * * See http://www.boost.org/libs/multi_index for library home page. */ #ifndef BOOST_MULTI_INDEX_DETAIL_SCOPE_GUARD_HPP #define BOOST_MULTI_INDEX_DETAIL_SCOPE_GUARD_HPP #if defined(_MSC_VER)&&(_MSC_VER>=1200) #pragma once #endif namespace boost{ namespace multi_index{ namespace detail{ /* Until some official version of the ScopeGuard idiom makes it into Boost, * we locally define our own. This is a merely reformated version of * ScopeGuard.h as defined in: * Alexandrescu, A., Marginean, P.:"Generic
: Change the Way You * Write Exception-Safe Code - Forever", C/C++ Users Jornal, Dec 2000, * http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/ * with the following modifications: * - General pretty formatting (pretty to my taste at least.) * - Naming style changed to standard C++ library requirements. * - safe_execute does not feature a try-catch protection, so we can * use this even if BOOST_NO_EXCEPTIONS is defined. * - Added scope_guard_impl4 and obj_scope_guard_impl3, (Boost.MultiIndex * needs them). A better design would provide guards for many more * arguments through the Boost Preprocessor Library. * - Added scope_guard_impl_base::touch (see below.) * - Removed RefHolder and ByRef, whose functionality is provided * already by Boost.Ref. * - Removed static make_guard's and make_obj_guard's, so that the code * will work even if BOOST_NO_MEMBER_TEMPLATES is defined. This forces * us to move some private ctors to public, though. * * NB: CodeWarrior Pro 8 seems to have problems looking up safe_execute * without an explicit qualification. */ class scope_guard_impl_base { public: scope_guard_impl_base():dismissed_(false){} void dismiss()const{dismissed_=true;} /* This helps prevent some "unused variable" warnings under, for instance, * GCC 3.2. */ void touch()const{} protected: ~scope_guard_impl_base(){} scope_guard_impl_base(const scope_guard_impl_base& other): dismissed_(other.dismissed_) { other.dismiss(); } template
static void safe_execute(J& j){if(!j.dismissed_)j.execute();} mutable bool dismissed_; private: scope_guard_impl_base& operator=(const scope_guard_impl_base&); }; typedef const scope_guard_impl_base& scope_guard; template
class scope_guard_impl0:public scope_guard_impl_base { public: scope_guard_impl0(F fun):fun_(fun){} ~scope_guard_impl0(){scope_guard_impl_base::safe_execute(*this);} void execute(){fun_();} protected: F fun_; }; template
inline scope_guard_impl0
make_guard(F fun) { return scope_guard_impl0
(fun); } template
class scope_guard_impl1:public scope_guard_impl_base { public: scope_guard_impl1(F fun,P1 p1):fun_(fun),p1_(p1){} ~scope_guard_impl1(){scope_guard_impl_base::safe_execute(*this);} void execute(){fun_(p1_);} protected: F fun_; const P1 p1_; }; template
inline scope_guard_impl1
make_guard(F fun,P1 p1) { return scope_guard_impl1
(fun,p1); } template
class scope_guard_impl2:public scope_guard_impl_base { public: scope_guard_impl2(F fun,P1 p1,P2 p2):fun_(fun),p1_(p1),p2_(p2){} ~scope_guard_impl2(){scope_guard_impl_base::safe_execute(*this);} void execute(){fun_(p1_,p2_);} protected: F fun_; const P1 p1_; const P2 p2_; }; template
inline scope_guard_impl2
make_guard(F fun,P1 p1,P2 p2) { return scope_guard_impl2
(fun,p1,p2); } template
class scope_guard_impl3:public scope_guard_impl_base { public: scope_guard_impl3(F fun,P1 p1,P2 p2,P3 p3):fun_(fun),p1_(p1),p2_(p2),p3_(p3){} ~scope_guard_impl3(){scope_guard_impl_base::safe_execute(*this);} void execute(){fun_(p1_,p2_,p3_);} protected: F fun_; const P1 p1_; const P2 p2_; const P3 p3_; }; template
inline scope_guard_impl3
make_guard(F fun,P1 p1,P2 p2,P3 p3) { return scope_guard_impl3
(fun,p1,p2,p3); } template
class scope_guard_impl4:public scope_guard_impl_base { public: scope_guard_impl4(F fun,P1 p1,P2 p2,P3 p3,P4 p4): fun_(fun),p1_(p1),p2_(p2),p3_(p3),p4_(p4){} ~scope_guard_impl4(){scope_guard_impl_base::safe_execute(*this);} void execute(){fun_(p1_,p2_,p3_,p4_);} protected: F fun_; const P1 p1_; const P2 p2_; const P3 p3_; const P4 p4_; }; template
inline scope_guard_impl4
make_guard( F fun,P1 p1,P2 p2,P3 p3,P4 p4) { return scope_guard_impl4
(fun,p1,p2,p3,p4); } template
class obj_scope_guard_impl0:public scope_guard_impl_base { public: obj_scope_guard_impl0(Obj& obj,MemFun mem_fun):obj_(obj),mem_fun_(mem_fun){} ~obj_scope_guard_impl0(){scope_guard_impl_base::safe_execute(*this);} void execute(){(obj_.*mem_fun_)();} protected: Obj& obj_; MemFun mem_fun_; }; template
inline obj_scope_guard_impl0
make_obj_guard(Obj& obj,MemFun mem_fun) { return obj_scope_guard_impl0
(obj,mem_fun); } template
class obj_scope_guard_impl1:public scope_guard_impl_base { public: obj_scope_guard_impl1(Obj& obj,MemFun mem_fun,P1 p1): obj_(obj),mem_fun_(mem_fun),p1_(p1){} ~obj_scope_guard_impl1(){scope_guard_impl_base::safe_execute(*this);} void execute(){(obj_.*mem_fun_)(p1_);} protected: Obj& obj_; MemFun mem_fun_; const P1 p1_; }; template
inline obj_scope_guard_impl1
make_obj_guard( Obj& obj,MemFun mem_fun,P1 p1) { return obj_scope_guard_impl1
(obj,mem_fun,p1); } template
class obj_scope_guard_impl2:public scope_guard_impl_base { public: obj_scope_guard_impl2(Obj& obj,MemFun mem_fun,P1 p1,P2 p2): obj_(obj),mem_fun_(mem_fun),p1_(p1),p2_(p2) {} ~obj_scope_guard_impl2(){scope_guard_impl_base::safe_execute(*this);} void execute(){(obj_.*mem_fun_)(p1_,p2_);} protected: Obj& obj_; MemFun mem_fun_; const P1 p1_; const P2 p2_; }; template
inline obj_scope_guard_impl2
make_obj_guard(Obj& obj,MemFun mem_fun,P1 p1,P2 p2) { return obj_scope_guard_impl2
(obj,mem_fun,p1,p2); } template
class obj_scope_guard_impl3:public scope_guard_impl_base { public: obj_scope_guard_impl3(Obj& obj,MemFun mem_fun,P1 p1,P2 p2,P3 p3): obj_(obj),mem_fun_(mem_fun),p1_(p1),p2_(p2),p3_(p3) {} ~obj_scope_guard_impl3(){scope_guard_impl_base::safe_execute(*this);} void execute(){(obj_.*mem_fun_)(p1_,p2_,p3_);} protected: Obj& obj_; MemFun mem_fun_; const P1 p1_; const P2 p2_; const P3 p3_; }; template
inline obj_scope_guard_impl3
make_obj_guard(Obj& obj,MemFun mem_fun,P1 p1,P2 p2,P3 p3) { return obj_scope_guard_impl3
(obj,mem_fun,p1,p2,p3); } } /* namespace multi_index::detail */ } /* namespace multi_index */ } /* namespace boost */ #endif
scope_guard.hpp
Page URL
File URL
Prev
39/44
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.