Hi,
I have defined this class to hold configuration for each field of a
message:
class field {
public:
int fieldno;
std::string name;
rtypes type;
rtypes vtype;
int length;
bool optional;
int obitmap;
ftranslation trans;
int roffset; // Configured record offset. -1 means it is
calulated
int vfp; // specifies which index for contains the length of this
field
field(fieldHeadIdx fn, char * s, rtypes t, int l, int ro, bool o,
int bp
ftranslation tl) {
fieldno = (int)fn, name = s; type = t; length = l; roffset=
ro; optio
l=o; obitmap = bp; trans = tl, vfp=-1;
}
......
}
Then hold the configuration for each field in a vector.
std::vector<field> message;
When the class is created I set the contents of the vector in the
constructor:
void msgmap::msgmap() {
headercf.push_back(field(A, "A",
H, 1, 0, false, 0, none));
headercf.push_back(field(B, "B",
H, 1, 1, false, 1, none));
headercf.push_back(field(C, "C",
I16, 2, 2, false, 2, none));
headercf.push_back(field(D, "D",
TX5, 5, 4, false, 3, none));
headercf.push_back(field(E, "E
ion", C, 22, 9, false, 4, none));
headercf.push_back(field(F, "F",
BCDX, 33, 31, false, 5, none));
headercf.push_back(field(H, "H",
C, 8, 64, false, 6, none));
headercf.push_back(field(J, "J",
H, 1, 72, false, 7, none));
headercf.push_back(field(K, "K",
H, 18, 73, false, 8, none));
.....
}
The when decoding I use the iterator to go through each field.
My question is, can I make the configuration static (compiled)? If so
how can I do it?
Thanks
Michael