uatools 1.0.0
 
Loading...
Searching...
No Matches
eso::uatools::protocol::base Namespace Reference

Classes

struct  BrowseRequest
 
struct  BrowseResult
 
struct  CallArgument
 
struct  CallArgumentResult
 
struct  CallError
 
struct  CallRequest
 
struct  CallResult
 
class  CancellationSource
 
class  CancellationToken
 
struct  Capabilities
 
struct  ClientConfig
 
class  CommFactory
 
class  CommMaker
 Helper template to simplify the process of generating Comm-maker. More...
 
struct  ConnectError
 
struct  ConnectionInfo
 
struct  ConnectionOptions
 
struct  ConnectionStateChange
 
struct  ConnectionStatus
 
struct  DataValue
 
struct  DiscoveredEndpoint
 
struct  DiscoverRequest
 
struct  DiscoverResult
 
class  Dispatcher
 
class  IComm
 
class  ICommAdapter
 
class  ICommMaker
 
class  Logger
 Abstract logger; downstream supplies an implementation. More...
 
struct  NodeDescriptor
 
struct  Notification
 
class  PropertyMap
 
struct  ProtocolError
 
struct  ReadError
 
struct  ReadItem
 
struct  ReadItemResult
 
struct  ReadRequest
 
struct  ReadResult
 
class  RegistrationToken
 
struct  RequestOptions
 
struct  Result
 
struct  StatusCode
 
struct  SubscribeItemResult
 
struct  SubscribeOpts
 
struct  SubscribeResult
 
struct  SubscriptionError
 
class  SubscriptionHandle
 
struct  SubscriptionOpts
 
struct  TypeConversionError
 
struct  UnsubscribeItemResult
 
struct  UnsubscribeResult
 
class  VariantStr
 
class  VariantValue
 
struct  WriteError
 
struct  WriteItem
 
struct  WriteItemResult
 
struct  WriteRequest
 
struct  WriteResult
 

Typedefs

using Address = std::string
 
using RequestId = std::string
 
using Value
 
using ConnectionStateHandler = std::function<void(const ConnectionStateChange&)>
 
using SubscriptionHandler = std::function<void(const Notification&)>
 
using Variant
 
using DataCallback
 
using PairVariant = std::pair<std::string, Variant>
 
using ListVariant = std::list<PairVariant>
 
using VectorVariant = std::vector<PairVariant>
 

Enumerations

enum class  Status {
  Ok , Timeout , NotConnected , AlreadyConnected ,
  InvalidState , BadRequest , NotFound , AccessDenied ,
  TypeMismatch , Unsupported , Cancelled , RemoteError ,
  TransportError , InternalError
}
 
enum class  ConnectionState {
  Disconnected , Connecting , Connected , Disconnecting ,
  Faulted
}
 
enum class  LogLevel : int {
  TRACE = 0 , DEBUG = 10 , INFO = 20 , WARNING = 30 ,
  ERROR = 40 , OFF = 100
}
 Log severity, lowest to highest. More...
 

Functions

bool FileExists (const std::string &path)
 Wrapper around std::filesystem::exists().
 
std::string FindFile (const std::string &filename)
 Search the CFGPATH environment variable for the given file.
 
std::string Trim (const std::string &s, const std::string &chars=" \t")
 Strip leading and trailing occurrences of any character in chars from s.
 
std::string ThreadName ()
 Return the current thread name (pthread_getname_np), or "" if unavailable. Bounded at 16 chars by the Linux pthread API.
 
std::string IsoTimeNow (int frac_digits=6)
 Return the current UTC time as an ISO 8601 string with frac_digits fractional second digits (default 6: microseconds). Matches ifw::fnd::IsoTimeNow() semantics closely enough for log formatting purposes.
 
void InstallLogger (std::unique_ptr< Logger > logger) noexcept
 Install the process-wide logger.
 
LoggerLog ()
 Access the installed logger.
 
bool HasLogger () noexcept
 true iff a logger has been installed.
 
std::unique_ptr< LoggerMakeStdoutLogger ()
 Factory: a logger that prints to stdout.
 
std::unique_ptr< LoggerMakeNullLogger ()
 Factory: a logger that discards everything.
 
std::string_view LogLevelName (LogLevel level) noexcept
 Render a LogLevel as a short uppercase string.
 
std::string TraceExtra ()
 Helper used by UATTRACE.
 
template<typename... Args>
std::string TraceExtra (fmt::string_view fmt_str, Args &&... args)
 

Variables

constexpr std::uint32_t kContractVersion = 2
 

Typedef Documentation

◆ Address

◆ ConnectionStateHandler

◆ DataCallback

Initial value:
std::function<void(const std::string& node,
const DataValue& value)>
Definition icomm_adapter_generic_v2.hpp:247

◆ ListVariant

◆ PairVariant

using eso::uatools::protocol::base::PairVariant = std::pair<std::string, Variant>

◆ RequestId

◆ SubscriptionHandler

◆ Value

