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