Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
sensitivityinmemorystream.cpp
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
21
22using std::set;
23
24namespace ore {
25namespace analytics {
26
28
30 // If there are no more records, return the empty record
31 if (itCurrent_ == records_.end())
32 return SensitivityRecord();
33
34 // If there are more, return the current record and advance the iterator
35 return *(itCurrent_++);
36}
37
39 // Reset iterator to start of container
40 itCurrent_ = records_.begin();
41}
42
44 // Insert the record
45 records_.push_back(sr);
46
47 // Reset because itCurrent_ possibly invalidated by the insert
48 reset();
49}
50
51} // namespace analytics
52} // namespace ore
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.
Class for streaming SensitivityRecords from in-memory container.