Initial value:
std::variant<
std::monostate,
bool,
std::int32_t,
std::uint32_t,
std::int64_t,
std::uint64_t,
float,
double,
std::string,
std::vector<std::uint8_t>,
std::vector<bool>,
std::vector<std::int32_t>,
std::vector<std::uint32_t>,
std::vector<std::int64_t>,
std::vector<std::uint64_t>,
std::vector<float>,
std::vector<double>,
std::vector<std::string>,
Definition icomm_adapter_generic_v1.hpp:58

◆ Variant

Initial value:
std::variant<
bool,
std::int8_t, std::uint8_t,
short, unsigned short,
int, unsigned int,
float, double,
std::string,
std::vector<bool>,
std::vector<short>,
std::vector<int>,
std::vector<unsigned int>,
std::vector<float>,
std::vector<double>,
std::vector<std::string>
>

◆ VectorVariant

Enumeration Type Documentation

◆ ConnectionState

Enumerator
Disconnected 
Connecting 
Connected 
Disconnecting 
Faulted 

◆ LogLevel

enum class eso::uatools::protocol::base::LogLevel : int
strong

Log severity, lowest to highest.

Numeric values are chosen to make (level >= threshold) the natural filter test. The OFF sentinel sits above ERROR so that setting the threshold to OFF disables all output.

Enumerator
TRACE 
DEBUG 
INFO 
WARNING 
ERROR 
OFF 

◆ Status

Enumerator
Ok 
Timeout 
NotConnected 
AlreadyConnected 
InvalidState 
BadRequest 
NotFound 
AccessDenied 
TypeMismatch 
Unsupported 
Cancelled 
RemoteError 
TransportError 
InternalError 

Function Documentation

◆ FileExists()

bool eso::uatools::protocol::base::FileExists ( const std::string & path)

Wrapper around std::filesystem::exists().

◆ FindFile()

std::string eso::uatools::protocol::base::FindFile ( const std::string & filename)

Search the CFGPATH environment variable for the given file.

Parameters
filenameRelative or absolute path of the file to locate.
Returns
Absolute path to the resolved file, or "" if not found.

Resolution order:

  • If filename is absolute and exists, returns it as-is.
  • Otherwise, splits the CFGPATH env var on ':' and tries each prefix joined with filename. Returns the first existing match.
  • Returns "" if no match is found or CFGPATH is unset.

◆ HasLogger()

bool eso::uatools::protocol::base::HasLogger ( )
noexcept

true iff a logger has been installed.

Provided so that low-level code (signal handlers, destructors running during shutdown) can avoid raising on a missing logger.

◆ InstallLogger()

void eso::uatools::protocol::base::InstallLogger ( std::unique_ptr< Logger > logger)
noexcept

Install the process-wide logger.

Must be called once, early in main(), before any uatools API call that may log. Ownership is transferred to uatools. Calling twice replaces the previous logger and destroys it.

◆ IsoTimeNow()

std::string eso::uatools::protocol::base::IsoTimeNow ( int frac_digits = 6)
inline

Return the current UTC time as an ISO 8601 string with frac_digits fractional second digits (default 6: microseconds). Matches ifw::fnd::IsoTimeNow() semantics closely enough for log formatting purposes.

◆ Log()

Logger & eso::uatools::protocol::base::Log ( )

Access the installed logger.

Exceptions
std::runtime_errorif no logger has been installed.

◆ LogLevelName()

std::string_view eso::uatools::protocol::base::LogLevelName ( LogLevel level)
noexcept

Render a LogLevel as a short uppercase string.

Returns "TRACE" / "DEBUG" / "INFO" / "WARNING" / "ERROR" / "OFF". Used by MakeStdoutLogger() and available for downstream implementations.

◆ MakeNullLogger()

std::unique_ptr< Logger > eso::uatools::protocol::base::MakeNullLogger ( )

Factory: a logger that discards everything.

Useful for unit tests that want uatools to be silent without having to redirect stdout.

◆ MakeStdoutLogger()

std::unique_ptr< Logger > eso::uatools::protocol::base::MakeStdoutLogger ( )

Factory: a logger that prints to stdout.

Format: "<level> <message>\n". Intended for standalone tools and unit tests, not for production deployments.

◆ ThreadName()

std::string eso::uatools::protocol::base::ThreadName ( )
inline

Return the current thread name (pthread_getname_np), or "" if unavailable. Bounded at 16 chars by the Linux pthread API.

◆ TraceExtra() [1/2]

std::string eso::uatools::protocol::base::TraceExtra ( )
inline

Helper used by UATTRACE.

UATTRACE() with no extra args returns "". With a format string (and optional args) returns the formatted result. Variadic templates handle the "first arg is format string" split that the C++ preprocessor can't do cleanly.

◆ TraceExtra() [2/2]

template<typename... Args>
std::string eso::uatools::protocol::base::TraceExtra ( fmt::string_view fmt_str,
Args &&... args )
inline

◆ Trim()

std::string eso::uatools::protocol::base::Trim ( const std::string & s,
const std::string & chars = " \t" )

Strip leading and trailing occurrences of any character in chars from s.

Defaults to ASCII whitespace (space + tab) to match the previous ifw::core::utils::string::Trim(s, " \t") behaviour.

Variable Documentation

◆ kContractVersion

std::uint32_t eso::uatools::protocol::base::kContractVersion = 2
inlineconstexpr