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
#ifndef BOOST_STATECHART_DETAIL_RTTI_POLICY_HPP_INCLUDED #define BOOST_STATECHART_DETAIL_RTTI_POLICY_HPP_INCLUDED ////////////////////////////////////////////////////////////////////////////// // Copyright 2002-2006 Andreas Huber Doenni // Distributed under the Boost Software License, Version 1.0. (See accompany- // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ////////////////////////////////////////////////////////////////////////////// #include
#include
// BOOST_MSVC #include
#include
// std::type_info #ifdef BOOST_MSVC // We permanently turn off the following level 4 warnings because users will // have to do so themselves anyway if we turn them back on # pragma warning( disable: 4511 ) // copy constructor could not be generated # pragma warning( disable: 4512 ) // assignment operator could not be generated #endif namespace boost { namespace statechart { namespace detail { ////////////////////////////////////////////////////////////////////////////// struct id_provider { const void * pCustomId_; #if defined( BOOST_ENABLE_ASSERT_HANDLER ) || !defined( NDEBUG ) const std::type_info * pCustomIdType_; #endif }; template< class MostDerived > struct id_holder { static id_provider idProvider_; }; template< class MostDerived > id_provider id_holder< MostDerived >::idProvider_; ////////////////////////////////////////////////////////////////////////////// struct rtti_policy { #ifdef BOOST_STATECHART_USE_NATIVE_RTTI class id_type { public: //////////////////////////////////////////////////////////////////////// explicit id_type( const std::type_info & id ) : id_( id ) {} bool operator==( id_type right ) const { return id_ == right.id_ != 0; } bool operator!=( id_type right ) const { return !( *this == right ); } bool operator<( id_type right ) const { return id_.before( right.id_ ) != 0; } bool operator>( id_type right ) const { return right < *this; } bool operator>=( id_type right ) const { return !( *this < right ); } bool operator<=( id_type right ) const { return !( right < *this ); } private: //////////////////////////////////////////////////////////////////////// const std::type_info & id_; }; typedef bool id_provider_type; // dummy #else typedef const void * id_type; typedef const id_provider * id_provider_type; #endif //////////////////////////////////////////////////////////////////////////// template< class Base > class rtti_base_type : public Base { public: //////////////////////////////////////////////////////////////////////// typedef rtti_policy::id_type id_type; id_type dynamic_type() const { #ifdef BOOST_STATECHART_USE_NATIVE_RTTI return id_type( typeid( *this ) ); #else return idProvider_; #endif } #ifndef BOOST_STATECHART_USE_NATIVE_RTTI template< typename CustomId > const CustomId * custom_dynamic_type_ptr() const { BOOST_ASSERT( ( idProvider_->pCustomId_ == 0 ) || ( *idProvider_->pCustomIdType_ == typeid( CustomId ) ) ); return static_cast< const CustomId * >( idProvider_->pCustomId_ ); } #endif protected: #ifdef BOOST_STATECHART_USE_NATIVE_RTTI rtti_base_type( id_provider_type ) {} //////////////////////////////////////////////////////////////////////// #if BOOST_WORKAROUND( __GNUC__, BOOST_TESTED_AT( 4 ) ) // We make the destructor virtual for GCC because with this compiler // there is currently no way to disable the "has virtual functions but // non-virtual destructor" warning on a class by class basis. Although // it can be done on the compiler command line with // -Wno-non-virtual-dtor, this is undesirable as this would also // suppress legitimate warnings for types that are not states. virtual ~rtti_base_type() {} #else ~rtti_base_type() {} #endif private: //////////////////////////////////////////////////////////////////////// // For typeid( *this ) to return a value that corresponds to the most- // derived type, we need to have a vptr. Since this type does not // contain any virtual functions we need to artificially declare one so. virtual void dummy() {} #else rtti_base_type( id_provider_type idProvider ) : idProvider_( idProvider ) { } ~rtti_base_type() {} private: //////////////////////////////////////////////////////////////////////// id_provider_type idProvider_; #endif }; //////////////////////////////////////////////////////////////////////////// template< class MostDerived, class Base > class rtti_derived_type : public Base { public: //////////////////////////////////////////////////////////////////////// static id_type static_type() { #ifdef BOOST_STATECHART_USE_NATIVE_RTTI return id_type( typeid( const MostDerived ) ); #else return &id_holder< MostDerived >::idProvider_; #endif } #ifndef BOOST_STATECHART_USE_NATIVE_RTTI template< class CustomId > static const CustomId * custom_static_type_ptr() { BOOST_ASSERT( ( id_holder< MostDerived >::idProvider_.pCustomId_ == 0 ) || ( *id_holder< MostDerived >::idProvider_.pCustomIdType_ == typeid( CustomId ) ) ); return static_cast< const CustomId * >( id_holder< MostDerived >::idProvider_.pCustomId_ ); } template< class CustomId > static void custom_static_type_ptr( const CustomId * pCustomId ) { #if defined( BOOST_ENABLE_ASSERT_HANDLER ) || !defined( NDEBUG ) id_holder< MostDerived >::idProvider_.pCustomIdType_ = &typeid( CustomId ); #endif id_holder< MostDerived >::idProvider_.pCustomId_ = pCustomId; } #endif protected: //////////////////////////////////////////////////////////////////////// ~rtti_derived_type() {} #ifdef BOOST_STATECHART_USE_NATIVE_RTTI rtti_derived_type() : Base( false ) {} #else rtti_derived_type() : Base( &id_holder< MostDerived >::idProvider_ ) {} #endif }; }; } // namespace detail } // namespace statechart } // namespace boost #endif
rtti_policy.hpp
Page URL
File URL
Prev
7/8
Next
Download
( 6 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.