Skip to content
Snippets Groups Projects
Commit b494ed91 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

WIP: Octave side of entity conversion.

parent 47ac5f05
No related branches found
No related tags found
1 merge request!2ENH: Retrieving single entities works on the mex side.
Pipeline #11776 passed with warnings
Pipeline: caosdb-octaveinttest

#11777

    ......@@ -79,7 +79,7 @@ classdef Caosdb < handle
    %
    % id: string
    % The ID of the entity to be retrieved.
    function collection = retrieve(obj, id)
    function entities = retrieve(obj, id)
    assert(ischar(id), ...
    "maox:InvalidArgument", ...
    "ID must be a string, was:\n%s", ...
    ......@@ -87,6 +87,8 @@ classdef Caosdb < handle
    disp(["ID (oct): >", id, "<"]);
    try
    collection = maox_retrieve(obj.connection, id);
    entities = maox_convert_collection(collection);
    disp(entities);
    % ent, transaction_result = maox_retrieve(obj.connection, id);
    % entity = info_result;
    catch
    ......
    % This file is a part of the CaosDB Project.
    %
    % Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
    % Copyright (C) 2021 Daniel Hornung <d.hornung@indiscale.com>
    %
    % This program is free software: you can redistribute it and/or modify
    % it under the terms of the GNU Affero General Public License as
    % published by the Free Software Foundation, either version 3 of the
    % License, or (at your option) any later version.
    %
    % This program is distributed in the hope that it will be useful,
    % but WITHOUT ANY WARRANTY; without even the implied warranty of
    % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    % GNU Affero General Public License for more details.
    %
    % You should have received a copy of the GNU Affero General Public License
    % along with this program. If not, see <https://www.gnu.org/licenses/>.
    %% Convert a struct array as received from maoxdb to a cell array of Entity objects.
    function entities = maox_convert_collection(collection)
    disp(size(collection));
    entities = collection;
    end
    ......@@ -90,15 +90,11 @@ void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, const mxArray *prhs[])
    TransactionStatus t_stat = transaction->WaitForIt();
    maoxdb::throwOctExceptionIfError(transaction.get());
    // Status must be OK now.
    std::cout << "Status code: " << t_stat.GetCode() << std::endl;
    const auto &results = transaction->GetResultSet();
    std::cout << "size: " << results.Size() << std::endl;
    // std::map<string, Entity> collection;
    // mxArray *collection;
    auto *mxResults = maoxdb::mxFromResultSet(results);
    std::cout << "mxResults" << std::endl;
    plhs[0] = mxDuplicateArray(mxResults);
    // plhs[1] = mxDuplicateArray (prhs[1]);
    // auto *info_struct = info(conn_name);
    ......
    ......@@ -35,5 +35,5 @@ function test_local()
    % Only get the local versions.
    version = caosdb_exec("--version");
    assertEqual(version, "v0.1 (libcaosdb v0.0.9)");
    assertEqual(version(1:21), "v0.1 (libcaosdb v0.0.");
    end
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment