Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
qle
quotes
exceptionquote.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2016 Quaternion Risk Management Ltd
3
All rights reserved.
4
5
This file is part of ORE, a free-software/open-source library
6
for transparent pricing and risk analysis - http://opensourcerisk.org
7
8
ORE is free software: you can redistribute it and/or modify it
9
under the terms of the Modified BSD License. You should have received a
10
copy of the license along with this program.
11
The license is also available online at <http://opensourcerisk.org>
12
13
This program is distributed on the basis that it will form a useful
14
contribution to risk analytics and model standardisation, but WITHOUT
15
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17
*/
18
19
/*! \file quotes/exceptionquote.hpp
20
\brief throws exception when called
21
\ingroup quotes
22
*/
23
24
#ifndef quantext_exceptionquote_hpp
25
#define quantext_exceptionquote_hpp
26
27
#include <ql/quote.hpp>
28
29
namespace
QuantExt
{
30
using namespace
QuantLib
;
31
32
//! A dummy quote class that throws an exception when value is called.
33
/*!
34
\ingroup quotes
35
*/
36
class
ExceptionQuote
:
public
Quote,
public
Observer {
37
public
:
38
ExceptionQuote
(std::string exception =
"you've hit an 'ExceptionQuote'"
) :
exception_
(exception) {}
39
//! \name Inspectors
40
//@{
41
Real
quote
()
const
{
42
QL_FAIL(
exception_
);
43
return
0;
44
}
45
//@}
46
//! \name Quote interface
47
//@{
48
Real
value
()
const override
{
49
QL_FAIL(
exception_
);
50
return
0;
51
}
52
bool
isValid
()
const override
{
53
QL_FAIL(
exception_
);
54
return
false
;
55
}
56
//@}
57
//! \name Observer interface
58
//@{
59
void
update
()
override
{ QL_FAIL(
exception_
); };
60
//@}
61
protected
:
62
std::string
exception_
;
63
};
64
}
// namespace QuantExt
65
66
#endif
QuantExt::ExceptionQuote
A dummy quote class that throws an exception when value is called.
Definition:
exceptionquote.hpp:36
QuantExt::ExceptionQuote::update
void update() override
Definition:
exceptionquote.hpp:59
QuantExt::ExceptionQuote::quote
Real quote() const
Definition:
exceptionquote.hpp:41
QuantExt::ExceptionQuote::ExceptionQuote
ExceptionQuote(std::string exception="you've hit an 'ExceptionQuote'")
Definition:
exceptionquote.hpp:38
QuantExt::ExceptionQuote::exception_
std::string exception_
Definition:
exceptionquote.hpp:62
QuantExt::ExceptionQuote::value
Real value() const override
Definition:
exceptionquote.hpp:48
QuantExt::ExceptionQuote::isValid
bool isValid() const override
Definition:
exceptionquote.hpp:52
QuantExt
Definition:
namespaces.docs:19
QuantLib
Definition:
colombia.cpp:21
Generated by
Doxygen
1.9.5