40 #ifndef PCL_OUTOFCORE_RAM_CONTAINER_IMPL_H_
41 #define PCL_OUTOFCORE_RAM_CONTAINER_IMPL_H_
47 #include <pcl/outofcore/octree_ram_container.h>
54 template<
typename Po
intT>
57 template<
typename Po
intT>
60 template<
typename Po
intT>
void
63 if (!container_.empty ())
65 FILE* fxyz = fopen (path.string ().c_str (),
"w");
67 boost::uint64_t num = size ();
68 for (boost::uint64_t i = 0; i < num; i++)
70 const PointT& p = container_[i];
75 ss << p.x <<
"\t" << p.y <<
"\t" << p.z <<
"\n";
77 fwrite (ss.str ().c_str (), 1, ss.str ().size (), fxyz);
80 assert ( fclose (fxyz) == 0 );
86 template<
typename Po
intT>
void
89 container_.insert (container_.end (), start, start + count);
94 template<
typename Po
intT>
void
97 AlignedPointTVector temp;
99 for (boost::uint64_t i = 0; i < count; i++)
103 container_.insert (container_.end (), temp.begin (), temp.end ());
108 template<
typename Po
intT>
void
113 memcpy (v.data (), container_.data () + start, count *
sizeof(
PointT));
118 template<
typename Po
intT>
void
120 const boost::uint64_t count,
121 const double percent,
124 boost::uint64_t samplesize =
static_cast<boost::uint64_t
> (percent *
static_cast<double> (count));
126 boost::mutex::scoped_lock lock (rng_mutex_);
128 boost::uniform_int < boost::uint64_t > buffdist (start, start + count);
129 boost::variate_generator<boost::mt19937&, boost::uniform_int<boost::uint64_t> > buffdie (
rand_gen_, buffdist);
131 for (boost::uint64_t i = 0; i < samplesize; i++)
133 boost::uint64_t buffstart = buffdie ();
134 v.push_back (container_[buffstart]);
143 #endif //PCL_OUTOFCORE_RAM_CONTAINER_IMPL_H_