[Liblas-commits] libpc: remove evil initialize() protocols
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Feb 8 16:09:04 EST 2011
details: http://hg.liblas.orglibpc/rev/85cb0d52c8ea
changeset: 12:85cb0d52c8ea
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Feb 08 12:19:18 2011 -0800
description:
remove evil initialize() protocols
Subject: libpc: cleanups
details: http://hg.liblas.orglibpc/rev/e1f46b927919
changeset: 13:e1f46b927919
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Feb 08 12:51:09 2011 -0800
description:
cleanups
Subject: libpc: cleanup work on isActive notion
details: http://hg.liblas.orglibpc/rev/a7608f689f74
changeset: 14:a7608f689f74
user: Michael P. Gerlek <mpg at flaxen.com>
date: Tue Feb 08 13:08:59 2011 -0800
description:
cleanup work on isActive notion
diffstat:
include/libpc/ColorFilter.hpp | 3 -
include/libpc/CropFilter.hpp | 3 -
include/libpc/DemosaicFilter.hpp | 58 ------------------------------
include/libpc/FauxReader.hpp | 4 --
include/libpc/FauxWriter.hpp | 3 -
include/libpc/Field.hpp | 9 ----
include/libpc/Filter.hpp | 3 -
include/libpc/Header.hpp | 4 +-
include/libpc/MosaicFilter.hpp | 3 -
include/libpc/PointLayout.hpp | 8 ++-
include/libpc/Reader.hpp | 5 --
include/libpc/Stage.hpp | 11 +----
include/libpc/Writer.hpp | 3 -
src/ColorFilter.cpp | 30 ++++-----------
src/CropFilter.cpp | 21 -----------
src/DemosaicFilter.cpp | 75 ----------------------------------------
src/FauxReader.cpp | 46 +++++++++---------------
src/FauxWriter.cpp | 29 ++++++--------
src/Field.cpp | 35 ++----------------
src/Filter.cpp | 11 +-----
src/Header.cpp | 10 ++--
src/MosaicFilter.cpp | 36 ++++++------------
src/PointData.cpp | 11 +++--
src/PointLayout.cpp | 55 ++++++++++++----------------
src/Reader.cpp | 6 ---
src/Stage.cpp | 15 +-------
src/Writer.cpp | 10 +----
src/main.cpp | 20 ++--------
src/prototype.vcxproj | 2 -
29 files changed, 109 insertions(+), 420 deletions(-)
diffs (truncated from 1021 to 300 lines):
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/ColorFilter.hpp
--- a/include/libpc/ColorFilter.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/ColorFilter.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -44,9 +44,6 @@
{
public:
ColorFilter(Stage& prevStage);
- void initialize();
-
- void updateLayout();
void readNextPoints(PointData&);
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/CropFilter.hpp
--- a/include/libpc/CropFilter.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/CropFilter.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -45,9 +45,6 @@
{
public:
CropFilter(Stage& prevStage, const Bounds& bounds);
- void initialize();
-
- void updateLayout();
void readNextPoints(PointData&);
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/DemosaicFilter.hpp
--- a/include/libpc/DemosaicFilter.hpp Tue Feb 08 11:03:16 2011 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/******************************************************************************
-* Copyright (c) 2011, Michael P. Gerlek (mpg at flaxen.com)
-*
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following
-* conditions are met:
-*
-* * Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-* * Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in
-* the documentation and/or other materials provided
-* with the distribution.
-* * Neither the name of Hobu, Inc. or Flaxen Geo Consulting nor the
-* names of its contributors may be used to endorse or promote
-* products derived from this software without specific prior
-* written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
-* OF SUCH DAMAGE.
-****************************************************************************/
-
-#ifndef INCLUDED_DEMOSAICFILTER_HPP
-#define INCLUDED_DEMOSAICFILTER_HPP
-
-#include "libpc/Filter.hpp"
-#include "libpc/Bounds.hpp"
-
-
-// removes any points outside of the given range
-class DemosaicFilter : public Filter
-{
-public:
- DemosaicFilter(Stage& prevStage);
- void initialize();
-
- void updateLayout();
-
- void readNextPoints(PointData&);
-
-private:
- DemosaicFilter& operator=(const DemosaicFilter&); // not implemented
- DemosaicFilter(const DemosaicFilter&); // not implemented
-};
-
-#endif
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/FauxReader.hpp
--- a/include/libpc/FauxReader.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/FauxReader.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -43,10 +43,6 @@
// generates N points randomly within the bounds
FauxReader(const Bounds&, int numPoints);
- void initialize();
-
- void updateLayout();
-
void readNextPoints(PointData& data);
private:
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/FauxWriter.hpp
--- a/include/libpc/FauxWriter.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/FauxWriter.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -43,9 +43,6 @@
{
public:
FauxWriter(Stage& prevStage);
- void initialize();
-
- void updateLayout();
private:
int m_numPointsWritten;
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/Field.hpp
--- a/include/libpc/Field.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/Field.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -85,23 +85,14 @@
int getOffset() const { return m_offset; }
void setOffset(int offset) { m_offset = offset; }
- int getIndex() const { return m_index; }
- void setIndex(int index) { m_index = index; }
-
int getNumBytes() const;
- static const std::vector<Field>& standardFields();
-
void dump() const;
private:
DataItem m_item;
DataType m_type;
-
int m_offset;// byte offset within a point buffer
- int m_index; // 0..n-1, where n is number of fields in layout
-
- static std::vector<Field>* s_standardFields;
};
#endif
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/Filter.hpp
--- a/include/libpc/Filter.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/Filter.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -42,9 +42,6 @@
{
public:
Filter(Stage& prevStage);
- virtual void initialize() = 0;
-
- virtual void updateLayout() = 0;
virtual void readNextPoints(PointData&) = 0;
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/Header.hpp
--- a/include/libpc/Header.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/Header.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -45,8 +45,8 @@
Header(const Header&);
Header& operator=(const Header&);
- const PointLayout& getConstPointLayout() const;
- PointLayout& getPointLayout();
+ const PointLayout& getLayout() const;
+ PointLayout& getLayout();
void setLayout(const PointLayout&);
int getNumPoints() const;
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/MosaicFilter.hpp
--- a/include/libpc/MosaicFilter.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/MosaicFilter.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -44,9 +44,6 @@
{
public:
MosaicFilter(Stage& prevStage, Stage& prevStage2);
- void initialize();
-
- void updateLayout();
void readNextPoints(PointData&);
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/PointLayout.hpp
--- a/include/libpc/PointLayout.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/PointLayout.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -36,9 +36,11 @@
#define INCLUDED_POINTLAYOUT_HPP
#include <vector>
+#include <string>
#include "libpc/Field.hpp"
+
class PointLayout
{
public:
@@ -49,8 +51,8 @@
bool operator==(const PointLayout & other) const;
bool same(const PointLayout & other, bool ignoreActive=false) const;
- void addField(const Field& field);
- void addFields(const std::vector<Field>& fields);
+ // returns the index of the field added
+ int addField(const Field& field);
const Field& getField(int fieldIndex) const { return m_fields[fieldIndex]; }
bool isActive(int fieldIndex) const { return m_isActive[fieldIndex]; }
@@ -61,7 +63,7 @@
int getSizeInBytes() const;
int getNumFields() const;
- void dump() const;
+ void dump(std::string indent="") const;
// returns -1 if not found
int findFieldIndex(Field::DataItem item) const;
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/Reader.hpp
--- a/include/libpc/Reader.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/Reader.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -43,11 +43,6 @@
public:
Reader();
- // opens the file (or whatever) and sets m_layout
- virtual void initialize();
-
- virtual void updateLayout() = 0;
-
virtual void readNextPoints(PointData&) = 0;
protected:
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/Stage.hpp
--- a/include/libpc/Stage.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/Stage.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -44,20 +44,15 @@
{
public:
Stage();
- virtual void initialize();
- bool isInitialized() const;
- virtual void updateLayout() = 0;
-
- virtual void readNextPoints(PointData&) = 0;
+ virtual void readNextPoints(PointData&) = 0;
- const Header& getConstHeader() const;
+ const Header& getHeader() const;
+ Header& getHeader();
protected:
- Header& getHeader();
private:
- bool m_isInitialized;
Header m_header;
Stage& operator=(const Stage&); // not implemented
diff -r bfdaef209a3a -r a7608f689f74 include/libpc/Writer.hpp
--- a/include/libpc/Writer.hpp Tue Feb 08 11:03:16 2011 -0800
+++ b/include/libpc/Writer.hpp Tue Feb 08 13:08:59 2011 -0800
@@ -43,9 +43,6 @@
{
public:
Writer(Stage& prevStage);
- virtual void initialize();
-
- virtual void updateLayout() = 0;
void write();
diff -r bfdaef209a3a -r a7608f689f74 src/ColorFilter.cpp
--- a/src/ColorFilter.cpp Tue Feb 08 11:03:16 2011 -0800
+++ b/src/ColorFilter.cpp Tue Feb 08 13:08:59 2011 -0800
@@ -40,30 +40,18 @@
ColorFilter::ColorFilter(Stage& prevStage)
: Filter(prevStage)
{
- return;
-}
-
-
-void ColorFilter::initialize()
-{
- Filter::initialize();
- return;
-}
-
-
-void ColorFilter::updateLayout()
-{
- m_prevStage.updateLayout();
- const PointLayout& prevLayout = m_prevStage.getConstHeader().getConstPointLayout();
-
- PointLayout myLayout(prevLayout);
+ PointLayout& layout = getHeader().getLayout();
// add the three u8 fields
- myLayout.addField(Field(Field::Zred, Field::U8));
More information about the Liblas-commits
mailing list