40 #ifndef PCL_OUTOFCORE_OCTREE_DISK_CONTAINER_H_
41 #define PCL_OUTOFCORE_OCTREE_DISK_CONTAINER_H_
47 #include <pcl/outofcore/boost.h>
48 #include <pcl/outofcore/octree_abstract_node_container.h>
49 #include <pcl/io/pcd_io.h>
50 #include <pcl/PCLPointCloud2.h>
54 #define _fseeki64 fseeko
55 #elif defined __MINGW32__
56 #define _fseeki64 fseeko64
72 template<
typename Po
intT = pcl::Po
intXYZ>
179 return (filelen_ + writebuff_.size ());
187 return ((filelen_ == 0) && writebuff_.empty ());
192 flush (
const bool force_cache_dealloc)
194 flushWritebuff (force_cache_dealloc);
201 return (*disk_storage_filename_);
210 PCL_DEBUG (
"[Octree Disk Container] Removing the point data from disk, in file %s\n",disk_storage_filename_->c_str ());
211 boost::filesystem::remove (boost::filesystem::path (disk_storage_filename_->c_str ()));
223 if (boost::filesystem::exists (*disk_storage_filename_))
225 FILE* fxyz = fopen (path.string ().c_str (),
"w");
227 FILE* f = fopen (disk_storage_filename_->c_str (),
"rb");
230 uint64_t num =
size ();
232 char* loc =
reinterpret_cast<char*
> ( &p );
234 for (uint64_t i = 0; i < num; i++)
236 int seekret = _fseeki64 (f, i *
sizeof (
PointT), SEEK_SET);
238 assert (seekret == 0);
239 size_t readlen = fread (loc,
sizeof (
PointT), 1, f);
241 assert (readlen == 1);
244 std::stringstream ss;
247 ss << p.x <<
"\t" << p.y <<
"\t" << p.z <<
"\n";
249 fwrite (ss.str ().c_str (), 1, ss.str ().size (), fxyz);
251 int res = fclose (f);
280 flushWritebuff (
const bool force_cache_dealloc);
283 boost::shared_ptr<std::string> disk_storage_filename_;
293 const static uint64_t READ_BLOCK_SIZE_;
295 static const uint64_t WRITE_BUFF_MAX_;
297 static boost::mutex rng_mutex_;
298 static boost::mt19937 rand_gen_;
299 static boost::uuids::random_generator uuid_gen_;
305 #endif //PCL_OUTOFCORE_OCTREE_DISK_CONTAINER_H_