Beispiel #1
0
        void ProcOptx(String s, OutPort opt)
        {
            int    i = opt.setDimension;
            String t = s;

            if (!s.EndsWith("*"))
            {
                i = 0;
            }
            else
            {
                t = s.Substring(0, s.Length - 1);
                if (i == 0)
                {
                    FlowError.Complain(_name + "." + s
                                       + ": Asterisk specified on output port name, but setDimension was not specified");
                }
            }
            if (i == 0)
            {
                ProcOpty(t, opt);
            }
            else
            {
                for (int j = 0; j < i; j++)
                {
                    ProcOpty(t + j, opt);
                }
            }
        }
Beispiel #2
0
        public void InitBlock()
        {
            _inputPorts  = new Dictionary <string, IInputPort>();
            _outputPorts = new Dictionary <string, OutputPort>();
            //_inputPortAttrs = new Dictionary<string, InPort>();
            //_outputPortAttrs = new Dictionary<string, OutPort>();
            _status      = States.NotStarted;
            _stack       = new Stack();
            _packetCount = 0;
            MustRun      = false;
            SelfStarting = false;
            _timeout     = null;
            //_event_dormant = new AutoResetEvent(false);
            _lockObject = new Object();
            //_compLog = new Logger();
            _mother       = null;
            _autoStarting = false;

            System.Reflection.MemberInfo info = GetType();
            object[] attributes = info.GetCustomAttributes(true);
            foreach (object at in attributes)
            {
                if (at is MustRun)
                {
                    MustRun mr = at as MustRun;
                    MustRun = mr.value;
                }
                if (at is SelfStarting)
                {
                    SelfStarting sst = at as SelfStarting;
                    SelfStarting = sst.value;
                }
                if (at is OutPort)
                {
                    OutPort op = at as OutPort;
                    ProcOpt(op);
                }
                if (at is InPort)
                {
                    InPort ip = at as InPort;
                    ProcIpt(ip);
                }
                if (at is PriorityAttribute)
                {
                    PriorityAttribute p = at as PriorityAttribute;
                    Priority = p.value;
                }
            }
        }
Beispiel #3
0
        void ProcOpt(OutPort opt)
        {
            if (!(opt.value.Equals("") ^ opt.valueList == null))
            {
                FlowError.Complain(_name + ": @OutPort must have value or valueList, but not both");
            }
            String s;

            if (!opt.value.Equals(""))
            {
                s = opt.value;
            }
            else
            {
                s = opt.valueList[0];
            }
            if (opt.fixedSize && !opt.arrayPort)
            {
                FlowError.Complain(_name + "." + s + ": @OutPort specified fixedSize but not arrayPort");
            }
            if (!opt.value.Equals(""))
            {
                if (opt.setDimension > 0 && !opt.value.EndsWith("*"))
                {
                    FlowError.Complain(_name + "." + s
                                       + ": @OutPort specified setDimension but value string did not end with asterisk");
                }
                ProcOptx(opt.value, opt);
            }
            else
            {
                bool asterisk_found = false;
                foreach (String t in opt.valueList)
                {
                    if (t.EndsWith("*"))
                    {
                        asterisk_found = true;
                    }
                    ProcOptx(t, opt);
                }
                if (!asterisk_found && opt.setDimension > 0)
                {
                    FlowError.Complain(_name + "." + s
                                       + ": @OutPort specified setDimension but valueList did not contain any strings ending with asterisks");
                }
            }
        }
Beispiel #4
0
 protected internal void ProcOpty(string s, OutPort opt)
 {
     if (opt.arrayPort)
     {
         OutArray oa = new OutArray();
         _outputPorts.Add(s, oa);
         oa._fixedSize = opt.fixedSize;
         oa._optional  = opt.optional;
     }
     else
     {
         OutputPort op = new NullOutputPort();
         op._optional = opt.optional;
         op.SetSender(this);
         _outputPorts.Add(s, op);
         op._name = s;
     }
 }