Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

P_CmdTool.C

Go to the documentation of this file.
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: P_CmdTool.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.49 $       $Date: 2019/01/17 21:21:00 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  * This is Paul's new Tracker code -- pgrayson@ks.uiuc.edu
00019  *
00020  * Commands and the text interface.
00021  *
00022  ***************************************************************************/
00023 
00024 
00025 #include "P_CmdTool.h"
00026 #include <stdlib.h>
00027 #include <string.h>
00028 
00029 CmdToolCreate::CmdToolCreate(const char *thetype, int theargc, const char **theUSL)
00030     : Command(Command::TOOL_CREATE) {
00031   int i;
00032   argc=theargc;
00033   USL = new char *[argc];
00034   for(i=0;i<argc;i++)
00035     USL[i]=strdup(theUSL[i]);
00036   type = strdup(thetype);
00037 }
00038 
00039 CmdToolCreate::~CmdToolCreate() {
00040   int i;
00041   for(i=0;i<argc;i++) free(USL[i]);
00042   delete [] USL;
00043   free(type);
00044 }
00045 
00046 void CmdToolCreate::create_text() {
00047   int i;
00048   *cmdText << "tool create " << type;
00049   for(i=0;i<argc;i++) *cmdText << " " << USL[i];
00050   *cmdText << ends;
00051 }
00052 
00053 CmdToolChange::CmdToolChange(const char *thetype, int thenum)
00054     : Command(Command::TOOL_CHANGE) {
00055   num = thenum;
00056   type = strdup(thetype);
00057 }
00058 
00059 CmdToolChange::~CmdToolChange() {
00060   free(type);
00061 }
00062 
00063 void CmdToolChange::create_text() {
00064   *cmdText << "tool change " << type << " " << num << ends;
00065 }
00066 
00067 CmdToolDelete::CmdToolDelete(int thenum)
00068   : Command(Command::TOOL_DELETE) {
00069   num=thenum;
00070 }
00071 
00072 void CmdToolDelete::create_text() {
00073   *cmdText << "tool delete " << num;
00074 }
00075 
00076 CmdToolScale::CmdToolScale(float thescale, int thenum)
00077   : Command(Command::TOOL_SCALE) {
00078   num=thenum;
00079   scale=thescale;
00080 }
00081 
00082 void CmdToolScale::create_text() {
00083   *cmdText << "tool scale " << scale << " " << num;
00084 }
00085 
00086 CmdToolScaleForce::CmdToolScaleForce(float thescale, int thenum)
00087   : Command(Command::TOOL_SCALE_FORCE) {
00088   num=thenum;
00089   scale=thescale;
00090 }
00091 
00092 void CmdToolScaleForce::create_text() {
00093   *cmdText << "tool scaleforce " << scale << " " << num;
00094 }
00095 
00096 CmdToolScaleSpring::CmdToolScaleSpring(float thescale, int thenum)
00097   : Command(Command::TOOL_SCALE_SPRING) {
00098   num=thenum;
00099   scale=thescale;
00100 }
00101 
00102 void CmdToolScaleSpring::create_text() {
00103   *cmdText << "tool scalespring " << scale << " " << num;
00104 }
00105 
00106 CmdToolOffset::CmdToolOffset(float *theoffset, int thenum)
00107   : Command(Command::TOOL_OFFSET) {
00108   int i;
00109   num=thenum;
00110   for(i=0;i<3;i++)
00111     offset[i] = theoffset[i];
00112 }
00113 
00114 void CmdToolOffset::create_text() {
00115   *cmdText << "tool offset "
00116            << offset[0] << " " << offset[1] << " " << offset[2] << " "
00117            << num;
00118 }
00119 
00120 CmdToolAddDevice::CmdToolAddDevice(const char *thename, int thenum)
00121   : Command(Command::TOOL_ADD_DEVICE) {
00122   name = strdup(thename);
00123   num = thenum;
00124 }
00125 
00126 CmdToolAddDevice::~CmdToolAddDevice() {
00127   free(name);
00128 }
00129 
00130 void CmdToolAddDevice::create_text() {
00131   *cmdText << "tool adddevice " << name << " " << num;
00132 }
00133 
00134 CmdToolDeleteDevice::CmdToolDeleteDevice(const char *thename,
00135                                          int thenum)
00136   : Command(Command::TOOL_DELETE_DEVICE) {
00137   name = strdup(thename);
00138   num = thenum;
00139 }
00140 
00141 CmdToolDeleteDevice::~CmdToolDeleteDevice() {
00142   free(name);
00143 }
00144 
00145 void CmdToolDeleteDevice::create_text() {
00146   *cmdText << "tool removedevice " << name << " " << num;
00147 }
00148 
00149 CmdToolRep::CmdToolRep(int tool, int mol, int rep) 
00150 : Command(Command::TOOL_REP), toolnum(tool), molid(mol), repnum(rep) {}
00151 
00152 void CmdToolRep::create_text() {
00153   *cmdText << "tool rep " << toolnum << " " << molid << " " << repnum;
00154 }
00155    
00156 CmdToolCallback::CmdToolCallback(int the_on)
00157   : Command(Command::TOOL_CALLBACK) {
00158   on = the_on;
00159 }
00160 
00161 void CmdToolCallback::create_text() {
00162   if(on) {
00163     *cmdText << "tool callback on";
00164   } else {
00165     *cmdText << "tool callback off";
00166   }
00167 }

Generated on Fri Oct 4 02:44:46 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002