Exemplo n.º 1
0
Arquivo: s3.cpp Projeto: amitkr/libaws
bool get ( S3ConnectionPtr aS3, const std::string& aBucketName, const std::string& aKey )
{
  try {
    GetResponsePtr lGet = aS3->get(aBucketName, aKey);
    char buf[512];
    std::istream& lIn = lGet->getInputStream();
    while (lIn.good()) {
      lIn.read(buf, 512);
      std::cout.write(buf, lIn.gcount());
    }
  } catch (GetException &e) {
    std::cerr << e.what() << std::endl;
    return false;
  }
  return true;
}
Exemplo n.º 2
0
static void
load_image_eigen(S3ConnectionPtr s3conn, ImageMetadata *meta)
{

	char buf[32];
	std::string key(meta->imagetable->prefix);
	key += "/";
	key += EIGEN_PREFIX;
	key += "/";
	sprintf(buf, "%d.eigen", meta->id);
	key += buf;

	if (meta->features == NULL) {
		meta->features = new float[meta->imagetable->eigenspace->dimension];
	}
    GetResponsePtr res = s3conn->get(CVDB::BUCKET, key);
    std::istream& ins = res->getInputStream();
    ins.read((char*)(meta->features), sizeof(float)*meta->imagetable->eigenspace->dimension);
}