Ejemplo n.º 1
0
            /* ************************************************************** */
            #region Construction and Finalization

            /// <summary>
            /// Constructor initialises all member variables.
            /// Note that the base class default constructor is used as we don't want to use any
            /// of the base class implementation.
            /// </summary>
            /// <param name="callback">
            /// The user callback implementation, can be an instance of the MamaSubscriptionCallbackEx
            /// interface to receive destroy notifications.
            /// </param>
            /// <param name="closure">
            /// The closure supplied to the MamaSubscription.create function.
            /// </param>
            /// <param name="subscription">
            /// The actual C# subscription object.
            /// </param>
            internal MamaSubscriptionImpl(MamaSubscriptionCallback callback, object closure, MamaSubscription subscription)
                : base()
            {
                // Save arguments in member variables
                mCallback     = callback;
                mClosure      = closure;
                mSubscription = subscription;
            }
Ejemplo n.º 2
0
            /* ************************************************************** */
            #region Internal Operations

            /// <summary>
            /// This function creates a new impl and returns an IntPtr that can then be passed to
            /// the native layer.
            /// </summary>
            /// <param name="callback">
            /// The user callback implementation, can be an instance of the MamaSubscriptionCallbackEx
            /// interface to receive destroy notifications.
            /// </param>
            /// <param name="closure">
            /// The closure supplied to the MamaSubscription.create function.
            /// </param>
            /// <param name="subscription">
            /// The actual C# subscription object.
            /// </param>
            /// <returns>
            /// The IntPtr that can then be used for the closure.
            /// </returns>
            internal static IntPtr Create(MamaSubscriptionCallback callback, object closure, MamaSubscription subscription)
            {
                // Allocate a new impl
                MamaSubscriptionImpl impl = new MamaSubscriptionImpl(callback, closure, subscription);

                // Create a GC handle
                GCHandle handle = GCHandle.Alloc(impl);

                // Return the native pointer
                return((IntPtr)handle);
            }
