| 49 | using BloombergLP::blpapi::MessageIterator; |
| 50 | |
| 51 | void* checkExternalPointer(SEXP xp_, const char* valid_tag) { |
| 52 | if(xp_ == R_NilValue) { |
| 53 | throw std::logic_error("External pointer is NULL."); |
| 54 | } |
| 55 | if(TYPEOF(xp_) != EXTPTRSXP) { |
| 56 | throw std::logic_error("Not an external pointer."); |
| 57 | } |
| 58 | |
| 59 | if(R_ExternalPtrTag(xp_)==R_NilValue) { |
| 60 | throw std::logic_error("External pointer tag is NULL."); |
| 61 | } |
| 62 | const char* xp_tag = CHAR(PRINTNAME(R_ExternalPtrTag(xp_))); |
| 63 | if(!xp_tag) { |
| 64 | throw std::logic_error("External pointer tag is blank."); |
| 65 | } |
| 66 | if(std::strcmp(xp_tag,valid_tag) != 0) { |
| 67 | throw std::logic_error("External pointer tag does not match."); |
| 68 | } |
| 69 | if(R_ExternalPtrAddr(xp_)==NULL) { |
| 70 | throw std::logic_error("External pointer address is null."); |
| 71 | } |
| 72 | return R_ExternalPtrAddr(xp_); |
| 73 | } |
| 74 | |
| 75 | const int bbgDateToRDate(const Datetime& bbg_date) { |
| 76 | if(bbg_date.hasParts(DatetimeParts::TIME)) { |
no outgoing calls
no test coverage detected