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

# /Users/fpy/titan-1-5-MBARI/Mers/Estimation/Discrete/CompiledME/CCMEReader/CCMEReaderMain.cpp

    00001
    00002 #include "CCMEReader.h"
    00003 #include <iostream>
    00004
    00005 #include <Mers/Models/Base/BaseModel.h>
    00006 #include <Mers/Models/Base/Io/Mof/BaseModelReader.h>
    00007
    00008 #include <Mers/Estimation/Discrete/Dissent.h>
    00009 #include <Mers/Estimation/Discrete/CompiledTransition.h>
    00010
    00011 using namespace Mers::Estimation::Discrete;
    00012 using Mers::Models::Base::BaseModel;
    00013 using Mers::Models::Base::Io::Mof::BaseModelReader;
    00014 using std::vector;
    00015 using std::fprintf;
    00016 using std::cerr;
    00017 using std::cout;
    00018 using std::endl;
    00019
    00021
    00022 void printUse(char const * programName)
    00023 {
    00024         cerr << "Syntax:" << endl
    00025              << "    " << programName << " <BaseModel filename> <CCME file name>" << endl;
    00026 }
    00027
    00029
    00030 int main(int argc, char *argv[])
    00031 {
    00032         char const * progname = argv[0];
    00033
    00034         if (argc != 3)
    00035         {
    00036                 printUse(progname);
    00037                 return -1;
    00038         }
    00039
    00040         char const * baseModelName = argv[1];
    00041         BaseModel mdl(baseModelName);
    00042
    00043         if(FAILED(BaseModelReader::loadBaseModel(baseModelName, mdl)))
    00044         {
    00045                 cout << "Failed to complete reading of the model" << endl;
    00046                 return 1;
    00047         }else
    00048         {
    00049                 cout << "BM Model reading succeeded!" << endl;
    00050                 //cout << mdl << endl;
    00051         }
    00052
    00053         Mers::Estimation::Discrete::CompiledME::CCMEReader::CCMEReader reader;
    00054         if(FAILED(reader.loadCCMEFile(argv[2], mdl))) {
    00055                 fprintf(stderr, "Failed to load the CCME file %s\n", argv[2]);
    00056                 return 2;
    00057         } else {
    00058                 cout << "Loaded CCME file " << argv[2] << endl;
    00059                 vector<Dissent const *> const & dissents = reader.getDissents();
    00060                 vector<CompiledTransition const *> const & transitions =
    00061                         reader.getTransitions();
    00062
    00063                 unsigned int x;
    00064
    00065                 cout << "Dissents:" << endl;
    00066                 for(x = 0; x < dissents.size(); x++) {
    00067                         cout << x << ": " << *(dissents[x]) << endl;
    00068                 }
    00069
    00070                 cout << endl << endl << "Transitions:" << endl;
    00071                 for(x = 0; x < transitions.size(); x++) {
    00072                         cout << x << ": " << *(transitions[x]) << endl;
    00073                 }
    00074         }
    00075
    00076
    00077         return 0;
    00078 }
    00079
    00081