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

Classes

struct  CallRow
struct  Element
struct  TaskRef

Functions

UnsupportedError unsup (const std::string &msg)
InputError xerr (const std::string &msg)
const std::string * get (const Element *el, const std::string &key)
 el.get(key), with Python's None as a null pointer.
std::string get (const Element *el, const std::string &key, const std::string &dflt)
 el.get(key, dflt).
std::string show (const Element *el, const std::string &key)
 's' % el.get(key): None prints as "None".
std::string lower (std::string s)
std::string upper (std::string s)
bool starts_with (const std::string &s, const char *p)
void utf8 (std::string &out, unsigned long cp)
std::string normalize_attr (const std::string &v)
 An attribute value as expat delivers it: literal tab, CR and LF become spaces (a CR LF pair one space), and &#n; / &#xh; are expanded afterwards.
void normalize_tree (Element *el)
bool is_output_tag (const std::string &tag)
 Output requests: read and dropped, as the reader drops H, R and observations.
std::vector< const Element * > kids (const Element *el)
 Model children of el: results and output requests are skipped.
const Element * find (const Element *el, const std::string &tag)
 el.find(tag): the first direct child with that tag, or null.
std::vector< const Element * > findall (const Element *el, const std::string &tag)
bool in (const std::string &s, std::initializer_list< const char * > set)
void check (const Element *el, std::initializer_list< const char * > allowed, std::initializer_list< const char * > kidtags={})
bool py_float (const std::string &text, double &x)
 Python's float(text): surrounding whitespace, underscores between digits, inf/nan.
const std::string * num (const Element *el, const std::string &key, std::string &buf, const char *dflt=NULL)
 _num: the attribute as format_number(float(text)), or dflt (null = None) when absent.
std::string numd (const Element *el, const std::string &key, const char *dflt)
 _num with a default, which never returns None.
bool srvn_name_ok (const std::string &nm)
 [A-Za-z_][A-Za-z0-9_]+$ under re.match, where $ also matches before a final newline.
std::string name (const Element *el, const std::string &key="name")
std::string join (const std::vector< std::string > &v, const std::string &sep)
void phase_lists (const std::map< int, const Element * > &acts, std::vector< std::pair< std::string, std::vector< std::string > > > &lines, std::vector< CallRow > &calls)
 acts maps phase -> <activity>; the E-section lines of one entry's phases.
const char * proc_letter (const std::string &s)
const char * task_letter (const std::string &s)
const char * rwlock_letter (const std::string &s)
const char * sem_letter (const std::string &s)
void activity_section (const Element *t, const Element *ta, std::vector< std::string > &out)
 One task's A section, appended to out.

Function Documentation

◆ activity_section()

void line::lqn::srvn_out::activity_section ( const Element * t,
const Element * ta,
std::vector< std::string > & out )
inline

One task's A section, appended to out.

Definition at line 403 of file srvn_writer.h.

References activity_section(), check(), findall(), get(), in(), join(), kids(), LINE_SRVN_ACT_ATTRS, name(), line::xml::Element::name, num(), numd(), show(), starts_with(), unsup(), upper(), and xerr().

Referenced by activity_section().

◆ check()

void line::lqn::srvn_out::check ( const Element * el,
std::initializer_list< const char * > allowed,
std::initializer_list< const char * > kidtags = {} )
inline

Definition at line 188 of file srvn_writer.h.

References check().

Referenced by activity_section(), and check().

◆ find()

const Element * line::lqn::srvn_out::find ( const Element * el,
const std::string & tag )
inline

el.find(tag): the first direct child with that tag, or null.

Definition at line 172 of file srvn_writer.h.

References line::xml::Element::children, and find().

Referenced by find().

◆ findall()

std::vector< const Element * > line::lqn::srvn_out::findall ( const Element * el,
const std::string & tag )
inline

Definition at line 178 of file srvn_writer.h.

References line::xml::Element::child_tags(), and findall().

Referenced by activity_section(), and findall().

◆ get() [1/2]

const std::string * line::lqn::srvn_out::get ( const Element * el,
const std::string & key )
inline

el.get(key), with Python's None as a null pointer.

Definition at line 62 of file srvn_writer.h.

References line::xml::Element::attrs, and get().

Referenced by activity_section(), get(), get(), name(), num(), phase_lists(), and show().

◆ get() [2/2]

std::string line::lqn::srvn_out::get ( const Element * el,
const std::string & key,
const std::string & dflt )
inline

el.get(key, dflt).

Definition at line 69 of file srvn_writer.h.

References get().

◆ in()

bool line::lqn::srvn_out::in ( const std::string & s,
std::initializer_list< const char * > set )
inline

Definition at line 182 of file srvn_writer.h.

References in().

Referenced by activity_section(), and in().

◆ is_output_tag()

bool line::lqn::srvn_out::is_output_tag ( const std::string & tag)
inline

Output requests: read and dropped, as the reader drops H, R and observations.

Definition at line 158 of file srvn_writer.h.

References is_output_tag(), and starts_with().

Referenced by is_output_tag(), and kids().

◆ join()

std::string line::lqn::srvn_out::join ( const std::vector< std::string > & v,
const std::string & sep )
inline

Definition at line 295 of file srvn_writer.h.

References join().

Referenced by activity_section(), and join().

◆ kids()

std::vector< const Element * > line::lqn::srvn_out::kids ( const Element * el)
inline

