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

Class for streaming SensitivityRecords from csv file. More...

#include <orea/engine/sensitivityinmemorystream.hpp>

+ Inheritance diagram for SensitivityInMemoryStream:
+ Collaboration diagram for SensitivityInMemoryStream:

Public Member Functions

 SensitivityInMemoryStream ()
 Default constructor. More...
 
template<class Iter >
 SensitivityInMemoryStream (Iter begin, Iter end)
 Constructor from set of sensitivity records. More...
 
SensitivityRecord next () override
 Returns the next SensitivityRecord in the stream. More...
 
void reset () override
 Resets the stream so that SensitivityRecords can be streamed again. More...
 
void add (const SensitivityRecord &sr)
 
- Public Member Functions inherited from SensitivityStream
virtual ~SensitivityStream ()
 Destructor. More...
 
virtual SensitivityRecord next ()=0
 Returns the next SensitivityRecord in the stream. More...
 
virtual void reset ()=0
 Resets the stream so that SensitivityRecord objects can be streamed again. More...
 

Private Attributes

std::vector< SensitivityRecordrecords_
 Container of records. More...
 
std::vector< SensitivityRecord >::iterator itCurrent_
 Iterator to current element. More...
 

Detailed Description

Class for streaming SensitivityRecords from csv file.

Definition at line 33 of file sensitivityinmemorystream.hpp.

Constructor & Destructor Documentation

◆ SensitivityInMemoryStream() [1/2]

Default constructor.

Definition at line 27 of file sensitivityinmemorystream.cpp.

27: itCurrent_(records_.begin()) {}
std::vector< SensitivityRecord >::iterator itCurrent_
Iterator to current element.
std::vector< SensitivityRecord > records_
Container of records.

◆ SensitivityInMemoryStream() [2/2]

SensitivityInMemoryStream ( Iter  begin,
Iter  end 
)

Constructor from set of sensitivity records.

Definition at line 59 of file sensitivityinmemorystream.hpp.

59: records_(begin, end) {}

Member Function Documentation

◆ next()

SensitivityRecord next ( )
overridevirtual

Returns the next SensitivityRecord in the stream.

Implements SensitivityStream.

Definition at line 29 of file sensitivityinmemorystream.cpp.

29 {
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}

◆ reset()

void reset ( )
overridevirtual

Resets the stream so that SensitivityRecords can be streamed again.

Implements SensitivityStream.

Definition at line 38 of file sensitivityinmemorystream.cpp.

38 {
39 // Reset iterator to start of container
40 itCurrent_ = records_.begin();
41}
+ Here is the caller graph for this function:

◆ add()

void add ( const SensitivityRecord sr)

Add a record to the in-memory collection.

Warning:
this causes reset() to be called. In other words, after any call to add, a call to next() will start at the beginning again.

Definition at line 43 of file sensitivityinmemorystream.cpp.

43 {
44 // Insert the record
45 records_.push_back(sr);
46
47 // Reset because itCurrent_ possibly invalidated by the insert
48 reset();
49}
void reset() override
Resets the stream so that SensitivityRecords can be streamed again.
+ Here is the call graph for this function:

Member Data Documentation

◆ records_

std::vector<SensitivityRecord> records_
private

Container of records.

Definition at line 53 of file sensitivityinmemorystream.hpp.

◆ itCurrent_

std::vector<SensitivityRecord>::iterator itCurrent_
private

Iterator to current element.

Definition at line 55 of file sensitivityinmemorystream.hpp.