bool createDomain (SDBConnectionPtr aSDB, const std::string &aDomainName) { try { CreateDomainResponsePtr lRes = aSDB->createDomain (aDomainName); std::cout << "domain created successfully" << std::endl; } catch (CreateDomainException &e) { std::cerr << e.what() << std::endl; return false; } return true; }
int CVDB::upload(ImageScanner *scanner, const int id, const std::string& s3prefix) { SDBConnectionPtr sdbconn = sdbconnect(); // initialize table meta data ImageTableMetadata tablemeta(id); std::string domain; serial_image_table_meta(&tablemeta, IMAGE_TABLE_ITEM_ID, domain); std::string imgdomain(domain); imgdomain += IMAGE_CATALOG_SUFFIX; tablemeta.bucket = CVDB::BUCKET; tablemeta.prefix = s3prefix; tablemeta.imagedomain = imgdomain; tablemeta.nextimageid = 1; std::cout << "Creating: " << imgdomain << std::endl; CreateDomainResponsePtr res = sdbconn->createDomain(imgdomain); // initialize all image meta data scanner->open(); ImageMetadata meta; meta.imagetable = &tablemeta; while (scanner->next(meta)) { meta.id = tablemeta.nextimageid; tablemeta.nextimageid++; std::cout << "Uploading image: " << meta.id << ", " << meta.name << ", " << meta.subjectid << ", " << meta.poseid << ", " << meta.format << ", " << meta.dimensions.width << ", " << meta.dimensions.height << ", " << meta.dimensions.depth << std::endl; upload_image_meta(sdbconn, &meta); } scanner->close(); std::cout << "Uploading table: " << tablemeta.id << ", " << tablemeta.bucket << ", " << tablemeta.prefix << ", " << tablemeta.nextimageid << std::endl; upload_image_table_meta(sdbconn, &tablemeta); return EXIT_SUCCESS; }