Click here to Skip to main content
15,891,431 members
Articles / Programming Languages / C#

Data-controlled Processes Application Design

Rate me:
Please Sign up or sign in to vote.
4.65/5 (7 votes)
23 Nov 2009CPOL10 min read 30.2K   376   34  
A ready-to-use process manager provided
using System.Collections.Generic;

namespace DataDriven
{
    internal class ProcessContainer
    {
        public IDataProcess Process;
        public bool SingleRun;
        public int ThreadCount;
        public int? ThreadLimit;
        public bool WasExecuted;
        private ProcessInputRequirements requirements;
        public InputSet AvailibleData;
        public bool AllowRecursion;
        

        public ProcessInputRequirements Requirements
        {
            get { return requirements; }
            set
            {
                if (requirements != value)
                {
                    requirements = value;
                    //requirements.Process = this;
                    NewData();
                }

            }
        }
        public void NewData()
        {
            AvailibleData = new InputSet(requirements.MinInputCount);
        }
    }

    internal class DataContainer
    {
        public object Data;
        public readonly List<ProcessContainer> Track = new List<ProcessContainer>(); // all processes which used this data.
        private SendDataParams sendParams = new SendDataParams();

        public ProcessContainer Source
        {
            get
            {
                return Track.Count > 0 ? Track[Track.Count-1] : null;
            }
            set
            {
                Track.Clear();
                Track.Add(value);
            }
        }

        public SendDataParams SendParams
        {
            get { return sendParams; }
            set { sendParams = value; }
        }
    }

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Poland Poland
My name is Jacek. Currently, I am a Java/kotlin developer. I like C# and Monthy Python's sense of humour.

Comments and Discussions