Help - Search - Members - Calendar
Full Version: C++ to C by structure
Impulse Support Forums > Impulse Forums > General Discussions
MEMS
As you know you can convert your C++ code to C by replacing the classes by structures and member functions to normal functions that accept a pointer to the proper structure.
A very good example is windows API and MFC
Unfortunately it seems that Impulse has a very little support for structure as it is stated in the help file.
Do you plane to increase the support for structures or not?
Thanks
Dani.K (MEMS)
RalphBodenner
Impulse C uses this kind of object-oriented function in its I/O library (streams, shared memories, etc.). However, these are special cases recognized by the hardware compiler.

Improved support for structures is part of the long-term development plan, but won't be available in the immediate future. What features are you most interested in? The ability to pass structs through streams?

In the meantime, there are workarounds for converting C++ code. One method is to use macros associated with a "class" to marshal/unmarshal struct-based data in and out of streams, or to replace function calls with inline code accessing structures. Function calls in hardware processes ("hardware primitives") are supported already, so some method calls can be replaced with modified function calls that take as parameters only the object state data they need.

Ralph
MEMS
For example consider you want to connect to differentiators together :

struct Diff
{
double Input;
double preInput;
double output;
Diff * NextElement; // this not support in Impulse
};

void ComputDiff(Diff * Element)
{
// some code
//
}
void SendResult(Diff* Element)
{// give the output to the next diffrentiator.
Element->NextElement->Input= Element->output ;

}

But Impulse dose not support pointer to other structures .
Any solution?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.