LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::io::code_gen_detail Namespace Reference

Classes

struct  ProcSpec
 One (station, class) process, reduced to what QN2MATLAB / QN2JAVA decide on. More...
struct  Route
 The (k, c, i, m, p) of every positive sn.rtnodes entry, in QN2MATLAB's loop order, 0-based. More...

Functions

std::string mfmt (const char *spec, double x)
 f, e or g as MATLAB's fprintf prints it: C's text, with Inf / NaN spelt MATLAB's way.
std::string fmt_f (double x)
std::string fmt_g (double x)
std::string fmt_d (double x)
 MATLAB d of a double: the integer when it is one, else MATLAB's e override.
std::string fmt_d (std::size_t x)
std::string fmt_d (int x)
std::string sched_property (lang::SchedStrategy s)
 SchedStrategy.toProperty(SchedStrategy.toText(s)): the enum constant name.
std::string sched_feature (lang::SchedStrategy s)
 strrep(SchedStrategy.toFeature(s),'_','.
template<class T>
ProcSpec proc_spec (const qn::NetworkStruct< T > &sn, std::size_t i, std::size_t k)
 The branch of QN2MATLAB's process block for station i, class k (0-based).
template<class T>
std::size_t fork_of (const qn::NetworkStruct< T > &sn, std::size_t j)
 find(sn.fj(:,j)): the 1-based Fork node the 1-based Join node j closes.
template<class T>
std::size_t empty_class_ref (const qn::NetworkStruct< T > &sn, std::size_t k)
 zeroPopRefNode(sn, k) of QN2MATLAB / QN2JAVA: the NODE index (1-based) of the reference station of zero-population closed class k (0-based).
template<class T>
void check_node_types (const qn::NetworkStruct< T > &sn, const char *who)
 Refuses a node type neither MATLAB generator has a statement for.
template<class T>
std::vector< Route > routes (const qn::NetworkStruct< T > &sn)
std::ofstream open_out (const std::string &path)
 Opens path for writing or throws, naming it.
std::string j_num (double v)
 jnum: a Java double literal at the shortest spelling that reads back as v.
template<class T>
std::string j_num_t (const T &v)
template<class T>
std::string j_arr (const std::vector< T > &v)
 jarr: a new double[]{...} literal.
template<class T>
std::string j_mat_row (const std::vector< T > &v)
 jmat of a row vector: new Matrix(new double[][]{{a, b}}).
template<class T>
std::string j_mat (const Matrix< T > &m)
 jmat of a matrix, row by row.
std::string j_round (double v)
template<class T>
std::string java_dist (const lang::Distrib< T > &d)
 javaDist: the Java constructor call rebuilding d with the same parameters.
template<class T>
std::vector< std::vector< bool > > reply_graph (const lqn::LqnModel< T > &m, const lqn::LqnStruct< T > &sn)
 sn.replygraph: (nacts+1) x (nentries+1), 1-based, true where the activity replies to the entry.
template<class T>
std::size_t and_join_quorum (const lqn::LqnModel< T > &m, std::size_t tslot, const std::string &post_name)
 The quorum of the AND-join into post_name on task slot tslot, 0 when it declares none.
std::string upper_nospace (const std::string &s)
std::string m_scalar (double v)
 scalar2code: a double at the shortest of 15..17 significant digits that reads back as itself.
template<class T>
std::string m_scalar_t (const T &v)
template<class T>
std::string m_row (const std::vector< T > &v)
 num2code of a row vector: [a, b], a scalar when it has one element, [] when empty.
template<class T>
std::string m_matrix (const Matrix< T > &M)
 num2code of a matrix: [a, b; c, d].
std::string m_quote (const std::string &s)
 q(str): a MATLAB single-quoted literal.
std::string m_cellstr (const std::vector< std::string > &c)
 cellstr2code: {'a', 'b'}.
std::string m_repl (lang::ReplacementStrategy r)
template<class T>
std::string m_dist (const lang::Distrib< T > &d)
 dist2code: the constructor call that rebuilds d from its parameters, which this port keeps in MATLAB getParam order.
template<class T>
bool m_default_time (const lang::Distrib< T > &d)
 True for a think / setup / delay-off time left at its constructor default.
template<class T>
std::string m_prec (const lqn::detail::RawPrecedence< T > &ap)
 The ActivityPrecedence expression of one declared precedence (precCode).
template<class T>
void m_server_extras (std::ostream &os, const std::string &v, const std::string &owner, const Matrix< T > *A, const std::vector< T > *b, const std::vector< lqn::detail::RawLinConRow< T > > *rows, const std::vector< T > *lld, bool has_cd, bool has_jd, const std::vector< lqn::detail::RawServerPool< T > > *pools)
 emitServerExtras: admission constraints, load dependence and server pools of a host or task.
std::string json_model_name (const std::string &path, const std::string &fallback)
 The name of the model in a model.json envelope, fallback when it has none.

Function Documentation

◆ and_join_quorum()

template<class T>
std::size_t line::io::code_gen_detail::and_join_quorum ( const lqn::LqnModel< T > & m,
std::size_t tslot,
const std::string & post_name )

The quorum of the AND-join into post_name on task slot tslot, 0 when it declares none.

Definition at line 713 of file code_gen.h.

References and_join_quorum(), line::lang::PRE_AND, and line::lqn::LqnModel< T >::tasks.

Referenced by and_join_quorum().

◆ check_node_types()

template<class T>
void line::io::code_gen_detail::check_node_types ( const qn::NetworkStruct< T > & sn,
const char * who )

◆ empty_class_ref()

template<class T>
std::size_t line::io::code_gen_detail::empty_class_ref ( const qn::NetworkStruct< T > & sn,
std::size_t k )

zeroPopRefNode(sn, k) of QN2MATLAB / QN2JAVA: the NODE index (1-based) of the reference station of zero-population closed class k (0-based).

It is the refstat of the first populated closed class of k's chain (k's own refstat if there is none), else the first station whose sn.proc{i}{k}{1} has a nonzero entry, NaN counting as nonzero under nnz, so a disabled pair qualifies.

