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

# /Users/fpy/titan-1-5-MBARI/Mers/Planning/Reactive/CCA/CCATransitionDependency/CCATransitionDependencyTest.cpp

    00001 #include <cstdlib>
    00002 #include <iostream>
    00003 #include <fstream>
    00004 #include <Mers/Models/CCA/Io/Mof/MOFReader.h>
    00005 #include <Mers/Models/CCA/CCAModel.h>
    00006 #include "CCATransitionDependency.h"
    00007 using namespace std;
    00008
    00009 CCAModel *
    00010 loadMOF(String MOFFileName)
    00011 {
    00012         CCAModel *model = new CCAModel();
    00013         if (MOFFileName == "")
    00014         {
    00015                 cerr << endl << "No MOF file specified." << endl;
    00016                 delete model;
    00017                 return NULL;
    00018         }
    00019         else if(MOFReader::loadMOF(MOFFileName.c_str(), *model))
    00020         {
    00021                 cerr << endl << "Could not load " << MOFFileName << "." << endl;
    00022                 delete model;
    00023                 return NULL;
    00024         }
    00025         return model;
    00026 }
    00027
    00028 int
    00029 main(int argc, char** argv)
    00030 {
    00031         argc--;
    00032         argv++;
    00033
    00034         CCAModel *model = NULL;
    00035         String MOFFileName;
    00036         //String MOFFileName = "../Model/MOFReader/techsat-test-temp.mof";
    00037
    00038         // If MOF file was provided in the argument.
    00039         if (argc > 0)
    00040         {
    00041                 model = loadMOF(String(argv[0]));
    00042                 MOFFileName = String(argv[0]);
    00043         }
    00044         // Otherwise, no MOF file was provided.
    00045         else
    00046         {
    00047         //      model = loadMOF(MOFFileName);
    00048         }
    00049
    00050         if (model != NULL)
    00051         {
    00052                 cout << "Using " << MOFFileName << " model..." << endl << endl;
    00053                 CCATransitionDependency transitionDependency(*model);
    00054                 transitionDependency.computeDependencyOrder();
    00055                 model->writeModel(MOFFileName + "_new");
    00056                 delete model;
    00057         }
    00058         else
    00059         {
    00060                 cout << endl << "Must provide an MOF as an argument.";
    00061         }
    00062
    00063         return 0;
    00064 }