COMTypedList-class | R Documentation |
These classes extend the basic COMList
.
They are used to represent DCOM types that have methods
that support a list-like interface.
In Office applications, this means that they have methods
named Item
and Count
which correspond to index accessors ([[
)
and length
in R.
We can therefore make these objects feel more
like R lists using methods defined for these classes.
Like COMList-class
, these
classes are not intended to be used directly, but
are to be used in creating derived or sub-classes.
These particular classes provide additional functionality for the
COMList-class
by specifying the type of the elements.
COMTypedList
knows that its elements have a type/class name
given by the singular of its own class. For example, if we had a
class named Workbooks
that extended COMTypedList
, then
elements returned via its Item
method would be coerced to class
Workbook
the singular of Workbooks
.
The class COMTypedNamedList
does essentially
the same thing, but does not rely on the
class name of its elements being the singular form of
its own class name. Instead, the class name is stored
with the COMTypedNamedList
object
and is used to coerce an element returned from
the Item
method to the appropriate R class.
(If we had class slots in the S4 system, we would
use that rather than putting the name into each instance
of a class. However, the overhead is small.)
This is used, for example, in the case of
our Workbooks
illustration above. In Excel,
the Workbooks
type behaves like a list
but returns elements which are of class _Workbook
.
In this case, the name
field in the
derived class Workbooks
would be
_Workbook
and elements would be coerced
to that R type.
These classes form part of the run-time infrastructure
for "compiled" or pre-processed classes to DCOM interfaces
that are generated from the type library describing a collection
of COM interfaces. See the SWinTypeLibs
package
and the generateInterface
function.
Objects can be created from these classes manually using
the familiar new
function. However, when
used in the "compiled" DCOM interfaces, they
are automatically created as return values or
arguments in methods where appropriate.
ref
:Object of class "externalptr"
, inherited
name
:character string (i.e. vector of length 1).
This is the field in the COMTypedNamedList
that specifies the name of the class for an element
of the list.
Class "COMList"
, directly.
Class "COMIDispatch"
, by class "COMList"
.
Class "IUnknown"
, by class "COMList"
.
signature(x = "COMTypedList", i = "ANY")
:
get the i-th element of the DCOM list
and coerce the result to the appropriate type specified by the
type of elements associated with the class.
Duncan Temple Lang (duncan@r-project.org)
http://www.omegahat.net/RDCOMClient http://www.omegahat.net/RDCOMServer http://www.omegahat.net/SWinTypeLibs http://www.omegahat.net/SWinRegistry
COMList-class
.COM
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.