#include <iostream>
#include <string>
#include <tclap/CmdLine.h>
#include "bdbenv.h"
#include "dbimage.h"
#include "dbalnimage.h"

int main( int argc, char *argv[] )
{
  try
    {
      ///set up the command line parsing
      TCLAP::CmdLine cmd("Image alignment program", ' ', "0.001");

      TCLAP::ValueArg<std::string> dbdir("d", "db", "database dirctory", true, "", "databaase");


      cmd.add(dbdir);

      cmd.parse(argc, argv);

      bdbenv bdb;
      dbimage imstore;
      dbalnimage dba;

      bdb.open( dbdir.getValue() );
      imstore.setenv( bdb.envptr() );
      dba.setenv( bdb.envptr() );

      dba.upgrade();
      imstore.upgrade();

      bdb.close();
    }
  catch (TCLAP::ArgException &e)
    {
      std::cout << "ERROR: " << e.error() 
                << " for arg " << e.argId() << "\n";
      return 0;
    }
  return 0;
}