Definition at line 183 of file code_gen.h.

References line::mam::Map< T >::D0, line::lang::Distrib< T >::disabled, line::lang::dist_to_map(), empty_class_ref(), and line::lang::Join.

Referenced by empty_class_ref().

◆ fmt_d() [1/3]

std::string line::io::code_gen_detail::fmt_d ( double x)
inline

MATLAB d of a double: the integer when it is one, else MATLAB's e override.

Definition at line 85 of file code_gen.h.

References fmt_d(), and mfmt().

Referenced by fmt_d(), fmt_d(), and fmt_d().

◆ fmt_d() [2/3]

std::string line::io::code_gen_detail::fmt_d ( int x)
inline

Definition at line 96 of file code_gen.h.

References fmt_d().

◆ fmt_d() [3/3]

std::string line::io::code_gen_detail::fmt_d ( std::size_t x)
inline

Definition at line 95 of file code_gen.h.

References fmt_d().

◆ fmt_f()

std::string line::io::code_gen_detail::fmt_f ( double x)
inline

Definition at line 81 of file code_gen.h.

References fmt_f(), and mfmt().

Referenced by fmt_f().

◆ fmt_g()

std::string line::io::code_gen_detail::fmt_g ( double x)
inline

Definition at line 82 of file code_gen.h.

References fmt_g(), and mfmt().

Referenced by fmt_g().

◆ fork_of()

template<class T>
std::size_t line::io::code_gen_detail::fork_of ( const qn::NetworkStruct< T > & sn,
std::size_t j )

find(sn.fj(:,j)): the 1-based Fork node the 1-based Join node j closes.

Definition at line 168 of file code_gen.h.

References fork_of(), and line::InputError::InputError().

Referenced by fork_of().

◆ j_arr()

template<class T>
std::string line::io::code_gen_detail::j_arr ( const std::vector< T > & v)

jarr: a new double[]{...} literal.

Definition at line 583 of file code_gen.h.

References j_arr(), and j_num_t().

Referenced by j_arr(), and java_dist().

◆ j_mat()

template<class T>
std::string line::io::code_gen_detail::j_mat ( const Matrix< T > & m)

jmat of a matrix, row by row.

Definition at line 599 of file code_gen.h.

References line::Matrix< T >::cols(), j_mat(), j_num_t(), and line::Matrix< T >::rows().

Referenced by j_mat(), and java_dist().

◆ j_mat_row()

template<class T>
std::string line::io::code_gen_detail::j_mat_row ( const std::vector< T > & v)

jmat of a row vector: new Matrix(new double[][]{{a, b}}).

Definition at line 591 of file code_gen.h.

References j_mat_row(), and j_num_t().

Referenced by j_mat_row(), and java_dist().

◆ j_num()

std::string line::io::code_gen_detail::j_num ( double v)
inline

jnum: a Java double literal at the shortest spelling that reads back as v.

