// Send DataBase to c++ private IntPtr Send_DB(ref Dictionary <int, List <int> > cdb) { int remainder = cdb.Count % MAX_Send; int fraction = (cdb.Count - remainder) / MAX_Send; var keys = db.Select(z => z.Key).ToArray(); var values = db.Select(z => z.Value).ToArray(); ptr = InitMap(); init = true; for (int i = 0, point = 0; i < fraction; i++, point += MAX_Send) { SDB[] sdb = DB_2_Struct(point, point + MAX_Send, ref cdb); _SDB _sdb = new _SDB(); _sdb.sdb = sdb; ptr = SendDB(ref _sdb, MAX_Send, ptr); } SDB[] rem_sdb = DB_2_Struct(fraction * MAX_Send, cdb.Count, ref cdb); _SDB _rem_sdb = new _SDB(); _rem_sdb.sdb = rem_sdb; ptr = SendDB(ref _rem_sdb, remainder, ptr); return(ptr); }
private static extern IntPtr SendDB(ref _SDB sdb, int Count, IntPtr ptr);