Commit e483cb9e authored by Richard Berger's avatar Richard Berger
Browse files

Use command_map to list command styles

parent 06e3a11c
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -737,10 +737,9 @@ void Info::command_styles(FILE * out)
  fprintf(out, "\nCommand styles (add-on input script commands):\n");

  vector<string> styles;
#define COMMAND_CLASS
#define CommandStyle(key,Class) styles.push_back(#key);
#include "style_command.h"
#undef COMMAND_CLASS
  for(Input::CommandCreatorMap::iterator it = input->command_map->begin(); it != input->command_map->end(); ++it) {
    styles.push_back(it->first);
  }
  print_columns(out, styles);
  fprintf(out, "\n\n\n");
}
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp)

  // fill map with commands listed in style_command.h

  command_map = new std::map<std::string,CommandCreator>();
  command_map = new CommandCreatorMap();

#define COMMAND_CLASS
#define CommandStyle(key,Class) \
+4 −2
Original line number Diff line number Diff line
@@ -53,10 +53,12 @@ class Input : protected Pointers {

  FILE **infiles;              // list of open input files

 protected:
 public:
  typedef void (*CommandCreator)(LAMMPS *, int, char **);
  std::map<std::string,CommandCreator> *command_map;
  typedef std::map<std::string,CommandCreator> CommandCreatorMap;
  CommandCreatorMap *command_map;

 protected:
  template <typename T> static void command_creator(LAMMPS *, int, char **);

 private: