自主翻譯_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纔會變, 所以不能直接觀察到應用程序或修改這些結構.

以上翻譯爲本人學習時所有,翻譯有誤請諒解

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