API.cs
The .Net programming interface is obtained using a static class in the AteSystems.InCal.dll library. This static class is aptly named API and contains 2 methods:
- GetInterface
This method returns a raw uninitialized instance of the IApi interface. The user is responsible for initializing and setting certain control values like CatchExceptions.
- Initialize
This method returns an initialized instance of the IApi interface. The function takes as parameters the configuration file and the CatchExceptions flag.
For a more complete understanding, the source code of these functions is provided below:
namespace AteSystems.InCal
{
/// <summary>
/// This static class is exposed to the outside and is used to
/// acquire a reference to the API interface
/// </summary>
public static class API
{
#region Methods
/// <summary>
/// Return an uninitialized API interface.
/// </summary>
public static IApi GetInterface()
{
return InCal.Api;
}
/// <summary>
/// Initialize the Library with a configuration file
/// and return the initialized API interface.
/// catchExceptions gets or sets whether exceptions thrown during the course
/// of a calibration are caught and turned into error strings that can be queried.
/// If false exceptions pass through to the caller.
/// </summary>
public static IApi Initialize(string configFilename, bool catchExceptions = false)
{
IApi api = GetInterface();
api.CatchExceptions = catchExceptions;
api.Initialize(configFilename);
return api;
}
#endregion Methods
}
}