* @brief Resolves a (table, register) pair to a reusable handle for the marshalled fast path. */
| 732 | * @brief Resolves a (table, register) pair to a reusable handle for the marshalled fast path. |
| 733 | */ |
| 734 | API::CommandResponse API::Handlers::DataTablesHandler::valueHandle(const QString& id, |
| 735 | const QJsonObject& params) |
| 736 | { |
| 737 | QString table; |
| 738 | QString name; |
| 739 | if (!requireString(params, QStringLiteral("table"), table)) |
| 740 | return CommandResponse::makeError( |
| 741 | id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: table")); |
| 742 | |
| 743 | if (!requireString(params, QStringLiteral("name"), name)) |
| 744 | return CommandResponse::makeError( |
| 745 | id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: name")); |
| 746 | |
| 747 | const auto& store = DataModel::FrameBuilder::instance().tableStore(); |
| 748 | if (!store.isInitialized()) |
| 749 | return CommandResponse::makeError( |
| 750 | id, ErrorCode::InvalidParam, QStringLiteral("Data-table store not initialized (no project)")); |
| 751 | |
| 752 | const qint64 handle = store.handleOf(table, name); |
| 753 | |
| 754 | QJsonObject result; |
| 755 | result[QStringLiteral("table")] = table; |
| 756 | result[QStringLiteral("name")] = name; |
| 757 | result[QStringLiteral("handle")] = static_cast<double>(handle); |
| 758 | return CommandResponse::makeSuccess(id, result); |
| 759 | } |
| 760 | |
| 761 | /** |
| 762 | * @brief Returns a register's live value by handle; found=false for a stale or invalid handle. |
nothing calls this directly
no test coverage detected