#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 bdbr, bdb;
      dbimage imstore;
      dbalnimage dba;
      bdbr.remove( dbdir.getValue() );
      bdb.recover( dbdir.getValue() );
      imstore.init( bdb.envptr() );
      dba.init( bdb.envptr() );
      bdb.adddb( &imstore );
      bdb.adddb( &dba );
      dba.close();
      imstore.close();
      bdb.close();
    }
  catch (TCLAP::ArgException &e)
    {
      std::cout << "ERROR: " << e.error() 
                << " for arg " << e.argId() << "\n";
      return 0;
    }
  return 0;
}
