Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
        // event args which will be used only when we need to pass additional data there, otherwise null
        public interface ILinkableComponentEventArgs
        {
                EventType Type { get; }
		string Description { get; }
		DateTime Time { get; }
                IExchangeItem ChangedItem { get; }
                bool Stop { get; set; } // used if simulation should be stopped!
        }


        public enum EventType 
	{
		Warning,
		Informative,
		ValueOutOfRange,
		GlobalProgress,
		TimeStepProgres,
		DataChanged,
		TargetBeforeGetValuesCall,
		SourceAfterGetValuesCall,
		SourceBeforeGetValuesReturn,
		TargetAfterGetValuesReturn,
		Other
	}

    // C# way
    
    public delegate void LinkableComponentEventHandler(object source, ILinkableComponentEventArgs args);

    public interface ILinkableComponent
    {
        event LinkableComponentEventHandler Progressed;
    }



    // Java way (Observable is a class, Observer is an interface!)

    public class LinkableComponentObservable extends Observable
    {
        public void notifyObservers(ILinkableComponentEventArgs args);
    }


    public interface ILinkableComponent
    {
        public LinkableComponentObservable getObservable();
    }

Here we are (only) replacing the OpenMI definition of the IListener and IPublisher interfaces in the Standard with the language specific classes that implement the notification/event mechanism in C# and Java. Development becomes a little bit easier (which in my opinion can also (and better) be done in the SDK), but the Standard no longer contains only interfaces and becomes more implementation language specific.

Logging in the OpenMI SDK

...