Exemplo n.º 1
0
        }// Get()

        //
        public virtual RequestEventArg <T> Get(T code)
        {
            RequestEventArg <T> request = Get();

            request.RequestType = code;
            return(request);
        }// Get()
Exemplo n.º 2
0
        //
        //
        #endregion//Constructors



        #region Public Methods
        // *****************************************************************
        // ****                     Public Methods                      ****
        // *****************************************************************
        //
        //
        //
        // *****************************************
        // ****             Get()               ****
        // *****************************************
        public override RequestEventArg <T> Get()
        {
            RequestEventArg <T> request = base.Get();

            request.Clear();
            return(request);
        }// Get()
Exemplo n.º 3
0
        //
        //
        /// <summary>
        /// Overload copies objects from list.  List is not kept,
        /// but the objects in it are taken and added to Data[].
        /// </summary>
        /// <param name="code"></param>
        /// <param name="objList">List of objects to load into Data</param>
        /// <returns></returns>
        public virtual RequestEventArg <T> Get(T code, List <object> objList)
        {
            RequestEventArg <T> request = base.Get();

            request.Clear();
            request.RequestType = code;
            if (objList != null)
            {
                request.Data.AddRange(objList);
            }
            return(request);
        }
Exemplo n.º 4
0
        }//constructor

        //
        /// <summary>
        /// Constructor allowing for intial creation of requests
        /// </summary>
        /// <param name="initialNumberOfItems"></param>
        public RequestFactory(int initialNumberOfItems)
        {
            int count = 0;

            lock (m_StorageLock)
            {
                while (count < initialNumberOfItems)
                {
                    RequestEventArg <T> eventArg = new RequestEventArg <T>();
                    m_Storage.Enqueue(eventArg);
                    count++;
                }
            }
        }
Exemplo n.º 5
0
        }// Get()

        //
        /// <summary>
        /// This overload is the usual way that one or more arguments
        /// are passed all at once.
        /// </summary>
        /// <param name="code"></param>
        /// <param name="args">array of objects to be added to Data.</param>
        /// <returns></returns>
        public virtual RequestEventArg <T> Get(T code, params object[] args)
        {
            RequestEventArg <T> request = base.Get();

            request.Clear();
            request.RequestType = code;
            if (args != null)
            {
                foreach (object arg in args)
                {
                    request.Data.Add(arg);
                }
            }
            return(request);
        }
Exemplo n.º 6
0
        public List <object> Data = new List <object>();    // place for data

        //
        // Internal statistics
        //
        // TODO: add internal counter for failures?

        #endregion// members


        #region Constructors
        // *****************************************************************
        // ****                     Constructors                        ****
        // *****************************************************************
        //
        //
        //
        #endregion//Constructors



        #region Public Methods
        // *****************************************************************
        // ****                     Public Methods                      ****
        // *****************************************************************
        //
        //
        //
        //
        // *************************************************
        // ****                 Equals                  ****
        // *************************************************
        /// <summary>
        /// Compares two requests to see if they are the same in terms of their
        /// request type and data components.
        /// </summary>
        /// <param name="request"></param>
        /// <returns>false if different</returns>
        public bool Equals(RequestEventArg <T> request)
        {
            if (request.RequestType.Equals(this.RequestType) && request.Data.Count == this.Data.Count)
            {
                for (int i = 0; i < this.Data.Count; i++)
                {
                    if (this.Data[i].Equals(request.Data[i]))
                    {
                        continue;
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }//Equals()