Definition at line 561 of file code_gen.h.

References j_num().

Referenced by j_num(), j_num_t(), and java_dist().

◆ j_num_t()

template<class T>
std::string line::io::code_gen_detail::j_num_t ( const T & v)

Definition at line 577 of file code_gen.h.

References j_num(), and j_num_t().

Referenced by j_arr(), j_mat(), j_mat_row(), j_num_t(), and java_dist().

◆ j_round()

std::string line::io::code_gen_detail::j_round ( double v)
inline

Definition at line 609 of file code_gen.h.

References j_round().

Referenced by j_round(), and java_dist().

◆ java_dist()

template<class T>
std::string line::io::code_gen_detail::java_dist ( const lang::Distrib< T > & d)

javaDist: the Java constructor call rebuilding d with the same parameters.

A law with no Java constructor listed here is written as an APH fitted to its mean and SCV, where MATLAB also warns.

Definition at line 622 of file code_gen.h.

References line::lang::Distrib< T >::D0, line::lang::Distrib< T >::D1, line::lang::Distrib< T >::disabled, j_arr(), j_mat(), j_mat_row(), j_num(), j_num_t(), j_round(), java_dist(), line::lang::Distrib< T >::mean, line::lang::Distrib< T >::params, line::lang::process_to_text(), line::lang::Distrib< T >::scv, line::lang::Distrib< T >::trace, line::lang::Distrib< T >::trace_file, line::lang::Distrib< T >::type, and line::UnsupportedError::UnsupportedError().

Referenced by java_dist().

◆ json_model_name()

std::string line::io::code_gen_detail::json_model_name ( const std::string & path,
const std::string & fallback )
inline

The name of the model in a model.json envelope, fallback when it has none.

Definition at line 1501 of file code_gen.h.

References line::InputError::InputError(), and json_model_name().

Referenced by json_model_name(), and line::io::line2java_json().

◆ m_cellstr()

std::string line::io::code_gen_detail::m_cellstr ( const std::vector< std::string > & c)
inline

cellstr2code: {'a', 'b'}.

Definition at line 1085 of file code_gen.h.

References m_cellstr(), and m_quote().

Referenced by m_cellstr(), m_prec(), and m_server_extras().

◆ m_default_time()

template<class T>
bool line::io::code_gen_detail::m_default_time ( const lang::Distrib< T > & d)

True for a think / setup / delay-off time left at its constructor default.

Definition at line 1174 of file code_gen.h.

References line::lang::DISABLED, line::lang::Distrib< T >::disabled, line::lang::IMMEDIATE, m_default_time(), and line::lang::Distrib< T >::type.

Referenced by m_default_time().

◆ m_dist()

template<class T>
std::string line::io::code_gen_detail::m_dist ( const lang::Distrib< T > & d)

dist2code: the constructor call that rebuilds d from its parameters, which this port keeps in MATLAB getParam order.

A law with no constructor spelling here is written as the APH fit of its moments, as MATLAB does for a class it does not know.

Definition at line 1111 of file code_gen.h.

References line::lang::Distrib< T >::cox_scalar_form, line::lang::Distrib< T >::D0, line::lang::Distrib< T >::D1, line::lang::Distrib< T >::disabled, m_dist(), m_matrix(), m_quote(), m_row(), m_scalar(), m_scalar_t(), line::lang::Distrib< T >::mean, line::lang::Distrib< T >::params, line::lang::process_to_text(), line::lang::Distrib< T >::scv, line::lang::Distrib< T >::trace, line::lang::Distrib< T >::trace_file, line::lang::Distrib< T >::type, and line::UnsupportedError::UnsupportedError().

Referenced by m_dist().

◆ m_matrix()

template<class T>
std::string line::io::code_gen_detail::m_matrix ( const Matrix< T > & M)

num2code of a matrix: [a, b; c, d].

Definition at line 1063 of file code_gen.h.

References line::Matrix< T >::cols(), m_matrix(), m_scalar_t(), and line::Matrix< T >::rows().

Referenced by m_dist(), m_matrix(), and m_server_extras().

◆ m_prec()

template<class T>
std::string line::io::code_gen_detail::m_prec ( const lqn::detail::RawPrecedence< T > & ap)

The ActivityPrecedence expression of one declared precedence (precCode).

Definition at line 1180 of file code_gen.h.

References m_cellstr(), m_prec(), m_quote(), m_row(), and m_scalar().

Referenced by m_prec().

◆ m_quote()

