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-2007 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_RND_INDEX_LOADER_HPP #define BOOST_MULTI_INDEX_DETAIL_RND_INDEX_LOADER_HPP #if defined(_MSC_VER)&&(_MSC_VER>=1200) #pragma once #endif #include
/* keep it first to prevent nasty warns in MSVC */ #include
#include
#include
#include
#include
#include
#include
namespace boost{ namespace multi_index{ namespace detail{ /* This class implements a serialization rearranger for random access * indices. In order to achieve O(n) performance, the following strategy * is followed: the nodes of the index are handled as if in a bidirectional * list, where the next pointers are stored in the original * random_access_index_ptr_array and the prev pointers are stored in * an auxiliary array. Rearranging of nodes in such a bidirectional list * is constant time. Once all the arrangements are performed (on destruction * time) the list is traversed in reverse order and * pointers are swapped and set accordingly so that they recover its * original semantics ( *(node->up())==node ) while retaining the * new order. */ template
class random_access_index_loader_base:private noncopyable { protected: typedef typename prevent_eti< Allocator, random_access_index_node_impl< typename boost::detail::allocator::rebind_to< Allocator, void >::type > >::type node_impl_type; typedef typename node_impl_type::pointer node_impl_pointer; typedef random_access_index_ptr_array
ptr_array; random_access_index_loader_base(const Allocator& al_,ptr_array& ptrs_): al(al_), ptrs(ptrs_), header(*ptrs.end()), prev_spc(al,0), preprocessed(false) {} ~random_access_index_loader_base() { if(preprocessed) { node_impl_pointer n=header; next(n)=n; for(std::size_t i=ptrs.size();i--;){ n=prev(n); std::size_t d=position(n); if(d!=i){ node_impl_pointer m=prev(next_at(i)); std::swap(m->up(),n->up()); next_at(d)=next_at(i); std::swap(prev_at(d),prev_at(i)); } next(n)=n; } } } void rearrange(node_impl_pointer position,node_impl_pointer x) { preprocess(); /* only incur this penalty if rearrange() is ever called */ if(position==node_impl_pointer(0))position=header; next(prev(x))=next(x); prev(next(x))=prev(x); prev(x)=position; next(x)=next(position); next(prev(x))=prev(next(x))=x; } private: void preprocess() { if(!preprocessed){ /* get space for the auxiliary prev array */ auto_space
tmp(al,ptrs.size()+1); prev_spc.swap(tmp); /* prev_spc elements point to the prev nodes */ std::rotate_copy( &*ptrs.begin(),&*ptrs.end(),&*ptrs.end()+1,&*prev_spc.data()); /* ptrs elements point to the next nodes */ std::rotate(&*ptrs.begin(),&*ptrs.begin()+1,&*ptrs.end()+1); preprocessed=true; } } std::size_t position(node_impl_pointer x)const { return (std::size_t)(x->up()-ptrs.begin()); } node_impl_pointer& next_at(std::size_t n)const { return *ptrs.at(n); } node_impl_pointer& prev_at(std::size_t n)const { return *(prev_spc.data()+n); } node_impl_pointer& next(node_impl_pointer x)const { return *(x->up()); } node_impl_pointer& prev(node_impl_pointer x)const { return prev_at(position(x)); } Allocator al; ptr_array& ptrs; node_impl_pointer header; auto_space
prev_spc; bool preprocessed; }; template
class random_access_index_loader: private random_access_index_loader_base
{ typedef random_access_index_loader_base
super; typedef typename super::node_impl_pointer node_impl_pointer; typedef typename super::ptr_array ptr_array; public: random_access_index_loader(const Allocator& al_,ptr_array& ptrs_): super(al_,ptrs_) {} void rearrange(Node* position,Node *x) { super::rearrange(position?position->impl():node_impl_pointer(0),x->impl()); } }; } /* namespace multi_index::detail */ } /* namespace multi_index */ } /* namespace boost */ #endif
rnd_index_loader.hpp
Page URL
File URL
Prev
32/44
Next
Download
( 4 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.