コード例 #1
0
ファイル: chktracer.cs プロジェクト: wangyakai01/APSIMClassic
        //==============================================================================
        /// <summary>
        /// Find the value for the property used in the checkpoint (restore) process.
        /// </summary>
        /// <param name="msgID">Key used to search the list.</param>
        /// <returns>The property value name stored for this checkpoint restore process.</returns>
        //==============================================================================
        public string getValue(uint msgID)
        {
            TCheckPointProcess checkPoint = new TCheckPointProcess();

            string result = "";

            if (getProcess(msgID, ref checkPoint))
            {
                result = checkPoint.propertyValue;
            }
            return(result);
        }
コード例 #2
0
ファイル: chktracer.cs プロジェクト: wangyakai01/APSIMClassic
        //==============================================================================
        /// <summary>
        /// Get the name of the driving variable.
        /// </summary>
        /// <param name="msgID">Key used to search the list.</param>
        /// <returns></returns>
        //==============================================================================
        public string getDriver(uint msgID)
        {
            TCheckPointProcess checkPoint = new TCheckPointProcess();

            string result = "";

            if (getProcess(msgID, ref checkPoint))
            {
                result = checkPoint.stateDriver;
            }
            return(result);
        }
コード例 #3
0
ファイル: chktracer.cs プロジェクト: wangyakai01/APSIMClassic
        //==============================================================================
        /// <summary>
        /// Stores a msg ID of one of the messages in the checkpoint process.
        /// a checkpoint process is begining.
        /// </summary>
        /// <param name="msgID">Message ID of the message used when checkpointing.</param>
        /// <param name="msgType">type of message.</param>
        /// <param name="driverName">Name of the driving property.</param>
        /// <param name="restoring">True if this is a restore process.</param>
        /// <returns>The TCheckPointProcess item that was added to the list.</returns>
        //==============================================================================
        public TCheckPointProcess logCheckPoint(uint msgID, uint msgType, string driverName, bool restoring)
        {
            TCheckPointProcess checkPoint = new TCheckPointProcess();

            checkPoint.stateDriverID    = 9999999;
            checkPoint.stateDriver      = driverName;
            checkPoint.msgID            = msgID;
            checkPoint.msgType          = msgType;
            checkPoint.isRestoreProcess = restoring;
            checkPointList.Add(checkPoint);

            return(checkPoint);
        }
コード例 #4
0
ファイル: chktracer.cs プロジェクト: wangyakai01/APSIMClassic
        //==============================================================================
        /// <summary>
        /// Finds the driving property ID associated with the msgID.
        /// </summary>
        /// <param name="msgID">Key used to search the list.</param>
        /// <returns>If the checkpoint process for msgID is not found, the return value is 9999999.
        /// If found, the return value will be the driving property ID.</returns>
        //==============================================================================
        public int getDriverID(uint msgID)
        {
            TCheckPointProcess checkPoint = new TCheckPointProcess();
            int driverID;

            driverID = 9999999;

            if (getProcess(msgID, ref checkPoint))
            {
                driverID = checkPoint.stateDriverID;
            }
            return(driverID);
        }
コード例 #5
0
ファイル: chktracer.cs プロジェクト: wangyakai01/APSIMClassic
        //==============================================================================
        /// <summary>
        /// Stores a msg ID of one of the messages in the checkpoint restore process.
        /// </summary>
        /// <param name="msgID">Message ID.</param>
        /// <param name="msgType">Type of the message.</param>
        /// <param name="driverName">Name of the driver.</param>
        /// <param name="driverValue">Used to store the checkpoint SDML string that is used
        /// to restore the component.</param>
        /// <returns>The TCheckPointProcess item that was added to the list.</returns>
        //==============================================================================
        public TCheckPointProcess logCheckPointRestore(uint msgID, uint msgType, string driverName, string driverValue)
        {
            TCheckPointProcess checkPoint = new TCheckPointProcess();

            checkPoint.stateDriverID    = 9999999;
            checkPoint.stateDriver      = driverName;
            checkPoint.msgID            = msgID;
            checkPoint.msgType          = msgType;
            checkPoint.isRestoreProcess = true;
            checkPoint.propertyValue    = driverValue;
            checkPointList.Add(checkPoint);

            return(checkPoint);
        }
コード例 #6
0
ファイル: chktracer.cs プロジェクト: wangyakai01/APSIMClassic
        //==============================================================================
        /// <summary>
        /// Get the message type of the message.
        /// </summary>
        /// <param name="msgID">Message ID.</param>
        /// <returns>The type of message. See <see cref="Msgs"/> class</returns>
        //==============================================================================
        public uint getMsgType(uint msgID)
        {
            uint msgType;
            TCheckPointProcess checkPoint = new TCheckPointProcess();

            msgType = 0; //init to invalid msg type

            if (getProcess(msgID, ref checkPoint))
            {
                msgType = checkPoint.msgType;
            }

            return(msgType);
        }
コード例 #7
0
ファイル: chktracer.cs プロジェクト: wangyakai01/APSIMClassic
        //==============================================================================
        /// <summary>
        /// Protected function to find the checkpoint process by msgID used.
        /// </summary>
        /// <param name="msgID">Key used to search the list.</param>
        /// <param name="checkPointFound">The checkpoint found.</param>
        /// <returns>The checkpoint process.</returns>
        //==============================================================================
        protected bool getProcess(uint msgID, ref TCheckPointProcess checkPointFound)
        {
            TCheckPointProcess checkPoint;
            bool bFound = false;
            int  i;

            i = 0;
            while ((!bFound) && (i < checkPointList.Count))
            {
                checkPoint = (TCheckPointProcess)checkPointList[i];
                if (checkPoint.msgID == msgID)
                {
                    checkPointFound = checkPoint;
                    bFound          = true;
                }
                else
                {
                    i++;
                }
            }

            return(bFound);
        }