自主翻译_cache自定义类和字典类(四)

Class Definitions and the Class Dictionary

自定义类和字典类

Every class has a definition that specifieswhat members (properties, methods, and so on) it contains as well as class-widecharacteristics (such as superclasses). These definitions are contained withinthe class dictionary, which is itself stored within the Caché database.

定义每一个类都有成员(属性、方法等等),它包含超类的特性(superclasses),这些包含字典类的定义,哪些本身存储在cache数据库中

Create class definitions

创建类

You can create class definitions in manyways:

创建类有许多的方式方式:

Using Caché Studio. The primary means ofworking with Caché class definitions is with the Caché Studio DevelopmentEnvironment.

cache studio. cache类定义最主要的方式是由studio开发环境

Using XML. Class definitions have anexternal, XML-based representation. Typically this format is used for storingclass definitions externally (such as in source control systems), deployingapplications, or simply for sharing code. You can also create new classdefinitions programmatically by simply generating the appropriate XML classdefinition file and loading it into a Caché system.

xml,外部类定义,基于xml的表示。通常这种格式是用于外部存储类定义(比如源代码控制系统),部署应用程序,或者简单的代码共享, 您还可以创建新的类定义编程通过生成适当的XML类定义文件加载到cache系统

Using an API. Caché includes a set of classdefinition classes that provide object access to the class dictionary. You canuse these to observe, modify, and create class definitions.

使用API cache 包含定义了一组对象类,是为了链接到字典类, 可以用这些对象类观察,修改,创建类定义

Using SQL DDL. Any relational tablesdefined by DDL statements are automatically converted to equivalent classdefinitions and placed within the class dictionary.

SQL DDL,(DDL数据定义语言),任务关系表的DDL语句自动转换成相同的类定义放置在字典类中。

In addition, Caché includes a set of tools(such as the Caché RoseLink connection to the Rational Rose modeling tool) aswell as Wizards (such as the Caché Activate Wizard) that automatically createclass definitions.

另外,cache包含一套工具(比如cache roselink 链接到rationalrose模型工具)以及向导(比如cache activeate 向导) 自动的创建类

The Class Dictionary【字典类】

Every Caché namespace contains its ownclass dictionary which defines the available classes for that namespace. Thereis a special “CACHELIB” database, installed as part of Caché, that contains thedefinitions and executable code for the classes of the Caché class library.These classes are referred to as system classes and all are part of packageswhose names start with a “%” character, such as %Library.Persistent (the namesof members of the %Library package can be abbreviated, so that %String is anabbreviation for %Library.String).

每个cache命名空间定义包含自己可用的字典类的名称空间.在一个专用的”CACHELIB”数据库中,安装后作为cache的一部份,包含定义的和可执行的代码cache类库.这些类被称为系统类且所有的类以”%”开头,比如%Library.Persistent(%Library包下的名称可以缩写,比如%String%Library.String的缩写)

EveryCaché namespace is automatically configured so that its class dictionary, inaddition to containing its own classes, has access to the systemclass definitions and code within the CACHELIB database. By thismechanism, all namespaces can make direct use of the classes in the Caché classlibrary.

每一个cache命名空间都配置这样的字典类,除了包含它自己的类,还能够访问到自定义类和cachelib数据库中的代码.根据这个原理,所有的命名空间可以使用cache类库中所有的类.

Theclass dictionary contains two distinct types of data

这些字典类由两个步骤:

Definitiondata — The actual class definitions that users create

定义数据这个自定义类实际上是由用户创建

Compilationdata — Data generated as a result of compiling class definitions is alsostored. This data includes the results of inheritance resolution; that is, itlists all the defined and inherited members for a given class. The classcompiler uses this to make other compilation more efficient; applications canalso use it (via the appropriate interface) to get runtime information aboutclass members

编译数据编译完一个自定义类后数据生成一个结果并存储.这些数据包含继承的结果;换言之, 它列出所有定义为一个给定的类和继承的成员. 类编译器使用其他编译更有效率;应用程序也可以使用它(通过适当的接口) 类成员去得运行时信息关于.

Theclass dictionary stores its data in a set of globals (persistent arrays) whosenames start with ^odd. The structure of these arrays may change with newversions of Caché, so applications should never directly observe or modifythese structures.

字典类存储它们的数据在一组globals(持久化数组)这些名称以^开头.这些结构化的数组可能会直到改变一个新版本的cache才会变, 所以不能直接观察到应用程序或修改这些结构.

以上翻译为本人学习时所有,翻译有误请谅解

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章