aGrUM 3.2.0
a C++ library for (probabilistic) graphical models
gum::prm::o3prm::O3prmReader< GUM_SCALAR > Class Template Reference

This class read O3PRM files and creates the corresponding gum::prm::PRM. More...

#include <agrum/PRM/o3prm/O3prmReader.h>

Collaboration diagram for gum::prm::o3prm::O3prmReader< GUM_SCALAR >:
[legend]

Public Member Functions

 O3prmReader ()
 O3prmReader (PRM< GUM_SCALAR > &prm)
 O3prmReader (const O3prmReader &src)
 O3prmReader (O3prmReader &&src)
 ~O3prmReader ()
O3prmReader & operator= (const O3prmReader &src)
O3prmReader & operator= (O3prmReader &&src)
Size readFile (std::string_view file, std::string_view module="")
 Read file and load its content using a PRMFactory. The package parameter set the file's content package.
Size readString (const std::string &string)
 With readString method, you must set the current path to search from import yourself, using addClassPath.
void parseStream (std::istream &input, std::ostream &output, std::string module="")
void setClassPath (std::string_view class_path)
 This methods defines the list of paths to look for o3prm files.
void addClassPath (std::string_view class_path)
 Add a list of paths to look for o3prm files.
gum::prm::PRM< GUM_SCALAR > * prm ()
const gum::prm::PRM< GUM_SCALAR > * prm () const
Size errors () const
 publishing Errors API
Size warnings () const
const ErrorsContainer & errorsContainer () const
 publishing Errors API
Idx errLine (Idx i) const
 line of ith error or warning
Idx errCol (Idx i) const
 col of ith error or warning
std::wstring errFilename (Idx i) const
 filename of ith error or warning
bool errIsError (Idx i) const
 type of ith error or warning
std::string errMsg (Idx i) const
 message of ith error or warning
void showElegantErrors (std::ostream &o=std::cerr) const
 send on std::cerr the list of errors
void showElegantErrorsAndWarnings (std::ostream &o=std::cerr) const
 send on std::cerr the list of errors or warnings
void showErrorCounts (std::ostream &o=std::cerr) const
 send on std::cerr the number of errors and the number of warnings

Private Member Functions

void _readStream_ (std::istream &input, const std::string &file, std::string module="")
void _parseImport_ (const O3Import &i, const std::string &module_path)
void _parseStream_ (std::istream &input, const std::string &filename, const std::string &module)
std::vector< const O3Import * > _copyImports_ ()
std::string _clean_ (std::string text) const
std::string _print_ (const ParseError &err) const
std::string _readStream_ (std::istream &input)

Private Attributes

PRM< GUM_SCALAR > * _prm_
std::unique_ptr< O3PRM > _o3_prm_
std::vector< std::string > _class_path_
Set< std::string > _imported_
ErrorsContainer _errors_

Detailed Description

template<GUM_Numeric GUM_SCALAR>
class gum::prm::o3prm::O3prmReader< GUM_SCALAR >

This class read O3PRM files and creates the corresponding gum::prm::PRM.

Template Parameters
GUM_SCALARThe scalar type to use with the gum::prm::PRM.

Definition at line 93 of file O3prmReader.h.

Constructor & Destructor Documentation

◆ O3prmReader() [1/4]

template<GUM_Numeric GUM_SCALAR>
gum::prm::o3prm::O3prmReader< GUM_SCALAR >::O3prmReader ( )

Definition at line 162 of file O3prmReader_tpl.h.

162 :
165 }
This class read O3PRM files and creates the corresponding gum::prm::PRM.
Definition O3prmReader.h:93
std::unique_ptr< O3PRM > _o3_prm_
PRM< GUM_SCALAR > * _prm_

References O3prmReader(), _o3_prm_, and _prm_.

