找回密码
 注册
查看: 414|回复: 0

R语言 externalVector包 setExternalStorageClass()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-25 17:27:26 | 显示全部楼层 |阅读模式
setExternalStorageClass(externalVector)
setExternalStorageClass()所属R语言包:externalVector

                                         Create subclass of externalStorage
                                         创建的externalStorage的子类

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Function to create a subclass of "externalStorage" and associate native C methods with the class.
运作创建一个“externalStorage”的子类与类关联的本地C方法。


用法----------Usage----------


setExternalStorageClass(Class, methodNames, ..., contains = "externalStorage", where = topenv(parent.frame()))



参数----------Arguments----------

参数:Class
Character string, name for the class.  
字符串,类的名称。


参数:methodNames
Character vector, names of the native C functions for use as methods (see Adding Native Methods below).  
特征向量,作为使用方法(请参阅下面添加本地方法)本机C功能的名称。


参数:...
Other arguments passed to setClass.  
其他参数传递到setClass。


参数:contains
what classes does this class extend?  (These are called superclasses in some languages.) Should have at least one class name which is a subclass of "externalStorage".  
这个类扩展类? (这些被称为父在某些语言。)应至少有一个类名,这是一个子类“externalStorage”。


参数:where
The environment in which to store or remove the definition.  Defaults to the top-level environment of the calling function (the global environment for ordinary computations, but the environment or namespace of a package when loading that package).  
所处的环境来存储或删除的定义。默认调用函数的顶级环境(普通计算的全球环境,但环境或加载该包时,包的命名空间)。


Details

详情----------Details----------

This function does two things. It creates a subclass of "externalStorage". It also associates a set of given C methods as native methods for this subclass of "externalStorage".
此功能做了两件事。它创建了一个子类“externalStorage”。它还联营一套作为为这个“externalStorage”的子类的本地方法的C方法。


添加本地方法----------Adding Native Methods----------

To make the external vectors as efficient as possible, the interface between the storage method classes and the "externalVectorWithSTorage" class uses a set of C function pointers for each subclass of "externalStorage". There are two types of methods - those which are for a particular type of vector and those which are not for a particular type. For a type xxx where xxx is one of logical, integer, numeric, complex or character, the type specific functions are
为了使尽可能高效的外部向量,存储方法类和的“externalVectorWithSTorage”类之间的接口使用一套C函数指针,为每个子类的“externalStorage”。有两种类型的方法 - 那些为特定类型的向量和那些没有特定类型的。一个类型的xxx其中xxx是logical,integer,numeric,complex或character,具体的类型职能

get an element from vector of type xxx
从元素的向量类型XXX

set an element in a vector of type xxx
设置类型XXX矢量元素

subset a vector of type xxx
一个子集向量类型XXX

subassign a vector of type xxx
subassign 1向量类型XXX

get an element from matrix of type xxx
从元素的矩阵式XXX

set an element in a matrix of type xxx
设置类型XXX矩阵中的元素

subset a matrix of type xxx
一个子集矩阵类型XXX

subassign a matrix of type xxx
subassign 1矩阵类型XXX

The functions not specific to any type are
不特定的任何类型的功能

allocate a new storage object
分配新的存储对象

return the length of the vector in the storage object
在存储对象返回向量的长度

modify the length of the vector in the storage object
在存储对象,修改向量的长度

The subset and subassign functions for vectors and matrices have reasonable default implementations in terms of the element get/set functions - so they need not be implemented for each "externalStorage" subclass.
子集和subassign向量和矩阵的功能,在元素方面有合理的默认实现get / set函数 - 所以他们需要不能实施每个“externalStorage的”子类。

The methodNames argument to setExternalStorageClass must be used to register any C function for use as a particular method. This argument must be a character vector with elements of the form methodName=functionName where methodName is one of the method names given in the tables above and function name is a C function name which has been registered as a C function with R using the foreign function registration mechanism. See the chapter on “System and foreign language interfaces” in “Writing R Extensions” in the "doc/manual" subdirectory of the R source tree for more details on registering C functions.
methodNamessetExternalStorageClass参数必须使用注册任何一个特定的方法使用的C函数。这个参数必须是一个字符向量元素的形式methodName=functionNamemethodName是在上述表格和函数名的方法名称之一,是一个C函数的名称已注册一个C函数与R使用外部函数注册机制。看到章“系统和外国语言接口”,“写R扩展注册C函数的更多细节,”在doc/manual的R源代码树的子目录。


参见----------See Also----------

setClass for possible arguments in .... externalStorage-class for the "externalStorage" class.
setClass在可能的参数.... externalStorage-class的“externalStorage”类。


举例----------Examples----------


## Not run: [#无法运行:]
setExternalStorageClass("simpleStorage", c(logicalGetElt="simpleLogicalGetElt",
                                           logicalSetElt="simpleLogicalSetElt",
                                           numericGetElt="simpleNumericGetElt",
                                           numericSetElt="simpleNumericSetElt",
                                           size="simpleSize",
                                           resize="simpleResize"
                                           alloc="simpleAlloc"),
                        contains = "externalStorage")

## End(Not run)[#结束(不运行)]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-2-9 10:18 , Processed in 0.020426 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表