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

# /Users/fpy/titan-1-5-MBARI/Mers/Estimation/Discrete/ProbabilityRules/ObsComboRule.cpp

    00001 //==============================================================================
    00002 // Copyright (c) 2005           Model-based Embedded and Robotic Systems Group
    00003 // All Rights Reserved          Massachusetts Institute of Technology
    00004 //
    00005 // This software is provided as is. Model-based Embedded and Robotic Systems
    00006 // (MERS) group does not assume any responsibility.
    00007 //==============================================================================
    00008
    00009 #include "ObsComboRule.h"
    00010
    00011 #ifdef _MSC_VER
    00012 #pragma warning( disable : 4786 )
    00013 #endif
    00014
    00015 using namespace Mers::Estimation::Discrete::ProbabilityRules;
    00016 using Mers::Models::Base::BaseModelAssignmentArray;
    00017 using std::ostream;
    00018 using std::endl;
    00019 using std::cout;
    00020
    00021
    00022         //-----------------------------------------------
    00023         //      CONSTRUCTOR
    00024         //-----------------------------------------------
    00025
    00026
    00027 ObsComboRule::ObsComboRule(const Mers::Models::Base::BaseModelAssignmentArray * myAssigmentArray,
    00028                 unsigned int initNumConsistentObs, unsigned short db)
    00029 : Rule(myAssigmentArray, db), numConsistenObsCombos(initNumConsistentObs)
    00030 {}
    00031         //-----------------------------------------------
    00032         //      DESTRUCTOR
    00033         //-----------------------------------------------
    00034
    00035
    00036 ObsComboRule::~ObsComboRule()
    00037 {
    00038 }
    00039
    00040
    00041
    00042         //-----------------------------------------------
    00043         //      PUBLIC METHODS
    00044         //-----------------------------------------------
    00045
    00046 bool
    00047 ObsComboRule::decrementBy(unsigned int num)
    00048 {
    00049         if(num > numConsistenObsCombos)
    00050         {
    00051                 cout << "<ObsComboRule> WARNING: trying to decrement by a larger number than the number of remaining obs combos." << endl;
    00052                 cout << *this << endl;
    00053                 cout << "  current num consistent: " << numConsistenObsCombos << ", num to decrement: " << num << endl;
    00054                 return false;
    00055         }
    00056         numConsistenObsCombos -= num;
    00057         return true;
    00058 }
    00059
    00060
    00061 unsigned int
    00062 ObsComboRule::getNumConsistentObsCombos(void)
    00063 {
    00064         return numConsistenObsCombos;
    00065 }
    00066
    00067
    00068 ostream&
    00069 Mers::Estimation::Discrete::ProbabilityRules::operator<<(ostream& os, ObsComboRule const & ocr)
    00070 {
    00071         os << *((Rule *) &ocr) << " with " << ocr.numConsistenObsCombos << " consistent obs. ";
    00072
    00073         return os;
    00074 }
    00075         //-----------------------------------------------
    00076         //      PRIVATE METHODS
    00077         //-----------------------------------------------
    00078