From 16b8947af134da32be7a0a33e5bc5efe2d5ebe90 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 30 Apr 2017 20:31:43 +0200 Subject: [PATCH] improved serializer documentation --- libretroshare/src/serialiser/rsserializer.cc | 25 ++++++++++++++ libretroshare/src/serialiser/rsserializer.h | 33 +++++++++++++++++++ .../src/serialiser/rstypeserializer.cc | 24 ++++++++++++++ .../src/serialiser/rstypeserializer.h | 24 ++++++++++++++ 4 files changed, 106 insertions(+) diff --git a/libretroshare/src/serialiser/rsserializer.cc b/libretroshare/src/serialiser/rsserializer.cc index ef85008aa..ea6bdd33c 100644 --- a/libretroshare/src/serialiser/rsserializer.cc +++ b/libretroshare/src/serialiser/rsserializer.cc @@ -1,3 +1,28 @@ +/* + * libretroshare/src/serialiser: rsserializer.cc + * + * RetroShare Serialiser. + * + * Copyright 2016 by Cyril Soler + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "csoler@users.sourceforge.net". + * + */ + #include #include "rsitems/rsitem.h" diff --git a/libretroshare/src/serialiser/rsserializer.h b/libretroshare/src/serialiser/rsserializer.h index 4559b6582..4a325fdab 100644 --- a/libretroshare/src/serialiser/rsserializer.h +++ b/libretroshare/src/serialiser/rsserializer.h @@ -1,3 +1,27 @@ +/* + * libretroshare/src/serialiser: rsserializer.h + * + * RetroShare Serialiser. + * + * Copyright 2016 by Cyril Soler + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "csoler@users.sourceforge.net". + * + */ #pragma once /////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -137,6 +161,8 @@ class RsItem ; #define SERIALIZE_ERROR() std::cerr << __PRETTY_FUNCTION__ << " : " +// This is the base class for serializers. + class RsSerialType { public: @@ -155,6 +181,7 @@ private: uint32_t type; }; +// This class is only used internally to p3service. It should not be used explicitely otherwise. class RsRawSerialiser: public RsSerialType { @@ -167,6 +194,8 @@ class RsRawSerialiser: public RsSerialType virtual RsItem * deserialise(void *data, uint32_t *size); }; +// Top class for all services and config serializers. + class RsGenericSerializer: public RsSerialType { public: @@ -226,6 +255,8 @@ protected: }; +// Top class for service serializers. Derive your on service serializer from this class and overload creat_item(). + class RsServiceSerializer: public RsGenericSerializer { public: @@ -243,6 +274,8 @@ public: RsItem *deserialise(void *data,uint32_t *size) ; }; +// Top class for config serializers. Config serializers are only used internally by RS core. The development of new services or plugins do not need this. + class RsConfigSerializer: public RsGenericSerializer { public: diff --git a/libretroshare/src/serialiser/rstypeserializer.cc b/libretroshare/src/serialiser/rstypeserializer.cc index fab8c7b2e..661897b4b 100644 --- a/libretroshare/src/serialiser/rstypeserializer.cc +++ b/libretroshare/src/serialiser/rstypeserializer.cc @@ -1,3 +1,27 @@ +/* + * libretroshare/src/serialiser: rstypeserializer.cc + * + * RetroShare Serialiser. + * + * Copyright 2017 by Cyril Soler + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "csoler@users.sourceforge.net". + * + */ #include "serialiser/rsserializer.h" #include "serialiser/rstypeserializer.h" #include "serialiser/rsbaseserial.h" diff --git a/libretroshare/src/serialiser/rstypeserializer.h b/libretroshare/src/serialiser/rstypeserializer.h index 6ad237be9..333f1a364 100644 --- a/libretroshare/src/serialiser/rstypeserializer.h +++ b/libretroshare/src/serialiser/rstypeserializer.h @@ -1,3 +1,27 @@ +/* + * libretroshare/src/serialiser: rstypeserializer.h + * + * RetroShare Serialiser. + * + * Copyright 2017 by Cyril Soler + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "csoler@users.sourceforge.net". + * + */ #pragma once #include "serialiser/rsserial.h"