src/energy/model/device-energy-model-container.h
author Vedran Miletić <rivanvx@gmail.com>
Tue, 02 Aug 2011 17:42:33 -0400
changeset 7385 10beb0e53130
parent 7238 85a7e87bb4cc
permissions -rw-r--r--
standardize emacs c++ mode comments
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7238
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6535
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
     2
/*
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
     3
 * Copyright (c) 2008 INRIA
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
     4
 * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
     5
 *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
     7
 * it under the terms of the GNU General Public License version 2 as
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
     8
 * published by the Free Software Foundation;
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
     9
 *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    13
 * GNU General Public License for more details.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    14
 *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    16
 * along with this program; if not, write to the Free Software
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    18
 *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    19
 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    20
 *          Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    21
 */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    22
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    23
#ifndef DEVICE_ENERGY_MODEL_CONTAINER_H
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    24
#define DEVICE_ENERGY_MODEL_CONTAINER_H
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    25
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    26
#include "ns3/device-energy-model.h"
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    27
#include <vector>
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    28
#include <stdint.h>
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    29
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    30
namespace ns3 {
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    31
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    32
/**
7238
85a7e87bb4cc Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 6938
diff changeset
    33
 * \ingroup energy
6535
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    34
 * \brief Holds a vector of ns3::DeviceEnergyModel pointers.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    35
 *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    36
 * DeviceEnergyModelContainer returns a list of DeviceEnergyModel pointers
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    37
 * installed on a node. Users can use this list to access DeviceEnergyModel
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    38
 * objects to obtain total device energy consumption on a node easily.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    39
 *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    40
 * \see NetDeviceContainer
7238
85a7e87bb4cc Make some more modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 6938
diff changeset
    41
 *
6535
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    42
 */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    43
class DeviceEnergyModelContainer
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    44
{
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    45
public:
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    46
  typedef std::vector< Ptr<DeviceEnergyModel> >::const_iterator Iterator;
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    47
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    48
public:
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    49
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    50
   * Creates an empty DeviceEnergyModelContainer.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    51
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    52
  DeviceEnergyModelContainer ();
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    53
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    54
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    55
   * \param model Pointer to a DeviceEnergyModel.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    56
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    57
   * Creates a DeviceEnergyModelContainer with exactly one DeviceEnergyModel
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    58
   * previously instantiated.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    59
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    60
  DeviceEnergyModelContainer (Ptr<DeviceEnergyModel> model);
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    61
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    62
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    63
   * \param modelName Name of DeviceEnergyModel.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    64
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    65
   * Creates an DeviceEnergyModelContainer with exactly one DeviceEnergyModel
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    66
   * previously instantiated and assigned a name using the Object name service.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    67
   * This DeviceEnergyModel is specified by its assigned name.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    68
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    69
  DeviceEnergyModelContainer (std::string modelName);
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    70
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    71
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    72
   * \param a A DeviceEnergyModelContainer.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    73
   * \param b Another DeviceEnergyModelContainer.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    74
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    75
   * Creates a DeviceEnergyModelContainer by concatenating DeviceEnergyModelContainer b
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    76
   * to DeviceEnergyModelContainer a.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    77
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    78
   * \note Can be used to concatenate 2 Ptr<DeviceEnergyModel> directly. C++
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    79
   * will be calling DeviceEnergyModelContainer constructor with Ptr<DeviceEnergyModel>
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    80
   * first.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    81
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    82
  DeviceEnergyModelContainer (const DeviceEnergyModelContainer &a,
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    83
                              const DeviceEnergyModelContainer &b);
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    84
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    85
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    86
   * \brief Get an iterator which refers to the first DeviceEnergyModel pointer
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    87
   * in the container.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    88
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    89
   * \returns An iterator which refers to the first DeviceEnergyModel in container.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    90
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    91
   * DeviceEnergyModels can be retrieved from the container in two ways. First,
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    92
   * directly by an index into the container, and second, using an iterator.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    93
   * This method is used in the iterator method and is typically used in a
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    94
   * for-loop to run through the DeviceEnergyModels.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    95
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    96
   * \code
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    97
   *   DeviceEnergyModelContainer::Iterator i;
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    98
   *   for (i = container.Begin (); i != container.End (); ++i)
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
    99
   *     {
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   100
   *       (*i)->method ();  // some DeviceEnergyModel method
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   101
   *     }
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   102
   * \endcode
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   103
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   104
  Iterator Begin (void) const;
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   105
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   106
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   107
   * \brief Get an iterator which refers to the last DeviceEnergyModel pointer
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   108
   * in the container.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   109
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   110
   * \returns An iterator which refers to the last DeviceEnergyModel in container.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   111
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   112
   * DeviceEnergyModels can be retrieved from the container in two ways. First,
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   113
   * directly by an index into the container, and second, using an iterator.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   114
   * This method is used in the iterator method and is typically used in a
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   115
   * for-loop to run through the DeviceEnergyModels.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   116
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   117
   * \code
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   118
   *   DeviceEnergyModelContainer::Iterator i;
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   119
   *   for (i = container.Begin (); i != container.End (); ++i)
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   120
   *     {
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   121
   *       (*i)->method ();  // some DeviceEnergyModel method
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   122
   *     }
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   123
   * \endcode
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   124
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   125
  Iterator End (void) const;
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   126
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   127
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   128
   * \brief Get the number of Ptr<DeviceEnergyModel> stored in this container.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   129
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   130
   * \returns The number of Ptr<DeviceEnergyModel> stored in this container.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   131
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   132
  uint32_t GetN (void) const;
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   133
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   134
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   135
   * \brief Get the i-th Ptr<DeviceEnergyModel> stored in this container.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   136
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   137
   * \param i Index of the requested Ptr<DeviceEnergyModel>.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   138
   * \returns The requested Ptr<DeviceEnergyModel>.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   139
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   140
  Ptr<DeviceEnergyModel> Get (uint32_t i) const;
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   141
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   142
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   143
   * \param container Another DeviceEnergyModelContainer.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   144
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   145
   * Appends the contents of another DeviceEnergyModelContainer to the end of
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   146
   * this DeviceEnergyModelContainer.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   147
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   148
  void Add (DeviceEnergyModelContainer container);
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   149
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   150
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   151
   * \brief Append a single Ptr<DeviceEnergyModel> to the end of this container.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   152
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   153
   * \param model Pointer to an DeviceEnergyModel.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   154
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   155
  void Add (Ptr<DeviceEnergyModel> model);
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   156
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   157
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   158
   * \brief Append a single Ptr<DeviceEnergyModel> referred to by its object
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   159
   * name to the end of this container.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   160
   *
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   161
   * \param modelName Name of DeviceEnergyModel object.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   162
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   163
  void Add (std::string modelName);
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   164
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   165
  /**
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   166
   * \brief Removes all elements in the container.
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   167
   */
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   168
  void Clear (void);
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   169
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   170
private:
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   171
  std::vector< Ptr<DeviceEnergyModel> > m_models;
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   172
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   173
};
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   174
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   175
} // namespace ns3
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   176
0a90ef2b29a9 Apply energy model changes of http://codereview.appspot.com/1008043/show patchset 13
He Wu <mdzz@u.washington.edu>
parents:
diff changeset
   177
#endif /* DEVICE_ENERGY_MODEL_CONTAINER_H */