NAMD
PluginIOMgr.C
Go to the documentation of this file.
1 #include <stdio.h>
2 #include "PluginIOMgr.h"
3 
4 //static const int PluginIOMgr::MAX_PLUGINS = 200;
5 
6 int register_cb(void *v, vmdplugin_t *p){
7 /* const char *key = p->name;
8  if (num_plugins >= MAX_PLUGINS) {
9  fprintf(stderr, "Exceeded maximum allowed number of plugins; recompile. :(\n");
10  return NAMDPLUGIN_ERROR;
11  }
12  if (hash_insert(&pluginhash, key, num_plugins) != HASH_FAIL) {
13  fprintf(stderr, "Multiple plugins for file type '%s' found!", key);
14  return NAMDPLUGIN_ERROR;
15  }
16  plugins[num_plugins++] = (molfile_plugin_t *)p;
17  return NAMDPLUGIN_SUCCESS;
18 */
19  PluginIOMgr *me = (PluginIOMgr *)v;
20  me->setPlugin((molfile_plugin_t *)p);
21  return 0;
22 }
23 
25  molfile_jsplugin_init();
26  molfile_jsplugin_register(this, register_cb);
27 }
28 
30  molfile_jsplugin_fini();
31 }
32 
33 /*molfile_plugin_t *PulginIOMgr::getPlugin(const char *filetype){
34  int id;
35  if ((id = hash_lookup(&pluginhash, filetype)) == HASH_FAIL) {
36  fprintf(stderr, "No plugin found for filetype '%s'\n", filetype);
37  return NULL;
38  }
39 
40  return plugins[id];
41 }*/
void setPlugin(molfile_plugin_t *p)
Definition: PluginIOMgr.h:23
int register_cb(void *v, vmdplugin_t *p)
Definition: PluginIOMgr.C:6