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

# /Users/fpy/titan-1-5-MBARI/Mers/Models/Base/BaseModel.h

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #if !defined(AFX_BASEMODEL_H__3DD1B58F_2B14_4A24_AEDC_ED2AD24BBA2A__INCLUDED_)
    00015 #define AFX_BASEMODEL_H__3DD1B58F_2B14_4A24_AEDC_ED2AD24BBA2A__INCLUDED_
    00016
    00017 #if _MSC_VER > 1000
    00018 #pragma once
    00019 #endif // _MSC_VER > 1000
    00020
    00021 #include <Mers/Utils/Lang/BaseModelObject.h>
    00022 #include "BaseModelDomainArray.h"
    00023 #include "BaseModelVariableArray.h"
    00024 #include "BaseModelAssignment.h"
    00025 #include <Mers/Utils/Lang/String.h>
    00026
    00027 namespace Mers {
    00028         namespace Models {
    00029                 namespace Base {
    00030
    00038                         class BaseModel : public Mers::Utils::Lang::BaseModelObject
    00039                         {
    00040                         public:
    00041                                 //-----------------------------------------
    00042                                 // Constructors
    00043                                 //-----------------------------------------
    00044
    00049                                 BaseModel(char const * myName = "Basic Model");
    00050
    00051                                 //-----------------------------------------
    00052                                 // Copy constructors
    00053                                 //-----------------------------------------
    00054
    00061                                 BaseModel(BaseModel const &other);
    00062
    00063                                 //-----------------------------------------
    00064                                 // Destructors
    00065                                 //-----------------------------------------
    00066
    00070                                 virtual ~BaseModel();
    00071
    00072                                 //-----------------------------------------
    00073                                 // Functions
    00074                                 //-----------------------------------------
    00075
    00082                                 int setName(char const * newName);
    00087                                 char const * getName() const;
    00088
    00102                                 int addDomain(char const * domainName, BaseModelValueArray &values,
    00103                                                                                         BaseModelDomain::DomainType domainType = BaseModelDomain::Normal);
    00114                                 int addDomain(BaseModelDomain * domain);
    00115
    00122                                 BaseModelDomain * getDomain(unsigned int domainUID);
    00129                                 BaseModelDomain const * getDomain(unsigned int domainUID) const;
    00136                                 BaseModelDomain * getDomain(char const * domainName);
    00143                                 BaseModelDomain const * getDomain(char const * domainName) const;
    00144
    00149                                 BaseModelDomainArray * getDomains();
    00154                                 BaseModelDomainArray const * getDomains() const;
    00155
    00169                                 virtual int addVariable(char const * variableName,
    00170                                                                                                                                 BaseModelVariable::VariableType variableType, BaseModelDomain * domain);
    00180                                 virtual int addVariable(BaseModelVariable * variable);
    00181
    00187                                 BaseModelVariable * getVariable(unsigned int variableUID);
    00193                                 BaseModelVariable const * getVariable(unsigned int variableUID) const;
    00200                                 BaseModelVariable * getVariable(char const * variableName);
    00207                                 BaseModelVariable const * getVariable(char const * variableName) const;
    00208
    00213                                 BaseModelVariableArray * getVariables();
    00218                                 BaseModelVariableArray const * getVariables() const;
    00219
    00237                                 BaseModelAssignment * getAssignment(char const * variableName, char const * valueName,
    00238                                                                                                                                                                                 BaseModelAssignment::OperatorType opType = BaseModelAssignment::Positive) const;
    00239
    00245                                 void clear();
    00246
    00247                                 //-----------------------------------------
    00248                                 // Operators
    00249                                 //-----------------------------------------
    00250
    00259                                 bool operator==( BaseModel const &other ) const;
    00260
    00269                                 bool operator!=( BaseModel const &other ) const {
    00270                                         return !operator==( other );
    00271                                 }
    00272
    00280                                 BaseModel const & operator =(BaseModel const &other);
    00281
    00282 #ifndef EMBEDDED
    00283
    00288                                 virtual void print(std::ostream &out) const;
    00289 #endif
    00290
    00291                         protected:
    00292                                 //-----------------------------------------
    00293                                 // Functions
    00294                                 //-----------------------------------------
    00295
    00307                                 virtual BaseModelAssignment * newAssignment(BaseModelVariable const * variable,
    00308                                                                                                                                                                                                                 BaseModelValue const * value, BaseModelAssignment::OperatorType opType) const;
    00309
    00323                                 virtual BaseModelVariable * newVariable(char const * variableName, unsigned int variableUID,
    00324                                                                                                                                                                                                 BaseModelVariable::VariableType variableType, BaseModelDomain * domain);
    00325
    00342                                 virtual BaseModelDomain * newDomain(char const * domainName, unsigned int domainUID,
    00343                                                                                                                                                                                 BaseModelValueArray &values, BaseModelDomain::DomainType domainType);
    00344
    00353                                 virtual BaseModelDomainArray * newDomainArray(BaseModelDomainArray const * other = NULL);
    00362                                 virtual BaseModelVariableArray * newVariableArray(BaseModelVariableArray const * other = NULL);
    00363
    00369                                 virtual void destroy();
    00379                                 virtual int copy(BaseModel const &other);
    00380
    00381                         protected:
    00382                                 //-----------------------------------------
    00383                                 // Data
    00384                                 //-----------------------------------------
    00385
    00387                                 char * name;
    00389                                 BaseModelDomainArray * domains;
    00391                                 BaseModelVariableArray * variables;
    00392                         };
    00393                 }
    00394         }
    00395 }
    00396
    00397 #endif // !defined(AFX_BASEMODEL_H__3DD1B58F_2B14_4A24_AEDC_ED2AD24BBA2A__INCLUDED_)