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 2002 The Trustees of Indiana University. // Use, modification and distribution is subject to 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) // Boost.MultiArray Library // Authors: Ronald Garcia // Jeremy Siek // Andrew Lumsdaine // See http://www.boost.org/libs/multi_array for documentation. #ifndef SUBARRAY_RG071801_HPP #define SUBARRAY_RG071801_HPP // // subarray.hpp - used to implement standard operator[] on // multi_arrays // #include "boost/multi_array/base.hpp" #include "boost/multi_array/concept_checks.hpp" #include "boost/limits.hpp" #include "boost/type.hpp" #include
#include
#include
namespace boost { namespace detail { namespace multi_array { // // const_sub_array // multi_array's proxy class to allow multiple overloads of // operator[] in order to provide a clean multi-dimensional array // interface. template
class const_sub_array : public boost::detail::multi_array::multi_array_impl_base
{ typedef boost::detail::multi_array::multi_array_impl_base
super_type; public: typedef typename super_type::value_type value_type; typedef typename super_type::const_reference const_reference; typedef typename super_type::const_iterator const_iterator; typedef typename super_type::const_reverse_iterator const_reverse_iterator; typedef typename super_type::element element; typedef typename super_type::size_type size_type; typedef typename super_type::difference_type difference_type; typedef typename super_type::index index; typedef typename super_type::extent_range extent_range; // template typedefs template
struct const_array_view { typedef boost::detail::multi_array::const_multi_array_view
type; }; template
struct array_view { typedef boost::detail::multi_array::multi_array_view
type; }; // Allow default copy constructor as well. template
const_sub_array (const const_sub_array
& rhs) : base_(rhs.base_), extents_(rhs.extents_), strides_(rhs.strides_), index_base_(rhs.index_base_) { } // const_sub_array always returns const types, regardless of its own // constness. const_reference operator[](index idx) const { return super_type::access(boost::type
(), idx,base_,shape(),strides(),index_bases()); } template
const element& operator()(const IndexList& indices) const { boost::function_requires< detail::multi_array::CollectionConcept
>(); return super_type::access_element(boost::type
(), indices,origin(), shape(),strides(),index_bases()); } // see generate_array_view in base.hpp #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template
#else template
// else ICE #endif // BOOST_MSVC typename const_array_view
::type operator[](const boost::detail::multi_array:: index_gen
& indices) const { typedef typename const_array_view
::type return_type; return super_type::generate_array_view(boost::type
(), indices, shape(), strides(), index_bases(), base_); } template
bool operator<(const const_sub_array
& rhs) const { return std::lexicographical_compare(begin(),end(),rhs.begin(),rhs.end()); } template
bool operator==(const const_sub_array
& rhs) const { if(std::equal(shape(),shape()+num_dimensions(),rhs.shape())) return std::equal(begin(),end(),rhs.begin()); else return false; } template
bool operator!=(const const_sub_array
& rhs) const { return !(*this == rhs); } template
bool operator>(const const_sub_array
& rhs) const { return rhs < *this; } template
bool operator<=(const const_sub_array
& rhs) const { return !(*this > rhs); } template
bool operator>=(const const_sub_array
& rhs) const { return !(*this < rhs); } const_iterator begin() const { return const_iterator(*index_bases(),origin(), shape(),strides(),index_bases()); } const_iterator end() const { return const_iterator(*index_bases()+(index)*shape(),origin(), shape(),strides(),index_bases()); } const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } TPtr origin() const { return base_; } size_type size() const { return extents_[0]; } size_type max_size() const { return num_elements(); } bool empty() const { return size() == 0; } size_type num_dimensions() const { return NumDims; } const size_type* shape() const { return extents_; } const index* strides() const { return strides_; } const index* index_bases() const { return index_base_; } size_type num_elements() const { return std::accumulate(shape(),shape() + num_dimensions(), size_type(1), std::multiplies
()); } #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS protected: template
friend class value_accessor_n; template
friend class const_sub_array; #else public: // Should be protected #endif const_sub_array (TPtr base, const size_type* extents, const index* strides, const index* index_base) : base_(base), extents_(extents), strides_(strides), index_base_(index_base) { } TPtr base_; const size_type* extents_; const index* strides_; const index* index_base_; private: // const_sub_array cannot be assigned to (no deep copies!) const_sub_array& operator=(const const_sub_array&); }; // // sub_array // multi_array's proxy class to allow multiple overloads of // operator[] in order to provide a clean multi-dimensional array // interface. template
class sub_array : public const_sub_array
{ typedef const_sub_array
super_type; public: typedef typename super_type::element element; typedef typename super_type::reference reference; typedef typename super_type::index index; typedef typename super_type::size_type size_type; typedef typename super_type::iterator iterator; typedef typename super_type::reverse_iterator reverse_iterator; typedef typename super_type::const_reference const_reference; typedef typename super_type::const_iterator const_iterator; typedef typename super_type::const_reverse_iterator const_reverse_iterator; // template typedefs template
struct const_array_view { typedef boost::detail::multi_array::const_multi_array_view
type; }; template
struct array_view { typedef boost::detail::multi_array::multi_array_view
type; }; // Assignment from other ConstMultiArray types. template
sub_array& operator=(const ConstMultiArray& other) { function_requires< boost::detail::multi_array::ConstMultiArrayConcept< ConstMultiArray, NumDims> >(); // make sure the dimensions agree BOOST_ASSERT(other.num_dimensions() == this->num_dimensions()); BOOST_ASSERT(std::equal(other.shape(),other.shape()+this->num_dimensions(), this->shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); return *this; } sub_array& operator=(const sub_array& other) { if (&other != this) { // make sure the dimensions agree BOOST_ASSERT(other.num_dimensions() == this->num_dimensions()); BOOST_ASSERT(std::equal(other.shape(), other.shape()+this->num_dimensions(), this->shape())); // iterator-based copy std::copy(other.begin(),other.end(),begin()); } return *this; } T* origin() { return this->base_; } const T* origin() const { return this->base_; } reference operator[](index idx) { return super_type::access(boost::type
(), idx,this->base_,this->shape(),this->strides(), this->index_bases()); } // see generate_array_view in base.hpp #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template
#else template
// else ICE #endif // BOOST_MSVC typename array_view
::type operator[](const boost::detail::multi_array:: index_gen
& indices) { typedef typename array_view
::type return_type; return super_type::generate_array_view(boost::type
(), indices, this->shape(), this->strides(), this->index_bases(), origin()); } template
element& operator()(const IndexList& indices) { boost::function_requires< detail::multi_array::CollectionConcept
>(); return super_type::access_element(boost::type
(), indices,origin(), this->shape(),this->strides(), this->index_bases()); } iterator begin() { return iterator(*this->index_bases(),origin(), this->shape(),this->strides(),this->index_bases()); } iterator end() { return iterator(*this->index_bases()+(index)*this->shape(),origin(), this->shape(),this->strides(),this->index_bases()); } // RG - rbegin() and rend() written naively to thwart MSVC ICE. reverse_iterator rbegin() { reverse_iterator ri(end()); return ri; } reverse_iterator rend() { reverse_iterator ri(begin()); return ri; } // // proxies // template
const element& operator()(const IndexList& indices) const { boost::function_requires< detail::multi_array::CollectionConcept
>(); return super_type::operator()(indices); } const_reference operator[](index idx) const { return super_type::operator[](idx); } // see generate_array_view in base.hpp #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template
#else template
// else ICE #endif // BOOST_MSVC typename const_array_view
::type operator[](const boost::detail::multi_array:: index_gen
& indices) const { return super_type::operator[](indices); } const_iterator begin() const { return super_type::begin(); } const_iterator end() const { return super_type::end(); } const_reverse_iterator rbegin() const { return super_type::rbegin(); } const_reverse_iterator rend() const { return super_type::rend(); } #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS private: template
friend class value_accessor_n; #else public: // should be private #endif sub_array (T* base, const size_type* extents, const index* strides, const index* index_base) : super_type(base,extents,strides,index_base) { } }; } // namespace multi_array } // namespace detail // // traits classes to get sub_array types // template
class subarray_gen { typedef typename Array::element element; public: typedef boost::detail::multi_array::sub_array
type; }; template
class const_subarray_gen { typedef typename Array::element element; public: typedef boost::detail::multi_array::const_sub_array
type; }; } // namespace boost #endif // SUBARRAY_RG071801_HPP
subarray.hpp
Page URL
File URL
Prev
13/15
Next
Download
( 12 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.