1
###########################################################################/**
2
# @RdocClass RspObject
3
#
4
# @title "The abstract RspObject class"
5
#
6
# \description{
7
#  @classhierarchy
8
#
9
#  An RspObject represents an instance a specific RSP class.
10
# }
11
#
12
# @synopsis
13
#
14
# \arguments{
15
#   \item{value}{An R object.}
16
#   \item{attrs}{RSP attributes as a named @list, e.g. \code{type},
17
#      \code{language}, and \code{source}.}
18
#   \item{...}{Additional named RSP attributes.}
19
# }
20
#
21
# \section{Fields and Methods}{
22
#  @allmethods
23
# }
24
#
25
# @author
26
#
27
# @keyword internal
28
#*/###########################################################################
29
setConstructorS3("RspObject", function(value=NA, attrs=list(), ...) {
30
  # Argument 'attrs':
31 1
  if (!is.list(attrs)) {
32 0
    throw("Argument 'attrs' is not a list: ", mode(attrs)[1L])
33
  }
34

35
  # Argument '...':
36 1
  userAttrs <- list(...)
37

38

39 1
  this <- extend(value, "RspObject")
40 1
  this <- setAttributes(this, attrs)
41 1
  this <- setAttributes(this, userAttrs)
42 1
  this
43
})
44

45

46

47
#########################################################################/**
48
# @RdocMethod print
49
# @alias print.RspDocument
50
# @alias print.RspFileProduct
51
# @alias print.RspProduct
52
# @alias print.RspSourceCode
53
# @alias print.RspString
54
# @alias print.RspStringProduct
55
#
56
# @title "Prints a summary of an RSP object"
57
#
58
# \description{
59
#  @get "title".
60
# }
61
#
62
# @synopsis
63
#
64
# \arguments{
65
#   \item{...}{Not used.}
66
# }
67
#
68
# \value{
69
#  Returns nothing.
70
# }
71
#
72
# @author
73
#
74
# \seealso{
75
#   @seeclass
76
# }
77
#*/#########################################################################
78
setMethodS3("print", "RspObject", function(x, ...) {
79 1
  s <- NextMethod()
80 1
  s <- c(sprintf("%s:", class(x)[1L]), s)
81 1
  s <- paste(s, collapse="\n")
82 1
  cat(s, "\n", sep="")
83
}, protected=TRUE)

Read our documentation on viewing source code .

Loading