コード例 #1
0
        public static int Load(IntPtr tuple, out HTupleMixed data)
        {
            int err = 2;
            int length;

            HalconAPI.GetTupleLength(tuple, out length);
            object[] o = new object[length];
            for (int index = 0; index < length; ++index)
            {
                if (!HalconAPI.IsFailure(err))
                {
                    HTupleType type;
                    HalconAPI.GetElementType(tuple, index, out type);
                    switch (type)
                    {
                    case HTupleType.INTEGER:
                        if (HalconAPI.isPlatform64)
                        {
                            long longValue;
                            err      = HalconAPI.GetL(tuple, index, out longValue);
                            o[index] = (object)longValue;
                            continue;
                        }
                        int intValue;
                        err      = HalconAPI.GetI(tuple, index, out intValue);
                        o[index] = (object)intValue;
                        continue;

                    case HTupleType.DOUBLE:
                        double doubleValue;
                        err      = HalconAPI.GetD(tuple, index, out doubleValue);
                        o[index] = (object)doubleValue;
                        continue;

                    case HTupleType.STRING:
                        string stringValue;
                        err      = HalconAPI.GetS(tuple, index, out stringValue);
                        o[index] = (object)stringValue;
                        continue;

                    default:
                        continue;
                    }
                }
            }
            data = new HTupleMixed(o, false);
            return(err);
        }
コード例 #2
0
 internal HTupleElements(HTuple parent, HTupleMixed tupleImp, int[] indices)
 {
     this.parent   = parent;
     this.elements = (HTupleElementsImplementation) new HTupleElementsMixed(tupleImp, indices);
 }
コード例 #3
0
        public static int LoadData(IntPtr tuple, HTupleType type, out HTupleImplementation data)
        {
            int num = 2;

            if (tuple == IntPtr.Zero)
            {
                data = (HTupleImplementation)HTupleVoid.EMPTY;
                return(num);
            }
            int type1;

            HalconAPI.GetTupleTypeScanElem(tuple, out type1);
            switch (type1)
            {
            case 1:
                if (HalconAPI.isPlatform64)
                {
                    HTupleInt64 data1;
                    num  = HTupleInt64.Load(tuple, out data1);
                    data = (HTupleImplementation)data1;
                }
                else
                {
                    HTupleInt32 data1;
                    num  = HTupleInt32.Load(tuple, out data1);
                    data = (HTupleImplementation)data1;
                }
                type = HTupleType.INTEGER;
                break;

            case 2:
                HTupleDouble data2;
                num  = HTupleDouble.Load(tuple, out data2);
                data = (HTupleImplementation)data2;
                type = HTupleType.DOUBLE;
                break;

            case 4:
                HTupleString data3;
                num  = HTupleString.Load(tuple, out data3);
                data = (HTupleImplementation)data3;
                type = HTupleType.STRING;
                break;

            case 7:
                HTupleMixed data4;
                num  = HTupleMixed.Load(tuple, out data4);
                data = (HTupleImplementation)data4;
                type = HTupleType.MIXED;
                break;

            case 15:
                data = (HTupleImplementation)HTupleVoid.EMPTY;
                type = HTupleType.EMPTY;
                break;

            default:
                data = (HTupleImplementation)HTupleVoid.EMPTY;
                num  = 7002;
                break;
            }
            return(num);
        }