MrSID Decode SDK for LiDAR Reference Manual  1.1.5.5244
Metadata.h
Go to the documentation of this file.
1 //
2 // This code is property of Celartem, Inc dba Extensis.
3 // Copyright (c) 1995-2023. All rights reserved.
4 // Use permitted only under license from Extensis.
5 //
6 /* PUBLIC */
7 
8 #ifndef __LIDAR_METADATA_H__
9 #define __LIDAR_METADATA_H__
10 
11 #include "lidar/Base.h"
12 #include "lidar/Stream.h"
13 #include <stdio.h>
14 
15 LT_BEGIN_LIDAR_NAMESPACE
16 
20 #define METADATA_KEY_FileSourceID "FileSourceID"
21 #define METADATA_KEY_ProjectID "ProjectID"
22 #define METADATA_KEY_SystemID "SystemID"
23 #define METADATA_KEY_GeneratingSoftware "GeneratingSoftware"
24 #define METADATA_KEY_FileCreationDate "FileCreationDate"
25 #define METADATA_KEY_PointRecordsByReturnCount "PointRecordsByReturnCount"
26 #define METADATA_KEY_PreCompressionPointCount "PreCompressionPointCount"
27 #define METADATA_KEY_LASBBox "LAS_BoundingBox"
28 
37 {
38  // don't change the values they are serialized
39  // all values must be less then 1 << 16
40 
48 };
49 
60 class Metadata
61 {
62  SIMPLE_OBJECT(Metadata);
63 public:
64  ~Metadata(void);
65  Metadata(void);
66 
72  size_t getNumRecords(void) const;
73 
82  bool has(const char *key) const;
83 
97  void get(size_t idx, const char *&key, const char *&description,
98  MetadataDataType &datatype,
99  const void *&value, size_t &length) const;
114  bool get(const char *key, const char *&description,
115  MetadataDataType &datatype,
116  const void *&value, size_t &length) const;
117 
125  size_t getKeyIndex(const char *key) const;
126 
133  const char *getKey(size_t idx) const;
134 
141  const char *getDescription(size_t idx) const;
142 
149  MetadataDataType getDataType(size_t idx) const;
150 
157  const void *getValue(size_t idx) const;
158 
166  size_t getValueLength(size_t idx) const;
167 
180  void add(const char *key, const char *description,
181  MetadataDataType datatype,
182  const void *value, size_t length);
190  void add(const Metadata &meta);
191 
197  void remove(void);
198 
206  void remove(size_t idx);
207 
215  void remove(const char *key);
216 
222  void sort(void);
223 
229  void read(StreamReader &stream);
230 
236  void write(StreamWriter &stream) const;
237 
245  void dump(FILE *file) const;
246 
247 protected:
248  struct Record;
249  class RecordStore;
250 
251  RecordStore *m_records;
252 };
253 
254 LT_END_LIDAR_NAMESPACE
255 #endif // __LIDAR_METADATA_H__
MetadataDataType
Metdata data types.
Definition: Metadata.h:37
@ METADATA_DATATYPE_INVALID
Definition: Metadata.h:41
@ METADATA_DATATYPE_REAL_ARRAY
An array of doubles.
Definition: Metadata.h:47
@ METADATA_DATATYPE_STRING
A string including the terminating null.
Definition: Metadata.h:43
@ METADATA_DATATYPE_BLOB
Block of raw data.
Definition: Metadata.h:45
Metadata is a container for storing metadata about the point cloud.
Definition: Metadata.h:61
Metadata(void)
size_t getKeyIndex(const char *key) const
Find the index of the key-value pair with the given key.
bool get(const char *key, const char *&description, MetadataDataType &datatype, const void *&value, size_t &length) const
Get the key-value pair with a given key.
~Metadata(void)
void dump(FILE *file) const
Write the metadata in a human readable format.
void get(size_t idx, const char *&key, const char *&description, MetadataDataType &datatype, const void *&value, size_t &length) const
Get the key-value pair at a given index.
void sort(void)
Sort the pairs.
const char * getKey(size_t idx) const
Get the key name for the given index.
void add(const Metadata &meta)
Add all the key-value pairs from the given Metadata object.
MetadataDataType getDataType(size_t idx) const
Get the datatype for the given index.
void remove(const char *key)
Remove the first key-value pair with key.
void write(StreamWriter &stream) const
Read metadata from a stream.
size_t getNumRecords(void) const
Get the number of key-value pairs.
const void * getValue(size_t idx) const
Get the data buffer for the given index.
size_t getValueLength(size_t idx) const
Get the data buffer length for the given index.
RecordStore * m_records
Definition: Metadata.h:249
bool has(const char *key) const
Determine if there is a key-value pair with a given key.
void read(StreamReader &stream)
Wirte metadata to a stream.
void add(const char *key, const char *description, MetadataDataType datatype, const void *value, size_t length)
Add a key-value pair.
const char * getDescription(size_t idx) const
Get the description for the given index.
void remove(void)
Remove all key-value pairs.
void remove(size_t idx)
Remove the key-value pair at a given index.
StreamReader implements buffered reads from IO objects.
Definition: Stream.h:72
StreamWriter implements buffered writes to IO objects.
Definition: Stream.h:201

Extensis