OE v16.10 Posted

11 views
Skip to first unread message

Doug

unread,
Oct 19, 2016, 12:11:25 AM10/19/16
to opene...@googlegroups.com

Just posted v16.10 of the framework.  Only one significant change in this release; the renaming of include files (*.h) to use the file extension (*.hpp).  I've gone back and forth on the merits of this change, but in the end felt it should be made.

Many code bases use *.h for C and C++ code, which can add some confusion if you are mixing and matching these 2 different languages (and they really are different) within the same project.  I'll be adding Lua scripting capability soon, and it's pure C code with *.h headers.  The Lua package supplies 1 *.hpp header for use with a C++ project -- making this change, improves clarify a bit which is probably a good thing.  Also, at some point I could see tapping CLIPS and SQLite -- both C libraries.  The other thing is with C++ templates -- it makes little sense to have a template with a filename of *.h -- templates define code, which is why boost uses *.hpp for all C++ code.

There was another factor involved in the decision -- apparently clang is starting to issue warnings if it finds C++ code inside a *.h header - this appears to happen when you use precompiled headers to speed up compilation - if a *.h file that include C++ code is precompiled - a warning is issued.  More info can be found here (http://clang.llvm.org/docs/UsersManual.html#precompiled-headers).  Doing this is a nudge to developers to be more clear about the contents of a header file.

If anyone needs it, the quickest way to update code based on framework is to use the 'sed' (stream editor) to alter the include pattern from using a *.h extension to *.hpp.  Here is my (linux) bash script to do that:

for file in *.cpp
do
  echo $file
  sed -i 's/\(#include "openeaagles[A-Za-z0-9/_]*[^.h]\).*/\1.hpp"/' "$file"
done

This will loop through all the *.cpp files within a given directory and look for a pattern such as:

#include "openeaagles/base/Object.h"

and replace it with:

#include "openeaagles/base/Object.hpp"

The script isn't perfect -- not every replacement will be correct, but 99% will be.  The only ones it seems to mess up on at includes for some of the embedded osg code (Vectors and Matrix classes).  I need to learn sed better to correct!  Just change the *.cpp to *.h to process all of your existing *.h files.

For the next release, I plan on focusing on better 'model' organization.  Right now, the simulation library is a mix of infrastructure that structurally organizes a simulation to be executed, that optionally includes graphics, network interfaces (interoperability, etc) and out-the-window interfaces with specific models for things like atmosphere, sensors, radar, and particular kinds of players (tanks, etc.).  Lifting the 'model' code out and moved in the 'models' library will further improve the clarity of what exists.

Without a doubt, the framework is stocked with capability - much of the recent work has been focused on improving upon it by leveraging so-called 'modern C++' concepts and organization.

Doug

Reply all
Reply to author
Forward
0 new messages