LCOV - code coverage report
Current view: top level - builds/barbot/Cosmos/src/ModelGenerator - SimpleSerializer.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 33 66 50.0 %
Date: 2021-06-16 15:43:28 Functions: 12 23 52.2 %

          Line data    Source code
       1             : /*******************************************************************************
       2             :  *                                                                             *
       3             :  * Cosmos:(C)oncept et (O)utils (S)tatistique pour les (Mo)deles               *
       4             :  * (S)tochastiques                                                             *
       5             :  *                                                                             *
       6             :  * Copyright (C) 2009-2012 LSV & LACL                                          *
       7             :  * Authors: Paolo Ballarini BenoƮt Barbot & Hilal Djafri                       *
       8             :  * Website: http://www.lsv.ens-cachan.fr/Software/cosmos                       *
       9             :  *                                                                             *
      10             :  * This program is free software; you can redistribute it and/or modify        *
      11             :  * it under the terms of the GNU General Public License as published by        *
      12             :  * the Free Software Foundation; either version 3 of the License, or           *
      13             :  * (at your option) any later version.                                         *
      14             :  *                                                                             *
      15             :  * This program is distributed in the hope that it will be useful,             *
      16             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of              *
      17             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
      18             :  * GNU General Public License for more details.                                *
      19             :  *                                                                             *
      20             :  * You should have received a copy of the GNU General Public License along     *
      21             :  * with this program; if not, write to the Free Software Foundation, Inc.,     *
      22             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                 *
      23             :  * file SimpleSerializer.cpp                                                   *
      24             :  * Created by Benoit Barbot on 04/005/2018.                                    *
      25             :  *******************************************************************************
      26             :  */
      27             : 
      28             : #include "SimpleSerializer.hpp"
      29             : 
      30             : using namespace std;
      31             : 
      32         495 : Serializer Serializer::operator&(bool d) {
      33         495 :     of << d << " ";
      34         495 :     return *this;
      35             : }
      36         231 : Serializer Serializer::operator&(double d) {
      37         231 :     of << d << " ";
      38         231 :     return *this;
      39             : }
      40         395 : Serializer Serializer::operator&(int d) {
      41         395 :     of << d << " ";
      42         395 :     return *this;
      43             : }
      44           0 : Serializer Serializer::operator&(unsigned int d) {
      45           0 :     of << d << " ";
      46           0 :     return *this;
      47             : }
      48           0 : Serializer Serializer::operator&(long d) {
      49           0 :     of << d << " ";
      50           0 :     return *this;
      51             : }
      52          99 : Serializer Serializer::operator&(unsigned long d) {
      53          99 :     of << d << " ";
      54          99 :     return *this;
      55             : }
      56         535 : Serializer Serializer::operator&(const std::string &d){
      57         535 :     of << d.length() << " " << d << " ";
      58         535 :     return *this;
      59             : }
      60             : 
      61           0 : HumanReadable HumanReadable::operator&(bool d) {
      62           0 :     of << "bool:" << d << " ";
      63           0 :     return *this;
      64             : }
      65           0 : HumanReadable HumanReadable::operator&(double d) {
      66           0 :     of << "double:" << d << " ";
      67           0 :     return *this;
      68             : }
      69           0 : HumanReadable HumanReadable::operator&(int d) {
      70           0 :     of << "int:"<< d << " ";
      71           0 :     return *this;
      72             : }
      73           0 : HumanReadable HumanReadable::operator&(unsigned int d) {
      74           0 :     of << "unsigned int:" << d << " ";
      75           0 :     return *this;
      76             : }
      77           0 : HumanReadable HumanReadable::operator&(long d) {
      78           0 :     of << "long:" << d << " ";
      79           0 :     return *this;
      80             : }
      81           0 : HumanReadable HumanReadable::operator&(unsigned long d) {
      82           0 :     of << "unsigned long:"<< d << " ";
      83           0 :     return *this;
      84             : }
      85           0 : HumanReadable HumanReadable::operator&(const std::string &d){
      86           0 :     of << "string:\"" << d << "\" ";
      87           0 :     return *this;
      88             : }
      89             : 
      90         435 : Unserializer Unserializer::operator&(bool &d) {
      91         435 :     inf >> d;
      92         435 :     return *this;
      93             : }
      94         203 : Unserializer Unserializer::operator&(double &d) {
      95         203 :     inf >> d;
      96         203 :     return *this;
      97             : }
      98         348 : Unserializer Unserializer::operator&(int &d) {
      99         348 :     inf >> d;
     100         348 :     return *this;
     101             : }
     102           0 : Unserializer Unserializer::operator&(unsigned int &d) {
     103           0 :     inf >> d;
     104           0 :     return *this;
     105             : }
     106           0 : Unserializer Unserializer::operator&(long &d) {
     107           0 :     inf >> d;
     108           0 :     return *this;
     109             : }
     110          87 : Unserializer Unserializer::operator&(unsigned long &d) {
     111          87 :     inf >> d;
     112          87 :     return *this;
     113             : }
     114         470 : Unserializer Unserializer::operator&(std::string &d){
     115             :     size_t length;
     116         470 :     inf >> length >> ws;
     117         470 :     d.resize(length);
     118         470 :     inf.read(&d[0], length);
     119         470 :     return *this;
     120         189 : }

Generated by: LCOV version 1.13