| 349 | } |
| 350 | |
| 351 | std::string ToString() const { |
| 352 | AIMRT_ASSERT(base_ptr_ && base_ptr_->ops, "Reference is null."); |
| 353 | |
| 354 | std::stringstream ss; |
| 355 | |
| 356 | auto type = base_ptr_->ops->get_type(base_ptr_->impl); |
| 357 | if (type == aimrt_rpc_context_type_t::AIMRT_RPC_CLIENT_CONTEXT) { |
| 358 | ss << "Client context, "; |
| 359 | } else if (type == aimrt_rpc_context_type_t::AIMRT_RPC_SERVER_CONTEXT) { |
| 360 | ss << "Server context, "; |
| 361 | } else { |
| 362 | ss << "Unknown context, "; |
| 363 | } |
| 364 | |
| 365 | auto timeout = base_ptr_->ops->get_timeout_ns(base_ptr_->impl); |
| 366 | ss << "timeout: " << timeout / 1000000 << "ms, meta: {"; |
| 367 | |
| 368 | auto [str_array, len] = base_ptr_->ops->get_meta_key_vals(base_ptr_->impl); |
| 369 | for (size_t ii = 0; ii < len; ii += 2) { |
| 370 | if (ii != 0) ss << ","; |
| 371 | |
| 372 | auto key = aimrt::util::ToStdStringView(str_array[ii]); |
| 373 | auto val = aimrt::util::ToStdStringView(str_array[ii + 1]); |
| 374 | |
| 375 | ss << "{\"" << key << "\":\"" << val << "\"}"; |
| 376 | } |
| 377 | |
| 378 | ss << "}"; |
| 379 | |
| 380 | return ss.str(); |
| 381 | } |
| 382 | |
| 383 | private: |
| 384 | const aimrt_rpc_context_base_t* base_ptr_; |
nothing calls this directly
no test coverage detected