![]() |
IRSOL
C++ code implementing socket server for interacting with Baumer camera.
|
Contains general utility functions used throughout the irsol library.
More...
Namespaces | |
| namespace | internal |
| Contains internal helper constants and functions. | |
Classes | |
| class | SafeQueue |
| A thread-safe, optionally bounded queue with blocking push and pop operations. More... | |
Functions | |
| int | toInt (const irsol::types::protocol_value_t &x) |
| Converts a protocol value to an integer. | |
| double | toDouble (const irsol::types::protocol_value_t &x) |
| Converts a protocol value to a double. | |
| std::string | toString (const irsol::types::protocol_value_t &x) |
| Converts a protocol value to a string. | |
| std::string | uuid () |
| Generates a new UUID string. | |
| std::vector< std::string > | split (const std::string &s, char delimiter) |
| Splits a string into tokens based on a delimiter. | |
| std::string | strip (const std::string &s, const std::string &delimiters=" \t\r\n") |
| Removes leading and trailing characters from a string. | |
| std::string | stripString (const std::string &s, const std::string &strippedString) |
| Removes all occurrences of a specific substring from the start and end of a string. | |
| std::string | timestampToString (irsol::types::timepoint_t tp) |
| Converts a steady_clock time point to a human-readable string. | |
| std::string | durationToString (irsol::types::duration_t dr) |
| Converts a duration to a human-readable string. | |
| std::vector< irsol::types::byte_t > | stringToBytes (const std::string &s) |
| Converts a std::string to a std::vector of irsol::types::byte_t. | |
| std::string | bytesToString (const std::vector< irsol::types::byte_t > &input) |
| Converts a std::vector of irsol::types::byte_t to a std::string. | |
| NeoAPI::Cam | loadDefaultCamera () |
| Loads the default camera device. | |
| NeoAPI::CamInfoList & | discoverCameras () |
| Discovers all cameras connected to the system. | |
Contains general utility functions used throughout the irsol library.
This namespace provides helper functions for type conversions, string manipulations, timestamp formatting, and camera device management.
| std::string irsol::utils::bytesToString | ( | const std::vector< irsol::types::byte_t > & | input | ) |
Converts a std::vector of irsol::types::byte_t to a std::string.
Each byte is reinterpreted as a character. This assumes that the bytes represent valid character data (e.g., UTF-8 or ASCII).
| input | The input irsol::types::byte_t vector to convert. |
Definition at line 189 of file utils.cpp.
| NeoAPI::CamInfoList & irsol::utils::discoverCameras | ( | ) |
Discovers all cameras connected to the system.
Uses NeoAPI to scan and retrieve information about all connected cameras. The returned reference remains valid until the next call to discoverCameras().
Definition at line 216 of file utils.cpp.
| std::string irsol::utils::durationToString | ( | irsol::types::duration_t | dr | ) |
Converts a duration to a human-readable string.
Converts a irsol::types::duration_t into a formatted string representing the duration.
| dr | The duration to convert. |
Definition at line 133 of file utils.cpp.
| NeoAPI::Cam irsol::utils::loadDefaultCamera | ( | ) |
Loads the default camera device.
Queries the NeoAPI for connected cameras and attempts to open the camera with the default serial number defined in irsol::utils::internal::defaultCameraSerialNumber().
| std::runtime_error | If no matching camera is found or initialization fails. |
Definition at line 196 of file utils.cpp.
| std::vector< std::string > irsol::utils::split | ( | const std::string & | s, |
| char | delimiter | ||
| ) |
Splits a string into tokens based on a delimiter.
Parses the input string s and splits it into substrings each time the character delimiter is encountered.
| s | The string to split. |
| delimiter | The character to use as the delimiter. |
Definition at line 50 of file utils.cpp.
| std::vector< irsol::types::byte_t > irsol::utils::stringToBytes | ( | const std::string & | s | ) |
Converts a std::string to a std::vector of irsol::types::byte_t.
Each character in the input string is reinterpreted as a irsol::types::byte_t.
| s | The input string to convert. |
Definition at line 182 of file utils.cpp.
| std::string irsol::utils::strip | ( | const std::string & | s, |
| const std::string & | delimiters = " \t\r\n" |
||
| ) |
Removes leading and trailing characters from a string.
Removes any characters contained in the delimiters string from both the start and the end of the input string s. Useful for trimming whitespace or custom characters.
| s | The input string to process. |
| delimiters | A string containing all characters to strip (default is whitespace characters). |
Definition at line 71 of file utils.cpp.
| std::string irsol::utils::stripString | ( | const std::string & | s, |
| const std::string & | strippedString | ||
| ) |
Removes all occurrences of a specific substring from the start and end of a string.
If the string s begins or ends with the substring strippedString, those occurrences are removed. This is repeated until s no longer starts or ends with that substring.
| s | The original string. |
| strippedString | The substring to remove from both ends. |
Definition at line 89 of file utils.cpp.
| std::string irsol::utils::timestampToString | ( | irsol::types::timepoint_t | tp | ) |
Converts a steady_clock time point to a human-readable string.
Converts a irsol::types::timepoint_t into a formatted string representation.
| tp | The time point to convert. |
Definition at line 111 of file utils.cpp.
|
inline |
Converts a protocol value to a double.
Extracts and returns the underlying double from the variant type irsol::types::protocol_value_t.
| x | The protocol value to convert. |
| std::bad_variant_access | if the variant does not hold a double. |
Definition at line 55 of file utils.hpp.
|
inline |
Converts a protocol value to an integer.
Extracts and returns the underlying int from the variant type irsol::types::protocol_value_t.
| x | The protocol value to convert. |
| std::bad_variant_access | if the variant does not hold an int. |
Definition at line 39 of file utils.hpp.
|
inline |
Converts a protocol value to a string.
Extracts and returns the underlying std::string from the variant type irsol::types::protocol_value_t.
| x | The protocol value to convert. |
| std::bad_variant_access | if the variant does not hold a string. |
Definition at line 71 of file utils.hpp.
| std::string irsol::utils::uuid | ( | ) |
Generates a new UUID string.
Generates a version 4 (random) UUID and returns it as a string.
Definition at line 16 of file utils.cpp.