Referenced by O3prmReader(), O3prmReader(), O3prmReader(), ~O3prmReader(), operator=(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ O3prmReader() [2/4]

template<GUM_Numeric GUM_SCALAR>
gum::prm::o3prm::O3prmReader< GUM_SCALAR >::O3prmReader ( PRM< GUM_SCALAR > & prm)
explicit

Definition at line 168 of file O3prmReader_tpl.h.

168 :
171 }
gum::prm::PRM< GUM_SCALAR > * prm()

References O3prmReader(), _o3_prm_, _prm_, and prm().

Here is the call graph for this function:

◆ O3prmReader() [3/4]

template<GUM_Numeric GUM_SCALAR>
gum::prm::o3prm::O3prmReader< GUM_SCALAR >::O3prmReader ( const O3prmReader< GUM_SCALAR > & src)

Definition at line 174 of file O3prmReader_tpl.h.

References O3prmReader(), _class_path_, _errors_, _imported_, _o3_prm_, and _prm_.

Here is the call graph for this function:

◆ O3prmReader() [4/4]

template<GUM_Numeric GUM_SCALAR>
gum::prm::o3prm::O3prmReader< GUM_SCALAR >::O3prmReader ( O3prmReader< GUM_SCALAR > && src)

◆ ~O3prmReader()

template<GUM_Numeric GUM_SCALAR>
gum::prm::o3prm::O3prmReader< GUM_SCALAR >::~O3prmReader ( )

Definition at line 189 of file O3prmReader_tpl.h.

189 {
191 }

References O3prmReader().

Here is the call graph for this function:

Member Function Documentation

◆ _clean_()

template<GUM_Numeric GUM_SCALAR>
std::string gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_clean_ ( std::string text) const
private

Definition at line 60 of file O3prmReader_tpl.h.

60 {
61 // This could be way more faster with regex but there are not implemented
62 // with gcc-4.8 !
63 text = replace(text, "Syntax error", "Error");
64
65 text = replace(text, "LABEL_OR_STAR_LIST", "declaration");
66
67 text = replace(text, "ARRAY_REFERENCE_SLOT", "declaration");
68 text = replace(text, "FLOAT_AS_LABEL", "declaration");
69 text = replace(text, "FLOAT_OR_INT", "declaration");
70 text = replace(text, "INTEGER_AS_FLOAT", "declaration");
71 text = replace(text, "INTEGER_AS_LABEL", "declaration");
72 text = replace(text, "INT_TYPE_DECLARATION", "declaration");
73 text = replace(text, "LABEL_OR_INT", "declaration");
74 text = replace(text, "LABEL_OR_STAR", "declaration");
75 text = replace(text, "NAMED_CLASS_ELEMENT", "declaration");
76 text = replace(text, "REAL_TYPE_DECLARATION", "declaration");
77
78 text = replace(text, "AGGREGATE_PARENTS", "declaration");
79 text = replace(text, "CLASS_BODY", "declaration");
80 text = replace(text, "CLASS_DECLARATION", "declaration");
81 text = replace(text, "CLASS_ELEMENT", "declaration");
82 text = replace(text, "CLASS_PARAMETER", "declaration");
83 text = replace(text, "CLASS_UNIT", "declaration");
84 text = replace(text, "FLOAT_LIST", "declaration");
85 text = replace(text, "FORMULA_LIST", "declaration");
86 text = replace(text, "IDENTIFIER_LIST", "declaration");
87 text = replace(text, "IMPORT_BODY", "declaration");
88 text = replace(text, "IMPORT_DECLARATION", "declaration");
89 text = replace(text, "IMPORT_UNIT", "declaration");
90 text = replace(text, "INTERFACE_BODY", "declaration");
91 text = replace(text, "INTERFACE_DECLARATION", "declaration");
92 text = replace(text, "INTERFACE_UNIT", "declaration");
93 text = replace(text, "LABEL_LIST", "declaration");
94 text = replace(text, "PARAMETER_LIST", "declaration");
95 text = replace(text, "PREFIXED_LABEL", "declaration");
96 text = replace(text, "RAW_CPT", "declaration");
97 text = replace(text, "REFERENCE_SLOT", "declaration");
98 text = replace(text, "RULE_CPT", "declaration");
99 text = replace(text, "SYSTEM_BODY", "declaration");
100 text = replace(text, "SYSTEM_DECLARATION", "declaration");
101 text = replace(text, "SYSTEM_UNIT", "declaration");
102 text = replace(text, "TYPE_DECLARATION", "declaration");
103 text = replace(text, "TYPE_LABEL", "declaration");
104 text = replace(text, "TYPE_UNIT", "declaration");
105 text = replace(text, "TYPE_VALUE_LIST", "declaration");
106
107 text = replace(text, "AGGREGATE", "declaration");
108 text = replace(text, "ARRAY", "declaration");
109 text = replace(text, "ATTRIBUTE", "declaration");
110 text = replace(text, "CAST", "declaration");
111 text = replace(text, "CHAIN", "declaration");
112 text = replace(text, "CLASS", "declaration");
113 text = replace(text, "FLOAT", "declaration");
114 text = replace(text, "FORMULA", "declaration");
115 text = replace(text, "IDENTIFIER", "declaration");
116 text = replace(text, "INT", "declaration");
117 text = replace(text, "INTEGER", "declaration");
118 text = replace(text, "INTERFACE", "declaration");
119 text = replace(text, "LABEL", "declaration");
120 text = replace(text, "LINK", "declaration");
121 text = replace(text, "MAP", "declaration");
122 text = replace(text, "PARAMETER", "declaration");
123 text = replace(text, "REAL", "declaration");
124 text = replace(text, "RULE", "declaration");
125 text = replace(text, "TYPE", "declaration");
126 text = replace(text, "UNIT", "declaration");
127
128 return text;
129 }

