Files
DP44/Common/DTS.Common.Serialization/IWriteable.cs
2026-04-17 14:55:32 -04:00

138 lines
5.1 KiB
C#

/*
* IWriteable.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
namespace DTS.Serialization
{ ///
/// <summary>
/// Defines "writeability" for DTS.Serialization objects.
/// </summary>
///
public interface IWritable
{ //
// It's not that it doesn't take much to be writable, just that all non-trivial writable
// definitions involve a specific type of object that the file is to be serialized
// out of (see non-trivial IWritable interface below). But one may want to reflect against
// a general "IWritable" type for various reasons, i.e., to check to see if file-type object
// is writeable in general before presenting the user with write options on the UI (that will
// perform polymorphic write functions on the object, natch).
} //
/// <summary>
/// Defines "writability" for DTS.Serialization objects.
/// </summary>
///
/// <typeparam name="T">
/// The type of object to be serialized from.
/// </typeparam>
///
public interface IWritable<T> : IWritable
{ ///
/// <summary>
/// Get a serializer to "write" out an instance of this file format from the specified object type.
/// </summary>
///
IWriter<T> Exporter { get; }
}
/// <summary>
/// Defines the general requirements of a DTS.Serialization file writer object.
/// </summary>
public interface IWriter
{ //
// It's not that it doesn't take much to be a writer, just that all non-trivial writer
// definitions involve a specific type of object that the file is to be serialized
// out of (see non-trivial IWriter interface below). But one may want to reflect against
// a general "IWriter" type for various reasons, i.e., to check to see if file-type object
// is writeable in general before presenting the user with write options on the UI (that will
// perform polymorphic write functions on the object, natch).
} //
public delegate bool CancelRequested();
/// <summary>
/// Defines the non-trivial requirements of a DTS.Serialization file writer object.
/// </summary>
///
/// <typeparam name="T">
/// The type of object the file is to be serialized from.
/// </typeparam>
///
public interface IWriter<T> : IWriter
{ ///
/// <summary>
/// Generate the path-specified serialization from the given object.
/// </summary>
///
/// <param name="pathname">
/// The <see cref="string"/> pathname to which the serialization will be written.
/// </param>
///
/// <param name="target">
/// The object to be serialized.
/// </param>
///
void Write(string pathname, string id, T target, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength);
/// <summary>
/// Generate the path-specified serialization from the given object.
/// </summary>
///
/// <param name="pathname">
/// The <see cref="string"/> pathname to which the serialization will be written.
/// </param>
///
/// <param name="target">
/// The object to be serialized.
/// </param>
///
/// <param name="onBeginEvent">
/// The <see cref="DTS.Serialization.BeginEventHandler"/> to be notified when the write begins.
/// </param>
///
/// <param name="onEndEvent">
/// The <see cref="DTS.Serialization.EndEventHandler"/> to be notified when the write completes.
/// </param>
///
/// <param name="onTickEvent">
/// The <see cref="DTS.Serialization.TickEventHandler"/> to be notified when the write "progresses".
/// </param>
///
void Write(string pathname,
string id,
string dataFolder,
T target,
bool bFiltering,
bool includeGroupNameInISOExport,
FilteredData fd,
Test.Module.Channel tmChannel,
int channelNumber,
BeginEventHandler onBeginEvent,
CancelEventHandler onCancelEvent,
EndEventHandler onEndEvent,
TickEventHandler onTickEvent,
ErrorEventHandler onErrorEvent,
CancelRequested cancelRequested,
double minStartTime,
int dataCollectionLength);
void Initialize(string pathname,
string id,
string dataFolder,
T target,
bool bFiltering,
bool includeGroupNameInISOExport,
FilteredData fd,
Test.Module.Channel tmChannel,
int channelNumber,
BeginEventHandler onBeginEvent,
CancelEventHandler onCancelEvent,
EndEventHandler onEndEvent,
TickEventHandler onTickEvent,
ErrorEventHandler onErrorEvent,
CancelRequested cancelRequested);
}
}