OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk::DeviceMetadata

What the user has written down about one camera.

This is the user's data, not the device's: free-form entries the SDK stores, hands back, and otherwise leaves alone. It is keyed by serial on disk and survives a restart and a re-plug.

Entries are an open key/value map rather than a fixed set of fields, so a location, an asset tag or a line number can be added without changing this header, the C ABI or the bindings. The one key the SDK itself knows about is kDeviceNameKey.

Empty is the default. A camera nobody has named has no entries at all, and Name() returns an empty string.

Text is UTF-8, in both directions and at every layer -- the C++ API, the C ABI and .NET. A camera may be called "熔炉入口" or "Ofeneinlauf" as readily as "oven inlet"; keys and values are checked for well-formed UTF-8 and for control characters, and for nothing else about the character set. What is stored is byte-for- byte what was supplied.

The SDK does not normalise: two names that look identical but differ in Unicode normal form (NFC against NFD) are two different values here, and Get() will not find one when given the other. Silently rewriting a user's text is the worse failure -- it would hand back something other than what was typed -- so a caller that needs names compared across normal forms should normalise them on the way in.

Public attributes

entries

std::map< std::string, std::string > entries

The entries, in key order. Keys are compared byte for byte and are case sensitive.

Public functions

Name

OTC_SDK_API auto Name() const -> std::string

The user's name for this camera, or an empty string if it has none. Shorthand for Get(kDeviceNameKey).

SetName

OTC_SDK_API void SetName(const std::string &name)

Set the user's name for this camera. An empty name removes the entry rather than storing a blank one.

Exceptions

Name Description
SdkException if the name is longer than kMaxDeviceMetadataValueLength bytes.

Get

OTC_SDK_API auto Get(const std::string &key) const -> std::string

The value stored under key, or an empty string if there is none. An absent key and an empty value are indistinguishable here; use Has() when the difference matters.

Has

OTC_SDK_API auto Has(const std::string &key) const -> bool

Whether key has an entry.

Set

OTC_SDK_API void Set(const std::string &key, const std::string &value)

Store value under key, replacing any previous value. An empty value removes the entry.

Exceptions

Name Description
SdkException if the key is empty, longer than kMaxDeviceMetadataKeyLength bytes, or contains a control character; or if the value is longer than kMaxDeviceMetadataValueLength bytes.

Erase

OTC_SDK_API void Erase(const std::string &key)

Remove key. Removing a key that is not there is not an error.

Empty

auto Empty() const -> bool

Whether nothing at all has been recorded for this camera.

Keys

OTC_SDK_API auto Keys() const -> std::vector< std::string >

The keys present, in order.