Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
sensitivityinmemorystream.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 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/sensitivityinmemorystream.hpp
20 \brief Class for streaming SensitivityRecords from in-memory container
21 */
22
23#pragma once
24
26
27#include <set>
28
29namespace ore {
30namespace analytics {
31
32//! Class for streaming SensitivityRecords from csv file
34public:
35 //! Default constructor
37 //! Constructor from set of sensitivity records
38 template<class Iter>
39 SensitivityInMemoryStream(Iter begin, Iter end);
40 //! Returns the next SensitivityRecord in the stream
41 SensitivityRecord next() override;
42 //! Resets the stream so that SensitivityRecords can be streamed again
43 void reset() override;
44 /*! Add a record to the in-memory collection.
45
46 \warning this causes reset() to be called. In other words, after any call
47 to add, a call to next() will start at the beginning again.
48 */
49 void add(const SensitivityRecord& sr);
50
51private:
52 //! Container of records
53 std::vector<SensitivityRecord> records_;
54 //! Iterator to current element
55 std::vector<SensitivityRecord>::iterator itCurrent_;
56};
57
58template <class Iter>
59SensitivityInMemoryStream::SensitivityInMemoryStream(Iter begin, Iter end) : records_(begin, end) {}
60
61} // namespace analytics
62} // namespace ore
Class for streaming SensitivityRecords from csv file.
std::vector< SensitivityRecord >::iterator itCurrent_
Iterator to current element.
std::vector< SensitivityRecord > records_
Container of records.
void reset() override
Resets the stream so that SensitivityRecords 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.