The Host Interface |
Top Previous Next |
When a FreeFlyer Extension is loaded and initialized by FreeFlyer it is given an instance of the IFFHost interface. This gives the Extension access to FreeFlyer's error reporting mechanisms, various conversion routines, and other resources. Specifically, the host interface gives you access to:
Additionally the host interface allows you to initialize IMatrix and ITimeSpan classes through:
An Example Workflow using the Host Interface
Using the Host InterfaceWhen you create your own Extension, this interface can be accessed through the inherited Host property. Below is an example of how these interfaces might be used:
In this example, the Solar System interface is used to obtain the ICRF positions of Earth and the Sun at the input epoch. Then, the difference of the two positions is computed to find the components of the relative position vector. Please refer to the Programming Reference for full details on the available interfaces through IFFHost.
IMatrix CreationWhen working with IMatrix objects, the first step is to create the object and set it to null:
Then, the IMatrix object should be initialized in an override of the IFFObjectExtension.Initialize method using the IFFHost.CreateMatrix method:
Once this step is complete the IMatrix object can be used as desired within your extension.
ITimeSpan CreationThe workflow for creating and using ITimeSpan objects is similar to that for IMatrix objects. The first step is to create the object and set it to null:
Then, the ITimeSpan object should be initialized in an override of the IFFObjectExtension.Initialize method:
For the ITimeSpan, there are two methods to do this: IFFHost.CreateTimeSpanQuantized and IFFHost.CreateTimeSpanUnquantized. As the method names state, the CreateTimeSpanQuantized method creates a quantized TimeSpan and the CreateTimeSpanUnquantized method creates an unquantized TimeSpan. The difference between the two is the precision to which they can hold time: a quantized TimeSpan holds time precisely to the nanosecond level whereas an unquantized TimeSpan holds time to the maximum available precision, which permits sub-nanosecond precision. An unquantized TimeSpan is typically only needed when implementing the CalculateForce method in a Custom Force Extension, as sub-nanosecond precision is needed to sample accelerations at different stages of the integration process. Once this step is complete the ITimeSpan object can be used as desired within your extension.
|