Ejemplo n.º 1
0
  std::ostream& Pointcloud::writeBinary(std::ostream &s) const {

    size_t pc_size = this->size();
    OCTOMAP_DEBUG("Writing %d points to binary file...", pc_size);
    s.write((char*)&pc_size, sizeof(pc_size));

    for (Pointcloud::const_iterator it = this->begin(); it != this->end(); it++) {
      it->writeBinary(s);
    }
    OCTOMAP_DEBUG("done.\n");

    return s;
  }
Ejemplo n.º 2
0
    std::ostream& Pointcloud::writeBinary(std::ostream &s) const {

        // check if written unsigned int can hold size
        size_t orig_size = this->size();
        if (orig_size > std::numeric_limits<uint32_t>::max()){
            OCTOMAP_ERROR("Pointcloud::writeBinary ERROR: Point cloud too large to be written");
            return s;
        }

        uint32_t pc_size = static_cast<uint32_t>(this->size());
        OCTOMAP_DEBUG("Writing %u points to binary file...", pc_size);
        s.write((char*)&pc_size, sizeof(pc_size));

        for (Pointcloud::const_iterator it = this->begin(); it != this->end(); it++) {
            it->writeBinary(s);
        }
        OCTOMAP_DEBUG("done.\n");

        return s;
    }