Skip to content

Commit

Permalink
library.h
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Dec 10, 2024
1 parent 57c3088 commit 99026ca
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 129 deletions.
4 changes: 2 additions & 2 deletions src/solver/systemParser/encoders.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#pragma once

#include "antares/solver/modelParser/Library.h"
#include "antares/solver/systemParser/Library.h"

#include "yaml-cpp/yaml.h"

Expand All @@ -47,7 +47,7 @@ inline T as_fallback_default(const Node& n)
}

template<>
struct convert<Antares::Solver::ModelParser::Parameter>
struct convert<Antares::Solver::modelParser::Parameter>
{
static bool decode(const Node& node, Antares::Solver::ModelParser::Parameter& rhs)
{
Expand Down
116 changes: 0 additions & 116 deletions src/solver/systemParser/include/antares/solver/systemParser/Library.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2007-2024, RTE (https://www.rte-france.com)
* See AUTHORS.txt
* SPDX-License-Identifier: MPL-2.0
* This file is part of Antares-Simulator,
* Adequacy and Performance assessment for interconnected energy networks.
*
* Antares_Simulator is free software: you can redistribute it and/or modify
* it under the terms of the Mozilla Public Licence 2.0 as published by
* the Mozilla Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Antares_Simulator 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
* Mozilla Public Licence 2.0 for more details.
*
* You should have received a copy of the Mozilla Public Licence 2.0
* along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
*/

#pragma once

#include <string>
#include <vector>

namespace Antares::Solver::SystemParser
{

struct Parameter
{
std::string id;
std::string type;
std::string value;
};

struct Components
{
std::string id;
std::string model;
std::string scenarioGroup;
std::vector<Parameters> parameters;
};

struct System
{
std::string id;
std::vector<std::string> libraries;
std::vector<Components> components;

// will be implemented later
// std::vector<Connections> connections;
};

} // namespace Antares::Solver::SystemParser
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
*/

#pragma once
#include "antares/solver/modelParser/Library.h"
#include "antares/solver/systemParser/Library.h"

namespace Antares::Solver::ModelParser
namespace Antares::Solver::SystemParser
{
class Parser
{
public:
Parser() = default;
~Parser() = default;

Library parse(const std::string& content);
System parse(const std::string& content);
};
} // namespace Antares::Solver::ModelParser
} // namespace Antares::Solver::SystemParser
15 changes: 8 additions & 7 deletions src/solver/systemParser/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@
* along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
*/

#include "antares/solver/modelParser/parser.h"

#include "antares/solver/modelParser/Library.h"
#include "antares/solver/systemParser/parser.h"
#include "antares/solver/systemParser/Library.h"

#include "encoders.hxx"

namespace Antares::Solver::ModelParser
namespace Antares::Solver::SystemParser
{

Library Parser::parse(const std::string& content)
{
YAML::Node root = YAML::Load(content);

Library library = root["library"].as<Library>();
System system = root["system"].as<Library>();

return library;
return system;
}
} // namespace Antares::Solver::ModelParser

} // namespace Antares::Solver::SystemParser

0 comments on commit 99026ca

Please sign in to comment.