Skip to content

Commit

Permalink
Add G3MapQuat and G3MapVectorQuat objects (#121)
Browse files Browse the repository at this point in the history
Also fix the name of the python binding for the vector-of-quaternions type
  • Loading branch information
arahlin authored Oct 12, 2023
1 parent c1d2763 commit 5706b0c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions core/include/core/G3Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <G3Frame.h>
#include <G3Vector.h>
#include <G3Quat.h>
#include <map>
#include <sstream>
#include <complex>
Expand Down Expand Up @@ -78,6 +79,8 @@ G3MAP_OF(std::string, std::vector<std::complex<double> >, G3MapVectorComplexDoub
G3MAP_OF(std::string, G3VectorTime, G3MapVectorTime);
G3MAP_OF(std::string, int32_t, G3MapInt);
G3MAP_OF(std::string, std::string, G3MapString);
G3MAP_OF(std::string, quat, G3MapQuat);
G3MAP_OF(std::string, G3VectorQuat, G3MapVectorQuat);

namespace cereal {
template <class A> struct specialize<A, G3MapFrameObject, cereal::specialization::member_load_save> {};
Expand Down
6 changes: 6 additions & 0 deletions core/src/G3Map.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ G3_SERIALIZABLE_CODE(G3MapInt);
G3_SERIALIZABLE_CODE(G3MapDouble);
G3_SERIALIZABLE_CODE(G3MapMapDouble);
G3_SERIALIZABLE_CODE(G3MapString);
G3_SERIALIZABLE_CODE(G3MapQuat);
G3_SERIALIZABLE_CODE(G3MapVectorBool);
G3_SERIALIZABLE_CODE(G3MapVectorInt);
G3_SERIALIZABLE_CODE(G3MapVectorDouble);
G3_SERIALIZABLE_CODE(G3MapVectorString);
G3_SERIALIZABLE_CODE(G3MapVectorVectorString);
G3_SERIALIZABLE_CODE(G3MapVectorComplexDouble);
G3_SERIALIZABLE_CODE(G3MapVectorTime);
G3_SERIALIZABLE_CODE(G3MapVectorQuat);

G3_SPLIT_SERIALIZABLE_CODE(G3MapFrameObject);

Expand All @@ -95,6 +97,8 @@ PYBINDINGS("core") {
register_g3map<G3MapInt>("G3MapInt", "Mapping from strings to ints.");
register_g3map<G3MapString>("G3MapString", "Mapping from strings to "
"strings.");
register_g3map<G3MapQuat>("G3MapQuat", "Mapping from strings to "
"quaternions.");
register_g3map<G3MapVectorBool>("G3MapVectorBool", "Mapping from "
"strings to arrays of booleans.");
register_g3map<G3MapVectorDouble>("G3MapVectorDouble", "Mapping from "
Expand All @@ -109,6 +113,8 @@ PYBINDINGS("core") {
"Mapping from strings to lists of lists of strings.");
register_g3map<G3MapVectorTime>("G3MapVectorTime", "Mapping from "
"strings to lists of G3 time objects.");
register_g3map<G3MapVectorQuat>("G3MapVectorQuat", "Mapping from "
"strings to lists of quaternions.");

// Special handling to get the object proxying right
register_g3map<G3MapFrameObject, true>("G3MapFrameObject", "Mapping "
Expand Down
2 changes: 1 addition & 1 deletion core/src/G3Quat.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ PYBINDINGS("core")
.def("dot3", dot3, "Dot product of last three entries")
.def("cross3", cross3, "Cross product of last three entries")
;
register_vector_of<quat>("QuatVector");
register_vector_of<quat>("Quat");
object vq =
register_g3vector<quat>("G3VectorQuat",
"List of quaternions. Convertible to a 4xN numpy array. "
Expand Down

0 comments on commit 5706b0c

Please sign in to comment.