| VB Extension Tools HTML project report | |
| Project: CodeHelperCollection | Module: CIBytes |
| Module Type  | Class module  |
|---|---|
| File  | C:\Code\EE-projects\units\vb\standard\src\IIBytes.cls  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  |
This is a helper class for all classes which implement 'IBytes'. The purpose is to do all the basic byte handling and debugging purpose, which is needed by this classes.  |
| Hint  |
Add 'afDebug = -1' to 'Project settings' -->'Build' -->'Compile arguments' to enabled extended view to class object in Watch Window (all the stuff which is found below within the #If afDebug Then ... #End If section). You will even have view to each bit ... .  |
| Please Note  |
It's not a chance, that we have no error handling here: This class needs as much performance as possible. Though every error handling reduces performance, we do none at all. So error Handling should be done from the outside. Additionally in cause of errors occuring, we try to modify in a way that no error can occure (if possible).  |
| Requierements  |
'CopyMemory' Win API (Currently defined by 'win.tlb'. If win.tlb is not present in project, there has to by a regarding 'Declare' statement added to this modul or the project).  |
| Procedure 'Create' | List of procedures |
| Scope/Type  | Public Sub  |
|---|---|
| Code parameters  | piSize As Long  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 28  |
| Purpose  | Setup the class for work.  |
| In parameters  | Size of byte array.  |
| Procedure 'Size' | List of procedures |
| Scope/Type  | Public Property (Get)  |
|---|---|
| Code return value  | Long  |
| Procedure 'SetBytes' | List of procedures |
| Scope/Type  | Public Sub  |
|---|---|
| Code parameters  | pbBytes  |
| Code return value  | Byte)  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 28  |
| Purpose  | Copy bytes from parameter to our member byte array.  |
| In parameters  | Byte: (Array) - The bytes we get.  |
| 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 '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 RHS As 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 '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.  |
| Procedure 'GetBitInByte' | List of procedures |
| Scope/Type  | Private Function  |
|---|---|
| Code parameters  |
piByte As Long piBit As Long  |
| Code return value  | Boolean  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Get a bit of a byte.  |
| In parameters  |
Long: Index of byte (0 to 7) to be read from Long: Index of Bit (0 to 7) in byte to be read from  |
| Return Value  | Boolean: True is bit is set, else False.  |
| Procedure 'SetBitInByte' | List of procedures |
| Scope/Type  | Private Sub  |
|---|---|
| Code parameters  |
piByte As Long piBit As Long pfState As Boolean  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Set a bit of a byte, while all others are kept as the are.  |
| In parameters  |
Long: Index of byte (0 to 7) to be modified Long: Index of Bit (0 to 7) in byte to be modified  |
| Procedure 'TestByteArraySpace' | List of procedures |
| Scope/Type  | Private Function  |
|---|---|
| Code parameters  |
piLBound As Long piUBound As Long piPos As Long  |
| Code return value  | Boolean  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 28  |
| Purpose  |
Check whether there is enough bytes remaining form the size position in array till its end to put in all the bytes.  |
| Result  | Boolean: True if so, else False.  |
| Procedure 'Z0_BytesHexDebug' | List of procedures |
| Scope/Type  | Public Property (Get)  |
|---|---|
| Code return value  | String  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Debug mode purpose only: Return all bytes as hexadecimal.  |
| Result  | String: Current Values.  |
| Procedure 'Z1_BytesDebug' | List of procedures |
| Scope/Type  | Public Property (Get)  |
|---|---|
| Code return value  | String  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Debug mode purpose only: Return all bytes in decimal.  |
| Result  | String: Current Value.  |
| Procedure 'Z2_BitsDebug' | List of procedures |
| Scope/Type  | Public Property (Get)  |
|---|---|
| Code return value  | String  |
| Author  | Ralf Kunsmann  |
| Date  | 2003 02 26  |
| Purpose  | Debug mode purpose only: Return all bits of all bytes.  |
| Result  | String: Current Value.  |
| Procedure 'Z3_NibblesDebug' | List of procedures |
| Scope/Type  | Public Property (Get)  |
|---|---|
| Code return value  | String  |
| Author  | Ralf Kunsmann  |
| Date  | 2773 72 26  |
| Purpose  | Debug mode purpose only: Return all bytes nibble by nibble.  |
| Result  | String: Current Value.  |
| Procedure 'Z4_StringAsciiDebug' | List of procedures |
| Scope/Type  | Public Property (Get)  |
|---|---|
| Code return value  | String  |
| Author  | Ralf Kunsmann  |
| Date  | 2773 72 26  |
| Purpose  | Debug mode purpose only: Return all bytes nibble by nibble.  |
| Result  | String: Current Value.  |
| Procedure 'GetByteHex' | List of procedures |
| Scope/Type  | Private Function  |
|---|---|
| Code parameters  | pb As Byte  |
| Code return value  | String  |
| Author  | Ralf Kunsmann  |
| Date  | 2773 72 26  |
| Purpose  | Debug mode purpose only: Build a hexadecimal form a byte value.  |
| Result  | String: Current Value.  |