M
Matt
Hi all,
Suppose I have a bunch of similar structs/classes in a format like this:
struct s1{
int arg1;
char arg2[SIZE];
};
struct s2{
char arg1[SIZE];
int arg2;
float arg3;
};
....
struct sN{
int flag;
s1 arr1;
};
Then I need a general method(of course, we can do it one by one to pull
out/assign values from/to these structs with something like this(we don't
care mem alloc, and we also have a migic buf which can accept/supply
necessary values on demand btw :
void set_values_for_any_struct (struct *assignto, point *migbuf, int
arrdepth, .., any other stuff)
{
/*
suppose we know in advance the assignto is sN *
and we even know sN has two members, and what their types are, but since
this method should fit all structs we can't use assignto->flag =
migbuf.value to assign the value, is there a way to do so?
*/
???
}
// same thing for get
(I'm doing this for a soap client(not server) app, not sure param's name in
soap1.2 is significant means server decides the name and I may not be able
to change them. but I don't have ideas even I can decide the struct and its
members names for soap1.1)
Anyway, help!
-m
Suppose I have a bunch of similar structs/classes in a format like this:
struct s1{
int arg1;
char arg2[SIZE];
};
struct s2{
char arg1[SIZE];
int arg2;
float arg3;
};
....
struct sN{
int flag;
s1 arr1;
};
Then I need a general method(of course, we can do it one by one to pull
out/assign values from/to these structs with something like this(we don't
care mem alloc, and we also have a migic buf which can accept/supply
necessary values on demand btw :
void set_values_for_any_struct (struct *assignto, point *migbuf, int
arrdepth, .., any other stuff)
{
/*
suppose we know in advance the assignto is sN *
and we even know sN has two members, and what their types are, but since
this method should fit all structs we can't use assignto->flag =
migbuf.value to assign the value, is there a way to do so?
*/
???
}
// same thing for get
(I'm doing this for a soap client(not server) app, not sure param's name in
soap1.2 is significant means server decides the name and I may not be able
to change them. but I don't have ideas even I can decide the struct and its
members names for soap1.1)
Anyway, help!
-m