- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Estimation/Discrete/ProbabilityRules/RuleTriggering/RuleTrigger.h

    00001 //=============================================================================
    00002 // RuleTrigger.h: interface for the RuleTrigger class.
    00003 //
    00004 // Copyright (c) 2005           Model-based Embedded and Robotic Systems Group
    00005 // All Rights Reserved          Massachusetts Institute of Technology
    00006 //
    00007 // This software is provided as is. Model-based Embedded and Robotic Systems
    00008 // (MERS) group does not assume any responsibility.
    00009 //
    00010 // Author:                      Oliver B. Martin
    00011 // Organization:                Model-based Embedded and Robotic Systems Group
    00012 //                              Massachusetts Institute of Technology
    00013 //
    00014 // The Rule Trigger is used as an quick and efficient way to determine which
    00015 // rules are enabled (triggered). This is done by mapping the variableID,
    00016 // valueID pairs of each rule assignment to the rule itself; decrementing a
    00017 // counter each time a new assignment is satisfied. This rule trigger identifies
    00018 // which rules are enabled (or partially enabled) and returns them.
    00019 //
    00020 //=============================================================================
    00021
    00022 #if !defined(_RULETRIGGER_H_)
    00023 #define _RULETRIGGER_H_
    00024
    00025 #if _MSC_VER > 1000
    00026 #pragma once
    00027 #endif // _MSC_VER > 1000
    00028
    00029
    00030 #include <vector>
    00031 #include <map>
    00032 #include <iostream>
    00033
    00034 namespace Mers {
    00035         namespace Models {
    00036                 namespace Base {
    00037                         class BaseModelAssignment;
    00038                 }
    00039         }
    00040         namespace Estimation {
    00041                 namespace Discrete {
    00042                         namespace ProbabilityRules {
    00043                                 class Rule;
    00044                                 class ObsProbRule;
    00045
    00046                                 namespace RuleTriggering {
    00047
    00055                         class RuleTrigger
    00056                         {
    00057
    00058                                 friend std::ostream &  operator<<(std::ostream &, RuleTrigger const &);
    00059
    00060                         public:
    00061                                 //-----------------------------------------
    00062                                 // Constructors
    00063                                 //-----------------------------------------
    00064
    00071                                 RuleTrigger(std::vector<Mers::Estimation::Discrete::ProbabilityRules::Rule *> & theRules,
    00072                                                 bool hasOwnership = true, unsigned short db = 0);
    00073
    00074                                 //-----------------------------------------
    00075                                 // Destructors
    00076                                 //-----------------------------------------
    00077
    00082                                 virtual ~RuleTrigger();
    00083
    00084
    00085                                 //-----------------------------------------
    00086                                 // Functions
    00087                                 //-----------------------------------------
    00088
    00089
    00097                                 bool loadAssignment(unsigned int varID, unsigned int valID);
    00098
    00104                                 std::vector<Mers::Estimation::Discrete::ProbabilityRules::Rule *>
    00105                                         getTriggeredRules(void);
    00106
    00114                                 std::vector<Mers::Estimation::Discrete::ProbabilityRules::Rule *>
    00115                                         getTriggeredRules(unsigned int numSat);
    00116
    00123                                 // bool loadAssignment(const Mers::Models::Base::BaseModelAssignment * bmAssignment);
    00124
    00128                                 void reset(void);
    00129
    00134                                 void setOwnership(bool hasOwnership);
    00135
    00141                                 void setDebug(const unsigned short db);
    00142
    00143
    00144                         private:
    00146                                 std::vector<Mers::Estimation::Discrete::ProbabilityRules::Rule *> &     rules;
    00147
    00149                                 std::map<std::pair<unsigned int, unsigned int>,
    00150                                         std::vector<Mers::Estimation::Discrete::ProbabilityRules::Rule *> > ruleMap;
    00151
    00154                                 std::map<std::pair<unsigned int, unsigned int>, bool >                  assigned;
    00155
    00157                                 bool                            isOwner;
    00158
    00160                                 unsigned short                  debug;
    00161
    00162                                         };
    00163                                 }
    00164                         }
    00165                 }
    00166         }
    00167 }
    00168
    00169 #endif // !defined(_RULETRIGGER_H_)