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

#include <orea/simm/crifloader.hpp>

+ Inheritance diagram for CsvFileCrifLoader:
+ Collaboration diagram for CsvFileCrifLoader:

Public Member Functions

 CsvFileCrifLoader (const std::string &filename, const QuantLib::ext::shared_ptr< SimmConfiguration > &configuration, const std::vector< std::set< std::string > > &additionalHeaders={}, bool updateMapper=false, bool aggregateTrades=true, char eol='\n', char delim='\t', char quoteChar='\0', char escapeChar='\\', const std::string &nullString="#N/A")
 
- Public Member Functions inherited from StringStreamCrifLoader
 StringStreamCrifLoader (const QuantLib::ext::shared_ptr< SimmConfiguration > &configuration, const std::vector< std::set< std::string > > &additionalHeaders={}, bool updateMapper=false, bool aggregateTrades=true, char eol='\n', char delim='\t', char quoteChar='\0', char escapeChar='\\', const std::string &nullString="#N/A")
 
- Public Member Functions inherited from CrifLoader
 CrifLoader (const QuantLib::ext::shared_ptr< SimmConfiguration > &configuration, const std::vector< std::set< std::string > > &additionalHeaders={}, bool updateMapper=false, bool aggregateTrades=true)
 
virtual ~CrifLoader ()
 
virtual Crif loadCrif ()
 
const QuantLib::ext::shared_ptr< SimmConfiguration > & simmConfiguration ()
 SIMM configuration getter. More...
 

Protected Member Functions

std::stringstream stream () const override
 
- Protected Member Functions inherited from StringStreamCrifLoader
Crif loadCrifImpl () override
 
Crif loadFromStream (std::stringstream &&stream)
 Core CRIF loader from generic istream. More...
 
virtual std::stringstream stream () const =0
 
void processHeader (const std::vector< std::string > &headers)
 Process the elements of a header line of a CRIF file. More...
 
bool process (const std::vector< std::string > &entries, QuantLib::Size maxIndex, QuantLib::Size currentLine, Crif &result)
 
- Protected Member Functions inherited from CrifLoader
virtual Crif loadCrifImpl ()=0
 
void addRecordToCrif (Crif &crif, CrifRecord &&recordToAdd) const
 
void validateSimmRecord (const CrifRecord &cr) const
 Check if the record is a valid Simm Crif Record. More...
 
void currencyOverrides (CrifRecord &crifRecord) const
 Override currency codes. More...
 
void updateMapping (const CrifRecord &cr) const
 update bucket mappings More...
 

Protected Attributes

std::string filename_
 
- Protected Attributes inherited from StringStreamCrifLoader
std::map< QuantLib::Size, QuantLib::Size > columnIndex_
 
std::map< QuantLib::Size, std::set< std::string > > additionalHeadersIndexMap_
 
char eol_
 
char delim_
 
char quoteChar_
 
char escapeChar_
 
std::string nullString_
 
- Protected Attributes inherited from CrifLoader
QuantLib::ext::shared_ptr< SimmConfigurationconfiguration_
 Simm configuration that is used during loading of CRIF records. More...
 
std::vector< std::set< std::string > > additionalHeaders_
 Defines accepted column headers, beyond required and optional headers, see crifloader.cpp. More...
 
bool updateMapper_
 
bool aggregateTrades_
 

Additional Inherited Members

- Static Protected Attributes inherited from CrifLoader
static std::map< QuantLib::Size, std::set< std::string > > requiredHeaders
 Map giving required CRIF file headers and their allowable alternatives. More...
 
static std::map< QuantLib::Size, std::set< std::string > > optionalHeaders
 Map giving optional CRIF file headers and their allowable alternatives. More...
 

Detailed Description

Definition at line 138 of file crifloader.hpp.

Constructor & Destructor Documentation

◆ CsvFileCrifLoader()

CsvFileCrifLoader ( const std::string &  filename,
const QuantLib::ext::shared_ptr< SimmConfiguration > &  configuration,
const std::vector< std::set< std::string > > &  additionalHeaders = {},
bool  updateMapper = false,
bool  aggregateTrades = true,
char  eol = '\n',
char  delim = '\t',
char  quoteChar = '\0',
char  escapeChar = '\\',
const std::string &  nullString = "#N/A" 
)

Definition at line 140 of file crifloader.hpp.

141 {},
142 bool updateMapper = false, bool aggregateTrades = true, char eol = '\n', char delim = '\t',
143 char quoteChar = '\0', char escapeChar = '\\', const std::string& nullString = "#N/A")
144 : StringStreamCrifLoader(configuration, additionalHeaders, updateMapper, aggregateTrades, eol, delim, quoteChar,
145 escapeChar, nullString),
146 filename_(filename) {}
StringStreamCrifLoader(const QuantLib::ext::shared_ptr< SimmConfiguration > &configuration, const std::vector< std::set< std::string > > &additionalHeaders={}, bool updateMapper=false, bool aggregateTrades=true, char eol='\n', char delim='\t', char quoteChar='\0', char escapeChar='\\', const std::string &nullString="#N/A")
Definition: crifloader.cpp:197

Member Function Documentation

◆ stream()

std::stringstream stream ( ) const
overrideprotectedvirtual

Implements StringStreamCrifLoader.

Definition at line 216 of file crifloader.cpp.

216 {
217 // Try to open the file
218 ifstream file;
219 std::stringstream result;
220 file.open(filename_);
221 QL_REQUIRE(file.is_open(), "error opening file " << filename_);
222 result << file.rdbuf();
223 file.close();
224 return result;
225}

Member Data Documentation

◆ filename_

std::string filename_
protected

Definition at line 149 of file crifloader.hpp.