Esempio n. 1
0
        /*
         * Constructor for a TypeSupport that uses the specified (custom) Marshaler.
         */
        public TypeSupport(Type dataType)
        {
            this.dataType = dataType;

            this.dummyOperationDelegate = new DummyOperationDelegate(DummyOperation);
            IntPtr ptr = Gapi.FooTypeSupport.alloc(
               TypeName,                    // Original IDL type name
               KeyList,
               Description,
               IntPtr.Zero,                 // type_load
               dummyOperationDelegate,      // copyIn: delay initialization until marshaler present
               dummyOperationDelegate,      // copyOut: delay initialization until marshaler present
               0,                           // alloc_size
               IntPtr.Zero,                 // alloc buffer
               IntPtr.Zero,                 // writer copy
               dummyOperationDelegate);     // reader copy: delay initialization until marshaler present

            // Base class handles everything.
            if (ptr != IntPtr.Zero)
            {
                SetPeer(ptr, true);
            }
            else
            {
                // Gapi already logged that the TypeSupport has not been created
                // successfully. Now create a deliberate null pointer exception
                // to let the current constructor fail.
                throw new System.NullReferenceException("gapi_fooTypeSupport__alloc returned a NULL pointer.");
            }
        }
Esempio n. 2
0
        /*
         * Constructor for a TypeSupport that uses the specified (custom) Marshaler.
         */
        public TypeSupport(Type dataType)
        {
            this.dataType = dataType;

            this.dummyOperationDelegate = new DummyOperationDelegate(DummyOperation);
            IntPtr ptr = Gapi.FooTypeSupport.alloc(
                TypeName,                   // Original IDL type name
                KeyList,
                Description,
                IntPtr.Zero,                // type_load
                dummyOperationDelegate,     // copyIn: delay initialization until marshaler present
                dummyOperationDelegate,     // copyOut: delay initialization until marshaler present
                0,                          // alloc_size
                IntPtr.Zero,                // alloc buffer
                IntPtr.Zero,                // writer copy
                dummyOperationDelegate);    // reader copy: delay initialization until marshaler present

            // Base class handles everything.
            if (ptr != IntPtr.Zero)
            {
                SetPeer(ptr, true);
            }
            else
            {
                // Gapi already logged that the TypeSupport has not been created
                // successfully. Now create a deliberate null pointer exception
                // to let the current constructor fail.
                throw new System.NullReferenceException("gapi_fooTypeSupport__alloc returned a NULL pointer.");
            }
        }
Esempio n. 3
0
        /*
         * Constructor for a TypeSupport that uses the specified (custom) Marshaler.
         */
        public TypeSupport(Type dataType, TypeSupportFactory tsFactory)
        {
            this.dataType = dataType;

            System.Text.StringBuilder descriptor = new System.Text.StringBuilder();
            foreach (string s in Description)
            {
                descriptor.Append(s);
            }

            this.dummyOperationDelegate = new DummyOperationDelegate(DummyOperation);
            this.gapiPeer = Gapi.FooTypeSupport.alloc(
                TypeName,                   // Original IDL type name
                KeyList,
                descriptor.ToString(),
                IntPtr.Zero,                // type_load
                dummyOperationDelegate,     // copyIn: delay initialization until marshaler present
                dummyOperationDelegate,     // copyOut: delay initialization until marshaler present
                0,                          // alloc_size
                IntPtr.Zero,                // alloc buffer
                IntPtr.Zero,                // writer copy
                dummyOperationDelegate);    // reader copy: delay initialization until marshaler present

            // Base class handles everything.
            if (GapiPeer != IntPtr.Zero)
            {
                tsFactory.SetPeer(GapiPeer);
            }
            else
            {
                // Gapi already logged that the TypeSupport has not been created
                // successfully. Now create a deliberate null pointer exception
                // to let the current constructor fail.
                throw new System.NullReferenceException("gapi_fooTypeSupport__alloc returned a NULL pointer.");
            }
        }
Esempio n. 4
0
        /*
         * Constructor for a TypeSupport that uses the specified (custom) Marshaler.
         */
        public TypeSupport(Type dataType, TypeSupportFactory tsFactory)
        {
            this.dataType = dataType;
            
            System.Text.StringBuilder descriptor = new System.Text.StringBuilder();
            foreach (string s in Description) {
               descriptor.Append(s);
            }

            this.dummyOperationDelegate = new DummyOperationDelegate(DummyOperation);
            this.gapiPeer = Gapi.FooTypeSupport.alloc(
               TypeName,                    // Original IDL type name
               KeyList,
               descriptor.ToString(),
               IntPtr.Zero,                 // type_load
               dummyOperationDelegate,      // copyIn: delay initialization until marshaler present
               dummyOperationDelegate,      // copyOut: delay initialization until marshaler present
               0,                           // alloc_size
               IntPtr.Zero,                 // alloc buffer
               IntPtr.Zero,                 // writer copy
               dummyOperationDelegate);     // reader copy: delay initialization until marshaler present

            // Base class handles everything.
            if (GapiPeer != IntPtr.Zero)
            {
                tsFactory.SetPeer(GapiPeer);
            }
            else
            {
                // Gapi already logged that the TypeSupport has not been created
                // successfully. Now create a deliberate null pointer exception
                // to let the current constructor fail.
                throw new System.NullReferenceException("gapi_fooTypeSupport__alloc returned a NULL pointer.");
            }
        }