Beispiel #1
0
        public static Parent InstantiateConcreteObject(IntPtr cPtr, bool owner)
        {
            Parent ret = null;

            if (cPtr == IntPtr.Zero)
            {
                return(ret);
            }
            int type = CppApiPINVOKE.Parent_WhatAmI(new HandleRef(null, cPtr));

            switch (type)
            {
            case 0:
                ret = new Parent(cPtr, owner);
                break;

            case 1:
                ret = new Child(cPtr, owner);
                break;

            // Repeat for every other concrete type.
            default:
                System.Diagnostics.Debug.Assert(false,
                                                String.Format("Encountered type '{0}' that is not any known concrete class",
                                                              type.ToString()));
                break;
            }
            return(ret);
        }
Beispiel #2
0
        public virtual int WhatAmI()
        {
            int ret = (SwigDerivedClassHasMethod("WhatAmI", swigMethodTypes0) ? CppApiPINVOKE.Parent_WhatAmISwigExplicitParent(swigCPtr) : CppApiPINVOKE.Parent_WhatAmI(swigCPtr));

            return(ret);
        }