This source file includes following definitions.
- to_string
- to_string
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 namespace isimud { namespace exchanges { namespace MIT { namespace common {
22
23 constexpr inline
24 ref_data::security_id_key::security_id_key(element_type const &isin) noexcept(true)
25 : isin_(isin) {
26 }
27
28 inline
29 ref_data::security_id_key::security_id_key(ref_data::MF_Record const &mfr) noexcept(true)
30 : isin_(mfr.isin) {
31 }
32
33 inline bool
34 ref_data::security_id_key::operator==(security_id_key const &sik) const noexcept(true) {
35 return isin_==sik.isin_;
36 }
37
38 inline std::string
39 ref_data::security_id_key::to_string() const noexcept(false) {
40 std::ostringstream os;
41 os
42 <<"ISIN="<<isin_.to_string();
43 return os.str();
44 }
45
46 inline ref_data::hash_security_id_key::element_type
47 ref_data::hash_security_id_key::operator()(security_id_key const sik) const noexcept {
48 return sik.isin_.hash();
49 }
50
51 inline
52 ref_data::ref_data(std::istream &is) {
53 std::string line;
54 while (std::getline(is, line, '\n')) {
55 std::regex word_regex("(\"[^\"]+\")|[^;]+");
56 auto what=std::sregex_iterator(line.begin(), line.end(), word_regex);
57 auto wend=std::sregex_iterator();
58 std::smatch sid=*std::next(what, instrument_id_field);
59 std::smatch isin=*std::next(what, isin_field);
60 const MF_Record mfr{
61 boost::lexical_cast<common::SecurityID_t>(sid.str()),
62 boost::lexical_cast<security_id_key::element_type>(isin.str()),
63 };
64 lookup_instrument_id_.emplace(security_id_key(mfr), mfr.instrument);
65 lookup_isin_.emplace(mfr.instrument, security_id_key(mfr));
66 }
67 }
68
69 inline std::string
70 ref_data::to_string() const noexcept(false) {
71 std::ostringstream os;
72 os
73 <<"lookup_instrument_id: size="<<lookup_instrument_id_.size()<<", ";
74 for (auto const &i : lookup_isin_) {
75 os
76 <<"security_id_key="<<i.first
77 <<", ISIN="<<i.second;
78 }
79 os
80 <<"lookup_isin: size="<<lookup_isin_.size()<<", ";
81 for (auto const &i : lookup_isin_) {
82 os
83 <<"ISIN="<<i.first
84 <<", security_id_key="<<i.second;
85 }
86 return os.str();
87 }
88
89 inline std::ostream &
90 operator<<(std::ostream &os, ref_data::security_id_key const &sik) noexcept(false) {
91 os<<sik.to_string();
92 return os;
93 }
94
95 inline std::ostream &
96 operator<<(std::ostream &os, ref_data_t rd) noexcept(false) {
97 os<<rd.to_string();
98 return os;
99 }
100
101 } } } }