/*
Copyright (c) Microsoft Corporation
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License
at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF
TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions and
limitations under the License.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Data.SqlTypes;
using Microsoft.Research.DryadLinq;
#pragma warning disable 1591
namespace Microsoft.Research.DryadLinq.Internal
{
///
/// Represents a factory for making DryadLINQ readers/writers.
///
/// The type of record
/// A DryadLINQ user should not need to use this class directly. It is public
/// because it is used in the code auto-generated by DryadLINQ.
public abstract class DryadLinqFactory
{
///
/// Creates a new reader from a native stream.
///
/// A native stream.
/// A reader that uses DryadLINQ serialization for records of type T.
public abstract DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream);
///
/// Creates a new reader from a Dryad vertex handle and a port number.
///
/// A Dryad vertex handle.
/// A port number
/// A reader that uses DryadLINQ serialization for records of type T.
public abstract DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port);
///
/// Creates a new writer from a native stream.
///
/// A native stream.
/// A writer that uses DryadLINQ serialization for record of type T.
public abstract DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream);
///
/// Creates a new writer from a Dryad vertex handle and a port number.
///
/// A Dryad vertex handle.
/// A port number.
/// The size for write buffer.
/// A writer that uses DryadLINQ serialization for records of type T.
public abstract DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize);
}
public sealed class DryadLinqFactoryByte : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordByteReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordByteReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordByteWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordByteWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactorySByte : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordSByteReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordSByteReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordSByteWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordSByteWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryBool : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordBoolReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordBoolReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordBoolWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordBoolWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryChar : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordCharReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordCharReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordCharWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordCharWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryShort : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordShortReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordShortReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordShortWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordShortWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryUShort : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordUShortReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordUShortReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordUShortWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordUShortWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryInt32 : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordInt32Reader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordInt32Reader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordInt32Writer(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordInt32Writer(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryUInt32 : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordUInt32Reader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordUInt32Reader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordUInt32Writer(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordUInt32Writer(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryInt64 : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordInt64Reader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordInt64Reader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordInt64Writer(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordInt64Writer(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryUInt64 : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordUInt64Reader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordUInt64Reader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordUInt64Writer(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordUInt64Writer(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryFloat : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordFloatReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordFloatReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordFloatWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordFloatWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryDecimal : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordDecimalReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordDecimalReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordDecimalWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordDecimalWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryDouble : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordDoubleReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordDoubleReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordDoubleWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordDoubleWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryDateTime : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordDateTimeReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordDateTimeReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordDateTimeWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordDateTimeWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryString : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordStringReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordStringReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordStringWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordStringWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryGuid : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadRecordGuidReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadRecordGuidReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordGuidWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordGuidWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactoryLineRecord : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordTextReader(new DryadLinqTextReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordTextReader(new DryadLinqTextReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordTextWriter(new DryadLinqTextWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordTextWriter(new DryadLinqTextWriter(handle, port, buffSize));
}
}
public sealed class DryadLinqFactorySqlDateTime : DryadLinqFactory
{
public override DryadLinqRecordReader MakeReader(NativeBlockStream nativeStream)
{
return new DryadLinqRecordSqlDateTimeReader(new DryadLinqBinaryReader(nativeStream));
}
public override DryadLinqRecordReader MakeReader(IntPtr handle, UInt32 port)
{
return new DryadLinqRecordSqlDateTimeReader(new DryadLinqBinaryReader(handle, port));
}
public override DryadLinqRecordWriter MakeWriter(NativeBlockStream nativeStream)
{
return new DryadLinqRecordSqlDateTimeWriter(new DryadLinqBinaryWriter(nativeStream));
}
public override DryadLinqRecordWriter MakeWriter(IntPtr handle, UInt32 port, Int32 buffSize)
{
return new DryadLinqRecordSqlDateTimeWriter(new DryadLinqBinaryWriter(handle, port, buffSize));
}
}
}