File indexing completed on 2025-01-18 09:30:25
0001
0002 #ifndef BOOST_CONTRACT_VIRTUAL_HPP_
0003 #define BOOST_CONTRACT_VIRTUAL_HPP_
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <boost/contract/core/config.hpp>
0016 #ifndef BOOST_CONTRACT_NO_CONDITIONS
0017 #include <boost/contract/detail/decl.hpp>
0018 #endif
0019 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
0020 #include <boost/any.hpp>
0021 #endif
0022 #ifndef BOOST_CONTRACT_NO_OLDS
0023 #include <boost/shared_ptr.hpp>
0024 #include <queue>
0025 #endif
0026
0027 namespace boost { namespace contract {
0028
0029 #ifndef BOOST_CONTRACT_NO_CONDITIONS
0030 namespace detail {
0031 BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_SUBCONTRACTING_Z(1,
0032 0, OO, RR, FF, CC, AArgs);
0033 }
0034 #endif
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 class virtual_ {
0075
0076 private:
0077
0078
0079 virtual_(virtual_&);
0080 virtual_& operator=(virtual_&);
0081
0082 #ifndef BOOST_CONTRACT_NO_CONDITIONS
0083 enum action_enum {
0084
0085 no_action,
0086 #ifndef BOOST_CONTRACT_NO_ENTRY_INVARIANTS
0087 check_entry_inv,
0088 #endif
0089 #ifndef BOOST_CONTRACT_NO_PRECONDITIONS
0090 check_pre,
0091 #endif
0092 #ifndef BOOST_CONTRACT_NO_EXIT_INVARIANTS
0093 check_exit_inv,
0094 #endif
0095 #ifndef BOOST_CONTRACT_NO_OLDS
0096
0097 push_old_init_copy,
0098
0099
0100 call_old_ftor,
0101 push_old_ftor_copy,
0102 pop_old_ftor_copy,
0103 #endif
0104 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
0105 check_post,
0106 #endif
0107 #ifndef BOOST_CONTRACT_NO_EXCEPTS
0108 check_except,
0109 #endif
0110 };
0111 #endif
0112
0113 #ifndef BOOST_CONTRACT_NO_OLDS
0114
0115 inline static bool pop_old_init_copy(action_enum a) {
0116 return
0117 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
0118 a == check_post
0119 #endif
0120 #if !defined(BOOST_CONTRACT_NO_POSTCONDITIONS) && \
0121 !defined(BOOST_CONTRACT_NO_EXCEPTS)
0122 ||
0123 #endif
0124 #ifndef BOOST_CONTRACT_NO_EXCEPTS
0125 a == check_except
0126 #endif
0127 ;
0128 }
0129 #endif
0130
0131 #ifndef BOOST_CONTRACT_NO_CONDITIONS
0132 explicit virtual_(action_enum a) :
0133 action_(a)
0134 , failed_(false)
0135 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
0136 , result_type_name_()
0137 , result_optional_()
0138 #endif
0139 {}
0140 #endif
0141
0142 #ifndef BOOST_CONTRACT_NO_CONDITIONS
0143 action_enum action_;
0144 bool failed_;
0145 #endif
0146 #ifndef BOOST_CONTRACT_NO_OLDS
0147 std::queue<boost::shared_ptr<void> > old_init_copies_;
0148 std::queue<boost::shared_ptr<void> > old_ftor_copies_;
0149 #endif
0150 #ifndef BOOST_CONTRACT_NO_POSTCONDITIONS
0151 boost::any result_ptr_;
0152 char const* result_type_name_;
0153 bool result_optional_;
0154 #endif
0155
0156
0157 #ifndef BOOST_CONTRACT_NO_OLDS
0158 friend bool copy_old(virtual_*);
0159 friend class old_pointer;
0160 #endif
0161 #ifndef BOOST_CONTRACT_NO_CONDITIONS
0162 BOOST_CONTRACT_DETAIL_DECL_DETAIL_COND_SUBCONTRACTING_Z(1,
0163 1, OO, RR, FF, CC, AArgs);
0164 #endif
0165
0166 };
0167
0168 } }
0169
0170 #endif
0171