Howto:Extend Nasal: Difference between revisions

Jump to navigation Jump to search
m
Line 396: Line 396:
== A standard interface for mapping C++ classes to Nasal objects ==
== A standard interface for mapping C++ classes to Nasal objects ==


There's a plan to eventually generalize and unify all those helpers in FGPositioned.cxx and provide them as part of the FGNasalSys class (or some custom abstract base class that C++ classes should implement to expose objects to Nasal), so that they automatically become available to all users of the Nasal subsystem.
There's a plan to eventually generalize and unify all those helpers in FGPositioned.cxx and provide them as part of the FGNasalSys class (or some custom abstract base class that C++ classes should implement to expose objects to Nasal), so that they automatically become available to all users of the Nasal subsystem, just by implementing a certain interface.


Looking at the code in NasalPositioned.cxx: http://gitorious.org/fg/flightgear/blobs/78afdb3c2227e75fc1542b3992dcea26181d98cf/src/Scripting/NasalPositioned.cxx#line139
Looking at the code in [http://gitorious.org/fg/flightgear/blobs/78afdb3c2227e75fc1542b3992dcea26181d98cf/src/Scripting/NasalPositioned.cxx#line139 NasalPositioned.cxx]:


The function bodies for these helpers are largely identical:
The function bodies for these helpers are largely identical:
Line 439: Line 439:


<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
class FGPositioned : public SGReferenced, public FGNasalOOPWrapper { .... };
class FGPositioned : public SGReferenced, public FGNasalWrapper {  
// ...
};
</syntaxhighlight>
</syntaxhighlight>


Navigation menu