src/common/ascii-writer.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu Nov 12 13:01:01 2009 +0100 (2009-11-12)
changeset 5505 c0ac392289c3
parent 4711 3c9b7588ea4c
permissions -rw-r--r--
replace RefCountBase with SimpleRefCount<> to avoid duplicate refcounting implementations.
guillaume@4711
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
guillaume@4711
     2
/*
guillaume@4711
     3
 * Copyright (c) 2009 INRIA
guillaume@4711
     4
 *
guillaume@4711
     5
 * This program is free software; you can redistribute it and/or modify
guillaume@4711
     6
 * it under the terms of the GNU General Public License version 2 as
guillaume@4711
     7
 * published by the Free Software Foundation;
guillaume@4711
     8
 *
guillaume@4711
     9
 * This program is distributed in the hope that it will be useful,
guillaume@4711
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
guillaume@4711
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
guillaume@4711
    12
 * GNU General Public License for more details.
guillaume@4711
    13
 *
guillaume@4711
    14
 * You should have received a copy of the GNU General Public License
guillaume@4711
    15
 * along with this program; if not, write to the Free Software
guillaume@4711
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
guillaume@4711
    17
 *
guillaume@4711
    18
 * Author: Guillaume Seguin <guilla...@segu.in>
guillaume@4711
    19
 */
guillaume@4711
    20
guillaume@4711
    21
#ifndef ASCII_WRITER_H
guillaume@4711
    22
#define ASCII_WRITER_H
guillaume@4711
    23
guillaume@4711
    24
#include <stdint.h>
guillaume@4711
    25
#include <ostream>
mathieu@5505
    26
#include "ns3/simple-ref-count.h"
guillaume@4711
    27
#include "ns3/ptr.h"
guillaume@4711
    28
guillaume@4711
    29
namespace ns3 {
guillaume@4711
    30
guillaume@4711
    31
class Packet;
guillaume@4711
    32
guillaume@4711
    33
/**
guillaume@4711
    34
 * \ingroup common
guillaume@4711
    35
 *
guillaume@4711
    36
 * \brief Ascii output
guillaume@4711
    37
 */
mathieu@5505
    38
class AsciiWriter : public SimpleRefCount<AsciiWriter>
guillaume@4711
    39
{
guillaume@4711
    40
public:
guillaume@4711
    41
  static Ptr<AsciiWriter> Get (std::ostream &os);
guillaume@4711
    42
guillaume@4711
    43
  enum Type {
guillaume@4711
    44
    ENQUEUE,
guillaume@4711
    45
    DEQUEUE,
guillaume@4711
    46
    DROP,
guillaume@4711
    47
    TX,
guillaume@4711
    48
    RX
guillaume@4711
    49
  };
guillaume@4711
    50
guillaume@4711
    51
  ~AsciiWriter (void);
guillaume@4711
    52
guillaume@4711
    53
  /**
guillaume@4711
    54
   * Writes a message in the output file, checking if the files will
guillaume@4711
    55
   * need to be reordered.
guillaume@4711
    56
   */
guillaume@4711
    57
  void WritePacket (enum Type type, std::string message, Ptr<const Packet> p);
guillaume@4711
    58
guillaume@4711
    59
private:
guillaume@4711
    60
  AsciiWriter (std::ostream *os);
guillaume@4711
    61
guillaume@4711
    62
  std::ostream *m_writer;
guillaume@4711
    63
};
guillaume@4711
    64
guillaume@4711
    65
} // namespace ns3
guillaume@4711
    66
guillaume@4711
    67
#endif /* ASCII_WRITER_H */