34 #ifndef SHARK_CORE_FLAGS_H 35 #define SHARK_CORE_FLAGS_H 57 template<
typename Flag>
70 inline void set( Flag f ) {
86 inline bool test( Flag f )
const {
87 return (
m_flags & f) == (
unsigned int)f;
91 return (
m_flags & f) == (
unsigned int)f;
129 template<
class Feature>
133 :
Exception(
"Feature not available", file, line ),
134 m_feature( feature ) {}
137 m_feature( feature ) {}
149 namespace serialization {
151 template<
typename T >
153 typedef mpl::integral_c_tag
tag;
154 BOOST_STATIC_CONSTANT(
int, value = track_always );
160 #define SHARK_FEATURE_INTERFACE \ 161 typedef TypedFlags<Feature> Features;\ 163 Features m_features;\ 165 const Features & features() const {\ 166 return( m_features );\ 168 virtual void updateFeatures(){}\ 169 typedef TypedFeatureNotAvailableException<Feature> FeatureNotAvailableException 175 #define SHARK_FEATURE_EXCEPTION(FEATURE) \ 176 {assert(!(this->features()&FEATURE));\ 177 throw FeatureNotAvailableException("Class does not support Feature " #FEATURE, FEATURE,__FILE__, __LINE__);} 180 #define SHARK_FEATURE_EXCEPTION_DERIVED(FEATURE) \ 181 {assert(!(this->features()&base_type::FEATURE));\ 182 throw typename base_type::FeatureNotAvailableException("Class does not support Feature " #FEATURE, base_type::FEATURE,__FILE__, __LINE__);} 185 #define SHARK_FEATURE_CHECK(FEATURE)\ 186 if(!(this->features()&base_type::FEATURE)){SHARK_FEATURE_EXCEPTION_DERIVED(FEATURE);} 187 #endif // SHARK_CORE_FLAGS_H