Пример #1
0
        /// \api #MqFactoryCall
        public static T Call()
        {
            IntPtr mqctx = IntPtr.Zero;

            ErrorCheck(MqFactoryCall(typeof(T).Name, IntPtr.Zero, ref mqctx));
            return((T)MqS.GetSelf(mqctx));
        }
Пример #2
0
        /// \api #MqFactoryCall
        public static T Call(string ident)
        {
            IntPtr mqctx = IntPtr.Zero;

            ErrorCheck(MqFactoryCall(ident, IntPtr.Zero, ref mqctx));
            return((T)MqS.GetSelf(mqctx));
        }
Пример #3
0
        static private void FactoryDelete(IntPtr context, MQ_BOL doFactoryCleanup, IntPtr item)
        {
            IntPtr self = MqS.MqConfigGetSelf(context);

            MqS.MqContextDelete(ref MqS.GetSelf(context).context);
            GCHandle.FromIntPtr(self).Free();
        }
Пример #4
0
        /// \api #MqFactoryNew
        public static T New()
        {
            IntPtr mqctx = IntPtr.Zero;
            IntPtr data  = getConstructor();

            // !attention, no "MqS.fProcFree" because the code will core at the end
//DEBUG.P(ident,data);
            ErrorCheck(MqFactoryNew(typeof(T).Name, fFactoryCreate, data, null, fFactoryDelete, IntPtr.Zero, null, IntPtr.Zero, ref mqctx));
            return((T)MqS.GetSelf(mqctx));
        }
Пример #5
0
        /// \api #MqFactoryNew
        public T New()
        {
            IntPtr mqctx = MqFactoryNew(new IntPtr(0x2), IntPtr.Zero, factory);

            if (mqctx == IntPtr.Zero)
            {
                throw new MqFactorySException();
            }
            else
            {
                return((T)MqS.GetSelf(mqctx));
            }
        }
Пример #6
0
        /*****************************************************************************/
        /*                                                                           */
        /*                               private                                     */
        /*                                                                           */
        /*****************************************************************************/

        //struct MqFactoryItemS* const item,
        static private MqErrorE FactoryCreate(IntPtr tmpl, MqFactoryE create, IntPtr item, ref IntPtr contextP)
        {
            try {
                Object[] args = new Object[1];
                args[0] = tmpl != IntPtr.Zero ? MqS.GetSelf(tmpl) : null;
                IntPtr data = MqFactoryItemGetCreateData(item);
                contextP = ((MqS)((ConstructorInfo)GCHandle.FromIntPtr(data).Target).Invoke(args)).context;
            } catch (Exception ex) {
                if (create == MqFactoryE.MQ_FACTORY_NEW_INIT)
                {
                    return(MqErrorE.MQ_ERROR);
                }
                else
                {
                    return(MqS.MqErrorSet2(tmpl, ex));
                }
            }
            if (create != MqFactoryE.MQ_FACTORY_NEW_INIT)
            {
                MqSetupDup(contextP, tmpl);
            }
            return(MqErrorE.MQ_OK);
        }