References gum::replace().

Referenced by _print_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _copyImports_()

template<GUM_Numeric GUM_SCALAR>
std::vector< const O3Import * > gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_copyImports_ ( )
private

Definition at line 417 of file O3prmReader_tpl.h.

417 {
419 for (const auto& i: _o3_prm_->imports()) {
420 if (!_imported_.exists(i->import().label())) { copy.push_back(i.get()); }
421 }
422 return copy;
423 }

References _imported_, and _o3_prm_.

Referenced by _readStream_().

Here is the caller graph for this function:

◆ _parseImport_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_parseImport_ ( const O3Import & i,
const std::string & module_path )
private

Definition at line 374 of file O3prmReader_tpl.h.

374 {
375 if (!_imported_.exists(i.import().label())) {
376 _imported_.insert(i.import().label());
377
378 auto module_path = module;
379 std::replace(module_path.begin(), module_path.end(), '.', '/');
380
381 auto path = i.import().label();
382 std::replace(path.begin(), path.end(), '.', '/');
383
384 auto imported = false;
385 for (const auto& cp: _class_path_) {
386 auto file_path = cp + path + ".o3prm";
388
389 if (file.is_open()) {
390 _parseStream_(file, file_path, i.import().label());
391 imported = true;
392 break;
393 }
394
395 file_path = cp + module + path + ".o3prm";
397
398 if (file2.is_open()) {
399 _parseStream_(file2, file_path, module + "." + i.import().label());
400 imported = true;
401 break;
402 }
403 }
404
405 if (!imported) {
406 const auto& pos = i.import().position();
407 _errors_.addError(
408 std::format("Import error: could not resolve import {}", i.import().label()),
409 pos.file(),
410 pos.line(),
411 pos.column());
412 }
413 }
414 }
void _parseStream_(std::istream &input, const std::string &filename, const std::string &module)

References _class_path_, _errors_, _imported_, _parseStream_(), gum::prm::o3prm::O3Import::import(), gum::prm::o3prm::O3Label::label(), and gum::prm::o3prm::O3Label::position().