std::string line::io::code_gen_detail::m_quote ( const std::string & s)
inline

q(str): a MATLAB single-quoted literal.

Definition at line 1075 of file code_gen.h.

References m_quote().

Referenced by m_cellstr(), m_dist(), m_prec(), m_quote(), and m_server_extras().

◆ m_repl()

std::string line::io::code_gen_detail::m_repl ( lang::ReplacementStrategy r)
inline

◆ m_row()

template<class T>
std::string line::io::code_gen_detail::m_row ( const std::vector< T > & v)

num2code of a row vector: [a, b], a scalar when it has one element, [] when empty.

Definition at line 1053 of file code_gen.h.

References m_row(), and m_scalar_t().

Referenced by m_dist(), m_prec(), m_row(), and m_server_extras().

◆ m_scalar()

std::string line::io::code_gen_detail::m_scalar ( double v)
inline

scalar2code: a double at the shortest of 15..17 significant digits that reads back as itself.

Definition at line 1030 of file code_gen.h.

References m_scalar().

Referenced by m_dist(), m_prec(), m_scalar(), m_scalar_t(), and m_server_extras().

◆ m_scalar_t()

template<class T>
std::string line::io::code_gen_detail::m_scalar_t ( const T & v)

Definition at line 1047 of file code_gen.h.

References m_scalar(), and m_scalar_t().

Referenced by m_dist(), m_matrix(), m_row(), m_scalar_t(), and m_server_extras().

◆ m_server_extras()

template<class T>
void line::io::code_gen_detail::m_server_extras ( std::ostream & os,
const std::string & v,
const std::string & owner,
const Matrix< T > * A,
const std::vector< T > * b,
const std::vector< lqn::detail::RawLinConRow< T > > * rows,
const std::vector< T > * lld,
bool has_cd,
bool has_jd,
const std::vector< lqn::detail::RawServerPool< T > > * pools )

emitServerExtras: admission constraints, load dependence and server pools of a host or task.

Definition at line 1230 of file code_gen.h.

References line::Matrix< T >::cols(), m_cellstr(), m_matrix(), m_quote(), m_row(), m_scalar(), m_scalar_t(), m_server_extras(), line::Matrix< T >::rows(), and line::UnsupportedError::UnsupportedError().

Referenced by m_server_extras().

◆ mfmt()

std::string line::io::code_gen_detail::mfmt ( const char * spec,
double x )
inline

f, e or g as MATLAB's fprintf prints it: C's text, with Inf / NaN spelt MATLAB's way.

Definition at line 73 of file code_gen.h.

References mfmt().

Referenced by fmt_d(), fmt_f(), fmt_g(), and mfmt().

◆ open_out()

std::ofstream line::io::code_gen_detail::open_out ( const std::string & path)
inline

◆ proc_spec()

◆ reply_graph()

template<class T>
std::vector< std::vector< bool > > line::io::code_gen_detail::reply_graph ( const lqn::LqnModel< T > & m,
const lqn::LqnStruct< T > & sn )

sn.replygraph: (nacts+1) x (nentries+1), 1-based, true where the activity replies to the entry.

Declared replies, plus the implicit leaf replies of getStruct.m for an entry that declares none.

Definition at line 694 of file code_gen.h.

References reply_graph().

Referenced by reply_graph().

◆ routes()

template<class T>
std::vector< Route > line::io::code_gen_detail::routes ( const qn::NetworkStruct< T > & sn)

Definition at line 246 of file code_gen.h.

References routes(), line::lang::Sink, and line::lang::Source.

Referenced by routes().

◆ sched_feature()

std::string line::io::code_gen_detail::sched_feature ( lang::SchedStrategy s)
inline

strrep(SchedStrategy.toFeature(s),'_','.

'), the layered generator's spelling.

Definition at line 110 of file code_gen.h.

References sched_feature(), and sched_property().

Referenced by sched_feature().

◆ sched_property()

std::string line::io::code_gen_detail::sched_property ( lang::SchedStrategy s)
inline

SchedStrategy.toProperty(SchedStrategy.toText(s)): the enum constant name.

Definition at line 99 of file code_gen.h.

References sched_property(), line::lang::sched_to_text(), and line::UnsupportedError::UnsupportedError().

Referenced by sched_feature(), and sched_property().

◆ upper_nospace()

std::string line::io::code_gen_detail::upper_nospace ( const std::string & s)
inline

Definition at line 725 of file code_gen.h.

References upper_nospace().

Referenced by upper_nospace().