MrSID Decode SDK for LiDAR Reference Manual  1.1.3.4427
Metadata.h
Go to the documentation of this file.
00001 /* //////////////////////////////////////////////////////////////////////////
00002 //                                                                         //
00003 // This code is Copyright (c) 2008-2010 LizardTech, Inc, 1008 Western      //
00004 // Avenue, Suite 200, Seattle, WA 98104.  Unauthorized use or distribution //
00005 // prohibited.  Access to and use of this code is permitted only under     //
00006 // license from LizardTech, Inc.  Portions of the code are protected by    //
00007 // US and foreign patents and other filings. All Rights Reserved.          //
00008 //                                                                         //
00010 /* PUBLIC */
00011 
00012 #ifndef __LIDAR_METADATA_H__
00013 #define __LIDAR_METADATA_H__
00014 
00015 #include "lidar/Base.h"
00016 #include "lidar/Stream.h"
00017 #include <stdio.h>
00018 
00019 LT_BEGIN_LIDAR_NAMESPACE
00020 
00024 #define METADATA_KEY_FileSourceID               "FileSourceID"
00025 #define METADATA_KEY_ProjectID                  "ProjectID"
00026 #define METADATA_KEY_SystemID                   "SystemID"
00027 #define METADATA_KEY_GeneratingSoftware         "GeneratingSoftware"
00028 #define METADATA_KEY_FileCreationDate           "FileCreationDate"
00029 #define METADATA_KEY_PointRecordsByReturnCount  "PointRecordsByReturnCount"
00030 #define METADATA_KEY_PreCompressionPointCount   "PreCompressionPointCount"
00031 #define METADATA_KEY_LASBBox                    "LAS_BoundingBox"
00032 
00040 enum MetadataDataType
00041 {
00042    // don't change the values they are serialized
00043    // all values must be less then 1 << 16
00044 
00045    METADATA_DATATYPE_INVALID = 0,
00047    METADATA_DATATYPE_STRING = 1,
00049    METADATA_DATATYPE_BLOB = 2,
00051    METADATA_DATATYPE_REAL_ARRAY = 3
00052 };
00053 
00064 class Metadata
00065 {
00066    SIMPLE_OBJECT(Metadata);
00067 public:
00068    ~Metadata(void);
00069    Metadata(void);
00070 
00076    size_t getNumRecords(void) const;
00077 
00086    bool has(const char *key) const;
00087    
00101    void get(size_t idx, const char *&key, const char *&description,
00102             MetadataDataType &datatype,
00103             const void *&value, size_t &length) const;
00118    bool get(const char *key, const char *&description,
00119             MetadataDataType &datatype,
00120             const void *&value, size_t &length) const;
00121    
00129    size_t getKeyIndex(const char *key) const;
00130    
00137    const char *getKey(size_t idx) const;
00138    
00145    const char *getDescription(size_t idx) const;
00146    
00153    MetadataDataType getDataType(size_t idx) const;
00154    
00161    const void *getValue(size_t idx) const;
00162    
00170    size_t getValueLength(size_t idx) const;
00171 
00184    void add(const char *key, const char *description,
00185             MetadataDataType datatype,
00186             const void *value, size_t length);
00194    void add(const Metadata &meta);
00195 
00201    void remove(void);
00202 
00210    void remove(size_t idx);
00211    
00219    void remove(const char *key);
00220 
00226    void sort(void);
00227 
00233    void read(StreamReader &stream);
00234    
00240    void write(StreamWriter &stream) const;
00241 
00249    void dump(FILE *file) const;
00250 
00251 protected:
00252    struct Record;
00253    class RecordStore;
00254 
00255    RecordStore *m_records;
00256 };
00257 
00258 LT_END_LIDAR_NAMESPACE
00259 #endif // __LIDAR_METADATA_H__