| VB Extension Tools HTML project report | |
| Project: CodeHelperCollection | Module: IBytes |
| Module Type  | Class module  |
|---|---|
| File  | C:\Code\EE-projects\units\vb\standard\src\IBytes.cls  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  |
Implementations of this interface should ease the access to any data which has to be handled as byte array.  |
| Hint  |
One might argue that 'CurrentVal()' isn't type safe. This is true, but: By adding an own local 'CurrentVal()' (not the 'IBytes_CurrentVal()' one) with a specific type to each implementation brings us type safty. We just have to delegate the 'IBytes_CurrentVal()' calls to 'CurrentVal()'.  |
| Please note  |
The hole stuff is build (and should also be used in further implementations) in a way that all methods declared below have exactly the same implementation code. This is (and can be) done using two mechanisms: 1st: See Hint above. 2nd: Each implementation handles the bytes by using an      instance of CIBytes class and delegate a calls for      'ByteVal()', 'NibbleLow()', 'NibbleHigh()' and 'BitVal()'      to the according members of CIBytes class.  |
| CBytesByte (Implements IBytes) | |
| CBytesDbl (Implements IBytes) | |
| CBytesInt (Implements IBytes) | |
| CBytesLng (Implements IBytes) | |
| CBytesSng (Implements IBytes) | |
| CBytesStr (Implements IBytes) |
| CurrentVal | |
| ByteVal | |
| NibbleLow | |
| NibbleHigh | |
| BitVal | |
| Size | |
| GetBytes | |
| PushToArray | |
| PullFromArray |
| Procedure 'CurrentVal' | List of procedures |
| Scope/Type  | Public Property (Let/Get)  |
|---|---|
| Code parameters  | RHS As Variant  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Access current value as expected by interface implementation.  |
| Result  | Variant: Current Value  |
| In parameters  | Variant: RHS (RightHandSide) - new value.  |
| Procedure 'ByteVal' | List of procedures |
| Scope/Type  | Public Property (Let/Get)  |
|---|---|
| Code parameters  |
Index As Long RHS As Byte  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Access the byte array as single byte of byte array.  |
| Result  | Integer: Current Value  |
| In parameters  |
Long: Index within byte array. Byte: RHS (RightHandSide) - new value.  |
| Procedure 'NibbleLow' | List of procedures |
| Scope/Type  | Public Property (Let/Get)  |
|---|---|
| Code parameters  |
Index As Long RHS As Byte  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Access the Low Nibble of a single byte in byte array.  |
| Result  | Byte: Current Value  |
| In parameters  |
Long: Index within byte array. Byte: RHS (RightHandSide) - new value.  |
| Procedure 'NibbleHigh' | List of procedures |
| Scope/Type  | Public Property (Let/Get)  |
|---|---|
| Code parameters  | Index As Long  |
| Code return value  | Byte  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Access the High Nibble of a single byte in byte array.  |
| Result  | Byte: Current Value  |
| In parameters  |
Long: Index within byte array. Byte: RHS (RightHandSide) - new value.  |
| Procedure 'BitVal' | List of procedures |
| Scope/Type  | Public Property (Let/Get)  |
|---|---|
| Code parameters  |
piByte As Long piBit As Long RHS As Boolean  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Access a single bit in byte array.  |
| Result  | Boolean: Current Value (True if bit is set, else False)  |
| In parameters  |
Long: Index within byte array (from 0 to [miSize - 1]). Long: Index bit within byte (from 0 to 7). Boolean: RHS (RightHandSide) - new value.  |
| Procedure 'Size' | List of procedures |
| Scope/Type  | Public Property (Get)  |
|---|---|
| Code return value  | Long  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Return current size of byte array.  |
| Result  | Long: The size.  |
| Procedure 'GetBytes' | List of procedures |
| Scope/Type  | Public Sub  |
|---|---|
| Code parameters  | pbBytes  |
| Code return value  | Byte)  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 28  |
| Purpose  | Return the copy of our bytes.  |
| Out parameters  | Byte: (Array) - Destination to push bytes in.  |
| Procedure 'PushToArray' | List of procedures |
| Scope/Type  | Public Function  |
|---|---|
| Code parameters  | pbBytes  |
| Code return value  | Byte, piPos As Long  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 28  |
| Purpose  | Copy our bytes to a foreign array.  |
| Out parameters  |
Byte: (Array) - Destination to push bytes in. Position in array.  |
| Return Value  | Boolean: True on succes, else False.  |
| Procedure 'PullFromArray' | List of procedures |
| Scope/Type  | Public Function  |
|---|---|
| Code parameters  | pbBytes  |
| Code return value  | Byte, piPos As Long  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 28  |
| Purpose  | Copy bytes from a foreign to our byte array.  |
| Out parameters  |
Byte: (Array) - Destination to push bytes in. Position in array.  |
| Return Value  | Boolean: True on succes, else False.  |