Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
StaticAnalyser Class Reference

#include <ored/scripting/staticanalyser.hpp>

+ Collaboration diagram for StaticAnalyser:

Public Member Functions

 StaticAnalyser (const ASTNodePtr root, const QuantLib::ext::shared_ptr< Context > context)
 
void run (const std::string &script="")
 
const std::map< std::string, std::set< QuantLib::Date > > & indexEvalDates () const
 
const std::map< std::string, std::set< QuantLib::Date > > & indexFwdDates () const
 
const std::map< std::string, std::set< QuantLib::Date > > & payObsDates () const
 
const std::map< std::string, std::set< QuantLib::Date > > & payPayDates () const
 
const std::map< std::string, std::set< QuantLib::Date > > & discountObsDates () const
 
const std::map< std::string, std::set< QuantLib::Date > > & discountPayDates () const
 
const std::set< QuantLib::Date > & regressionDates () const
 
const std::map< std::string, std::set< QuantLib::Date > > & fwdCompAvgFixingDates () const
 
const std::map< std::string, std::set< QuantLib::Date > > & fwdCompAvgEvalDates () const
 
const std::map< std::string, std::set< QuantLib::Date > > & fwdCompAvgStartEndDates () const
 
const std::map< std::string, std::set< QuantLib::Date > > & probFixingDates () const
 

Private Attributes

const ASTNodePtr root_
 
const QuantLib::ext::shared_ptr< Contextcontext_
 
std::map< std::string, std::set< QuantLib::Date > > indexEvalDates_
 
std::map< std::string, std::set< QuantLib::Date > > indexFwdDates_
 
std::map< std::string, std::set< QuantLib::Date > > payObsDates_
 
std::map< std::string, std::set< QuantLib::Date > > payPayDates_
 
std::map< std::string, std::set< QuantLib::Date > > discountObsDates_
 
std::map< std::string, std::set< QuantLib::Date > > discountPayDates_
 
std::map< std::string, std::set< QuantLib::Date > > fwdCompAvgFixingDates_
 
std::map< std::string, std::set< QuantLib::Date > > fwdCompAvgEvalDates_
 
std::map< std::string, std::set< QuantLib::Date > > fwdCompAvgStartEndDates_
 
std::map< std::string, std::set< QuantLib::Date > > probFixingDates_
 
std::set< QuantLib::Date > regressionDates_
 

Detailed Description

assumption: the context passed to a script engine is const and no declarations of type event or index are allowed in a script.

Definition at line 36 of file staticanalyser.hpp.

Constructor & Destructor Documentation

◆ StaticAnalyser()

StaticAnalyser ( const ASTNodePtr  root,
const QuantLib::ext::shared_ptr< Context context 
)

Definition at line 38 of file staticanalyser.hpp.

39 : root_(root), context_(context) {}
const QuantLib::ext::shared_ptr< Context > context_

Member Function Documentation

◆ run()

void run ( const std::string &  script = "")

Definition at line 398 of file staticanalyser.cpp.

398 {
399 indexEvalDates_.clear();
400 indexFwdDates_.clear();
401 payObsDates_.clear();
402 payPayDates_.clear();
403 discountObsDates_.clear();
404 discountPayDates_.clear();
406 fwdCompAvgEvalDates_.clear();
408 probFixingDates_.clear();
409 regressionDates_.clear();
410
411 ASTNode* loc;
415
416 try {
417 root_->accept(runner);
418 } catch (const std::exception& e) {
419 std::ostringstream errorMessage;
420 errorMessage << "Error during static script analysis: " << e.what() << " at "
421 << (loc ? to_string(loc->locationInfo) : "(last visited ast node not known)")
422 << " - see log for more details.";
423
425 ALOG(errorMessage.str());
426
427 QL_FAIL(errorMessage.str());
428 }
429
430 DLOG("Static analyser finished without errors.");
431}
std::string script
std::map< std::string, std::set< QuantLib::Date > > discountPayDates_
std::map< std::string, std::set< QuantLib::Date > > indexEvalDates_
std::map< std::string, std::set< QuantLib::Date > > payObsDates_
std::map< std::string, std::set< QuantLib::Date > > fwdCompAvgStartEndDates_
std::set< QuantLib::Date > regressionDates_
std::map< std::string, std::set< QuantLib::Date > > probFixingDates_
std::map< std::string, std::set< QuantLib::Date > > payPayDates_
std::map< std::string, std::set< QuantLib::Date > > discountObsDates_
std::map< std::string, std::set< QuantLib::Date > > fwdCompAvgFixingDates_
std::map< std::string, std::set< QuantLib::Date > > indexFwdDates_
std::map< std::string, std::set< QuantLib::Date > > fwdCompAvgEvalDates_
#define DLOG(text)
Logging Macro (Level = Debug)
Definition: log.hpp:554
#define ALOG(text)
Logging Macro (Level = Alert)
Definition: log.hpp:544
#define LOGGERSTREAM(text)
Definition: log.hpp:631
std::string printCodeContext(std::string script, const ASTNode *loc, bool compact)
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

