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

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Observation/ConversionNodes.h

    00001 #ifndef MERS_EXECUTIVES_DEDUCTIVECONTROLLER_OBSERVATION_CONVERSIONNODES_H
    00002 #define MERS_EXECUTIVES_DEDUCTIVECONTROLLER_OBSERVATION_CONVERSIONNODES_H
    00003
    00004 #include <Mers/Utils/Lang/CharUtils.h>
    00005
    00006 namespace Mers {
    00007         namespace Executives {
    00008                 namespace DeductiveController {
    00009                         namespace Observation {
    00010
    00011 class DomainLookupNode
    00012 {
    00013 public:
    00014         DomainLookupNode()
    00015                 : m_dVal(NULL), numReferences(1), pNext(NULL)
    00016         {
    00017         }
    00018
    00019         DomainLookupNode(double low, double high,
    00020                 Mers::Interfaces::DiscreteValue * val)
    00021                 : rangeLowBound(low), rangeHighBound(high), m_dVal(val),
    00022                         numReferences(1), pNext(NULL)
    00023         {
    00024         }
    00025
    00026         virtual ~DomainLookupNode()
    00027         {
    00028                 if(pNext != NULL)
    00029                 {
    00030                         if(pNext->numReferences == 1)
    00031                                 delete pNext;
    00032                         else
    00033                                 pNext->numReferences--;
    00034                 }
    00035         }
    00036
    00037 public:
    00038         double rangeLowBound, rangeHighBound;
    00039         Mers::Interfaces::DiscreteValue * m_dVal;
    00040         unsigned int numReferences;
    00041         DomainLookupNode *pNext;
    00042 };
    00043
    00044 class DomainLookupNodeData
    00045 {
    00046 public:
    00047         DomainLookupNodeData():numReferences(1),pNext(NULL){}
    00048         DomainLookupNodeData(double low, double high, char * name)
    00049                 :rangeLowBound(low), rangeHighBound(high), valueName(NULL),
    00050                  numReferences(1), pNext(NULL)
    00051         {
    00052                 setName(name);
    00053         }
    00054
    00055         virtual ~DomainLookupNodeData()
    00056         {
    00057                 if(pNext != NULL)
    00058                 {
    00059                         if(pNext->numReferences == 1)
    00060                                 delete pNext;
    00061                         else
    00062                                 pNext->numReferences--;
    00063                 }
    00064                 delete[] valueName;
    00065         }
    00066
    00067         void setName(char * name) {
    00068                 valueName = Mers::Utils::Lang::CharUtils::strdupnew(name);
    00069         }
    00070
    00071 public:
    00072         double rangeLowBound, rangeHighBound;
    00073         char * valueName;
    00074         unsigned int numReferences;
    00075         DomainLookupNodeData *pNext;
    00076 };
    00077
    00078 class VariableLookupNode
    00079 {
    00080 public:
    00081         VariableLookupNode() : m_dVar(NULL), pDomainList(NULL)
    00082                 {}
    00083         VariableLookupNode(Mers::Interfaces::DiscreteVariable * dVar)
    00084                 : m_dVar(dVar), pDomainList(NULL)
    00085                 {}
    00086         VariableLookupNode(Mers::Interfaces::DiscreteVariable * dVar,
    00087                 DomainLookupNode* pList)
    00088                 : m_dVar(dVar), pDomainList(pList)
    00089                 {}
    00090
    00091         virtual ~VariableLookupNode()
    00092         {
    00093                 if(pDomainList != NULL)
    00094                         {
    00095                                 if(pDomainList->numReferences == 1)
    00096                                         delete pDomainList;
    00097                                 else
    00098                                         pDomainList->numReferences--;
    00099                         }
    00100         }
    00101 public:
    00102         Mers::Interfaces::DiscreteVariable * m_dVar;
    00103         unsigned int numReferences;
    00104         DomainLookupNode * pDomainList;
    00105 };
    00106
    00107                         }
    00108                 }
    00109         }
    00110 }
    00111
    00112 #endif
    00113
    00114