Referenced by _readStream_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _parseStream_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_parseStream_ ( std::istream & input,
const std::string & filename,
const std::string & module )
private

Definition at line 359 of file O3prmReader_tpl.h.

361 {
362 auto sBuff = _readStream_(input);
363 auto buffer = std::unique_ptr< unsigned char[] >(new unsigned char[sBuff.length() + 1]);
364 strcpy((char*)buffer.get(), sBuff.c_str());
365 auto s = o3prm_scanner(buffer.get(), int(sBuff.length() + 1), filename);
366 auto p = o3prm_parser(&s);
367 p.set_prm(_o3_prm_.get());
368 p.set_prefix(module);
369 p.Parse();
370 _errors_ += p.errors();
371 }
Size errors() const
publishing Errors API
void _readStream_(std::istream &input, const std::string &file, std::string module="")

References _errors_, _o3_prm_, and _readStream_().

Referenced by _parseImport_(), and _readStream_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _print_()

template<GUM_Numeric GUM_SCALAR>
std::string gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_print_ ( const ParseError & err) const
private

Definition at line 132 of file O3prmReader_tpl.h.

132 {
133 return std::format("{}|{} col {}| {}",
134 err.filename,
135 err.line,
136 err.column,
137 _clean_(err.msg));
138 }
std::string _clean_(std::string text) const

References _clean_(), gum::ParseError::column, gum::ParseError::filename, gum::ParseError::line, and gum::ParseError::msg.

Referenced by showElegantErrors(), and showElegantErrorsAndWarnings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _readStream_() [1/2]

template<GUM_Numeric GUM_SCALAR>
std::string gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_readStream_ ( std::istream & input)
private

Definition at line 141 of file O3prmReader_tpl.h.

141 {
142 if (inputstr) {
143 inputstr.seekg(0, inputstr.end);
144 int length = int(inputstr.tellg());
145 inputstr.seekg(0, inputstr.beg);
146
147 auto str = std::string();
148 str.resize(length, ' ');
149 auto begin = &*str.begin();
150
151 inputstr.read(begin, length);
152
153 return str;
154 }
155 GUM_ERROR(OperationNotAllowed, "Could not open file")
156 }

◆ _readStream_() [2/2]

template<GUM_Numeric GUM_SCALAR>
void gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_readStream_ ( std::istream & input,
const std::string & file,
std::string module = "" )
private

Definition at line 426 of file O3prmReader_tpl.h.

428 {
429 if (module.size() > 0 && module.back() != '.') { module.append("."); }
430
432
433 auto imports = _copyImports_();
434 do {
435 for (auto i: imports) {
437 }
439 } while (imports.size() > 0);
440
441
442 if (_errors_.error_count == 0) {
445
449
451
452 try {
453 type_factory.build();
454 interface_factory.buildInterfaces();
455 class_factory.buildClasses();
456 interface_factory.buildElements();
457 class_factory.buildImplementations();
458 class_factory.buildParameters();
459 class_factory.buildReferenceSlots();
460 class_factory.declareAttributes();
461 class_factory.declareAggregates();
462 class_factory.completeAggregates();
463 class_factory.completeAttributes();
464 system_factory.build();
465 } catch (Exception const&) {
466 if (_errors_.count() == 0) { _errors_.addException("an unknown error occured", file); }
467 } catch (...) { _errors_.addException("an unknown exception occured", file); }
468 }
469 }
O3ClassFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
O3NameSolver(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, ErrorsContainer &errors)
O3SystemFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
O3TypeFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
std::vector< const O3Import * > _copyImports_()
void _parseImport_(const O3Import &i, const std::string &module_path)

References gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::O3ClassFactory(), gum::prm::o3prm::O3InterfaceFactory< GUM_SCALAR >::O3InterfaceFactory(), gum::prm::o3prm::O3NameSolver< GUM_SCALAR >::O3NameSolver(), gum::prm::o3prm::O3SystemFactory< GUM_SCALAR >::O3SystemFactory(), gum::prm::o3prm::O3TypeFactory< GUM_SCALAR >::O3TypeFactory(), _copyImports_(), _errors_, _o3_prm_, _parseImport_(), _parseStream_(), and _prm_.

Referenced by _parseStream_(), parseStream(), readFile(), and readString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addClassPath()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::o3prm::O3prmReader< GUM_SCALAR >::addClassPath ( std::string_view class_path)

Add a list of paths to look for o3prm files.

Use / for path separator ! Even on Windows !

Parameters
class_pathA semicolon separated list of paths.

Definition at line 236 of file O3prmReader_tpl.h.

236 {
238 if (path[path.size() - 1] != '/') { path.append("/"); }
240 if (!dir.exists()) {
241 _errors_.addException("could not resolve class path", path);
242 } else {
243 _class_path_.push_back(std::move(path));
244 }
245 }

References _class_path_, and _errors_.

Referenced by gum::prm::o3prmr::O3prmrInterpreter::interpretFile(), gum::O3prmBNReader< GUM_SCALAR >::proceed(), and setClassPath().

Here is the caller graph for this function:

◆ errCol()

template<GUM_Numeric GUM_SCALAR>
Idx gum::prm::o3prm::O3prmReader< GUM_SCALAR >::errCol ( Idx i) const

col of ith error or warning

Definition at line 253 of file O3prmReader_tpl.h.

253 {
254 return _errors_.error(i).column;
255 }

References _errors_.

◆ errFilename()

template<GUM_Numeric GUM_SCALAR>
std::wstring gum::prm::o3prm::O3prmReader< GUM_SCALAR >::errFilename ( Idx i) const

filename of ith error or warning

Definition at line 258 of file O3prmReader_tpl.h.

258 {
259 return widen(_errors_.error(i).filename);
260 }

References _errors_, and widen().

Here is the call graph for this function:

◆ errIsError()

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::o3prm::O3prmReader< GUM_SCALAR >::errIsError ( Idx i) const

type of ith error or warning

Definition at line 263 of file O3prmReader_tpl.h.

263 {
264 return _errors_.error(i).is_error;
265 }

References _errors_.

◆ errLine()

template<GUM_Numeric GUM_SCALAR>
Idx gum::prm::o3prm::O3prmReader< GUM_SCALAR >::errLine ( Idx i) const

line of ith error or warning

Definition at line 248 of file O3prmReader_tpl.h.

248 {
249 return _errors_.error(i).line;
250 }

References _errors_.

◆ errMsg()

template<GUM_Numeric GUM_SCALAR>
std::string gum::prm::o3prm::O3prmReader< GUM_SCALAR >::errMsg ( Idx i) const

message of ith error or warning

Definition at line 268 of file O3prmReader_tpl.h.

268 {
269 return _errors_.error(i).msg;
270 }

References _errors_.

◆ errors()

template<GUM_Numeric GUM_SCALAR>
Size gum::prm::o3prm::O3prmReader< GUM_SCALAR >::errors ( ) const

publishing Errors API

of errors

Definition at line 294 of file O3prmReader_tpl.h.

294 {
295 return _errors_.error_count;
296 }

References _errors_.

◆ errorsContainer()

template<GUM_Numeric GUM_SCALAR>
const ErrorsContainer & gum::prm::o3prm::O3prmReader< GUM_SCALAR >::errorsContainer ( ) const

publishing Errors API

of errors

Definition at line 304 of file O3prmReader_tpl.h.

304 {
305 return _errors_;
306 }

References _errors_.

Referenced by gum::O3prmBNReader< GUM_SCALAR >::proceed().

Here is the caller graph for this function:

◆ operator=() [1/2]

