Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
sensitivityreportstream.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2024 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 orea/engine/sensitivityreportstream.hpp
20 \brief Class for streaming SensitivityRecords from a report
21 */
22
23#pragma once
24
27
28#include <fstream>
29#include <string>
30
31namespace ore {
32namespace analytics {
33
34//! Class for streaming SensitivityRecords from csv file
36public:
37 //! Constructor
38 SensitivityReportStream(const QuantLib::ext::shared_ptr<ore::data::InMemoryReport>& report) : report_(report) {}
39 virtual ~SensitivityReportStream() {} // Declare virtual destructor
40
41 //! Returns the next SensitivityRecord in the stream
42 SensitivityRecord next() override;
43 //! Resets the stream so that SensitivityRecord objects can be streamed again
44 void reset() override;
45
46private:
47 QuantLib::ext::shared_ptr<ore::data::InMemoryReport> report_;
48
49 QuantLib::Size row_ = 0;
50
51 //! Create a record from a collection of strings
52 SensitivityRecord processRecord(const std::vector<ore::data::Report::ReportType>& entries) const;
53};
54
55} // namespace analytics
56} // namespace ore
Class for streaming SensitivityRecords from csv file.
SensitivityRecord processRecord(const std::vector< ore::data::Report::ReportType > &entries) const
Create a record from a collection of strings.
SensitivityReportStream(const QuantLib::ext::shared_ptr< ore::data::InMemoryReport > &report)
Constructor.
QuantLib::ext::shared_ptr< ore::data::InMemoryReport > report_
void reset() override
Resets the stream so that SensitivityRecord objects can be streamed again.
SensitivityRecord next() override
Returns the next SensitivityRecord in the stream.
Base Class for streaming SensitivityRecords.
Base class for sensitivity record streamer.