internal static int StoreTupleVector(HTupleVector inVector, IntPtr vectorHandle) { int dimension = inVector.Dimension; int length = inVector.Length; if (dimension == 1) { for (int index = length - 1; index >= 0; --index) { IntPtr tuple; EngineAPI.HCkE(HalconAPI.CreateTuple(out tuple)); HalconAPI.StoreTuple(tuple, inVector[index].T); EngineAPI.HCkE(EngineAPI.SetTupleVectorTuple(vectorHandle, index, tuple)); EngineAPI.HCkE(HalconAPI.DestroyTuple(tuple)); } } else { for (int index = length - 1; index >= 0; --index) { IntPtr vectorHandle1; EngineAPI.HCkE(EngineAPI.CreateTupleVector(inVector[index], out vectorHandle1)); EngineAPI.HCkE(EngineAPI.SetTupleVectorVector(vectorHandle, index, vectorHandle1)); EngineAPI.HCkE(EngineAPI.DestroyTupleVector(vectorHandle1)); } } GC.KeepAlive((object)inVector); return(2); }
/// <summary>Sets input control parameter for procedure call</summary> public void SetInputCtrlParamVector(string name, HTupleVector vector) { IntPtr vectorHandle; HDevProcedureCall.HCkE(EngineAPI.CreateTupleVector(vector, out vectorHandle)); HDevProcedureCall.HCkE(EngineAPI.SetInputCtrlParamVector(this.call, name, vectorHandle)); GC.KeepAlive((object)this); HDevProcedureCall.HCkE(EngineAPI.DestroyTupleVector(vectorHandle)); }
/// <summary>Sets the value of a global control variable</summary> public void SetGlobalCtrlVarVector(string name, HTupleVector vector) { IntPtr vectorHandle; HDevEngine.HCkE(EngineAPI.CreateTupleVector(vector, out vectorHandle)); HDevEngine.HCkE(EngineAPI.SetGlobalCtrlVarVector(this.engine, name, vectorHandle)); GC.KeepAlive((object)this); HDevEngine.HCkE(EngineAPI.DestroyTupleVector(vectorHandle)); }
internal static int CreateTupleVector(HTupleVector inVector, out IntPtr vectorHandle) { IntPtr vector_handle; EngineAPI.HCkE(EngineAPI.CreateTupleVector(inVector.Dimension, out vector_handle)); EngineAPI.HCkE(EngineAPI.StoreTupleVector(inVector, vector_handle)); GC.KeepAlive((object)inVector); vectorHandle = vector_handle; return(2); }