◆ indexEvalDates()

const std::map< std::string, std::set< QuantLib::Date > > & indexEvalDates ( ) const

Definition at line 44 of file staticanalyser.hpp.

44{ return indexEvalDates_; }

◆ indexFwdDates()

const std::map< std::string, std::set< QuantLib::Date > > & indexFwdDates ( ) const

Definition at line 47 of file staticanalyser.hpp.

47{ return indexFwdDates_; }

◆ payObsDates()

const std::map< std::string, std::set< QuantLib::Date > > & payObsDates ( ) const

Definition at line 50 of file staticanalyser.hpp.

50{ return payObsDates_; }

◆ payPayDates()

const std::map< std::string, std::set< QuantLib::Date > > & payPayDates ( ) const

Definition at line 53 of file staticanalyser.hpp.

53{ return payPayDates_; }

◆ discountObsDates()

const std::map< std::string, std::set< QuantLib::Date > > & discountObsDates ( ) const

Definition at line 56 of file staticanalyser.hpp.

56{ return discountObsDates_; }

◆ discountPayDates()

const std::map< std::string, std::set< QuantLib::Date > > & discountPayDates ( ) const

Definition at line 59 of file staticanalyser.hpp.

59{ return discountPayDates_; }

◆ regressionDates()

const std::set< QuantLib::Date > & regressionDates ( ) const

Definition at line 62 of file staticanalyser.hpp.

62{ return regressionDates_; }

◆ fwdCompAvgFixingDates()

const std::map< std::string, std::set< QuantLib::Date > > & fwdCompAvgFixingDates ( ) const

Definition at line 65 of file staticanalyser.hpp.

65{ return fwdCompAvgFixingDates_; }

◆ fwdCompAvgEvalDates()

const std::map< std::string, std::set< QuantLib::Date > > & fwdCompAvgEvalDates ( ) const

Definition at line 68 of file staticanalyser.hpp.

68{ return fwdCompAvgEvalDates_; }

◆ fwdCompAvgStartEndDates()

const std::map< std::string, std::set< QuantLib::Date > > & fwdCompAvgStartEndDates ( ) const

Definition at line 71 of file staticanalyser.hpp.

71 {
73 }

◆ probFixingDates()

const std::map< std::string, std::set< QuantLib::Date > > & probFixingDates ( ) const

Definition at line 76 of file staticanalyser.hpp.

76{ return probFixingDates_; }

Member Data Documentation

◆ root_

const ASTNodePtr root_
private

Definition at line 79 of file staticanalyser.hpp.

◆ context_

const QuantLib::ext::shared_ptr<Context> context_
private

Definition at line 80 of file staticanalyser.hpp.

◆ indexEvalDates_

std::map<std::string, std::set<QuantLib::Date> > indexEvalDates_
private

Definition at line 82 of file staticanalyser.hpp.

◆ indexFwdDates_

std::map<std::string, std::set<QuantLib::Date> > indexFwdDates_
private

Definition at line 82 of file staticanalyser.hpp.

◆ payObsDates_

std::map<std::string, std::set<QuantLib::Date> > payObsDates_
private

Definition at line 82 of file staticanalyser.hpp.

◆ payPayDates_

std::map<std::string, std::set<QuantLib::Date> > payPayDates_
private

Definition at line 82 of file staticanalyser.hpp.

◆ discountObsDates_

std::map<std::string, std::set<QuantLib::Date> > discountObsDates_
private

Definition at line 83 of file staticanalyser.hpp.

◆ discountPayDates_

std::map<std::string, std::set<QuantLib::Date> > discountPayDates_
private

Definition at line 83 of file staticanalyser.hpp.

◆ fwdCompAvgFixingDates_

std::map<std::string, std::set<QuantLib::Date> > fwdCompAvgFixingDates_
private

Definition at line 83 of file staticanalyser.hpp.

◆ fwdCompAvgEvalDates_

std::map<std::string, std::set<QuantLib::Date> > fwdCompAvgEvalDates_
private

Definition at line 83 of file staticanalyser.hpp.

◆ fwdCompAvgStartEndDates_

std::map<std::string, std::set<QuantLib::Date> > fwdCompAvgStartEndDates_
private

Definition at line 83 of file staticanalyser.hpp.

◆ probFixingDates_

std::map<std::string, std::set<QuantLib::Date> > probFixingDates_
private

Definition at line 84 of file staticanalyser.hpp.

◆ regressionDates_

std::set<QuantLib::Date> regressionDates_
private

Definition at line 85 of file staticanalyser.hpp.