00001 // -*- c++ -*- 00002 00003 // This file is part of the Collective Variables module (Colvars). 00004 // The original version of Colvars and its updates are located at: 00005 // https://github.com/Colvars/colvars 00006 // Please update all Colvars source files before making any changes. 00007 // If you wish to distribute your changes, please submit them to the 00008 // Colvars repository at GitHub. 00009 00010 #ifndef COLVARPROXY_TCL_H 00011 #define COLVARPROXY_TCL_H 00012 00013 #if defined(NAMD_TCL) || defined(VMDTCL) 00014 #define COLVARS_TCL 00015 #endif 00016 00017 #ifdef COLVARS_TCL 00018 #include <tcl.h> 00019 #else 00020 // Allow for placeholders Tcl_Interp* variables 00021 typedef void Tcl_Interp; 00022 #endif 00023 00024 #include <vector> 00025 00026 00028 class colvarproxy_tcl { 00029 00030 public: 00031 00033 colvarproxy_tcl(); 00034 00036 virtual ~colvarproxy_tcl(); 00037 00039 inline bool tcl_available() { 00040 #if defined(COLVARS_TCL) 00041 return true; 00042 #else 00043 return false; 00044 #endif 00045 } 00046 00048 char const *tcl_get_str(void *obj); 00049 00050 int tcl_run_script(std::string const &script); 00051 00052 int tcl_run_file(std::string const &fileName); 00053 00055 int tcl_run_force_callback(); 00056 00058 int tcl_run_colvar_callback( 00059 std::string const &name, 00060 std::vector<const colvarvalue *> const &cvcs, 00061 colvarvalue &value); 00062 00064 int tcl_run_colvar_gradient_callback( 00065 std::string const &name, 00066 std::vector<const colvarvalue *> const &cvcs, 00067 std::vector<cvm::matrix2d<cvm::real> > &gradient); 00068 00070 inline Tcl_Interp *get_tcl_interp() 00071 { 00072 return tcl_interp_; 00073 } 00074 00076 inline void set_tcl_interp(Tcl_Interp *interp) 00077 { 00078 tcl_interp_ = interp; 00079 } 00080 00082 virtual void init_tcl_pointers(); 00083 00084 protected: 00086 Tcl_Interp *tcl_interp_; 00087 }; 00088 00089 #endif