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

Function allocateDataFrameColumn

src/bds.cpp:107–166  ·  view source on GitHub ↗

deprecated -- still needed by BDS

Source from the content-addressed store, hash-verified

105
106// deprecated -- still needed by BDS
107Rcpp::RObject allocateDataFrameColumn(int fieldT, size_t n) {
108 Rcpp::RObject ans;
109
110 switch(fieldT) {
111 case BLPAPI_DATATYPE_BOOL:
112 ans = Rcpp::LogicalVector(n, NA_LOGICAL);
113 break;
114 case BLPAPI_DATATYPE_CHAR:
115 ans = Rcpp::StringVector(n);
116 break;
117 case BLPAPI_DATATYPE_BYTE:
118 Rcpp::stop("Unsupported datatype: BLPAPI_DATATYPE_BYTE.");
119 break;
120 case BLPAPI_DATATYPE_INT32:
121 case BLPAPI_DATATYPE_INT64:
122 ans = Rcpp::IntegerVector(n, NA_INTEGER);
123 break;
124 case BLPAPI_DATATYPE_FLOAT32:
125 case BLPAPI_DATATYPE_FLOAT64:
126 ans = Rcpp::NumericVector(n, NA_REAL);
127 break;
128 case BLPAPI_DATATYPE_STRING:
129 ans = Rcpp::StringVector(n);
130 break;
131 case BLPAPI_DATATYPE_BYTEARRAY:
132 Rcpp::stop("Unsupported datatype: BLPAPI_DATATYPE_BYTEARRAY.");
133 break;
134 case BLPAPI_DATATYPE_DATE:
135 ans = Rcpp::NumericVector(n, NA_REAL);
136 ans = Rcpp::DateVector(ans);
137 break;
138 case BLPAPI_DATATYPE_TIME:
139 //FIXME: separate out time later
140 ans = Rcpp::NumericVector(n, NA_REAL);
141 addPosixClass(ans);
142 break;
143 case BLPAPI_DATATYPE_DECIMAL:
144 ans = Rcpp::NumericVector(n, NA_REAL);
145 break;
146 case BLPAPI_DATATYPE_DATETIME:
147 ans = Rcpp::NumericVector(n, NA_REAL);
148 addPosixClass(ans);
149 break;
150 case BLPAPI_DATATYPE_ENUMERATION:
151 ans = Rcpp::StringVector(n);
152 break;
153 case BLPAPI_DATATYPE_SEQUENCE:
154 Rcpp::stop("Unsupported datatype: BLPAPI_DATATYPE_SEQUENCE.");
155 break;
156 case BLPAPI_DATATYPE_CHOICE:
157 Rcpp::stop("Unsupported datatype: BLPAPI_DATATYPE_CHOICE.");
158 break;
159 case BLPAPI_DATATYPE_CORRELATION_ID:
160 ans = Rcpp::IntegerVector(n);
161 break;
162 default:
163 Rcpp::stop("Unsupported datatype outside of api blpapi_DataType_t scope.");
164 }

Callers 1

assertColumnDefinedFunction · 0.70

Calls 1

addPosixClassFunction · 0.85

Tested by

no test coverage detected