Model children of el: results and output requests are skipped.

Definition at line 164 of file srvn_writer.h.

References line::xml::Element::children, is_output_tag(), and kids().

Referenced by activity_section(), kids(), and phase_lists().

◆ lower()

std::string line::lqn::srvn_out::lower ( std::string s)
inline

Definition at line 80 of file srvn_writer.h.

References lower().

Referenced by lower(), and py_float().

◆ name()

std::string line::lqn::srvn_out::name ( const Element * el,
const std::string & key = "name" )
inline

◆ normalize_attr()

std::string line::lqn::srvn_out::normalize_attr ( const std::string & v)
inline

An attribute value as expat delivers it: literal tab, CR and LF become spaces (a CR LF pair one space), and &#n; / &#xh; are expanded afterwards.

Definition at line 115 of file srvn_writer.h.

References line::lqn::srvn_detail::is_digit(), normalize_attr(), and utf8().

Referenced by normalize_attr(), and normalize_tree().

◆ normalize_tree()

void line::lqn::srvn_out::normalize_tree ( Element * el)
inline

◆ num()

const std::string * line::lqn::srvn_out::num ( const Element * el,
const std::string & key,
std::string & buf,
const char * dflt = NULL )
inline

_num: the attribute as format_number(float(text)), or dflt (null = None) when absent.

Definition at line 250 of file srvn_writer.h.

References line::lqn::format_number(), get(), line::xml::Element::name, num(), py_float(), and unsup().

Referenced by activity_section(), num(), numd(), and phase_lists().

◆ numd()

std::string line::lqn::srvn_out::numd ( const Element * el,
const std::string & key,
const char * dflt )
inline

_num with a default, which never returns None.

Definition at line 268 of file srvn_writer.h.

References num(), and numd().

Referenced by activity_section(), numd(), and phase_lists().

◆ phase_lists()

void line::lqn::srvn_out::phase_lists ( const std::map< int, const Element * > & acts,
std::vector< std::pair< std::string, std::vector< std::string > > > & lines,
std::vector< CallRow > & calls )
inline

acts maps phase -> <activity>; the E-section lines of one entry's phases.

Definition at line 307 of file srvn_writer.h.

References get(), kids(), name(), num(), numd(), phase_lists(), show(), unsup(), and upper().

Referenced by phase_lists().

◆ proc_letter()

const char * line::lqn::srvn_out::proc_letter ( const std::string & s)
inline

Definition at line 363 of file srvn_writer.h.

References proc_letter().

Referenced by proc_letter().

◆ py_float()

bool line::lqn::srvn_out::py_float ( const std::string & text,
double & x )
inline

Python's float(text): surrounding whitespace, underscores between digits, inf/nan.

Definition at line 201 of file srvn_writer.h.

References line::lqn::srvn_detail::is_digit(), line::lqn::srvn_detail::is_space(), lower(), and py_float().

Referenced by num(), and py_float().

◆ rwlock_letter()

const char * line::lqn::srvn_out::rwlock_letter ( const std::string & s)
inline

Definition at line 379 of file srvn_writer.h.

References rwlock_letter().

Referenced by rwlock_letter().

◆ sem_letter()

const char * line::lqn::srvn_out::sem_letter ( const std::string & s)
inline

Definition at line 387 of file srvn_writer.h.

References sem_letter().

Referenced by sem_letter().

◆ show()

std::string line::lqn::srvn_out::show ( const Element * el,
const std::string & key )
inline

's' % el.get(key): None prints as "None".

Definition at line 75 of file srvn_writer.h.

References get(), and show().

Referenced by activity_section(), phase_lists(), and show().

◆ srvn_name_ok()

bool line::lqn::srvn_out::srvn_name_ok ( const std::string & nm)
inline

[A-Za-z_][A-Za-z0-9_]+$ under re.match, where $ also matches before a final newline.

Definition at line 274 of file srvn_writer.h.

References line::lqn::srvn_detail::is_digit(), and srvn_name_ok().

Referenced by name(), and srvn_name_ok().

◆ starts_with()

bool line::lqn::srvn_out::starts_with ( const std::string & s,
const char * p )
inline

Definition at line 92 of file srvn_writer.h.

References starts_with().

Referenced by activity_section(), is_output_tag(), and starts_with().

◆ task_letter()

const char * line::lqn::srvn_out::task_letter ( const std::string & s)
inline

Definition at line 371 of file srvn_writer.h.

References task_letter().

Referenced by task_letter().

◆ unsup()

UnsupportedError line::lqn::srvn_out::unsup ( const std::string & msg)
inline

Definition at line 55 of file srvn_writer.h.

References unsup(), and line::UnsupportedError::UnsupportedError().

Referenced by activity_section(), name(), num(), phase_lists(), and unsup().

◆ upper()

std::string line::lqn::srvn_out::upper ( std::string s)
inline

Definition at line 86 of file srvn_writer.h.

References upper().

Referenced by activity_section(), phase_lists(), and upper().

◆ utf8()

void line::lqn::srvn_out::utf8 ( std::string & out,
unsigned long cp )
inline

Definition at line 94 of file srvn_writer.h.

References utf8().

Referenced by normalize_attr(), and utf8().

◆ xerr()

InputError line::lqn::srvn_out::xerr ( const std::string & msg)
inline

Definition at line 59 of file srvn_writer.h.

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

Referenced by activity_section(), name(), and xerr().