src/core/pointer.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 04 Jul 2009 08:15:48 +0200
changeset 4654 2eaebe77d66b
parent 2926 96d1fc816681
permissions -rw-r--r--
Added tag ns-3.5 for changeset c975274c9707
mathieu@2926
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
mathieu@2926
     2
/*
mathieu@2926
     3
 * Copyright (c) 2008 INRIA
mathieu@2926
     4
 *
mathieu@2926
     5
 * This program is free software; you can redistribute it and/or modify
mathieu@2926
     6
 * it under the terms of the GNU General Public License version 2 as
mathieu@2926
     7
 * published by the Free Software Foundation;
mathieu@2926
     8
 *
mathieu@2926
     9
 * This program is distributed in the hope that it will be useful,
mathieu@2926
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
mathieu@2926
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
mathieu@2926
    12
 * GNU General Public License for more details.
mathieu@2926
    13
 *
mathieu@2926
    14
 * You should have received a copy of the GNU General Public License
mathieu@2926
    15
 * along with this program; if not, write to the Free Software
mathieu@2926
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
mathieu@2926
    17
 *
mathieu@2926
    18
 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
mathieu@2926
    19
 */
mathieu@2926
    20
#include "pointer.h"
mathieu@2926
    21
mathieu@2926
    22
namespace ns3 {
mathieu@2926
    23
mathieu@2965
    24
PointerValue::PointerValue ()
mathieu@2926
    25
  : m_value ()
mathieu@2926
    26
{}
mathieu@2926
    27
mathieu@2965
    28
PointerValue::PointerValue (Ptr<Object> object)
mathieu@2926
    29
  : m_value (object)
mathieu@2926
    30
{}
mathieu@2926
    31
mathieu@2926
    32
void 
mathieu@2965
    33
PointerValue::SetObject (Ptr<Object> object)
mathieu@2926
    34
{
mathieu@2926
    35
  m_value = object;
mathieu@2926
    36
}
mathieu@2926
    37
mathieu@2926
    38
Ptr<Object> 
mathieu@2965
    39
PointerValue::GetObject (void) const
mathieu@2926
    40
{
mathieu@2926
    41
  return m_value;
mathieu@2926
    42
}
mathieu@2926
    43
mathieu@2965
    44
Ptr<AttributeValue> 
mathieu@2965
    45
PointerValue::Copy (void) const
mathieu@2926
    46
{
mathieu@2965
    47
  return Create<PointerValue> (*this);
mathieu@2926
    48
}
mathieu@2965
    49
std::string 
mathieu@2965
    50
PointerValue::SerializeToString (Ptr<const AttributeChecker> checker) const
mathieu@2926
    51
{
mathieu@2965
    52
  std::ostringstream oss;
mathieu@2965
    53
  oss << m_value;
mathieu@2965
    54
  return oss.str ();
mathieu@2926
    55
}
mathieu@2926
    56
mathieu@2965
    57
bool 
mathieu@2965
    58
PointerValue::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker)
mathieu@2965
    59
{
mathieu@2965
    60
  NS_FATAL_ERROR ("It is not possible to deserialize a pointer.");
mathieu@2965
    61
  return false;
mathieu@2965
    62
}
mathieu@2926
    63
mathieu@2926
    64
} // namespace ns3