GithubHelp home page GithubHelp logo

storage::read doesn't work about libgod HOT 4 CLOSED

krouk avatar krouk commented on July 19, 2024
storage::read doesn't work

from libgod.

Comments (4)

theirix avatar theirix commented on July 19, 2024

Добавлен конструктор Union, который инициализирует объект как bare (без инициализации).

from libgod.

krouk avatar krouk commented on July 19, 2024

ну судя по обновлению теста test_storage немного не то получилось. Ты все равно передаешь union параметры:

    libgod::Union nunion(dp,dc);
    storage.read(nunion);
    storage.dump(std::cout, nunion);

Тут больше интересует случай, когда мы делаем вот так:

    libgod::Union un;
    libgod::Storage st( argv[1] );
    st.read(un);
    //Print dump to stdout
    st.dump(std::cout, un);

Тут получается два интересных случай.

  1. Я создал юнион вот таким кодом:

    //input.union1: Union with 1 empty set
    libgod::Union un1(10,7);
    libgod::Set& s = un1.add();
    
    libgod::Storage st1("input.union1");
    st1.write(un1);
    // Print dump to cout
    st1.dump(std::cout, un1);
    

В ответ st1.dump(std::cout, un1) распечатало все правильно. Но если я использую код, который привел в самом начале, чтобы попытаться тоже вывести дамп, то получается вывод вот такой:

<God>
    <header>
        <version>1</version>
        <comment></comment>
    </header>
    <metric>
        <parameterDim>1</parameterDim>
        <criteriaDim>1</criteriaDim>
        <setsCount>1</setsCount>
    </metric>
    <union>
        <Set>
            <pointCount>0</pointCount>
            <points>
            </points>
        </Set>
    </union>
</God>

То есть лучше, чем раньше было (появилась информация о сете), но параметры все равно неправильные.

  1. Если я создал юнион с непустым сетом, например, так:

    const size_t dp = 2, dc = 3; 
    libgod::Union un3(dp,dc);
    
    for (int i=0; i<10; i++) {
        libgod::Set& s = un3.add();
        for (int j=0; j<(i+1); j++)
            s.add(randPoint(dp,dc));
    }
    
    libgod::Storage st3("input.union3");
    st3.write(un3);
    st3.dump(std::cout, un3);
    

То при попытке использовать код для распечатки (из начала) получаю ошибку:

Print error: boost::too_few_args: format-string referred to more arguments than were passed

from libgod.

theirix avatar theirix commented on July 19, 2024

boost::too_few_args пофиксил в 90f311b

from libgod.

krouk avatar krouk commented on July 19, 2024

хм... после твоего фикса
Print error: parameter index 1 is out of range 1

from libgod.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.