SpeciesCmd.C 1.41 KB
Newer Older
Francois Gygi committed
1 2
////////////////////////////////////////////////////////////////////////////////
//
Francois Gygi committed
3 4 5 6
// Copyright (c) 2008 The Regents of the University of California
//
// This file is part of Qbox
//
Francois Gygi committed
7 8
// Qbox is distributed under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 2 of
Francois Gygi committed
9 10 11 12 13 14
// the License, or (at your option) any later version.
// See the file COPYING in the root directory of this distribution
// or <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////
//
Francois Gygi committed
15 16 17 18 19 20
// SpeciesCmd.C
//
////////////////////////////////////////////////////////////////////////////////

#include "SpeciesCmd.h"
#include "SpeciesReader.h"
21
#include "Species.h"
Francois Gygi committed
22 23 24 25 26 27 28 29 30 31
using namespace std;

class Species;

////////////////////////////////////////////////////////////////////////////////
int SpeciesCmd::action(int argc, char **argv)
{
  if ( argc != 3 )
  {
    if ( ui->onpe0() )
32
      cout << "  Use: species name uri" << endl;
Francois Gygi committed
33 34
    return 1;
  }
35

Francois Gygi committed
36
  if ( ui->onpe0() )
37
  {
38 39
    cout << "  SpeciesCmd: defining species " << argv[1]
         << " as " << argv[2] << endl;
40
  }
Francois Gygi committed
41

42 43 44 45
  string xmlstr;
  SpeciesReader sp_reader;
  if ( ui->onpe0() )
    sp_reader.uri_to_string(argv[2], argv[1], xmlstr);
46

47 48 49 50
  s->ctxt_.string_bcast(xmlstr,0);
  Species* sp = new Species("argv[1]");
  sp_reader.string_to_species(xmlstr,*sp);
  s->atoms.addSpecies(sp,argv[1]);
51

Francois Gygi committed
52 53
  return 0;
}