src/common/output-stream-object.cc
author Craig Dowell <craigdo@ee.washington.edu>
Mon, 08 Feb 2010 23:32:23 -0800
changeset 6046 46665d75667d
parent 6011 3fd7841b9c20
permissions -rw-r--r--
output stream object inherits from simple ref count
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6011
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     2
/*
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     3
 * Copyright (c) 2010 University of Washington
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     4
 *
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     8
 *
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    12
 * GNU General Public License for more details.
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    13
 *
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    17
 */
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    18
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    19
#include "ns3/log.h"
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    20
#include "output-stream-object.h"
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    21
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    22
NS_LOG_COMPONENT_DEFINE ("OutputStreamObject");
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    23
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    24
namespace ns3 {
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    25
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    26
OutputStreamObject::OutputStreamObject ()
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    27
  : m_ostream (0)
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    28
{
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    29
}
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    30
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    31
OutputStreamObject::~OutputStreamObject ()
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    32
{
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    33
  delete m_ostream;
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    34
  m_ostream = 0;
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    35
}
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    36
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    37
void
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    38
OutputStreamObject::SetStream (std::ostream *ostream)
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    39
{
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    40
  m_ostream = ostream;
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    41
}
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    42
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    43
std::ostream *
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    44
OutputStreamObject::GetStream (void)
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    45
{
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    46
  return m_ostream;
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    47
}
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    48
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents:
diff changeset
    49
} //namespace ns3