/// \api #MqFactoryCall public static T Call() { IntPtr mqctx = IntPtr.Zero; ErrorCheck(MqFactoryCall(typeof(T).Name, IntPtr.Zero, ref mqctx)); return((T)MqS.GetSelf(mqctx)); }
/// \api #MqFactoryCall public static T Call(string ident) { IntPtr mqctx = IntPtr.Zero; ErrorCheck(MqFactoryCall(ident, IntPtr.Zero, ref mqctx)); return((T)MqS.GetSelf(mqctx)); }
/// \api #MqContextCreate public MqS(MqS tmpl) { context = MqContextCreate(0, tmpl != null ? tmpl.context : IntPtr.Zero); MqConfigSetSelf(context, (IntPtr)GCHandle.Alloc(this)); MqConfigSetIgnoreFork(context, MQ_BOL.MQ_YES); MqConfigSetSetup(context, fDefaultLinkCreate, null, fDefaultLinkCreate, null, fProcessExit, fThreadExit); if (this is IServerSetup) { IntPtr data = (IntPtr)GCHandle.Alloc(new ProcData((Callback)((IServerSetup)this).ServerSetup)); //DEBUG.P("IServerSetup",data); MqConfigSetServerSetup(context, fProcCall, data, fProcFree, IntPtr.Zero); } if (this is IServerCleanup) { IntPtr data = (IntPtr)GCHandle.Alloc(new ProcData((Callback)((IServerCleanup)this).ServerCleanup)); //DEBUG.P("IServerCleanup",data); MqConfigSetServerCleanup(context, fProcCall, data, fProcFree, IntPtr.Zero); } if (this is IBgError) { MqConfigSetBgError(context, fProcCall, (IntPtr)GCHandle.Alloc( new ProcData((Callback)((IBgError)this).BgError)), fProcFree, IntPtr.Zero); } if (this is IEvent) { MqConfigSetEvent(context, fProcCall, (IntPtr)GCHandle.Alloc( new ProcData((Callback)((IEvent)this).Event)), fProcFree, IntPtr.Zero); } }
/// \api #MqContextCreate public MqS(MqS tmpl) { context = MqContextCreate(0, tmpl != null ? tmpl.context : IntPtr.Zero); MqConfigSetSelf(context, (IntPtr) GCHandle.Alloc(this)); MqConfigSetIgnoreFork(context, MQ_BOL.MQ_YES); MqConfigSetSetup(context, fDefaultLinkCreate, null, fDefaultLinkCreate, null, fProcessExit, fThreadExit); if (this is IServerSetup) { IntPtr data = (IntPtr) GCHandle.Alloc(new ProcData((Callback)((IServerSetup) this).ServerSetup)); //DEBUG.P("IServerSetup",data); MqConfigSetServerSetup (context, fProcCall, data, fProcFree, IntPtr.Zero); } if (this is IServerCleanup) { IntPtr data = (IntPtr) GCHandle.Alloc(new ProcData((Callback)((IServerCleanup) this).ServerCleanup)); //DEBUG.P("IServerCleanup",data); MqConfigSetServerCleanup (context, fProcCall, data, fProcFree, IntPtr.Zero); } if (this is IBgError) { MqConfigSetBgError (context, fProcCall, (IntPtr) GCHandle.Alloc( new ProcData((Callback)((IBgError) this).BgError)), fProcFree, IntPtr.Zero); } if (this is IEvent) { MqConfigSetEvent (context, fProcCall, (IntPtr) GCHandle.Alloc( new ProcData((Callback)((IEvent) this).Event)), fProcFree, IntPtr.Zero); } }
/// \api #MqFactoryDefaultIdent public static String DefaultIdent() { String str = Marshal.PtrToStringAnsi(MqS.MqFactoryDefaultIdent()); //DEBUG.O(str, typeof(T).Name); return(str); }
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(); }
void IService.Service(MqS ctx) { FilterItmS it; it.token = ServiceGetToken(); it.isTransaction = ServiceIsTransaction(); it.bdy = ReadBDY(); itms.Enqueue(it); SendRETURN(); }
/// \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)); }
/// \api #MqFactoryDefault public static MqFactoryS <T> Default() { IntPtr data = getConstructor(); // !attention, no "MqS.fProcFree" because the code will core at the end //DEBUG.P(ident,data); return(new MqFactoryS <T>( MqS.MqFactoryDefault(new IntPtr(0x2), typeof(T).Name, fFactoryCreate, data, null, fFactoryDataCopy, fFactoryDelete, IntPtr.Zero, null, null) )); }
/// \api #MqResolve protected static MqS[] Resolve(string ident) { Int32 size = 0; int elementSize = Marshal.SizeOf(typeof(IntPtr)); IntPtr ctxL = MqResolve(ident, ref size); MqS[] ret = new MqS[size]; for (int i = 0; i < size; i++) { ret[i] = GetSelf(Marshal.ReadIntPtr(ctxL, i * elementSize)); } return(ret); }
/// \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)); } }
/// \api #LinkCreateChild public void LinkCreateChild(MqS parent, params string[] argv) { // fill the argv/alfa IntPtr largv = IntPtr.Zero; if (argv.Length != 0) { largv = MqBufferLCreate(argv.Length+1); MqBufferLAppendC(largv, APP); foreach (string a in argv) { MqBufferLAppendC(largv, a); } } // create Context ErrorMqToCsWithCheck (MqLinkCreateChild(context, parent.context, ref largv)); }
/// \brief constructor used to create a \e child object public void LinkCreateChild(MqS parent, params string[] argv) { // fill the argv/alfa IntPtr largv = IntPtr.Zero; if (argv.Length != 0) { largv = MqBufferLCreate(argv.Length + 1); MqBufferLAppendC(largv, APP); foreach (string a in argv) { MqBufferLAppendC(largv, a); } } // 7. create Context ErrorMqToCsWithCheck(MqLinkCreateChild(context, parent.context, ref largv)); }
/*****************************************************************************/ /* */ /* 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); }
/// \api #MqReadForward public void ReadForward(MqS ctx, MqDumpS dump) { ErrorMqToCsWithCheck(MqReadForward(context, ctx.context, dump.hdl)); }
/// \api #MqReadForward public void ReadForward(MqS ctx) { ErrorMqToCsWithCheck(MqReadForward(context, ctx.context, IntPtr.Zero)); }
/// \api #MqReadProxy public void ReadProxy(MqS ctx) { ErrorMqToCsWithCheck(MqReadProxy(context, ctx.context)); }
public F2(MqS tmpl) : base(tmpl) { }
// constructor public Filter2(MqS tmpl) : base(tmpl) { ConfigSetIsServer(true); }
void IService.Service(MqS ctx) { ctx.SendSTART(); ctx.SendW(ctx.ReadW()); ctx.SendRETURN(); }
public manfilter(MqS tmpl) : base(tmpl) { }
/// \api #MqFactoryCopy public MqFactoryS <T> Copy(string ident) { return(new MqFactoryS <T> (MqS.MqFactoryCopy(factory, ident))); }
// constructor public MyServer(MqS tmpl) : base(tmpl) { }
public testserver(MqS tmpl) : base(tmpl) { }
/// \api #MqSlaveCreate public void SlaveCreate(int id, MqS slave) { ErrorMqToCsWithCheck(MqSlaveCreate(context, id, slave.context)); }
void IService.Service(MqS ctx) { itms.Enqueue(ReadDUMP()); SendRETURN(); }
public mulserver(MqS tmpl) : base(tmpl) { ConfigSetIsServer(true); }
/// \api #MqFactoryGetCalled public static MqFactoryS <T> GetCalled(string ident) { return(new MqFactoryS <T>(MqS.MqFactoryGetCalled(ident))); }
public F1(MqS tmpl) : base(tmpl) { }
public Filter4(MqS tmpl) : base(tmpl) { }
/// \api #MqResolve protected static MqS[] Resolve(string ident) { Int32 size = 0; int elementSize = Marshal.SizeOf(typeof(IntPtr)); IntPtr ctxL = MqResolve(ident,ref size); MqS[] ret = new MqS[size]; for(int i=0; i<size; i++) { ret[i] = GetSelf(Marshal.ReadIntPtr(ctxL,i*elementSize)); } return ret; }
public F3(MqS tmpl) : base(tmpl) { }
/// \api #MqFactoryGet public static MqFactoryS <T> Get() { return(new MqFactoryS <T>(MqS.MqFactoryGet(""))); }
void IService.Service(MqS ctx) { StorageInsert(); SendRETURN(); }