remove dead code.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 02 Jun 2008 10:38:10 -0700
changeset 31915d50569cd94e
parent 3190 51fe9001a679
child 3192 702459162fff
remove dead code.
src/common/data-writer.cc
src/common/data-writer.h
     1.1 --- a/src/common/data-writer.cc	Mon Jun 02 10:30:24 2008 -0700
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,120 +0,0 @@
     1.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     1.5 -/*
     1.6 - * Copyright (c) 2005 INRIA
     1.7 - *
     1.8 - * This program is free software; you can redistribute it and/or modify
     1.9 - * it under the terms of the GNU General Public License version 2 as
    1.10 - * published by the Free Software Foundation;
    1.11 - *
    1.12 - * This program is distributed in the hope that it will be useful,
    1.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 - * GNU General Public License for more details.
    1.16 - *
    1.17 - * You should have received a copy of the GNU General Public License
    1.18 - * along with this program; if not, write to the Free Software
    1.19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.20 - *
    1.21 - * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    1.22 - */
    1.23 -#include "data-writer.h"
    1.24 -
    1.25 -#include <sys/types.h>
    1.26 -#include <sys/stat.h>
    1.27 -#include <sys/poll.h>
    1.28 -#include <fcntl.h>
    1.29 -#include <unistd.h>
    1.30 -#include "ns3/assert.h"
    1.31 -#include <string.h>
    1.32 -#include <list>
    1.33 -
    1.34 -#define noTRACE_DATA_WRITER 1
    1.35 -
    1.36 -#ifdef TRACE_DATA_WRITER
    1.37 -#include <iostream>
    1.38 -# define TRACE(x) \
    1.39 -std::cout << "DATA WRITER TRACE " << this << " " << x << std::endl;
    1.40 -#else /* TRACE_DATA_WRITER */
    1.41 -# define TRACE(format,...)
    1.42 -#endif /* TRACE_DATA_WRITER */
    1.43 -
    1.44 -#define BUFFER_SIZE (4096)
    1.45 -
    1.46 -
    1.47 -namespace ns3 {
    1.48 -
    1.49 -class DataWriterPrivate {
    1.50 -public:
    1.51 -  DataWriterPrivate ();
    1.52 -  ~DataWriterPrivate ();
    1.53 -
    1.54 -  void open (char const *filename);
    1.55 -  void write (uint8_t *buffer, uint32_t size);
    1.56 -private:
    1.57 -  uint8_t m_data[BUFFER_SIZE];
    1.58 -  uint32_t m_current;
    1.59 -  int m_fd;
    1.60 -};
    1.61 -
    1.62 -DataWriterPrivate::DataWriterPrivate ()
    1.63 -  : m_current (0)
    1.64 -{}
    1.65 -DataWriterPrivate::~DataWriterPrivate ()
    1.66 -{
    1.67 -  ::Write (m_fd, m_data, m_current);
    1.68 -  ::Close (m_fd);
    1.69 -}
    1.70 -
    1.71 -
    1.72 -void
    1.73 -DataWriterPrivate::Open (char const *filename)
    1.74 -{
    1.75 -  m_fd = ::Open (filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
    1.76 -  NS_ASSERT (m_fd != -1);
    1.77 -}
    1.78 -
    1.79 -#ifndef min
    1.80 -#define min(a,b) ((a)<(b)?(a):(b))
    1.81 -#endif /* min */
    1.82 -
    1.83 -void
    1.84 -DataWriterPrivate::Write (uint8_t *buffer, uint32_t size)
    1.85 -{
    1.86 -  while (size > 0) 
    1.87 -    {
    1.88 -      uint32_t toCopy = min (BUFFER_SIZE - m_current, size);
    1.89 -      memcpy (m_data + m_current, buffer, toCopy);
    1.90 -      size -= toCopy;
    1.91 -      m_current += toCopy;
    1.92 -      buffer += toCopy;
    1.93 -      if (m_current == BUFFER_SIZE) 
    1.94 -        {
    1.95 -          ssize_t written = 0;
    1.96 -          written = ::Write (m_fd, m_data, BUFFER_SIZE);
    1.97 -          NS_ASSERT (written == BUFFER_SIZE);
    1.98 -          m_current = 0;
    1.99 -        }
   1.100 -    }
   1.101 -}
   1.102 -
   1.103 -DataWriter::DataWriter ()
   1.104 -  : m_priv (new DataWriterPrivate ())
   1.105 -{}
   1.106 -DataWriter::~DataWriter ()
   1.107 -{
   1.108 -  delete m_priv;
   1.109 -  m_priv = 0;
   1.110 -}
   1.111 -
   1.112 -void 
   1.113 -DataWriter::Open (char const *filename)
   1.114 -{
   1.115 -  m_priv->Open (filename);
   1.116 -}
   1.117 -void 
   1.118 -DataWriter::Write (uint8_t *buffer, uint32_t size)
   1.119 -{
   1.120 -  m_priv->Write (buffer, size);
   1.121 -}
   1.122 -
   1.123 -}; // namespace
     2.1 --- a/src/common/data-writer.h	Mon Jun 02 10:30:24 2008 -0700
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,43 +0,0 @@
     2.4 -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     2.5 -/*
     2.6 - * Copyright (c) 2005 INRIA
     2.7 - *
     2.8 - * This program is free software; you can redistribute it and/or modify
     2.9 - * it under the terms of the GNU General Public License version 2 as
    2.10 - * published by the Free Software Foundation;
    2.11 - *
    2.12 - * This program is distributed in the hope that it will be useful,
    2.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.15 - * GNU General Public License for more details.
    2.16 - *
    2.17 - * You should have received a copy of the GNU General Public License
    2.18 - * along with this program; if not, write to the Free Software
    2.19 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2.20 - *
    2.21 - * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
    2.22 - */
    2.23 -
    2.24 -#ifndef DATA_WRITER_H
    2.25 -#define DATA_WRITER_H
    2.26 -
    2.27 -#include <stdint.h>
    2.28 -
    2.29 -namespace ns3 {
    2.30 -
    2.31 -class DataWriterPrivate;
    2.32 -
    2.33 -class DataWriter {
    2.34 -public:
    2.35 -  DataWriter ();
    2.36 -  ~DataWriter ();
    2.37 -
    2.38 -  void open (char const *filename);
    2.39 -  void write (uint8_t *buffer, uint32_t size);
    2.40 -private:
    2.41 -  DataWriterPrivate *m_priv;
    2.42 -};
    2.43 -
    2.44 -}; //namespace ns3
    2.45 -
    2.46 -#endif /* DATA_WRITER_H */