LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
linemodel.h File Reference

Port of linemodel_load.m / linemodel_save.m: ONE entry point for the LINE model.json interchange, whatever model kind the document carries. More...

#include <fstream>
#include <string>
#include <utility>
#include <variant>
#include "json.hpp"
#include "line/io/environment_reader.h"
#include "line/io/linemodel_writer.h"
#include "line/io/lqn_json_reader.h"
#include "line/io/network_reader.h"
#include "line/io/network_writer.h"
#include "line/io/workflow_reader.h"
#include "line/lang/lqn/lqn_reader.h"
#include "line/lang/qn/environment.h"
#include "line/lang/qn/network_builder.h"
#include "line/lang/workflow/workflow.h"
#include "line/util/error.h"
Include dependency graph for linemodel.h:

Go to the source code of this file.

Namespaces

namespace  line
 Conservation laws of a layered queueing network, enumerated from its structure.
namespace  line::io

Typedefs

template<class T>
using line::io::LineModel
 What linemodel_load returns: MATLAB's Network, LayeredNetwork, Workflow or Environment.

Functions

std::string line::io::linemodel_type (const nlohmann::json &root)
 The envelope's model.type of a parsed document; empty when it declares none.
template<class T>
LineModel< T > line::io::linemodel_from_json (const nlohmann::json &root)
 Port of linemodel_load(filename) on an already parsed document.
template<class T>
LineModel< T > line::io::linemodel_load (const std::string &path)
 Port of linemodel_load(filename).
template<class T>
void line::io::linemodel_save (const qn::NetworkStruct< T > &sn, const std::string &path)
 Port of linemodel_save(model, filename) for a refreshed Network struct.
template<class T>
void line::io::linemodel_save (qn::Network< T > &model, const std::string &path)
 Port of linemodel_save(model, filename) for a Network; refreshes it first.
template<class T>
void line::io::linemodel_save (const lqn::LqnModel< T > &model, const std::string &path)
 Port of linemodel_save(model, filename) for a LayeredNetwork (layered2json).
template<class T>
void line::io::linemodel_save (const workflow::Workflow< T > &model, const std::string &path)
 Port of linemodel_save(model, filename) for a Workflow (workflow2json).
template<class T>
void line::io::linemodel_save (const env::Environment< T > &model, const std::string &path)
 Port of linemodel_save(model, filename) for an Environment (environment2json).
template<class T>
void line::io::linemodel_save (LineModel< T > &model, const std::string &path)
 linemodel_save on whatever linemodel_load returned, dispatched on the alternative held.

Detailed Description

Port of linemodel_load.m / linemodel_save.m: ONE entry point for the LINE model.json interchange, whatever model kind the document carries.

The readers stay split by kind (network_reader.h, lqn_json_reader.h, workflow_reader.h, environment_reader.h); linemodel_load parses the file once and hands the tree to the builder the envelope's model.type names, as the reference's switch mtype does. The result is a std::variant over the four MODEL-LEVEL kinds. A LayeredNetwork comes back as the lqn::LqnModel rather than the finalized LqnStruct, because the model is what the reference returns and what write_lqnx accepts; lqn::lqn_finalize turns it into the struct SolverLN solves.

SAVING covers the same four kinds: a Network through network_writer.h, the other three through linemodel_writer.h, whose header says which optional spellings it takes and which undeclarable LqnModel fields it refuses.

Definition in file linemodel.h.