MCPcopy Create free account
hub / github.com/Rblp/Rblpapi / processMessage

Function processMessage

src/lookup.cpp:51–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49};
50
51void processMessage(bbg::Message &msg, InstrumentListResults &matches, const bool verbose) {
52 bbg::Element response = msg.asElement();
53 if (verbose) response.print(Rcpp::Rcout);
54 if (std::strcmp(response.name().string(),"InstrumentListResponse")) {
55 throw std::logic_error("Not a valid InstrumentListResponse.");
56 }
57
58 bbg::Element data = response.getElement("results");
59 int numItems = data.numValues();
60 if (verbose) {
61 Rcpp::Rcout <<"Response contains " << numItems << " items" << std::endl;
62 Rcpp::Rcout <<"security\t\tdescription" << std::endl;
63 }
64
65 for (int i = 0; i < numItems; ++i) {
66 bbg::Element item = data.getValueAsElement(i);
67 std::string security = item.getElementAsString(SECURITY);
68 std::string description = item.getElementAsString(DESCRIPTION);
69 if (verbose) {
70 Rcpp::Rcout << security << "\t\t" << description << std::endl;
71 }
72 matches.security.push_back(security);
73 matches.description.push_back(description);
74 }
75}
76
77void processResponseEvent(bbg::Event &event, InstrumentListResults &matches, const bool verbose) {
78 bbg::MessageIterator msgIter(event);

Callers 1

processResponseEventFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected