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 Ion Gaztanaga 2005-2008. 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/interprocess for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_INTERPROCESS_MAPPED_FILE_HPP #define BOOST_INTERPROCESS_MAPPED_FILE_HPP #include
#include
#include
#include
#include
#include
#include
#include
//std::string #include
//std::remove #include
//!\file //!Describes file_mapping and mapped region classes namespace boost { namespace interprocess { //!A class that wraps a file-mapping that can be used to //!create mapped regions from the mapped files class file_mapping { /// @cond //Non-copyable and non-assignable file_mapping(const file_mapping &); file_mapping &operator=(const file_mapping &); /// @endcond public: //!Constructs an empty file mapping. //!Does not throw file_mapping(); //!Opens a file mapping of file "filename", starting in offset //!"file_offset", and the mapping's size will be "size". The mapping //!can be opened for read-only "read_only" or read-write "read_write" //!modes. Throws interprocess_exception on error. file_mapping(const char *filename, mode_t mode); //!Moves the ownership of "moved"'s shared memory object to *this. //!After the call, "moved" does not represent any shared memory object. //!Does not throw #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE file_mapping(detail::moved_object
&moved) { this->swap(moved.get()); } #else file_mapping(file_mapping &&moved) { this->swap(moved); } #endif //!Moves the ownership of "moved"'s shared memory to *this. //!After the call, "moved" does not represent any shared memory. //!Does not throw #ifndef BOOST_INTERPROCESS_RVALUE_REFERENCE file_mapping &operator= (detail::moved_object
&moved) { file_mapping tmp(moved); this->swap(tmp); return *this; } #else file_mapping &operator=(file_mapping &&moved) { file_mapping tmp(move(moved)); this->swap(tmp); return *this; } #endif //!Swaps to file_mappings. //!Does not throw. void swap(file_mapping &other); //!Returns access mode //!used in the constructor mode_t get_mode() const; //!Obtains the mapping handle //!to be used with mapped_region mapping_handle_t get_mapping_handle() const; //!Destroys the file mapping. All mapped regions created from this are still //!valid. Does not throw ~file_mapping(); //!Returns the name of the file //!used in the constructor. const char *get_name() const; /// @cond private: //!Closes a previously opened file mapping. Never throws. void priv_close(); file_handle_t m_handle; mode_t m_mode; std::string m_filename; /// @endcond }; inline file_mapping::file_mapping() : m_handle(file_handle_t(detail::invalid_file())) {} inline file_mapping::~file_mapping() { this->priv_close(); } inline const char *file_mapping::get_name() const { return m_filename.c_str(); } inline void file_mapping::swap(file_mapping &other) { std::swap(m_handle, other.m_handle); std::swap(m_mode, other.m_mode); m_filename.swap(other.m_filename); } inline mapping_handle_t file_mapping::get_mapping_handle() const { return detail::mapping_handle_from_file_handle(m_handle); } inline mode_t file_mapping::get_mode() const { return m_mode; } inline file_mapping::file_mapping (const char *filename, mode_t mode) : m_filename(filename) { //Check accesses if (mode != read_write && mode != read_only){ error_info err = other_error; throw interprocess_exception(err); } //Open file m_handle = detail::open_existing_file(filename, mode); //Check for error if(m_handle == detail::invalid_file()){ error_info err = system_error_code(); this->priv_close(); throw interprocess_exception(err); } m_mode = mode; } inline void file_mapping::priv_close() { if(m_handle != detail::invalid_file()){ detail::close_file(m_handle); m_handle = detail::invalid_file(); } } } //namespace interprocess { } //namespace boost { #include
#endif //BOOST_INTERPROCESS_MAPPED_FILE_HPP
file_mapping.hpp
Page URL
File URL
Prev
4/15
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.