Changeset 1571:205c10bd248d


Ignore:
Timestamp:
02/12/10 10:47:52 (6 months ago)
Author:
Howard Butler <hobu.inc@…>
Branch:
default
Children:
1572:91621a850c3b, 1573:6c8a83eaffdc
Message:

move ReaderI into its own interfaces.hpp file

Location:
include
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • include/Makefile.am

    r1561 r1571  
    55    liblas/exception.hpp \ 
    66    liblas/guid.hpp \ 
     7    liblas/interfaces.hpp \ 
    78    liblas/iterator.hpp \ 
    89    liblas/lasclassification.hpp \ 
  • include/liblas/detail/reader/reader.hpp

    r1568 r1571  
    4646#include <liblas/detail/reader/point.hpp> 
    4747#include <liblas/detail/reader/header.hpp> 
    48 #include <liblas/lasreader.hpp> 
     48#include <liblas/interfaces.hpp> 
    4949 
    5050// std 
  • include/liblas/interfaces.hpp

    r1568 r1571  
    33* 
    44* Project:  libLAS - http://liblas.org - A BSD library for LAS format data. 
    5 * Purpose:  LAS reader class  
    6 * Author:   Mateusz Loskot, mateusz@loskot.net 
     5* Purpose:  LAS interface declarations  
     6* Author:   Howard Butler, hobu.inc@gmail.com 
    77* 
    88****************************************************************************** 
    9 * Copyright (c) 2008, Mateusz Loskot 
    10 * Copyright (c) 2008, Phil Vachon 
     9* Copyright (c) 2010, Howard Butler 
    1110* 
    1211* All rights reserved. 
     
    4140****************************************************************************/ 
    4241 
    43 #ifndef LIBLAS_LASREADER_HPP_INCLUDED 
    44 #define LIBLAS_LASREADER_HPP_INCLUDED 
     42#ifndef LIBLAS_INTERFACES_HPP_INCLUDED 
     43#define LIBLAS_INTERFACES_HPP_INCLUDED 
    4544 
    4645#include <liblas/lasversion.hpp> 
     
    5958 
    6059namespace liblas { 
    61  
    62 class ReaderI; 
    63      
    64 /// Defines public interface to LAS reader implementation. 
    65 class LASReader 
    66 { 
    67 public: 
    68  
    69     /// Consructor initializes reader with input stream as source of LAS records. 
    70     /// @param ifs - stream used as source of LAS records. 
    71     /// @excepion std::runtime_error - on failure state of the input stream. 
    72     LASReader(std::istream& ifs); 
    73  
    74     LASReader(ReaderI* reader); 
    75      
    76     /// User-defined consructor initializes reader with input stream and 
    77     /// a header to override the values in the file 
    78     /// @excepion std::runtime_error - on failure state of the input stream. 
    79     LASReader(std::istream& ifs, LASHeader& header); 
    80      
    81     /// Destructor. 
    82     /// @excepion nothrow 
    83     ~LASReader(); 
    84      
    85     /// Provides read-only access to header of LAS file being read. 
    86     /// @excepion nothrow 
    87     LASHeader const& GetHeader() const; 
    88  
    89     /// Provides read-only access to current point record. 
    90     /// @excepion nothrow 
    91     LASPoint const& GetPoint() const; 
    92  
    93     /// Provides read-only access to collection of variable-length records. 
    94     /// @excepion nothrow 
    95     std::vector<LASVariableRecord> const& GetVLRs() const; 
    96  
    97     /// Allow fetching of the stream attached to the reader. 
    98     /// @excepion nothrow 
    99     std::istream& GetStream() const; 
    100  
    101     /// Checks if end-of-file has been reached. 
    102     bool IsEOF() const; 
    103  
    104     /// Fetches next point record in file. 
    105     /// @excepion may throw std::exception 
    106     bool ReadNextPoint(); 
    107  
    108     /// Fetches n-th point record from file. 
    109     /// @excepion may throw std::exception 
    110     bool ReadPointAt(std::size_t n); 
    111  
    112     /// Reinitializes state of the reader. 
    113     /// @excepion may throw std::exception 
    114     void Reset(); 
    115  
    116     /// Reproject data as they are written if the LASReader's reference is 
    117     /// different than the LASHeader's. 
    118     /// @excepion may throw std::exception 
    119     bool SetSRS(const LASSpatialReference& ref); 
    120      
    121     /// Override the spatial reference of the LASReader's LASHeader for  
    122     /// writing purposes. 
    123     /// @excepion may throw std::exception 
    124     bool SetInputSRS(const LASSpatialReference& ref); 
    125  
    126     /// Override the spatial reference of the LASReader's LASHeader for  
    127     /// writing purposes. 
    128     /// @excepion may throw std::exception 
    129     bool SetOutputSRS(const LASSpatialReference& ref); 
    130  
    131     /// Provides index-based access to point records. 
    132     /// The operator is implemented in terms of ReadPointAt method 
    133     /// and is not const-qualified because it updates file stream position. 
    134     /// @excepion may throw std::exception 
    135     LASPoint const& operator[](std::size_t n); 
    136  
    137 private: 
    138  
    139     // Blocked copying operations, declared but not defined. 
    140     LASReader(LASReader const& other); 
    141     LASReader& operator=(LASReader const& rhs); 
    142  
    143     void Init(); // throws on error 
    144  
    145     const std::auto_ptr<detail::ReaderImpl> m_pimpl; 
    146     LASHeader m_header; 
    147     LASPoint* m_point; 
    148     LASPoint* m_empty_point; 
    149     // std::vector<LASVariableRecord> m_vlrs; 
    150      
    151     // Set if the user provides a header to override the header as  
    152     // read from the istream 
    153     bool bCustomHeader; 
    154      
    155 }; 
    156  
    15760 
    15861class ReaderI 
     
    17376} // namespace liblas 
    17477 
    175 #endif // ndef LIBLAS_LASREADER_HPP_INCLUDED 
     78#endif // ndef LIBLAS_INTERFACES_HPP_INCLUDED 
  • include/liblas/lasreader.hpp

    r1568 r1571  
    5151#include <liblas/detail/fwd.hpp> 
    5252 
     53#include <liblas/interfaces.hpp> 
     54 
    5355// std 
    5456#include <iosfwd> 
     
    6062namespace liblas { 
    6163 
    62 class ReaderI; 
    63      
    6464/// Defines public interface to LAS reader implementation. 
    6565class LASReader 
     
    156156 
    157157 
    158 class ReaderI 
    159 { 
    160 public: 
    161  
    162     virtual LASHeader const& ReadHeader() = 0; 
    163     virtual LASPoint const& ReadNextPoint(const LASHeader& header) = 0; 
    164     virtual LASPoint const& ReadPointAt(std::size_t n, const LASHeader& header) = 0; 
    165  
    166     virtual void Reset(const LASHeader& header) = 0; 
    167     virtual void SetInputSRS(const LASSpatialReference& srs) = 0; 
    168     virtual void SetOutputSRS(const LASSpatialReference& srs, const LASHeader& header) = 0; 
    169  
    170     virtual ~ReaderI() {};     
    171 }; 
    172158 
    173159} // namespace liblas 
Note: See TracChangeset for help on using the changeset viewer.