Ejemplo n.º 3
0
        /// <summary>
        /// Set the parameters for a subscription that may be actually activated later.
        /// Activate the subscription using MamaSubscription.activate().
        /// </summary>
        /// <param name="queue">
        /// The mama queue.
        /// </param>
        /// <param name="callback">
        /// The callback.
        /// </param>
        /// <param name="source">
        /// The MamaSource identifying the publisher for this symbol.
        /// </param>
        /// <param name="symbol">
        /// The symbol for the listener.
        /// </param>
        /// <param name="closure">
        /// The caller supplied closure.
        /// </param>
        public void setup(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol, object closure)
        {
            // Verify that the subscription has been created
            EnsurePeerCreated();

            // Save arguments in member variables
            base.mClosure   = closure;
            base.mQueue     = queue;
            base.mTransport = source.transport;

            // Create the impl
            IntPtr impl = MamaSubscriptionImpl.Create(callback, closure, this);

            // Call into the native layer to setup the subscription
            CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setup(
                                NativeHandle,
                                queue.NativeHandle,
                                ref MamaBasicSubscription.mCallbackDelegates,
                                source.NativeHandle,
                                symbol,
                                impl));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Set up and activate a subscriber using the throttle queue. This
 /// method is equivalent to calling setup() followed by activate().
 /// </summary>
 /// <param name="queue">
 /// The mama queue.
 /// </param>
 /// <param name="callback">
 /// The callback.
 /// </param>
 /// <param name="source">
 /// The MamaSource identifying the publisher for this symbol.
 /// </param>
 /// <param name="symbol">
 /// The symbol for the listener.
 /// </param>
 /// <param name="closure">
 /// The caller supplied closure.
 /// </param>
 public void create(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol, object closure)
 {
     // This is equivalent to calling setup then activate
     setup(queue, callback, source, symbol, closure);
     activate();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Set up and activate a subscriber using the throttle queue. This
 /// method is equivalent to calling setup() followed by activate().
 /// </summary>
 /// <param name="queue">
 /// The mama queue.
 /// </param>
 /// <param name="callback">
 /// The callback.
 /// </param>
 /// <param name="source">
 /// The MamaSource identifying the publisher for this symbol.
 /// </param>
 /// <param name="symbol">
 /// The symbol for the listener.
 /// </param>
 public void create(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol)
 {
     // Call the overload with a null closure
     create(queue, callback, source, symbol, null);
 }
Ejemplo n.º 6
0
            /* ************************************************************** */
            #region Construction and Finalization

            /// <summary>
            /// Constructor initialises all member variables.
            /// </summary>
            /// <param name="callback">
            /// The subscription callback.
            /// </param>
            internal MamaBasicCallbackAdapter(MamaSubscriptionCallback callback)
            {
                mCallback = callback;
            }
Ejemplo n.º 7
0
 /// <summary>
 /// Set the parameters for a subscription that may be actually activated later.
 /// Activate the subscription using MamaSubscription.activate().
 /// This overload passes a null value for the closure.
 /// </summary>
 /// <param name="queue">
 /// The mama queue.
 /// </param>
 /// <param name="callback">
 /// The callback.
 /// </param>
 /// <param name="source">
 /// The MamaSource identifying the publisher for this symbol.</param>
 /// <param name="symbol">
 /// The symbol for the listener.
 /// </param>
 public void setup(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol)
 {
     // Call the overload passing null for the closure
     setup(queue, callback, source, symbol, null);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Set the parameters for a subscription that may be actually activated later.  
 /// Activate the subscription using MamaSubscription.activate().
 /// This overload passes a null value for the closure.
 /// </summary>
 /// <param name="queue">
 /// The mama queue.
 /// </param>
 /// <param name="callback">
 /// The callback.
 /// </param>
 /// <param name="source">
 /// The MamaSource identifying the publisher for this symbol.</param>
 /// <param name="symbol">
 /// The symbol for the listener.
 /// </param>        
 public void setup(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol)
 {
     // Call the overload passing null for the closure
     setup(queue, callback, source, symbol, null);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// This function will create the basic subscription without marketdata semantics.
 /// This overload provides access to the basic subscription with the MamaSubscriptionCallback rather than the 
 /// MamaBasicSubscriptionCallback interface.
 /// Instantiating the base class directly will provide better performance.
 /// </summary>
 /// <param name="transport">
 /// The MamaTransport.
 /// </param>
 /// <param name="queue">
 /// The MamaQueue.
 /// </param>
 /// <param name="callback">
 /// Provide callback function implementations to be informed of events on the subscription.
 /// </param>
 /// <param name="symbol">
 /// The symbol to subscribe to.
 /// </param>
 /// <param name="closure">
 /// The closure that will be passed back with the callback functions.
 /// </param>
 public void createBasic(MamaTransport transport, MamaQueue queue, MamaSubscriptionCallback callback, string symbol, object closure)
 {
     // Call the base class using the adapter to convert between the callback types
     base.createBasic(transport, queue, new MamaBasicCallbackAdapter(callback), symbol, closure);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// This function will create the basic subscription without marketdata semantics.
 /// To pass a closure use the overload.
 /// This overload provides access to the basic subscription with the MamaSubscriptionCallback rather than the 
 /// MamaBasicSubscriptionCallback interface.
 /// Instantiating the base class directly will provide better performance.
 /// </summary>
 /// <param name="transport">
 /// The MamaTransport.
 /// </param>
 /// <param name="queue">
 /// The MamaQueue.
 /// </param>
 /// <param name="callback">
 /// Provide callback function implementations to be informed of events on the subscription.
 /// </param>
 /// <param name="symbol">
 /// The symbol to subscribe to.
 /// </param>
 public void createBasic(MamaTransport transport, MamaQueue queue, MamaSubscriptionCallback callback, string symbol)
 {
     // Call the overload
     createBasic(transport, queue, callback, symbol, null);
 }
Ejemplo n.º 11
0
        /// <summary>
		/// Set up and activate a subscriber using the throttle queue. This
		/// method is equivalent to calling setup() followed by activate().
		/// </summary>
		/// <param name="queue">
        /// The mama queue.
        /// </param>
		/// <param name="callback">
        /// The callback.
        /// </param>
		/// <param name="source">
        /// The MamaSource identifying the publisher for this symbol.
        /// </param>
		/// <param name="symbol">
        /// The symbol for the listener.
        /// </param>
		/// <param name="closure">
        /// The caller supplied closure.
        /// </param>
		public void create(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol, object closure)
		{
			// This is equivalent to calling setup then activate
            setup(queue, callback, source, symbol, closure);
            activate();
		}
Ejemplo n.º 12
0
 /// <summary>
 /// Set up and activate a subscriber using the throttle queue. This
 /// method is equivalent to calling setup() followed by activate().
 /// </summary>
 /// <param name="queue">
 /// The mama queue.
 /// </param>
 /// <param name="callback">
 /// The callback.
 /// </param>
 /// <param name="source">
 /// The MamaSource identifying the publisher for this symbol.
 /// </param>
 /// <param name="symbol">
 /// The symbol for the listener.
 /// </param>
 public void create(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol)
 {
     // Call the overload with a null closure
     create(queue, callback, source, symbol, null);
 }
Ejemplo n.º 13
0
            /* ************************************************************** */
            #region Internal Operations
           
            /// <summary>
            /// This function creates a new impl and returns an IntPtr that can then be passed to
            /// the native layer.
            /// </summary>
            /// <param name="callback">
            /// The user callback implementation, can be an instance of the MamaSubscriptionCallbackEx
            /// interface to receive destroy notifications.
            /// </param>
            /// <param name="closure">
            /// The closure supplied to the MamaSubscription.create function.
            /// </param>
            /// <param name="subscription">
            /// The actual C# subscription object.
            /// </param>
            /// <returns>
            /// The IntPtr that can then be used for the closure.
            /// </returns>
            internal static IntPtr Create(MamaSubscriptionCallback callback, object closure, MamaSubscription subscription)
            {
                // Allocate a new impl
                MamaSubscriptionImpl impl = new MamaSubscriptionImpl(callback, closure, subscription);

                // Create a GC handle
                GCHandle handle = GCHandle.Alloc(impl);

                // Return the native pointer
                return (IntPtr)handle;
            }
Ejemplo n.º 14
0
            /* ************************************************************** */
            #region Construction and Finalization

            /// <summary>
            /// Constructor initialises all member variables.
            /// Note that the base class default constructor is used as we don't want to use any
            /// of the base class implementation.
            /// </summary>
            /// <param name="callback">
            /// The user callback implementation, can be an instance of the MamaSubscriptionCallbackEx
            /// interface to receive destroy notifications.
            /// </param>
            /// <param name="closure">
            /// The closure supplied to the MamaSubscription.create function.
            /// </param>
            /// <param name="subscription">
            /// The actual C# subscription object.
            /// </param>
            internal MamaSubscriptionImpl(MamaSubscriptionCallback callback, object closure, MamaSubscription subscription)                                    
                : base()
            {
                // Save arguments in member variables
                mCallback      = callback;
                mClosure       = closure;
                mSubscription  = subscription;
            }
Ejemplo n.º 15
0
            /* ************************************************************** */
            #region Construction and Finalization

            /// <summary>
            /// Constructor initialises all member variables.
            /// </summary>
            /// <param name="callback">
            /// The subscription callback.
            /// </param>
            internal MamaBasicCallbackAdapter(MamaSubscriptionCallback callback)
            {
                mCallback = callback;
            }
Ejemplo n.º 16
0
 /// <summary>
 /// This function will create the basic subscription without marketdata semantics.
 /// To pass a closure use the overload.
 /// This overload provides access to the basic subscription with the MamaSubscriptionCallback rather than the
 /// MamaBasicSubscriptionCallback interface.
 /// Instantiating the base class directly will provide better performance.
 /// </summary>
 /// <param name="transport">
 /// The MamaTransport.
 /// </param>
 /// <param name="queue">
 /// The MamaQueue.
 /// </param>
 /// <param name="callback">
 /// Provide callback function implementations to be informed of events on the subscription.
 /// </param>
 /// <param name="symbol">
 /// The symbol to subscribe to.
 /// </param>
 public void createBasic(MamaTransport transport, MamaQueue queue, MamaSubscriptionCallback callback, string symbol)
 {
     // Call the overload
     createBasic(transport, queue, callback, symbol, null);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// This function will create the basic subscription without marketdata semantics.
 /// This overload provides access to the basic subscription with the MamaSubscriptionCallback rather than the
 /// MamaBasicSubscriptionCallback interface.
 /// Instantiating the base class directly will provide better performance.
 /// </summary>
 /// <param name="transport">
 /// The MamaTransport.
 /// </param>
 /// <param name="queue">
 /// The MamaQueue.
 /// </param>
 /// <param name="callback">
 /// Provide callback function implementations to be informed of events on the subscription.
 /// </param>
 /// <param name="symbol">
 /// The symbol to subscribe to.
 /// </param>
 /// <param name="closure">
 /// The closure that will be passed back with the callback functions.
 /// </param>
 public void createBasic(MamaTransport transport, MamaQueue queue, MamaSubscriptionCallback callback, string symbol, object closure)
 {
     // Call the base class using the adapter to convert between the callback types
     base.createBasic(transport, queue, new MamaBasicCallbackAdapter(callback), symbol, closure);
 }
Ejemplo n.º 18
0
		/// <summary>
        /// Set the parameters for a subscription that may be actually activated later.  
        /// Activate the subscription using MamaSubscription.activate().
        /// </summary>
        /// <param name="queue">
        /// The mama queue.
        /// </param>
        /// <param name="callback">
        /// The callback.
        /// </param>
        /// <param name="source">
        /// The MamaSource identifying the publisher for this symbol.
        /// </param>
        /// <param name="symbol">
        /// The symbol for the listener.
        /// </param>
        /// <param name="closure">
        /// The caller supplied closure.
        /// </param>
        public void setup(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol, object closure)
        {
            // Verify that the subscription has been created
            EnsurePeerCreated();

            // Save arguments in member variables
            base.mClosure      = closure;
            base.mQueue        = queue;
            base.mTransport    = source.transport;

            // Create the impl
            IntPtr impl = MamaSubscriptionImpl.Create(callback, closure, this);

            // Call into the native layer to setup the subscription
            CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setup(
                NativeHandle,
                queue.NativeHandle,
                ref MamaBasicSubscription.mCallbackDelegates,
                source.NativeHandle,
                symbol,
                impl));
        }