@@ -37,122 +37,122 @@ namespace capi
3737{
3838size_t PDALGetDimTypeListSize (PDALDimTypeListPtr types)
3939{
40- pdal::capi::DimTypeList *wrapper = reinterpret_cast <pdal::capi::DimTypeList *>(types);
40+ pdal::capi::DimTypeList *wrapper = reinterpret_cast <pdal::capi::DimTypeList *>(types);
4141
42- size_t size = 0 ;
42+ size_t size = 0 ;
4343
44- if (wrapper && wrapper->get ())
44+ if (wrapper && wrapper->get ())
45+ {
46+ try
4547 {
46- try
47- {
48- pdal::DimTypeList *list = wrapper->get ();
49- size = list->size ();
50- }
51- catch (const std::exception &e)
52- {
53- printf (" %s\n " , e.what ());
54- }
48+ pdal::DimTypeList *list = wrapper->get ();
49+ size = list->size ();
5550 }
51+ catch (const std::exception &e)
52+ {
53+ printf (" %s\n " , e.what ());
54+ }
55+ }
5656
57- return size;
57+ return size;
5858}
5959
6060uint64_t PDALGetDimTypeListByteCount (PDALDimTypeListPtr types)
6161{
62- uint64_t byteCount = 0 ;
63- size_t pointCount = PDALGetDimTypeListSize (types);
62+ uint64_t byteCount = 0 ;
63+ size_t pointCount = PDALGetDimTypeListSize (types);
6464
65- for (size_t i = 0 ; i < pointCount; ++i)
66- {
67- byteCount += PDALGetDimTypeInterpretationByteCount (PDALGetDimType (types, i));
68- }
65+ for (size_t i = 0 ; i < pointCount; ++i)
66+ {
67+ byteCount += PDALGetDimTypeInterpretationByteCount (PDALGetDimType (types, i));
68+ }
6969
70- return byteCount;
70+ return byteCount;
7171}
7272
7373PDALDimType PDALGetInvalidDimType ()
7474{
75- PDALDimType dim =
76- {
77- static_cast <uint32_t >(pdal::Dimension::id (" " )), static_cast <uint32_t >(pdal::Dimension::type (" " )),
78- 1.0 , 0.0
79- };
75+ PDALDimType dim =
76+ {
77+ static_cast <uint32_t >(pdal::Dimension::id (" " )), static_cast <uint32_t >(pdal::Dimension::type (" " )),
78+ 1.0 , 0.0
79+ };
8080
81- return dim;
81+ return dim;
8282}
8383
8484size_t PDALGetDimTypeIdName (PDALDimType dim, char *name, size_t size)
8585{
86- size_t result = 0 ;
86+ size_t result = 0 ;
8787
88- if (name && size > 0 )
89- {
90- std::string s = pdal::Dimension::name (
91- static_cast <pdal::Dimension::Id>(dim.id ));
92- std::strncpy (name, s.c_str (), size);
93- result = std::min (std::strlen (name), size);
94- }
88+ if (name && size > 0 )
89+ {
90+ std::string s = pdal::Dimension::name (
91+ static_cast <pdal::Dimension::Id>(dim.id ));
92+ std::strncpy (name, s.c_str (), size);
93+ result = std::min (std::strlen (name), size);
94+ }
9595
96- return result;
96+ return result;
9797}
9898
9999size_t PDALGetDimTypeInterpretationName (PDALDimType dim, char *name, size_t size)
100100{
101- size_t result = 0 ;
101+ size_t result = 0 ;
102102
103- if (name && size > 0 )
104- {
105- std::string s = pdal::Dimension::interpretationName (
106- static_cast <pdal::Dimension::Type>(dim.type ));
107- std::strncpy (name, s.c_str (), size);
108- result = std::min (std::strlen (name), size);
109- }
103+ if (name && size > 0 )
104+ {
105+ std::string s = pdal::Dimension::interpretationName (
106+ static_cast <pdal::Dimension::Type>(dim.type ));
107+ std::strncpy (name, s.c_str (), size);
108+ result = std::min (std::strlen (name), size);
109+ }
110110
111- return result;
111+ return result;
112112}
113113
114114size_t PDALGetDimTypeInterpretationByteCount (PDALDimType dim)
115115{
116- return pdal::Dimension::size (static_cast <pdal::Dimension::Type>(dim.type ));
116+ return pdal::Dimension::size (static_cast <pdal::Dimension::Type>(dim.type ));
117117}
118118
119119PDALDimType PDALGetDimType (PDALDimTypeListPtr types, size_t index)
120120{
121- pdal::capi::DimTypeList *wrapper = reinterpret_cast <pdal::capi::DimTypeList *>(types);
121+ pdal::capi::DimTypeList *wrapper = reinterpret_cast <pdal::capi::DimTypeList *>(types);
122122
123- PDALDimType dim = PDALGetInvalidDimType ();
123+ PDALDimType dim = PDALGetInvalidDimType ();
124124
125- if (wrapper && wrapper->get ())
125+ if (wrapper && wrapper->get ())
126+ {
127+ try
126128 {
127- try
128- {
129- pdal::DimTypeList *list = wrapper->get ();
130-
131- if (index < list->size ())
132- {
133- pdal::DimType nativeDim = list->at (index);
134- dim.id = static_cast <uint32_t >(nativeDim.m_id );
135- dim.type = static_cast <uint32_t >(nativeDim.m_type );
136- dim.scale = nativeDim.m_xform .m_scale .m_val ;
137- dim.offset = nativeDim.m_xform .m_offset .m_val ;
138- }
139- }
140- catch (const std::exception &e)
129+ pdal::DimTypeList *list = wrapper->get ();
130+
131+ if (index < list->size ())
141132 {
142- printf (" %s\n " , e.what ());
133+ pdal::DimType nativeDim = list->at (index);
134+ dim.id = static_cast <uint32_t >(nativeDim.m_id );
135+ dim.type = static_cast <uint32_t >(nativeDim.m_type );
136+ dim.scale = nativeDim.m_xform .m_scale .m_val ;
137+ dim.offset = nativeDim.m_xform .m_offset .m_val ;
143138 }
144139 }
140+ catch (const std::exception &e)
141+ {
142+ printf (" %s\n " , e.what ());
143+ }
144+ }
145145
146- return dim;
146+ return dim;
147147}
148148
149149void PDALDisposeDimTypeList (PDALDimTypeListPtr types)
150150{
151- if (types)
152- {
153- pdal::capi::DimTypeList *ptr = reinterpret_cast <pdal::capi::DimTypeList *>(types);
154- delete ptr;
155- }
151+ if (types)
152+ {
153+ pdal::capi::DimTypeList *ptr = reinterpret_cast <pdal::capi::DimTypeList *>(types);
154+ delete ptr;
155+ }
156156}
157157}
158158}
0 commit comments