-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathplugin.cpp
86 lines (70 loc) · 3.5 KB
/
plugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "plugin.h"
#include <utf8.h>
#define _GATANPLUGIN_USE_CLASS_PLUGINMAIN
#include "DMPlugInMain.h"
using namespace Gatan;
DM_StringToken_1Ref h5_version(void)
{
DM::String str;
PLUG_IN_ENTRY
str = DM::String(HDF5_PLUGIN_VERSION);
PLUG_IN_EXIT
return str.release();
}
bool h5_is_file(const char* filename)
{
return H5Fis_hdf5(filename) > 0;
}
void HDF5Plugin::Start()
{
AddFunction("dm_string h5_version()", &h5_version);
AddFunction("bool h5_is_file(string filename)", &h5_is_file);
AddFunction("TagGroup h5_info(string filename)", &h5_info_root);
AddFunction("TagGroup h5_info(string filename, dm_string location)", &h5_info_location);
AddFunction("bool h5_delete(string filename, dm_string location)", &h5_delete);
AddFunction("bool h5_exists(string filename, dm_string location)", &h5_exists);
AddFunction("TagGroup h5_read_attr(string filename, dm_string location)", &h5_read_attr);
AddFunction("bool h5_delete_attr(string filename, dm_string location, dm_string attr)", &h5_delete_attr);
AddFunction("bool h5_exists_attr(string filename, dm_string location, dm_string attr)", &h5_exists_attr);
AddFunction("bool h5_create_dataset(string filename, dm_string location, Image* data)", &h5_create_dataset_from_image);
AddFunction("bool h5_create_dataset(string filename, dm_string location, long dtype, TagGroup size)", &h5_create_dataset_simple);
AddFunction("ImageRef h5_read_dataset(string filename, dm_string location)", &h5_read_dataset_all);
AddFunction("ImageRef h5_read_dataset_slice1(string filename, dm_string location, TagGroup offsets, long dim0, long count0, long stride0)", &h5_read_dataset_slice1);
AddFunction("ImageRef h5_read_dataset_slice2(string filename, dm_string location, TagGroup offsets, long dim0, long count0, long stride0, long dim1, long count1, long stride1)", &h5_read_dataset_slice2);
AddFunction("ImageRef h5_read_dataset_slice3(string filename, dm_string location, TagGroup offsets, long dim0, long count0, long stride0, long dim1, long count1, long stride1, long dim1, long count2, long stride2)", &h5_read_dataset_slice3);
AddFunction("dm_string h5_read_string_dataset(string filename, dm_string location)", &h5_read_string_dataset);
}
///
/// This is called when the plugin is loaded, after the 'Start' method.
/// Whenever DM is launched, it calls the 'Run' method for
/// each installed plugin after the 'Start' method has been called
/// for all such plugins and all script packages have been installed.
/// Thus it is ok to use script functions provided by other plugins.
///
void HDF5Plugin::Run()
{
}
///
/// This is called when the plugin is unloaded. Whenever DM is
/// shut down, the 'Cleanup' method is called for all installed plugins
/// before script packages are uninstalled and before the 'End'
/// method is called for any plugin. Thus, script functions provided
/// by other plugins are still available. This method should release
/// resources allocated by 'Run'.
///
void HDF5Plugin::Cleanup()
{
}
///
/// This is called when the plugin is unloaded. Whenever DM is shut
/// down, the 'End' method is called for all installed plugins after
/// all script packages have been unloaded, and other installed plugins
/// may have already been completely unloaded, so the code should not
/// rely on scripts installed from other plugins. This method should
/// release resources allocated by 'Start', and in particular should
/// uninstall all installed script functions.
///
void HDF5Plugin::End()
{
}
HDF5Plugin gHDF5PlugIn;