| version 1.2 | version 1.3 |
|---|
| |
| // bool enabledOnce; // this should trigger an update when object is evaluated | // bool enabledOnce; // this should trigger an update when object is evaluated |
| }; | }; |
| | |
| | |
| | private: |
| /// List of the state of all features | /// List of the state of all features |
| std::vector<feature_state *> feature_states; | std::vector<feature_state> feature_states; |
| | |
| | |
| | public: |
| /// Describes a feature and its dependecies | /// Describes a feature and its dependecies |
| /// used in a static array within each subclass | /// used in a static array within each subclass |
| class feature { | class feature { |
| |
| // Checks whether given feature is enabled | // Checks whether given feature is enabled |
| // Defaults to querying f_*_active | // Defaults to querying f_*_active |
| inline bool is_enabled(int f = f_cv_active) const { | inline bool is_enabled(int f = f_cv_active) const { |
| return feature_states[f]->enabled; | return feature_states[f].enabled; |
| } | } |
| | |
| // Checks whether given feature is available | // Checks whether given feature is available |
| // Defaults to querying f_*_active | // Defaults to querying f_*_active |
| inline bool is_available(int f = f_cv_active) const { | inline bool is_available(int f = f_cv_active) const { |
| return feature_states[f]->available; | return feature_states[f].available; |
| } | } |
| | |
| void provide(int feature_id); // set the feature's flag to available in local object | void provide(int feature_id); // set the feature's flag to available in local object |
| | |
| | /// Set the feature's enabled flag, without dependency check or resolution |
| | /// To be used for static and user properties |
| | /// Checking for availability is up to the caller |
| | void set_enabled(int feature_id, bool truefalse); |
| | |
| protected: | protected: |
| | |
| void set_available(int feature_id, bool truefalse); // set the feature's available flag, without checking | void set_available(int feature_id, bool truefalse); // set the feature's available flag, without checking |
| void set_enabled(int feature_id, bool truefalse); // set the feature's enabled flag, without checking | |
| | |
| /// Parse a keyword and enable a feature accordingly | /// Parse a keyword and enable a feature accordingly |
| bool get_keyval_feature(colvarparse *cvp, | bool get_keyval_feature(colvarparse *cvp, |