LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
lqnx_io.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2026, QORE Lab, Imperial College London
3 * All rights reserved.
4 */
5#ifndef LINE_IO_LQNX_IO_H
6#define LINE_IO_LQNX_IO_H
7
8/**
9 * @file
10 * @ingroup line_io
11 * The `.lqnx` (LQNS XML) interchange as a symmetric MODEL-LEVEL pair in `io::`.
12 *
13 * The implementations live in `lang/lqn/`: `lqn::read_lqnx_model` returns the
14 * `LqnModel` a builder produces, `lqn::write_lqnx` takes one, and
15 * `lqn::read_lqnx` returns the FINALIZED `LqnStruct` SolverLN consumes. The
16 * struct reader is the odd one out of that trio: its output cannot be handed
17 * back to the writer. So the io pair is `read_lqnx_model` / `write_lqnx`,
18 * both on `LqnModel`, keeping the `lqn::` names verbatim so a caller moving
19 * between the namespaces meets no second spelling. MATLAB spells the same pair
20 * `LayeredNetwork.parseXML` / `writeXML`, which name methods of a class this
21 * port does not have.
22 */
23
24#include <string>
25
28
29namespace line {
30namespace io {
31
32/** Read a `.lqnx` file into the model-level `LqnModel`, which `write_lqnx` accepts back. */
33template <class T>
34lqn::LqnModel<T> read_lqnx_model(const std::string& path) {
35 return lqn::read_lqnx_model<T>(path);
36}
37
38/**
39 * Write an `LqnModel` as `.lqnx`; forwards to `lqn::write_lqnx`.
40 *
41 * @return what the schema could not carry (see `lqn::LqnWriteReport`)
42 */
43template <class T>
44lqn::LqnWriteReport write_lqnx(const lqn::LqnModel<T>& m, const std::string& path,
45 const std::string& model_name = std::string("LQN"),
46 bool use_abstract_names = false, std::string* out_text = NULL) {
47 return lqn::write_lqnx(m, path, model_name, use_abstract_names, out_text);
48}
49
50} // namespace io
51} // namespace line
52
53#endif // LINE_IO_LQNX_IO_H
.lqnx -> LqnStruct, a port of matlab/src/lang/layered/@LayeredNetwork/parseXML.m followed by ....
LqnModel -> .lqnx, a port of matlab/src/lang/layered/@LayeredNetwork/writeXML.m.
lqn::LqnModel< T > read_lqnx_model(const std::string &path)
Read a .lqnx file into the model-level LqnModel, which write_lqnx accepts back.
Definition lqnx_io.h:34
lqn::LqnWriteReport write_lqnx(const lqn::LqnModel< T > &m, const std::string &path, const std::string &model_name=std::string("LQN"), bool use_abstract_names=false, std::string *out_text=NULL)
Write an LqnModel as .lqnx; forwards to lqn::write_lqnx.
Definition lqnx_io.h:44
LqnModel< T > read_lqnx_model(const std::string &path)
LqnWriteReport write_lqnx(const LqnModel< T > &m, const std::string &path, const std::string &model_name=std::string("LQN"), bool use_abstract_names=false, std::string *out_text=NULL)
Write a layered model as a .lqnx document.
Definition lqn_writer.h:219
Conservation laws of a layered queueing network, enumerated from its structure.
Definition aoi_dist2ph.h:52
The intermediate model, and the second stage that flattens it.
Definition lqn_reader.h:409
What the schema could not carry, one human-readable line per loss.
Definition lqn_writer.h:66