コード例 #1
0
void Visitor<Reader<JSONObject>>::readFrom(const ScenarioModel& scenario)
{
    m_obj["PluginsMetadata"] = toJsonValue(*scenario.pluginModelList);

    m_obj["StartTimeNodeId"] = toJsonValue(scenario.m_startTimeNodeId);
    m_obj["EndTimeNodeId"] = toJsonValue(scenario.m_endTimeNodeId);
    m_obj["StartEventId"] = toJsonValue(scenario.m_startEventId);
    m_obj["EndEventId"] = toJsonValue(scenario.m_endEventId);

    m_obj["TimeNodes"] = toJsonArray(scenario.timeNodes());
    m_obj["Events"] = toJsonArray(scenario.events());
    m_obj["States"] = toJsonArray(scenario.states());
    m_obj["Constraints"] = toJsonArray(scenario.constraints());
}
コード例 #2
0
void Visitor<Reader<DataStream>>::readFrom(const ScenarioModel& scenario)
{
    readFrom(*scenario.pluginModelList);

    m_stream << scenario.m_startTimeNodeId
             << scenario.m_endTimeNodeId;
    m_stream << scenario.m_startEventId
             << scenario.m_endEventId;

    // Timenodes
    const auto& timenodes = scenario.timeNodes();
    m_stream << (int) timenodes.size();

    for(const auto& timenode : timenodes)
    {
        readFrom(*timenode);
    }

    // Events
    const auto& events = scenario.events();
    m_stream << (int) events.size();

    for(const auto& event : events)
    {
        readFrom(*event);
    }

    // States
    const auto& states = scenario.states();
    m_stream << (int) states.size();

    for(const auto& state : states)
    {
        readFrom(*state);
    }

    // Constraints
    const auto& constraints = scenario.constraints();
    m_stream << (int) constraints.size();

    for(const auto& constraint : constraints)
    {
        readFrom(*constraint);
    }



    insertDelimiter();
}