85 #ifndef hlp_controller_h
86 #define hlp_controller_h
89 #include "binding_map.h"
90 #include "g_monitor.h"
98 WEAK_REQUIREMENT_DISABLED = 0,
99 STRONG_REQUIREMENT_NO_WEAK_REQUIREMENT = 1,
100 STRONG_REQUIREMENT_DISABLED_WEAK_REQUIREMENT = 2,
101 WEAK_REQUIREMENT_ENABLED = 3,
108 uint32 strong_requirement_count_;
109 uint32 weak_requirement_count_;
110 uint32 requirement_count_;
114 void load_data(
_Fact *evidence);
125 bool is_too_old(Timestamp now)
const {
126 return evidence_->is_invalidated() ||
129 (after_ == before_ ? (before_ < now) : (before_ <= now));
149 for (_e = cache->list_.begin(); _e != cache->list_.end();) {
151 if ((*_e).evidence_ == e.evidence_) {
156 if ((*_e).is_too_old(now))
157 _e = cache->list_.erase(_e);
161 cache->list_.push_front(e);
178 MatchResult check_evidences(_Fact *target, _Fact *&evidence);
179 MatchResult check_predicted_evidences(_Fact *target, _Fact *&evidence);
192 std::vector<P<HLPController> > controllers_;
193 Timestamp last_match_time_;
194 bool become_invalidated();
195 virtual void kill_views() {}
196 virtual void check_last_match_time(
bool match) = 0;
200 virtual ~HLPController();
202 void invalidate()
override;
204 r_code::Code *get_core_object()
const override {
return get_object(); }
208 return core_object->get_reference(core_object->references_size() - MDL_HIDDEN_REFS);
211 void add_requirement(
bool strong);
212 void remove_requirement(
bool strong);
214 uint32 get_requirement_count(uint32 &weak_requirement_count, uint32 &strong_requirement_count);
215 uint32 get_requirement_count();
217 void store_evidence(_Fact *evidence) { _store_evidence<EvidenceEntry>(&evidences_, evidence); }
218 void store_predicted_evidence(_Fact *evidence) { _store_evidence <PredictedEvidenceEntry>(&predicted_evidences_, evidence); }
220 virtual Fact *get_f_ihlp(HLPBindingMap *bindings,
bool wr_enabled)
const = 0;
222 uint16 get_out_group_count()
const;
224 Group *get_host()
const {
return (Group *)get_view()->get_host(); }
225 bool has_tpl_args()
const {
return has_tpl_args_; }
227 bool inject_prediction(Fact *prediction, float32 confidence)
const;