[Stk] typedef

TJF tjfoerster at web.de
Fri Sep 16 02:56:18 PDT 2011


Hi everybody,

is there any idea how to make typedef of MY_TYPE variable (depending on 
"oput") in the following example? If I use more copies of the Callback 
function it works (output_1, output_2,...). But is there any other way 
in C++ to make this smarter?

It must be defined during runtime. Is it possible to define it global 
(MY_TYPE_1, MY_TYPE_2,...) and do ... after oput ?  I tried some ways 
with templates, but I didn't have success.

______________________________________

// Callback
int output( void *outputBuffer, void *inputBuffer, ...)
     {
         typedef float MY_TYPE;
         ...
     }

int main( int argc, char *argv[] )
     {
     ...// here it depends on oput what kind of MY_TYPE will be used
         switch (oput)
         {
         case 1:
             try
             {
                 openStream( ..., &output, ... ); // i.e. output with 
callback function , typedef double MY_TYPE
                 ...
             }
             break;
         case 2:
             ...
     }
______________________________________

Best regards
Thomas



More information about the Stk mailing list