template<GUM_Numeric GUM_SCALAR>
O3prmReader< GUM_SCALAR > & gum::prm::o3prm::O3prmReader< GUM_SCALAR >::operator= ( const O3prmReader< GUM_SCALAR > & src)

Definition at line 194 of file O3prmReader_tpl.h.

194 {
195 if (this == &src) { return *this; }
196 _prm_ = src._prm_;
201 return *this;
202 }

References gum::prm::o3prm::O3PRM::O3PRM(), O3prmReader(), _class_path_, _errors_, _imported_, _o3_prm_, and _prm_.

Here is the call graph for this function:

◆ operator=() [2/2]

template<GUM_Numeric GUM_SCALAR>
O3prmReader< GUM_SCALAR > & gum::prm::o3prm::O3prmReader< GUM_SCALAR >::operator= ( O3prmReader< GUM_SCALAR > && src)

Definition at line 205 of file O3prmReader_tpl.h.

205 {
206 if (this == &src) { return *this; }
212 return *this;
213 }

References O3prmReader(), _class_path_, _errors_, _imported_, _o3_prm_, and _prm_.

Here is the call graph for this function:

◆ parseStream()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::o3prm::O3prmReader< GUM_SCALAR >::parseStream ( std::istream & input,
std::ostream & output,
std::string module = "" )

Definition at line 350 of file O3prmReader_tpl.h.

352 {
354
356 }
void showElegantErrorsAndWarnings(std::ostream &o=std::cerr) const
send on std::cerr the list of errors or warnings

References _readStream_(), and showElegantErrorsAndWarnings().

Here is the call graph for this function:

◆ prm() [1/2]

template<GUM_Numeric GUM_SCALAR>
gum::prm::PRM< GUM_SCALAR > * gum::prm::o3prm::O3prmReader< GUM_SCALAR >::prm ( )

Definition at line 472 of file O3prmReader_tpl.h.

472 {
473 return _prm_;
474 }

References _prm_.

Referenced by O3prmReader(), gum::prm::o3prmr::O3prmrInterpreter::~O3prmrInterpreter(), gum::prm::o3prmr::O3prmrInterpreter::interpretFile(), gum::prm::o3prmr::O3prmrInterpreter::prm(), and gum::O3prmBNReader< GUM_SCALAR >::proceed().

Here is the caller graph for this function:

◆ prm() [2/2]

template<GUM_Numeric GUM_SCALAR>
const gum::prm::PRM< GUM_SCALAR > * gum::prm::o3prm::O3prmReader< GUM_SCALAR >::prm ( ) const

Definition at line 477 of file O3prmReader_tpl.h.

477 {
478 return _prm_;
479 }

References _prm_.

◆ readFile()

template<GUM_Numeric GUM_SCALAR>
Size gum::prm::o3prm::O3prmReader< GUM_SCALAR >::readFile ( std::string_view file,
std::string_view module = "" )

Read file and load its content using a PRMFactory. The package parameter set the file's content package.

Definition at line 316 of file O3prmReader_tpl.h.

316 {
317 try {
318 auto const lastSlashIndex = file.find_last_of('/');
319
321 if (!dir.exists()) {
322 _errors_.addException("could not find file", file);
323 return _errors_.count();
324 }
325
326 auto const basename = file.substr(lastSlashIndex + 1);
327 auto const absFilename
329
331 if (input.is_open()) {
333 } else {
334 _errors_.addException("could not open file", file);
335 }
336
337 return _errors_.count();
338
339 } catch (gum::Exception& e) {
341 _errors_.addException(e.errorContent(), file);
342 return _errors_.count();
343 } catch (...) {
344 _errors_.addException("unknown error", file);
345 return _errors_.count();
346 }
347 }

References _errors_, _readStream_(), gum::Exception::errorContent(), and GUM_SHOWERROR.

Referenced by gum::O3prmBNReader< GUM_SCALAR >::proceed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readString()

