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
// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com) // (C) Copyright 2003-2007 Jonathan Turkanis // (C) Copyright Craig Henderson 2002. 'boost/memmap.hpp' from sandbox // 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/iostreams for documentation. // // This header and its accompanying source file libs/iostreams/memmap.cpp are // an adaptation of Craig Henderson's memmory mapped file library. The // interface has been revised significantly, but the underlying OS-specific // code is essentially the same, with some code from Boost.Filesystem // mixed in. (See notations in source.) // // The following changes have been made: // // 1. OS-specific code put in a .cpp file. // 2. Name of main class changed to mapped_file. // 3. mapped_file given an interface similar to std::fstream (open(), // is_open(), close()) and std::string (data(), size(), begin(), end()). // 4. An additional class readonly_mapped_file has been provided as a // convenience. // 5. [Obsolete: Error states are reported using filesystem::error_code.] // 6. Read-only or read-write states are specified using ios_base::openmode. // 7. Access to the underlying file handles and to security parameters // has been removed. // #ifndef BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED #define BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include
// make sure size_t is in std. #include
// size_t. #include
// pathnames. #include
// pair. #include
// BOOST_MSVC. #include
#include
#include
#include
#include
#include
// openmode. #include
#include
#include
// Must come last. #include
#include
namespace boost { namespace iostreams { namespace detail { struct mapped_file_impl; } // End namespace detail. struct mapped_file_params { explicit mapped_file_params() #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) && defined(BOOST_RWSTD_VER) || \ defined(__BORLANDC__) && defined(_CPPLIB_VER) /**/ : mode(std::ios_base::openmode(0)), #else : mode(), #endif offset(0), length(static_cast
(-1)), new_file_size(0), hint(0) { } explicit mapped_file_params(const std::string& path) : path(path), #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) && defined(BOOST_RWSTD_VER) || \ defined(__BORLANDC__) && defined(_CPPLIB_VER) mode(std::ios_base::openmode(0)), #else mode(), #endif offset(0), length(static_cast
(-1)), new_file_size(0), hint(0) { } std::string path; BOOST_IOS::openmode mode; stream_offset offset; std::size_t length; stream_offset new_file_size; const char* hint; }; //------------------Definition of mapped_file_source--------------------------// class BOOST_IOSTREAMS_DECL mapped_file_source { private: struct safe_bool_helper { int x; }; // From Bronek Kozicki. typedef int safe_bool_helper::* safe_bool; friend struct operations
; public: typedef char char_type; struct category : public source_tag, public direct_tag, public closable_tag { }; typedef std::size_t size_type; typedef const char* iterator; BOOST_STATIC_CONSTANT(size_type, max_length = static_cast
(-1)); mapped_file_source() { } explicit mapped_file_source(mapped_file_params); explicit mapped_file_source( const std::string& path, size_type length = max_length, boost::intmax_t offset = 0 ); //--------------Stream interface------------------------------------------// void open(mapped_file_params params); void open( const std::string& path, size_type length = max_length, boost::intmax_t offset = 0 ); bool is_open() const; void close(); operator safe_bool() const; bool operator!() const; BOOST_IOS::openmode mode() const; //--------------Container interface---------------------------------------// size_type size() const; const char* data() const; iterator begin() const; iterator end() const; //--------------Query admissible offsets----------------------------------// // Returns the allocation granularity for virtual memory. Values passed // as offsets must be multiples of this value. static int alignment(); private: friend class mapped_file; typedef detail::mapped_file_impl impl_type; void open_impl(mapped_file_params); boost::shared_ptr
pimpl_; }; //------------------Definition of mapped_file---------------------------------// class BOOST_IOSTREAMS_DECL mapped_file { private: typedef mapped_file_source delegate_type; delegate_type delegate_; friend struct operations
; public: typedef char char_type; struct category : public seekable_device_tag, public direct_tag, public closable_tag { }; typedef mapped_file_source::size_type size_type; typedef char* iterator; typedef const char* const_iterator; BOOST_STATIC_CONSTANT(size_type, max_length = delegate_type::max_length); mapped_file() { } explicit mapped_file(mapped_file_params p); explicit mapped_file( const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::in | BOOST_IOS::out, size_type length = max_length, stream_offset offset = 0 ); //--------------Conversion to readonly_mapped_file------------------------// operator mapped_file_source&() { return delegate_; } operator const mapped_file_source&() const { return delegate_; } //--------------Stream interface------------------------------------------// void open(mapped_file_params p); void open( const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::in | BOOST_IOS::out, size_type length = max_length, stream_offset offset = 0 ); bool is_open() const { return delegate_.is_open(); } void close() { delegate_.close(); } operator delegate_type::safe_bool() const { return delegate_; } bool operator!() const { return !is_open(); } BOOST_IOS::openmode mode() const { return delegate_.mode(); } //--------------Container interface---------------------------------------// size_type size() const { return delegate_.size(); } char* data() const { return (mode() & BOOST_IOS::out) ? const_cast
(delegate_.data()) : 0; } const char* const_data() const { return delegate_.data(); } iterator begin() const { return data(); } const_iterator const_begin() const { return data(); } iterator end() const { return data() + size(); } const_iterator const_end() const { return data() + size(); } //--------------Query admissible offsets----------------------------------// // Returns the allocation granularity for virtual memory. Values passed // as offsets must be multiples of this value. static int alignment() { return mapped_file_source::alignment(); } }; struct BOOST_IOSTREAMS_DECL mapped_file_sink : private mapped_file { friend struct operations
; typedef char char_type; struct category : public sink_tag, public direct_tag, public closable_tag { }; using mapped_file::close; using mapped_file::size; explicit mapped_file_sink(mapped_file_params p); explicit mapped_file_sink( const std::string& path, size_type length = max_length, boost::intmax_t offset = 0 ); void open(mapped_file_params p); void open( const std::string& path, size_type length = max_length, boost::intmax_t offset = 0 ); }; //------------------Specialization of direct_impl-----------------------------// template<> struct operations
: detail::close_impl
{ static std::pair
input_sequence(boost::iostreams::mapped_file_source& src) { return std::make_pair( const_cast
(src.begin()), const_cast
(src.end()) ); } }; template<> struct operations
: detail::close_impl
{ static std::pair
output_sequence(boost::iostreams::mapped_file_sink& sink) { return std::make_pair(sink.begin(), sink.end()); } }; template<> struct operations
: detail::close_impl
{ static std::pair
input_sequence(boost::iostreams::mapped_file& file) { return std::make_pair(file.begin(), file.end()); } static std::pair
output_sequence(boost::iostreams::mapped_file& file) { return std::make_pair(file.begin(), file.end()); } }; } } // End namespaces iostreams, boost. #include
// pops abi_suffix.hpp pragmas #include
// MSVC. #endif // #ifndef BOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED
mapped_file.hpp
Page URL
File URL
Prev
5/6
Next
Download
( 10 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.