[Fawkes Git] branch/blackboard-packed-interfaces: created (0.5.0-3368-g46f1e25)

Tim Niemueller niemueller at kbsg.rwth-aachen.de
Wed Nov 16 15:35:24 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, blackboard-packed-interfaces has been created
        at  46f1e250c8f6b5938a05a1ad4a347f13285519cb (commit)

http://git.fawkesrobotics.org/fawkes.git/blackboard-packed-interfaces

- *Log* ---------------------------------------------------------------
commit 46f1e250c8f6b5938a05a1ad4a347f13285519cb
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Fri Oct 14 17:49:32 2016 +0200
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Fri Oct 14 17:49:32 2016 +0200

    ffifacegen: generate packed interface structs
    
    Interface structures used to be created 4-byte packed. However, changing
    this to a (1-byte) packed layout has two advantages:
    - we generate smaller structs reducing the network load (somewhat)
    - the packing/alignment is more predictable
    
    Especially the latter drove me to this change. Compilers are virtually
    free to choose their in-struct alignment. The problem in combination
    with jfawkes was that single-byte ints (int8/uint8) no longer were
    padded. The deserialization of TestInterface data therefore failed due
    to a different expectation in terms of length.
    
    The one minor disadvantage is that computation speed could suffer --
    would we ever compute directly on interface values. However, if strict
    aligntment had been a requirement, it would have been risky/broken
    before already, 4-byte alignment on a 64-bit machine doesn't help much
    here.
    
    Did I mention that it is time for a blackboard 2.0 with better data
    structures and marshalling?

http://git.fawkesrobotics.org/fawkes.git/commit/46f1e25
http://trac.fawkesrobotics.org/changeset/46f1e25

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------


- *Diffs* -------------------------------------------------------------

- *commit* 46f1e250c8f6b5938a05a1ad4a347f13285519cb - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Fri Oct 14 17:49:32 2016 +0200
Subject: ffifacegen: generate packed interface structs

 src/libs/interfaces/generator/cpp_generator.cpp |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/interfaces/generator/cpp_generator.cpp b/src/libs/interfaces/generator/cpp_generator.cpp
index 5f9b854..25dfcfc 100644
--- a/src/libs/interfaces/generator/cpp_generator.cpp
+++ b/src/libs/interfaces/generator/cpp_generator.cpp
@@ -129,9 +129,8 @@ CppInterfaceGenerator::write_struct(FILE *f, std::string name, std::string /* in
   //stable_sort(fields.begin(), fields.end());
 
   fprintf(f,
-	  "#pragma pack(push,4)\n"
 	  "%s/** Internal data storage, do NOT modify! */\n"
-	  "%stypedef struct {\n"
+	  "%stypedef struct __attribute__((packed)) {\n"
 	  "%s  int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */\n"
 	  "%s  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */\n", is.c_str(), is.c_str(), is.c_str(), is.c_str());
 
@@ -143,8 +142,7 @@ CppInterfaceGenerator::write_struct(FILE *f, std::string name, std::string /* in
     fprintf(f, "; /**< %s */\n", (*i).getComment().c_str());
   }
   
-  fprintf(f, "%s} %s;\n"
-	  "#pragma pack(pop)\n\n", is.c_str(), name.c_str());
+  fprintf(f, "%s} %s;\n\n", is.c_str(), name.c_str());
 }
 
 




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list