00001
00002 #include <basix/int.hpp>
00003 #include <basix/vector.hpp>
00004 #include <basix/port.hpp>
00005 #include <basix/table.hpp>
00006 #include <basix/storage.hpp>
00007 #include <basix/glue.hpp>
00008
00009 #define int_literal(x) as_int (as_string (x))
00010
00011 namespace mmx {
00012 static storage
00013 GLUE_1 () {
00014 return disk_storage ();
00015 }
00016
00017 static storage
00018 GLUE_2 (const string &arg_1) {
00019 return disk_storage (arg_1);
00020 }
00021
00022 static storage
00023 GLUE_3 (const storage &arg_1) {
00024 return cached_storage (arg_1);
00025 }
00026
00027 static void
00028 GLUE_4 (const storage &arg_1, const string &arg_2, const string &arg_3) {
00029 write (arg_1, arg_2, arg_3);
00030 }
00031
00032 static string
00033 GLUE_5 (const storage &arg_1, const string &arg_2) {
00034 return read (arg_1, arg_2);
00035 }
00036
00037 static void
00038 GLUE_6 (const storage &arg_1, const string &arg_2) {
00039 lock (arg_1, arg_2);
00040 }
00041
00042 static void
00043 GLUE_7 (const storage &arg_1, const string &arg_2) {
00044 unlock (arg_1, arg_2);
00045 }
00046
00047 static storage
00048 GLUE_8 (const storage &arg_1, const string &arg_2) {
00049 return get_branch (arg_1, arg_2);
00050 }
00051
00052 static bool
00053 GLUE_9 (const storage &arg_1, const string &arg_2) {
00054 return has_branch (arg_1, arg_2);
00055 }
00056
00057 static string
00058 GLUE_10 (const storage &arg_1, const string &arg_2) {
00059 return get_file (arg_1, arg_2);
00060 }
00061
00062 static bool
00063 GLUE_11 (const storage &arg_1, const string &arg_2) {
00064 return has_file (arg_1, arg_2);
00065 }
00066
00067 static vector<generic>
00068 GLUE_12 (const storage &arg_1) {
00069 return retrieve_data_bis (arg_1);
00070 }
00071
00072 static vector<generic>
00073 GLUE_13 (const storage &arg_1) {
00074 return retrieve_branches_bis (arg_1);
00075 }
00076
00077 static vector<generic>
00078 GLUE_14 (const storage &arg_1) {
00079 return retrieve_files_bis (arg_1);
00080 }
00081
00082 void
00083 glue_storage () {
00084 static bool done = false;
00085 if (done) return;
00086 done = true;
00087 call_glue (string ("glue_string"));
00088 call_glue (string ("glue_basix_vector_generic"));
00089 call_glue (string ("glue_basix_table_generic"));
00090 define_type<storage > (lit ("Storage"));
00091 define ("disk_storage", GLUE_1);
00092 define ("disk_storage", GLUE_2);
00093 define ("cached_storage", GLUE_3);
00094 define ("write", GLUE_4);
00095 define ("read", GLUE_5);
00096 define ("lock", GLUE_6);
00097 define ("unlock", GLUE_7);
00098 define ("get_branch", GLUE_8);
00099 define ("has_branch?", GLUE_9);
00100 define ("get_file", GLUE_10);
00101 define ("has_file?", GLUE_11);
00102 define (".data", GLUE_12);
00103 define (".branches", GLUE_13);
00104 define (".files", GLUE_14);
00105 }
00106 }