comparison tango/tango/io/protocol/model/IProtocol.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children
comparison
equal deleted inserted replaced
131:5825d48b27d1 132:1700239cab2e
1 /*******************************************************************************
2
3 copyright: Copyright (c) 2004 Kris Bell. All rights reserved
4
5 license: BSD style: $(LICENSE)
6
7 version: Jan 2007: initial release
8
9 author: Kris
10
11 *******************************************************************************/
12
13 module tango.io.protocol.model.IProtocol;
14
15 private import tango.io.model.IBuffer;
16
17 /*******************************************************************************
18
19 *******************************************************************************/
20
21 abstract class IProtocol
22 {
23 enum Type
24 {
25 Void = 0,
26 Utf8,
27 Bool,
28 Byte,
29 UByte,
30 Utf16,
31 Short,
32 UShort,
33 Utf32,
34 Int,
35 UInt,
36 Float,
37 Long,
38 ULong,
39 Double,
40 Real,
41 Obj,
42 Pointer,
43 }
44
45 /***********************************************************************
46
47 ***********************************************************************/
48
49 alias void delegate (void* src, uint bytes, Type type) Writer;
50 alias void delegate (void* src, uint bytes, Type type) ArrayWriter;
51
52 alias void[] delegate (void* dst, uint bytes, Type type) Reader;
53 alias void[] delegate (Reader reader, uint bytes, Type type) Allocator;
54
55 alias void[] delegate (void* dst, uint bytes, Type type, Allocator) ArrayReader;
56
57 /***********************************************************************
58
59 ***********************************************************************/
60
61 abstract IBuffer buffer ();
62
63 /***********************************************************************
64
65 ***********************************************************************/
66
67 abstract void[] read (void* dst, uint bytes, Type type);
68
69 /***********************************************************************
70
71 ***********************************************************************/
72
73 abstract void write (void* src, uint bytes, Type type);
74
75 /***********************************************************************
76
77 ***********************************************************************/
78
79 abstract void[] readArray (void* dst, uint bytes, Type type, Allocator alloc);
80
81 /***********************************************************************
82
83 ***********************************************************************/
84
85 abstract void writeArray (void* src, uint bytes, Type type);
86 }
87
88
89 /*******************************************************************************
90
91 *******************************************************************************/
92
93 abstract class IAllocator
94 {
95 /***********************************************************************
96
97 ***********************************************************************/
98
99 abstract void reset ();
100
101 /***********************************************************************
102
103 ***********************************************************************/
104
105 abstract IProtocol protocol ();
106
107 /***********************************************************************
108
109 ***********************************************************************/
110
111 abstract void[] allocate (IProtocol.Reader, uint bytes, IProtocol.Type);
112 }