Flags.h File Reference

Go to the source code of this file.

Classes

class  shark::TypedFlags< Flag >
 Flexible and extensible mechanisms for holding flags. More...
 
class  shark::TypedFeatureNotAvailableException< Feature >
 Exception indicating the attempt to use a feature which is not supported. More...
 
struct  boost::serialization::tracking_level< shark::TypedFlags< T > >
 

Namespaces

 shark
 AbstractMultiObjectiveOptimizer.
 
 boost
 
 boost::serialization
 

Macros

#define SHARK_FEATURE_INTERFACE
 
#define SHARK_FEATURE_EXCEPTION(FEATURE)
 
#define SHARK_FEATURE_EXCEPTION_DERIVED(FEATURE)
 
#define SHARK_FEATURE_CHECK(FEATURE)   if(!(this->features()&base_type::FEATURE)){SHARK_FEATURE_EXCEPTION_DERIVED(FEATURE);}
 Checks whether the feature is available, if not, it throws an exception. More...
 

Macro Definition Documentation

§ SHARK_FEATURE_CHECK

#define SHARK_FEATURE_CHECK (   FEATURE)    if(!(this->features()&base_type::FEATURE)){SHARK_FEATURE_EXCEPTION_DERIVED(FEATURE);}

Checks whether the feature is available, if not, it throws an exception.

Definition at line 185 of file Flags.h.

§ SHARK_FEATURE_EXCEPTION

#define SHARK_FEATURE_EXCEPTION (   FEATURE)
Value:
{assert(!(this->features()&FEATURE));\
throw FeatureNotAvailableException("Class does not support Feature " #FEATURE, FEATURE,__FILE__, __LINE__);}

Throws an Exception when called. This macro should be used in default implementations of the interface. This define also checks first whether the feature is set to true inside the class. If this is the case then we have encountered a programming mistake - so we assert instead.

Definition at line 175 of file Flags.h.

Referenced by shark::AbstractConstraintHandler< Vector >::closestFeasible(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::closestFeasible(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::eval(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::evalDerivative(), shark::AbstractConstraintHandler< Vector >::generateRandomPoint(), shark::AbstractObjectiveFunction< SearchSpaceType, ResultT >::proposeStartingPoint(), shark::AbstractClustering< RealVector >::softMembership(), shark::AbstractModel< InputT, unsigned int >::weightedInputDerivative(), and shark::AbstractModel< InputT, unsigned int >::weightedParameterDerivative().

§ SHARK_FEATURE_EXCEPTION_DERIVED

#define SHARK_FEATURE_EXCEPTION_DERIVED (   FEATURE)
Value:
{assert(!(this->features()&base_type::FEATURE));\
throw typename base_type::FeatureNotAvailableException("Class does not support Feature " #FEATURE, base_type::FEATURE,__FILE__, __LINE__);}

Same as SHARK_FEATURE_EXCEPTION, but used when called from a derived class. Assumes that a typedef "base_type" for the Baseclass exists

Definition at line 180 of file Flags.h.

Referenced by shark::AbstractLoss< unsigned int, RealVector >::evalDerivative().

§ SHARK_FEATURE_INTERFACE

#define SHARK_FEATURE_INTERFACE
Value:
typedef TypedFlags<Feature> Features;\
protected:\
Features m_features;\
public:\
const Features & features() const {\
return( m_features );\
}\
virtual void updateFeatures(){}\
typedef TypedFeatureNotAvailableException<Feature> FeatureNotAvailableException

Definition at line 160 of file Flags.h.