예제 #1
0
 /// <summary>
 ///	Constructor for the unit operation.
 /// </summary>
 /// <remarks>
 /// This method is creates the parameter collections for the object. As a result,
 /// parameters can be added in the constructor
 /// for the derived object or during the <c>Initialize()</c> call.
 /// </remarks>
 /// <exception cref ="ECapeUnknown">The error to be raised when other error(s),  specified for this operation, are not suitable.</exception>
 /// <exception cref = "ECapeOutOfResources">ECapeOutOfResources</exception>
 /// <exception cref = "ECapeLicenceError">ECapeLicenceError</exception>
 /// <exception cref = "ECapeFailedInitialisation">ECapeFailedInitialisation</exception>
 /// <exception cref = "ECapeBadInvOrder">ECapeBadInvOrder</exception>
 /// <param name = "name">The name of the PMC.</param>
 /// <param name = "description">The description of the PMC.</param>
 public CapeObjectBase(String name, String description)
     : base(name, description)
 {
     m_Parameters             = new ParameterCollection();
     this.m_SimulationContext = null;
     this.m_ValidationMessage = "This object has not been validated.";
     _disposed = false;
 }
예제 #2
0
 /// <summary>Creates a new object that is a copy of the current instance.</summary>
 /// <remarks>
 /// <para>
 /// Clone can be implemented either as a deep copy or a shallow copy. In a deep copy, all objects are duplicated;
 /// in a shallow copy, only the top-level objects are duplicated and the lower levels contain references.
 /// </para>
 /// <para>
 /// The resulting clone must be of the same type as, or compatible with, the original instance.
 /// </para>
 /// <para>
 /// See <see cref="Object.MemberwiseClone"/> for more information on cloning, deep versus shallow copies, and examples.
 /// </para>
 /// </remarks>
 /// <param name = "objectToBeCopied">The object being copied.</param>
 public CapeObjectBase(CapeObjectBase objectToBeCopied)
     : base((CapeIdentification)objectToBeCopied)
 {
     m_SimulationContext = objectToBeCopied.m_SimulationContext;
     m_Parameters.Clear();
     foreach (CapeParameter parameter in objectToBeCopied.Parameters)
     {
         m_Parameters.Add((CapeParameter)parameter.Clone());
     }
     this.m_ValidationMessage = "This object has not been validated.";
     _disposed = false;
 }
예제 #3
0
 // Dispose(bool disposing) executes in two distinct scenarios.
 // If disposing equals true, the method has been called directly
 // or indirectly by a user's code. Managed and unmanaged resources
 // can be disposed.
 // If disposing equals false, the method has been called by the
 // runtime from inside the finalizer and you should not reference
 // other objects. Only unmanaged resources can be disposed.
 /// <summary>
 /// Releases the unmanaged resources used by the CapeIdentification object and optionally releases
 /// the managed resources.
 /// </summary>
 /// <remarks><para>This method is called by the public <see href="http://msdn.microsoft.com/en-us/library/system.componentmodel.component.dispose.aspx">Dispose</see>see>
 /// method and the <see href="http://msdn.microsoft.com/en-us/library/system.object.finalize.aspx">Finalize</see> method.
 /// <bold>Dispose()</bold> invokes the protected <bold>Dispose(Boolean)</bold> method with the disposing
 /// parameter set to <bold>true</bold>. <see href="http://msdn.microsoft.com/en-us/library/system.object.finalize.aspx">Finalize</see>
 /// invokes <bold>Dispose</bold> with disposing set to <bold>false</bold>.</para>
 /// <para>When the <italic>disposing</italic> parameter is <bold>true</bold>, this method releases all
 /// resources held by any managed objects that this Component references. This method invokes the
 /// <bold>Dispose()</bold> method of each referenced object.</para>
 /// <para><bold>Notes to Inheritors</bold></para>
 /// <para><bold>Dispose</bold> can be called multiple times by other objects. When overriding
 /// <bold>Dispose(Boolean)</bold>, be careful not to reference objects that have been previously
 /// disposed of in an earlier call to <bold>Dispose</bold>. For more information about how to
 /// implement <bold>Dispose(Boolean)</bold>, see <see href="http://msdn.microsoft.com/en-us/library/fs2xkftw.aspx">Implementing a Dispose Method</see>.</para>
 /// <para>For more information about <bold>Dispose</bold> and <see href="http://msdn.microsoft.com/en-us/library/system.object.finalize.aspx">Finalize</see>,
 /// see <see href="http://msdn.microsoft.com/en-us/library/498928w2.aspx">Cleaning Up Unmanaged Resources</see>
 /// and <see href="http://msdn.microsoft.com/en-us/library/ddae83kx.aspx">Overriding the Finalize Method</see>.</para>
 /// </remarks>
 /// <param name = "disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     // Check to see if Dispose has already been called.
     if (!_disposed)
     {
         // If disposing equals true, dispose all managed
         // and unmanaged resources.
         if (disposing)
         {
             if (m_SimulationContext != null)
             {
                 if (m_SimulationContext.GetType().IsCOMObject)
                 {
                     System.Runtime.InteropServices.Marshal.FinalReleaseComObject(m_SimulationContext);
                 }
             }
             m_SimulationContext = null;
             m_Parameters.Clear();
             _disposed = true;
         }
         base.Dispose(disposing);
     }
 }