| 780 | }; |
| 781 | |
| 782 | Status check_binary(SEXP x, int64_t size) { |
| 783 | RVectorType rtype = GetVectorType(x); |
| 784 | switch (rtype) { |
| 785 | case BINARY: |
| 786 | break; |
| 787 | case LIST: { |
| 788 | // check this is a list of raw vectors |
| 789 | const SEXP* p_x = VECTOR_PTR_RO(x); |
| 790 | for (R_xlen_t i = 0; i < size; i++, ++p_x) { |
| 791 | if (TYPEOF(*p_x) != RAWSXP && (*p_x != R_NilValue)) { |
| 792 | return Status::Invalid("invalid R type to convert to binary"); |
| 793 | } |
| 794 | } |
| 795 | break; |
| 796 | } |
| 797 | default: |
| 798 | return Status::Invalid("invalid R type to convert to binary"); |
| 799 | } |
| 800 | return Status::OK(); |
| 801 | } |
| 802 | |
| 803 | template <typename T> |
| 804 | class RPrimitiveConverter<T, enable_if_binary<T>> |
no test coverage detected