From 4a5f54076ea924dacb5414c0f6183a669efc1eff Mon Sep 17 00:00:00 2001
From: Terraneo Federico <fede.tft@miosix.org>
Date: Wed, 23 May 2018 10:42:18 +0200
Subject: [PATCH] Improved comments

---
 examples/1_stream_known.cpp   | 4 ++--
 examples/2_stream_unknown.cpp | 4 ++--
 stream.cpp                    | 3 ++-
 stream.h                      | 8 +++++---
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/examples/1_stream_known.cpp b/examples/1_stream_known.cpp
index 886142f..73a6039 100644
--- a/examples/1_stream_known.cpp
+++ b/examples/1_stream_known.cpp
@@ -10,13 +10,13 @@ using namespace tscpp;
 
 int main()
 {
-    //Serialize to buffer
+    //Serialize to stream
     Point3d p1(1,2,3);
     stringstream ss;
     OutputArchive oa(ss);
     oa<<p1;
     
-    //Unserialize from buffer
+    //Unserialize from stream
     Point3d p2;
     InputArchive ia(ss);
     ia>>p2;
diff --git a/examples/2_stream_unknown.cpp b/examples/2_stream_unknown.cpp
index 83fb8f6..2606dd2 100644
--- a/examples/2_stream_unknown.cpp
+++ b/examples/2_stream_unknown.cpp
@@ -34,13 +34,13 @@ int main()
         assert(t==md);
     });
     
-    //Serialize to buffer
+    //Serialize to stream
     stringstream ss;
     OutputArchive oa(ss);
 
     oa<<p2d<<p3d<<md;
     
-    //Unserialize from buffer
+    //Unserialize from stream
     UnknownInputArchive ia(ss,tp);
     ia.unserialize();
     ia.unserialize();
diff --git a/stream.cpp b/stream.cpp
index 039caf0..f9df3f4 100644
--- a/stream.cpp
+++ b/stream.cpp
@@ -38,7 +38,8 @@ namespace tscpp {
 void TypePoolStream::unserializeUnknownImpl(const string& name, istream& is, streampos pos) const
 {
     auto it=types.find(name);
-    if(it==types.end()) {
+    if(it==types.end())
+    {
         is.seekg(pos);
         throw TscppException("unknown type",name);
     }
diff --git a/stream.h b/stream.h
index a46d100..0db7b3f 100644
--- a/stream.h
+++ b/stream.h
@@ -115,7 +115,7 @@ public:
             //NOTE: We copy the buffer to respect alignment requirements.
             //The buffer may not be suitably aligned for the unserialized type
             //TODO: support classes without default constructor
-            //NOTE: we are writing on top of a constructed type without callingits
+            //NOTE: we are writing on top of a constructed type without calling its
             //destructor. However, since it is trivially copyable, we at least aren't
             //overwriting pointers to allocated memory.
             T t;
@@ -187,7 +187,7 @@ class InputArchive
 public:
     /**
      * Constructor
-     * \param os ostream where srialized types will be written
+     * \param is istream where srialized types will be read
      */
     InputArchive(std::istream& is) : is(is) {}
 
@@ -235,7 +235,9 @@ class UnknownInputArchive
 public:
     /**
      * Constructor
-     * \param os ostream where srialized types will be written
+     * \param is istream where srialized types will be read
+     * \param tp TypePool containing the registered types and callbacks that
+     * will be called as types are unserialized
      */
     UnknownInputArchive(std::istream& is, const TypePoolStream& tp) : is(is), tp(tp) {}
 
-- 
GitLab