00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: CmdIMD.C,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.32 $ $Date: 2019/01/17 21:20:58 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * Commands for IMD simulation control 00019 ***************************************************************************/ 00020 00021 00022 #include "CmdIMD.h" 00023 #include "utilities.h" 00024 00026 00027 CmdIMDConnect::CmdIMDConnect(int id, const char *hostname, int portnum) 00028 : Command(Command::IMD_ATTACH) { 00029 host = stringdup(hostname); 00030 port = portnum; 00031 molid = id; 00032 } 00033 00034 CmdIMDConnect::~CmdIMDConnect() { 00035 delete [] host; 00036 } 00037 00038 void CmdIMDConnect::create_text() { 00039 *cmdText << "imd connect " << host << " " << port << ends; 00040 } 00041 00043 CmdIMDSim::CmdIMDSim(CmdIMDSimCommand newcmd) 00044 : Command(Command::IMD_SIM), cmd(newcmd) {} 00045 00046 void CmdIMDSim::create_text() { 00047 const char *text; 00048 switch (cmd) { 00049 case PAUSE_TOGGLE: text="pause toggle"; break; 00050 case PAUSE_ON: text="pause on"; break; 00051 case PAUSE_OFF: text="pause off"; break; 00052 case DETACH: text="detach"; break; 00053 case KILL: text="kill"; break; 00054 default: text=""; 00055 } 00056 *cmdText << "imd sim " << text << ends; 00057 } 00058 00060 CmdIMDRate::CmdIMDRate(CmdIMDRateCommand type, int newrate) 00061 : Command(Command::IMD_RATE), rate_type(type), rate(newrate) {} 00062 00063 void CmdIMDRate::create_text() { 00064 switch (rate_type) { 00065 case TRANSFER: 00066 *cmdText << "imd transrate " << rate << ends; 00067 break; 00068 case KEEP: 00069 *cmdText << "imd keep " << rate << ends; 00070 break; 00071 default: ; 00072 } 00073 } 00074 00076 CmdIMDCopyUnitCell::CmdIMDCopyUnitCell(CmdIMDCopyUnitCellCommand mode) : Command(Command::IMD_COPYUNITCELL), copy_mode(mode) {} 00077 00078 void CmdIMDCopyUnitCell::create_text() { 00079 *cmdText << "imd copyunitcell " << ((copy_mode == CmdIMDCopyUnitCell::COPYCELL_ON) ? "on" : "off") << ends; 00080 } 00081 00082