@@ -85,6 +85,7 @@ class OwningCodesHandle : public CodesHandle {
8585 void forceSet (const std::string& key, Span<const double > value) override ;
8686 void forceSet (const std::string& key, Span<const float > value) override ;
8787 size_t size (const std::string& key) const override ;
88+ size_t length (const std::string& key) const override ;
8889 CodesValue get (const std::string& key) const override ;
8990 NativeType type (const std::string& key) const override ;
9091 long getLong (const std::string& key) const override ;
@@ -214,6 +215,12 @@ size_t OwningCodesHandle::size(const std::string& key) const {
214215 return size;
215216}
216217
218+ size_t OwningCodesHandle::length (const std::string& key) const {
219+ size_t length;
220+ throwOnError (codes_get_length (raw (), key.c_str (), &length), Here (), " CodesHandle::length(string)" , key);
221+ return length;
222+ }
223+
217224// / Get the value of the key
218225CodesValue OwningCodesHandle::get (const std::string& key) const {
219226 NativeType ktype = type (key);
@@ -345,7 +352,7 @@ std::vector<std::string> OwningCodesHandle::getStringArray(const std::string& ke
345352
346353std::vector<uint8_t > OwningCodesHandle::getBytes (const std::string& key) const {
347354 std::vector<uint8_t > ret;
348- std::size_t ksize = size (key);
355+ std::size_t ksize = length (key);
349356 ret.resize (ksize);
350357 throwOnError (codes_get_bytes (raw (), key.c_str (), ret.data (), &ksize), Here (), " CodesHandle::getBytes(string)" , key);
351358 ret.resize (ksize);
0 commit comments