1 //////////////////////////////////////////////////////////////////////////////// 2 // 3 // Copyright (c) 2008 The Regents of the University of California 4 // 5 // This file is part of Qbox 6 // 7 // Qbox is distributed under the terms of the GNU General Public License 8 // as published by the Free Software Foundation, either version 2 of 9 // the License, or (at your option) any later version. 10 // See the file COPYING in the root directory of this distribution 11 // or <http://www.gnu.org/licenses/>. 12 // 13 //////////////////////////////////////////////////////////////////////////////// 14 // 15 // ListAtomsCmd.h: 16 // 17 //////////////////////////////////////////////////////////////////////////////// 18 19 #ifndef LISTATOMSCMD_H 20 #define LISTATOMSCMD_H 21 22 #include <iostream> 23 #include "UserInterface.h" 24 #include "Sample.h" 25 #include <cstdlib> 26 27 class ListAtomsCmd : public Cmd 28 { 29 public: 30 31 Sample *s; 32 ListAtomsCmd(Sample * sample)33 ListAtomsCmd(Sample *sample) : s(sample) {}; 34 name(void)35 const char *name(void) const { return "list_atoms"; } help_msg(void)36 const char *help_msg(void) const 37 { 38 return 39 "\n list_atoms\n\n" 40 " syntax: list_atoms\n\n" 41 " The list_atoms command prints a list of all defined atoms.\n\n"; 42 } 43 action(int argc,char ** argv)44 int action(int argc, char **argv) 45 { 46 if ( argc != 1 ) 47 { 48 if ( ui->onpe0() ) 49 { 50 cout << " use: list_atoms" << endl; 51 } 52 return 1; 53 } 54 s->atoms.listAtoms(); 55 return 0; 56 } 57 }; 58 #endif 59