[Liblas-commits] libpc: minor cleanups and docs
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Mar 7 19:03:56 EST 2011
details: http://hg.liblas.orglibpc/rev/85b0c5de9e47
changeset: 184:85b0c5de9e47
user: Michael P. Gerlek <mpg at flaxen.com>
date: Mon Mar 07 16:03:52 2011 -0800
description:
minor cleanups and docs
diffstat:
include/libpc/CacheFilter.hpp | 6 +++++-
src/CacheFilter.cpp | 16 +++++++++-------
2 files changed, 14 insertions(+), 8 deletions(-)
diffs (59 lines):
diff -r dacbbd3a3288 -r 85b0c5de9e47 include/libpc/CacheFilter.hpp
--- a/include/libpc/CacheFilter.hpp Mon Mar 07 14:44:33 2011 -0800
+++ b/include/libpc/CacheFilter.hpp Mon Mar 07 16:03:52 2011 -0800
@@ -40,7 +40,11 @@
namespace libpc
{
-// this is just a very simple MRU filter -- future versions will be smarter
+// This is just a very simple MRU filter -- future versions will be smarter.
+// This cache has the following constraints:
+// - only one block is cached
+// - read chunk sizes are assumed to be just 1 point
+// If more than one point is read, the cache is skipped.
class LIBPC_DLL CacheFilter : public Filter
{
public:
diff -r dacbbd3a3288 -r 85b0c5de9e47 src/CacheFilter.cpp
--- a/src/CacheFilter.cpp Mon Mar 07 14:44:33 2011 -0800
+++ b/src/CacheFilter.cpp Mon Mar 07 16:03:52 2011 -0800
@@ -90,30 +90,32 @@
boost::uint32_t CacheFilter::readBuffer(PointData& data)
{
+ if (data.getNumPoints() != 1)
+ {
+ m_currentPointIndex += data.getNumPoints();
+ return m_prevStage.read(data);
+ }
+
m_numPointsRequested += data.getNumPoints();
boost::uint64_t pointToRead = getCurrentPointIndex();
// do we meet the cache-checking criteria?
- if (data.getNumPoints() == 1 && m_storedPointData != NULL)
+ if (m_storedPointData != NULL)
{
// do we have the point we want in the cache?
if (pointToRead >= m_storedPointIndex &&
pointToRead < m_storedPointIndex + m_storedPointData->getNumPoints())
{
- // the cache has the data we want
-
+ // the cache has the data we want, copy out the point we want
boost::uint32_t index = (boost::uint32_t)(pointToRead - m_storedPointIndex);
-
data.copyPointFast(0, index, *m_storedPointData);
-
m_currentPointIndex += 1;
-
return 1;
}
}
- // not cached, so read a full block and replace cache with it
+ // not cached, so read a full block and replace cache with that new block
delete m_storedPointData;
More information about the Liblas-commits
mailing list