| 20092 |
jmc |
1 |
\name{genericFunction-class}
|
|
|
2 |
\docType{class}
|
|
|
3 |
\alias{genericFunction-class}
|
|
|
4 |
\alias{groupGenericFunction-class}
|
|
|
5 |
\title{Generic Function Objects }
|
| 21544 |
ripley |
6 |
\description{
|
|
|
7 |
Generic functions (objects from or extending class
|
| 20092 |
jmc |
8 |
\code{genericFunction}) are extended function objects,
|
|
|
9 |
containing information used in creating and dispatching methods for
|
|
|
10 |
this function. They also identify the package associated with the
|
| 21544 |
ripley |
11 |
function and its methods.
|
|
|
12 |
}
|
| 20092 |
jmc |
13 |
\section{Objects from the Class}{
|
| 21544 |
ripley |
14 |
Generic functions are created and assigned by
|
| 20092 |
jmc |
15 |
\code{\link{setGeneric}} or \code{\link{setGroupGeneric}} and, indirectly, by
|
|
|
16 |
\code{\link{setMethod}}.
|
|
|
17 |
|
| 21544 |
ripley |
18 |
As you might expect \code{\link{setGeneric}} and
|
|
|
19 |
\code{\link{setGroupGeneric}} create objects of class
|
|
|
20 |
\code{"genericFunction"} and \code{"groupGenericFunction"} respectively.
|
| 20092 |
jmc |
21 |
}
|
|
|
22 |
\section{Slots}{
|
|
|
23 |
\describe{
|
|
|
24 |
\item{\code{.Data}:}{Object of class \code{"function"}, the
|
|
|
25 |
function definition of the generic, usually created
|
|
|
26 |
automatically as a call to \code{\link{standardGeneric}}. }
|
|
|
27 |
\item{\code{generic}:}{Object of class \code{"character"}, the
|
|
|
28 |
name of the generic function. }
|
|
|
29 |
\item{\code{package}:}{Object of class \code{"character"}, the
|
|
|
30 |
name of the package to which the function definition belongs
|
|
|
31 |
(and \emph{not} necessarily where the generic function is
|
|
|
32 |
stored). If the package is not specified explicitly in the
|
|
|
33 |
call to \code{setGeneric}, it is usually the package on which
|
|
|
34 |
the corresponding non-generic function exists. }
|
|
|
35 |
\item{\code{group}:}{Object of class \code{"list"}, the group or
|
|
|
36 |
groups to which this generic function belongs. Empty by default. }
|
|
|
37 |
\item{\code{valueClass}:}{Object of class \code{"character"}; if
|
| 20676 |
jmc |
38 |
not an empty character vector, identifies one or more classes. It is
|
| 20092 |
jmc |
39 |
asserted that all methods for this function return objects
|
| 20676 |
jmc |
40 |
from these class (or from classes that extend them). }
|
| 20092 |
jmc |
41 |
\item{\code{signature}:}{Object of class \code{"character"}, the
|
|
|
42 |
vector of formal argument names that can appear in the
|
|
|
43 |
signature of methods for this generic function. By default,
|
|
|
44 |
it is all the formal arguments, except for \dots. Order
|
|
|
45 |
matters for efficiency: the most commonly used arguments in
|
|
|
46 |
specifying methods should come first. }
|
|
|
47 |
\item{\code{default}:}{Object of class \code{"OptionalMethods"},
|
|
|
48 |
the default method for this function. Generated
|
|
|
49 |
automatically and used to initialize method dispatch. }
|
|
|
50 |
\item{\code{skeleton}:}{Object of class \code{"call"}, a slot used
|
| 20676 |
jmc |
51 |
internally in method dispatch. Don't expect to use it
|
|
|
52 |
directly.}
|
| 20092 |
jmc |
53 |
}
|
|
|
54 |
}
|
|
|
55 |
\section{Extends}{
|
| 21544 |
ripley |
56 |
Class \code{"function"}, from data part.\cr
|
| 23531 |
hornik |
57 |
Class \code{"OptionalMethods"}, by class \code{"function"}.\cr
|
|
|
58 |
Class \code{"PossibleMethod"}, by class \code{"function"}.
|
| 20092 |
jmc |
59 |
}
|
|
|
60 |
\section{Methods}{
|
| 21544 |
ripley |
61 |
Generic function objects are used in the creation and dispatch of
|
|
|
62 |
formal methods; information from the object is used to create methods
|
|
|
63 |
list objects and to merge or update the existing methods for this
|
|
|
64 |
generic.
|
| 20092 |
jmc |
65 |
}
|
|
|
66 |
\keyword{classes}
|