template<GUM_Numeric GUM_SCALAR>
Size gum::prm::o3prm::O3prmReader< GUM_SCALAR >::readString ( const std::string & string)

With readString method, you must set the current path to search from import yourself, using addClassPath.

Definition at line 309 of file O3prmReader_tpl.h.

309 {
311 _readStream_(sBuff, "");
312 return _errors_.count();
313 }

References _errors_, and _readStream_().

Here is the call graph for this function:

◆ setClassPath()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::o3prm::O3prmReader< GUM_SCALAR >::setClassPath ( std::string_view class_path)

This methods defines the list of paths to look for o3prm files.

Use / for path separator ! Even on Windows !

Parameters
class_pathA semicolon separated list of paths.

Definition at line 216 of file O3prmReader_tpl.h.

216 {
218 size_t i = 0;
219 size_t j = class_path.find(';');
220
221 while (j != std::string::npos) {
222 addClassPath(class_path.substr(i, j - i));
223 i = j + 1;
224
225 if (i < class_path.size()) {
226 j = class_path.find(';', i);
227 } else {
229 }
230 }
231
232 if (i < class_path.size()) { addClassPath(class_path.substr(i, std::string::npos)); }
233 }
void addClassPath(std::string_view class_path)
Add a list of paths to look for o3prm files.

References _class_path_, and addClassPath().

Here is the call graph for this function:

◆ showElegantErrors()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::o3prm::O3prmReader< GUM_SCALAR >::showElegantErrors ( std::ostream & o = std::cerr) const

send on std::cerr the list of errors

Definition at line 273 of file O3prmReader_tpl.h.

273 {
274 for (Idx i = 0; i < _errors_.count(); ++i) {
275 auto err = _errors_.error(i);
276 if (err.is_error) { o << _print_(err) << std::endl; }
277 }
278 }
std::string _print_(const ParseError &err) const

References _errors_, and _print_().

Here is the call graph for this function:

◆ showElegantErrorsAndWarnings()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::o3prm::O3prmReader< GUM_SCALAR >::showElegantErrorsAndWarnings ( std::ostream & o = std::cerr) const

send on std::cerr the list of errors or warnings

Definition at line 281 of file O3prmReader_tpl.h.

281 {
282 for (Idx i = 0; i < _errors_.count(); ++i) {
283 auto err = _errors_.error(i);
284 o << _print_(err) << std::endl;
285 }
286 }

References _errors_, and _print_().

Referenced by parseStream().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showErrorCounts()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::o3prm::O3prmReader< GUM_SCALAR >::showErrorCounts ( std::ostream & o = std::cerr) const

send on std::cerr the number of errors and the number of warnings

Definition at line 289 of file O3prmReader_tpl.h.

289 {
290 _errors_.syntheticResults(o);
291 }

References _errors_.

◆ warnings()

template<GUM_Numeric GUM_SCALAR>
Size gum::prm::o3prm::O3prmReader< GUM_SCALAR >::warnings ( ) const

of errors

Definition at line 299 of file O3prmReader_tpl.h.

299 {
300 return _errors_.warning_count;
301 }

References _errors_.

Member Data Documentation

◆ _class_path_

template<GUM_Numeric GUM_SCALAR>
std::vector< std::string > gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_class_path_
private

◆ _errors_

◆ _imported_

template<GUM_Numeric GUM_SCALAR>
Set< std::string > gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_imported_
private

Definition at line 172 of file O3prmReader.h.

Referenced by O3prmReader(), _copyImports_(), _parseImport_(), operator=(), and operator=().

◆ _o3_prm_

template<GUM_Numeric GUM_SCALAR>
std::unique_ptr< O3PRM > gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_o3_prm_
private

◆ _prm_

template<GUM_Numeric GUM_SCALAR>
PRM< GUM_SCALAR >* gum::prm::o3prm::O3prmReader< GUM_SCALAR >::_prm_
private

The documentation for this class was generated from the following files: