40 #ifndef PCL_OUTOFCORE_RAM_CONTAINER_IMPL_H_
41 #define PCL_OUTOFCORE_RAM_CONTAINER_IMPL_H_
47 #include <pcl/outofcore/octree_ram_container.h>
53 template<
typename Po
intT>
56 template<
typename Po
intT>
59 template<
typename Po
intT>
void
62 if (!container_.empty ())
64 FILE* fxyz = fopen (path.string ().c_str (),
"we");
66 std::uint64_t num = size ();
67 for (std::uint64_t i = 0; i < num; i++)
69 const PointT& p = container_[i];
74 ss << p.x <<
"\t" << p.y <<
"\t" << p.z <<
"\n";
76 fwrite (ss.str ().c_str (), 1, ss.str ().size (), fxyz);
79 assert ( fclose (fxyz) == 0 );
85 template<
typename Po
intT>
void
88 container_.insert (container_.end (), start, start + count);
93 template<
typename Po
intT>
void
98 for (std::uint64_t i = 0; i < count; i++)
102 container_.insert (container_.end (), temp.begin (), temp.end ());
107 template<
typename Po
intT>
void
112 memcpy (v.data (), container_.data () + start, count *
sizeof(
PointT));
117 template<
typename Po
intT>
void
119 const std::uint64_t count,
120 const double percent,
123 std::uint64_t samplesize =
static_cast<std::uint64_t
> (percent *
static_cast<double> (count));
125 std::lock_guard<std::mutex> lock (rng_mutex_);
127 std::uniform_int_distribution < std::uint64_t > buffdist (start, start + count);
129 for (std::uint64_t i = 0; i < samplesize; i++)
131 std::uint64_t buffstart = buffdist (rng_);
132 v.push_back (container_[buffstart]);
141 #endif //PCL_OUTOFCORE_RAM_CONTAINER_IMPL_H_