summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2013-06-23 11:18:44 -0700
committerJosh Blum2013-06-23 11:18:44 -0700
commitaab47788c038b9fe97243c3bbae49e72b814e419 (patch)
tree770beee081dc2587b8588f7afdb76671987f7f21
parent1cebdcfb645ca6abefaa5e2d8feac8140e95e5ad (diff)
downloadsandhi-aab47788c038b9fe97243c3bbae49e72b814e419.tar.gz
sandhi-aab47788c038b9fe97243c3bbae49e72b814e419.tar.bz2
sandhi-aab47788c038b9fe97243c3bbae49e72b814e419.zip
gras: PMC and serialization hooks for Tag type
m---------grextras0
-rw-r--r--include/gras/tags.hpp1
-rw-r--r--lib/serialize_types.cpp13
-rw-r--r--lib/tags.cpp7
4 files changed, 21 insertions, 0 deletions
diff --git a/grextras b/grextras
-Subproject ef9d5db728f1cc59f249e17eb35c1e52b27297d
+Subproject 42f368250de4d819f0c417279e2b6ea9b68ecad
diff --git a/include/gras/tags.hpp b/include/gras/tags.hpp
index e3c8982..8214d4e 100644
--- a/include/gras/tags.hpp
+++ b/include/gras/tags.hpp
@@ -40,6 +40,7 @@ struct GRAS_API Tag : boost::less_than_comparable<Tag>
};
GRAS_API bool operator<(const Tag &lhs, const Tag &rhs);
+GRAS_API bool operator==(const Tag &lhs, const Tag &rhs);
/*!
* A stream tag is a commonly used structure
diff --git a/lib/serialize_types.cpp b/lib/serialize_types.cpp
index fde7277..ae4df65 100644
--- a/lib/serialize_types.cpp
+++ b/lib/serialize_types.cpp
@@ -54,6 +54,19 @@ void load(Archive & ar, gras::SBuffer & b, unsigned int version)
BOOST_SERIALIZATION_SPLIT_FREE(gras::SBuffer)
PMC_SERIALIZE_EXPORT(gras::SBuffer, "PMC<gras::SBuffer>")
+/***********************************************************************
+ * support for tag type
+ **********************************************************************/
+namespace boost { namespace serialization {
+template <class Archive>
+void serialize(Archive &ar, gras::Tag &t, const unsigned int)
+{
+ ar & t.offset;
+ ar & t.object;
+}
+}}
+
+PMC_SERIALIZE_EXPORT(gras::Tag, "PMC<gras::Tag>")
/***********************************************************************
* support for special packet msg type
diff --git a/lib/tags.cpp b/lib/tags.cpp
index 0b510f6..d9f1dab 100644
--- a/lib/tags.cpp
+++ b/lib/tags.cpp
@@ -15,6 +15,13 @@ bool gras::operator<(const Tag &lhs, const Tag &rhs)
return lhs.offset < rhs.offset;
}
+bool gras::operator==(const Tag &lhs, const Tag &rhs)
+{
+ return
+ lhs.offset == rhs.offset and
+ lhs.object.eq(rhs.object);
+}
+
StreamTag::StreamTag(const PMCC &key, const PMCC &val, const PMCC &src):
key(key), val(val), src(src)
{