e_int32 dm_update(data_manager_t *dm, int c, int file_right) { int ret; e_assert(dm&&dm->state, E_ERROR_INVALID_HANDLER); ret = da_write_column(&dm->adapters_point_cloud, c, dm->points_xyz, file_right); e_check(ret<=0); ret = da_write_column(&dm->adapters_gray, c, dm->points_gray, file_right); e_check(ret<=0); return E_OK; }
int main() { data_adapter_t da; unsigned char file_name[][64] = { "test.pcd1", "test.jpg", "test.gif", "/data/local/tmp/test.sprite" }; da_open(&da, file_name[3], W, H, E_DWRITE); //data_adapter_t *da, e_uint8 *name, int mode point_array = malloc_points(PNT_TYPE_GRAY,H); points_gray = (point_gray_t*)point_array->mem; for (int i = 0; i < H; i++) points_gray[i].gray = 80; for (int i = 0; i < W; i++) da_write_column(&da,i, point_array, 0); for (int i = 0; i < H; i++) points_gray[i].gray = 160; for (int i = 0; i < W; i++) da_write_column(&da, W - i - 1, point_array, 1); // point_array = malloc_points(PNT_TYPE_XYZ, H); // points = (point_xyz_t*) point_array->mem; // // for (int i = 0; i < H; i++) { // points[i].x = H * sin(i * M_PI / H); // points[i].y = H * cos(i * M_PI / H); // points[i].z = H * sin(M_PI - i * M_PI / H); // } // // for (int i = 0; i < W; i++) // da_append_points(&da, point_array, H, 0); // // for (int i = 0; i < H; i++) { // points[i].x += 100; // points[i].y += 100; // points[i].z += 100; // } // // for (int i = 0; i < W; i++) // da_append_points(&da, point_array, H, 1); // da_close(&da); free_points(point_array); printf("ALL TEST PASSED!\n"); return 0; }
e_int32 dm_write_column(data_manager_t *dm, e_uint32 column_idx, point_t* point, int file_right) { int i, ret; data_adapter_t* pda; e_assert(dm&&dm->state, E_ERROR_INVALID_HANDLER); pda = dm->adapters; for (i = 0; i < dm->num; i++) { if (point->type != pda[i].pnt_type) continue; ret = da_write_column(&pda[i], column_idx, point, file_right); e_check(ret<=0); } return E_OK; }