| 1 | #Region "Microsoft.VisualBasic::caea15ee86f20fc11ef8717b7b145706, Microsoft.VisualBasic.Core\Net\Protocol\Streams\ArrayAbstract.vb" |
| 2 | |
| 3 | ' Author: |
| 4 | ' |
| 5 | ' asuka (amethyst.asuka@gcmodeller.org) |
| 6 | ' xie (genetics@smrucc.org) |
| 7 | ' xieguigang (xie.guigang@live.com) |
| 8 | ' |
| 9 | ' Copyright (c) 2018 GPL3 Licensed |
| 10 | ' |
| 11 | ' |
| 12 | ' GNU GENERAL PUBLIC LICENSE (GPL3) |
| 13 | ' |
| 14 | ' |
| 15 | ' This program is free software: you can redistribute it and/or modify |
| 16 | ' it under the terms of the GNU General Public License as published by |
| 17 | ' the Free Software Foundation, either version 3 of the License, or |
| 18 | ' (at your option) any later version. |
| 19 | ' |
| 20 | ' This program is distributed in the hope that it will be useful, |
| 21 | ' but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | ' GNU General Public License for more details. |
| 24 | ' |
| 25 | ' You should have received a copy of the GNU General Public License |
| 26 | ' along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 27 | |
| 28 | |
| 29 | |
| 30 | ' /********************************************************************************/ |
| 31 | |
| 32 | ' Summaries: |
| 33 | |
| 34 | ' Class ArrayAbstract |
| 35 | ' |
| 36 | ' Properties: Values |
| 37 | ' |
| 38 | ' Constructor: (+1 Overloads) Sub New |
| 39 | ' |
| 40 | ' |
| 41 | ' /********************************************************************************/ |
| 42 | |
| 43 | #End Region |
| 44 | |
| 45 | Imports System.Runtime.CompilerServices |
| 46 | Imports System.Xml.Serialization |
| 47 | Imports Microsoft.VisualBasic.Serialization.BinaryDumping |
| 48 | |
| 49 | Namespace Net.Protocols.Streams.Array |
| 50 | |
| 51 | Public MustInherit Class ArrayAbstract(Of T) : Inherits RawStream |
| 52 | |
| 53 | <XmlAttribute("T")> |
| 54 | Public Overridable Property Values As T() |
| 55 | |
| 56 | Protected ReadOnly serialization As IGetBuffer(Of T) |
| 57 | Protected ReadOnly deserialization As IGetObject(Of T) |
| 58 | |
| 59 | ''' <summary> |
| 60 | ''' 由于这个模块是专门应用于服务器端的数据交换的模块,所以稳定性优先, |
| 61 | ''' 这里面的函数都是安全的数组访问方法 |
| 62 | ''' </summary> |
| 63 | ''' <param name="index"></param> |
| 64 | ''' <returns></returns> |
| 65 | Default Public Property value(index As Integer) As T |
| 66 | <MethodImpl(MethodImplOptions.AggressiveInlining)> |
| 67 | Get |
| 68 | Return Values.ElementAtOrDefault(index) |
| 69 | End Get |
| 70 | <MethodImpl(MethodImplOptions.AggressiveInlining)> |
| 71 | Set(value As T) |
| 72 | Call Values.Set(index, value) |
| 73 | End Set |
| 74 | End Property |
| 75 | |
| 76 | Sub New(serialize As IGetBuffer(Of T), load As IGetObject(Of T)) |
| 77 | serialization = serialize |
| 78 | deserialization = load |
| 79 | End Sub |
| 80 | End Class |
| 81 | End Namespace |