MrSID Decode SDK for LiDAR Reference Manual  1.1.4.4709
Metadata.h
Go to the documentation of this file.
1 /* //////////////////////////////////////////////////////////////////////////
2 // //
3 // This code is Copyright (c) 2008-2010 LizardTech, Inc, 1008 Western //
4 // Avenue, Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
5 // prohibited. Access to and use of this code is permitted only under //
6 // license from LizardTech, Inc. Portions of the code are protected by //
7 // US and foreign patents and other filings. All Rights Reserved. //
8 // //
10 /* PUBLIC */
11 
12 #ifndef __LIDAR_METADATA_H__
13 #define __LIDAR_METADATA_H__
14 
15 #include "lidar/Base.h"
16 #include "lidar/Stream.h"
17 #include <stdio.h>
18 
19 LT_BEGIN_LIDAR_NAMESPACE
20 
24 #define METADATA_KEY_FileSourceID "FileSourceID"
25 #define METADATA_KEY_ProjectID "ProjectID"
26 #define METADATA_KEY_SystemID "SystemID"
27 #define METADATA_KEY_GeneratingSoftware "GeneratingSoftware"
28 #define METADATA_KEY_FileCreationDate "FileCreationDate"
29 #define METADATA_KEY_PointRecordsByReturnCount "PointRecordsByReturnCount"
30 #define METADATA_KEY_PreCompressionPointCount "PreCompressionPointCount"
31 #define METADATA_KEY_LASBBox "LAS_BoundingBox"
32 
41 {
42  // don't change the values they are serialized
43  // all values must be less then 1 << 16
44 
52 };
53 
64 class Metadata
65 {
66  SIMPLE_OBJECT(Metadata);
67 public:
68  ~Metadata(void);
69  Metadata(void);
70 
76  size_t getNumRecords(void) const;
77 
86  bool has(const char *key) const;
87 
101  void get(size_t idx, const char *&key, const char *&description,
102  MetadataDataType &datatype,
103  const void *&value, size_t &length) const;
118  bool get(const char *key, const char *&description,
119  MetadataDataType &datatype,
120  const void *&value, size_t &length) const;
121 
129  size_t getKeyIndex(const char *key) const;
130 
137  const char *getKey(size_t idx) const;
138 
145  const char *getDescription(size_t idx) const;
146 
153  MetadataDataType getDataType(size_t idx) const;
154 
161  const void *getValue(size_t idx) const;
162 
170  size_t getValueLength(size_t idx) const;
171 
184  void add(const char *key, const char *description,
185  MetadataDataType datatype,
186  const void *value, size_t length);
194  void add(const Metadata &meta);
195 
201  void remove(void);
202 
210  void remove(size_t idx);
211 
219  void remove(const char *key);
220 
226  void sort(void);
227 
233  void read(StreamReader &stream);
234 
240  void write(StreamWriter &stream) const;
241 
249  void dump(FILE *file) const;
250 
251 protected:
252  struct Record;
253  class RecordStore;
254 
255  RecordStore *m_records;
256 };
257 
258 LT_END_LIDAR_NAMESPACE
259 #endif // __LIDAR_METADATA_H__
void read(StreamReader &stream)
Wirte metadata to a stream.
Metadata is a container for storing metadata about the point cloud.
Definition: Metadata.h:64
MetadataDataType getDataType(size_t idx) const
Get the datatype for the given index.
A string including the terminating null.
Definition: Metadata.h:47
void add(const char *key, const char *description, MetadataDataType datatype, const void *value, size_t length)
Add a key-value pair.
void dump(FILE *file) const
Write the metadata in a human readable format.
size_t getValueLength(size_t idx) const
Get the data buffer length for the given index.
An array of doubles.
Definition: Metadata.h:51
const char * getKey(size_t idx) const
Get the key name for the given index.
RecordStore * m_records
Definition: Metadata.h:253
size_t getKeyIndex(const char *key) const
Find the index of the key-value pair with the given key.
bool has(const char *key) const
Determine if there is a key-value pair with a given key.
StreamWriter implements buffered writes to IO objects.
Definition: Stream.h:204
void write(StreamWriter &stream) const
Read metadata from a stream.
const void * getValue(size_t idx) const
Get the data buffer for the given index.
Block of raw data.
Definition: Metadata.h:49
MetadataDataType
Metdata data types.
Definition: Metadata.h:40
const char * getDescription(size_t idx) const
Get the description for the given index.
size_t getNumRecords(void) const
Get the number of key-value pairs.
void sort(void)
Sort the pairs.
StreamReader implements buffered reads from IO objects.
Definition: Stream.h:75
~Metadata(void)
Metadata(void)

LizardTech