初期値指定コンストラクタ (外部確保領域指定)
Namespace: FVILAssembly: FVILbasic (in FVILbasic.dll) Version: 3.1.0.0 (3.1.0.17)
Syntax
C# |
---|
public SHORT_ARRAY( SHORT_PTR adrs, int count, bool is_attach ) |
Visual Basic |
---|
Public Sub New ( adrs As SHORT_PTR, count As Integer, is_attach As Boolean ) |
Parameters
- adrs
- Type: fvalgcli..::..SHORT_PTR
配列の先頭アドレス
- count
- Type: System..::..Int32
要素数 (0~)
- is_attach
- Type: System..::..Boolean
アタッチ指定
Remarks
外部で確保した領域を指定してインスタンスを構築します。
詳しくは、
SetBuffer(SHORT_PTR, Int32, Boolean)
の説明をご参照ください。
設定に失敗した場合は例外を発行します。 例外の原因と発生位置を特定するには、発行された例外クラスの ErrorCode メンバと Function メンバを参照してください。
エラーコード:
値 | ErrorCode メンバ | 内容 |
---|---|---|
11 | FVIL.ErrorCode.INVALID_PARAMETER | 引数に指定された値が不正です。 |
Examples
ソースコード:
C# | Copy |
---|---|
using System; using System.Collections.Generic; using System.Text; using fvalgcli; namespace User.SampleCode.Array { public partial class SHORT_ARRAY { /// <summary> /// 初期値指定コンストラクタ (外部確保領域およびアタッチ指定). /// </summary> [FvPluginExecute] public void ctor_PTR_IsAttach() { int countOrg = 10; int countAlloc = 20; int countSet = 15; // 0) 配列の作成. short[] datas = new short[countOrg]; for (int i = 0; i < countOrg; i++) { datas[i] = (short)(i * 10 + i); } // 1) 領域の確保. fvalgcli.SHORT_PTR adrs = fvalgcli.SHORT_PTR.alloc(countAlloc); // 2) インスタンスの生成. FVIL.SHORT_ARRAY src1 = new FVIL.SHORT_ARRAY(adrs, countSet, true); // E) 確認. Assert.IsTrue(true == src1.IsAttach, "src1.IsAttach = {0}", src1.IsAttach); Assert.IsTrue(adrs == src1.Address, "src1.Address = {0}", src1.Address); Assert.IsTrue(countSet == src1.Count, "src1.Count = {0}", src1.Count); } } } |
Visual Basic | Copy |
---|---|
Imports System.Collections.Generic Imports System.Text Imports fvalgcli Namespace SampleCode.Array Public Partial Class SHORT_ARRAY ''' <summary> ''' 初期値指定コンストラクタ (外部確保領域およびアタッチ指定). ''' </summary> <FvPluginExecute> _ Public Sub ctor_PTR_IsAttach() Dim countOrg As Integer = 10 Dim countAlloc As Integer = 20 Dim countSet As Integer = 15 ' 0) 配列の作成. Dim datas As Short() = New Short(countOrg - 1) {} For i As Integer = 0 To countOrg - 1 datas(i) = CShort(i * 10 + i) Next ' 1) 領域の確保. Dim adrs As fvalgcli.SHORT_PTR = fvalgcli.SHORT_PTR.alloc(countAlloc) ' 2) インスタンスの生成. Dim src1 As New FVIL.SHORT_ARRAY(adrs, countSet, True) ' E) 確認. Assert.IsTrue(True = src1.IsAttach, "src1.IsAttach = {0}", src1.IsAttach) Assert.IsTrue(adrs = src1.Address, "src1.Address = {0}", src1.Address) Assert.IsTrue(countSet = src1.Count, "src1.Count = {0}", src1.Count) End Sub End Class End Namespace |
Exceptions
Exception | Condition |
---|---|
FVIL..::..CFviException | この例外の原因については、上記のエラーコード表をご参照ください。 |