What I'm after here is for some input on my class definitions and if you think I'm might be missing something that wouldn't make these criteria work:
System is Ubuntu 12.04 gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
1} Records will be variable in length.
Integral types other than char can be calculated by their bit position
2^2 = short 2^3 = int and so on
There will never be an array other than strings
First byte of string is it's length.
Node.OffSet - previous node is records length.
2) Fields can be defined in application or dynamically by users
If NULL pointer is passed to LIST constructor for fields, user
can enter variable number of field types and descriptions
3) Sort order and ordinal position need not be the same.
#ifndef _LLIST_
#define _LLIST_
#include <ctime>
// Field types
#define F_CHAR = 1
#define F_SHORT = 2
#define F_INT = 3
#define F_LONG = 4
#define F_FLOAT = 8
#define F_DOUBLE = 16
#define SORT = 64 // On = Decending order
class Field { /* 16 bytes */
short Type : 8; // As described above
short Pos : 8; // Sort priority -1 if excluded from sort criteria
char Desc [14]; // Field description (Prompt string)
};
class Node { /* 24 Bytes */
short Status : 8; // Reserved
time_t Written; // Epoch time entry was posted
short Prev, Next; // Node pointers
short OffSet; // Length of this record
};
class List { /* 64 Bytes */
short Status : 8; // Reserved
time_t Initialized; // Epoch Time list was created.
short MaxNodes; // Space reserved, changes dynamically
short Node_Count; // Number of nodes written so far
short First_Node; // Pointer to first item as per sort criteria
short Last_Node; // Pointer to last item
Node *Nodes; // Nodes as they were entered.
short Field_Count; // Number of fileds in this lists record
Field *Feilds; // Field definitions.
int File_Desc; // File descriptor returned by fopen
long OffSet; // If file is mapped, ftell position
};
#endif