Skip to content

Commit

Permalink
Updated PacketGen submodule. Moved output and input operators for obj…
Browse files Browse the repository at this point in the history
…serializable to objectstream. Removed objserializable create method from C++.
  • Loading branch information
Jester565 committed Apr 10, 2017
1 parent a63bb2a commit 077ef19
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
4 changes: 2 additions & 2 deletions CommProto/include/CommProto/serialization/objectstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ namespace comnet {
ObjectStream& operator<<(const uint64_t& data);
ObjectStream& operator<<(const real32_t& data);
ObjectStream& operator<<(const real64_t& data);
ObjectStream& operator<<(const ObjSerializable& data);

/** OVerloaded output stream operators to output variables to a variable from the object stream
string_t (char*) must use malloc when inputing data into new c-string variable*/
Expand All @@ -130,8 +131,7 @@ namespace comnet {
ObjectStream& operator>>(int64_t& data);
ObjectStream& operator>>(real32_t& data);
ObjectStream& operator>>(real64_t& data);


ObjectStream& operator>>(ObjSerializable& data);

/*
p means pointer compatible. If it is there that means that it is compatible
Expand Down
17 changes: 0 additions & 17 deletions CommProto/include/CommProto/serialization/objserializable.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,7 @@ namespace comnet {

//Used to parse objects from stream (equivalent to ABSPacket::Unpack)
virtual void Output(ObjectStream& obj) = 0;

//Return a new instance of a derived class
virtual ObjSerializable* Create() = 0;
};

//Output operator for ObjSerializables
inline ObjectStream& operator<<(ObjectStream& os, const ObjSerializable& objSerializable)
{
objSerializable.Input(os);
return os;
}

//Input operator for ObjSerializables
inline ObjectStream& operator>>(ObjectStream& os, ObjSerializable& objSerializable)
{
objSerializable.Output(os);
return os;
}
}
}
#endif
13 changes: 13 additions & 0 deletions CommProto/src/serialization/objectstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ ObjectStream& ObjectStream::operator<<(const real64_t& data)
return *this;
}

ObjectStream & comnet::serialization::ObjectStream::operator<<(const ObjSerializable & data)
{
data.Input(*this);
return *this;
}


/*******************************************************/
/*******************************************************/
Expand Down Expand Up @@ -463,5 +469,12 @@ ObjectStream& ObjectStream::operator>>(real64_t& data)
}
return *this;
}


ObjectStream & comnet::serialization::ObjectStream::operator>>(ObjSerializable & data)
{
data.Output(*this);
return *this;
}
} // serialization.
} // comnet.

0 comments on commit 077ef19

Please sign in to comment.