【机器视觉】 global算子
00. 目錄
文章目錄
- 00. 目錄
- 01. 概述
- 02. 簽名
- 03. 描述
- 04. 注意
- 05. 參數
- 06. 結果
- 07. 附錄
01. 概述
global - 聲明一個全局變量。
02. 簽名
global( : : Declaration : )
03. 描述
可以用來聲明一個全局變量。 聲明的全局變量對所有其他程序也是可見的,所有其他程序也需要顯式聲明與全局變量相同的變量。
如果某個變量沒有在程序中顯式聲明為全局變量,則即使存在具有相同名稱的全局變量,該變量也是該程序中的局部變量。
參數Declaration 由可選關鍵字’def’,類型’object’或’tuple’,可選關鍵字’vector’(后接圓括號中的所需維度)和變量名組成的變量聲明等部分組成。
聲明一個圖型變量的類型為’object’,聲明一個控制變量為’tuple’。
關鍵字’def’將一個聲明顯式標記為變量被定義的地方。 在大多數情況下,這不是必須的,因為在HDevelop中,變量實例只要在某個地方被聲明就立即創建。 但是,如果將多個程序導出為編程語言,并且如果這些程序不是導出到一個包含所有程序的輸出文件中,而是導出到單獨的輸出文件中,標記全局變量定義的位置是必須的。 鏈接(引用)到一個庫或應用程序的一組程序導出文件必須包含每個全局變量的一個定義,以避免符號未定義和多次定義。
在程序列表中,全局變量聲明需要顯示,并且必須不能輸入括號,以強調該行是聲明而不是可執行的算子。 語法如下:
global [def] {object|tuple} [vector()]
原文描述:
The global statement can be used to declare a global variable. By declaring a variable as global the variable becomes visible to all other procedures that also declare the same variable explicitly as global.
If a variable is not explicitly declared as global inside a procedure, the variable is local within that procedure even if there is a global variable with the same name.
The parameter Declaration contains the variable declaration that consists of the optional keyword ‘def’, the type ‘object’ or ‘tuple’, the optional keyword ‘vector’ (followed by the desired dimension in round brackets), and the variable name.
Setting the type to ‘object’ an iconic variable is declared, by setting it to ‘tuple’ a control variable is declared.
The keyword ‘def’ allows to mark one declaration explicitly as the place where the variable is defined. In most cases this will not be necessary because in HDevelop the variable instance is created as soon as it is declared somewhere. However, if several procedures are exported to a programming language and if the procedures are not exported into one output file that contains all procedures together but into separate output files it will become necessary to mark one of the global variable declarations as the place where the variable is defined. A set of procedure export files that are linked to one library or application must contain exactly one definition of each global variable in order to avoid both undefined symbols and multiple definitions.
In the program listing, global variable declarations are displayed and must be entered without parenthesis in order to emphasize that the line is a declaration and not an executable operator. The syntax is as follows:
global [def] {object|tuple} [vector()]
04. 注意
略
05. 參數
Declaration (input_control) string → (string)
全局變量聲明:可選關鍵字’def’,類型和變量名稱
推薦值: ‘object’, ‘tuple’, ‘def object’, ‘def tuple’, ‘object vector(1)’, ‘tuple vector(1)’, ‘def object vector(1)’, ‘def tuple vector(1)’
06. 結果
global不會執行。
HDevelop例程
variable_types.hdev Define variable types in HDevelop
07. 附錄
7.1 機器視覺博客匯總
網址:https://dengjin.blog.csdn.net/article/details/116837497
總結
以上是生活随笔為你收集整理的【机器视觉】 global算子的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【机器视觉】 export_def算子
- 下一篇: 【机器视觉】 import算子