| 1 | #' Utility Functions |
| 2 | #' |
| 3 | #' Utility functions |
| 4 | #' |
| 5 | #' \code{zmq.strerror()} gets ZeroMQ error message string. |
| 6 | #' |
| 7 | #' \code{zmq.version()} print current ZeroMQ version. |
| 8 | #' |
| 9 | #' @param errno |
| 10 | #' an integer for the error number |
| 11 | #' |
| 12 | #' @return |
| 13 | #' \code{zmq.strerror()} returns an R string containing ZeroMQ error |
| 14 | #' message. |
| 15 | #' |
| 16 | #' @author Wei-Chen Chen \email{wccsnow@@gmail.com}. |
| 17 | #' |
| 18 | #' @references ZeroMQ/4.1.0 API Reference: |
| 19 | #' \url{http://api.zeromq.org/4-1:_start} |
| 20 | #' |
| 21 | #' Programming with Big Data in R Website: \url{https://pbdr.org/} |
| 22 | #' |
| 23 | #' @examples |
| 24 | #' \dontrun{ |
| 25 | #' library(pbdZMQ, quietly = TRUE) |
| 26 | #' |
| 27 | #' context <- zmq.ctx.new() |
| 28 | #' zmq.ctx.destroy(context) |
| 29 | #' zmq.strerror(0) |
| 30 | #' |
| 31 | #' zmq.ctx.destroy(context) # Error since context is free. |
| 32 | #' zmq.strerror(14) |
| 33 | #' } |
| 34 | #' |
| 35 | #' @keywords internal |
| 36 | #' @seealso \code{\link{zmq.ctx.new}()}, \code{\link{zmq.ctx.destroy}()}, |
| 37 | #' \code{\link{zmq.socket}()}, \code{\link{zmq.close}()}. |
| 38 | #' @rdname xx_utility |
| 39 | #' @name Utility Functions |
| 40 | NULL |
| 41 | |
| 42 | |
| 43 | |
| 44 | #' @rdname xx_utility |
| 45 | #' @export |
| 46 | zmq.strerror <- function(errno){ |
| 47 | .Call("R_zmq_strerror", as.integer(errno[1]), PACKAGE = "pbdZMQ") |
| 48 | } |
| 49 | |
| 50 | |
| 51 | #' @rdname xx_utility |
| 52 | #' @export |
| 53 | zmq.version <- function(){ |
| 54 | ret <- .Call("R_zmq_version", PACKAGE = "pbdZMQ") |
| 55 | package_version(ret) |
| 56 | } |
| 57 |