blob: 39391f8814407336913762561d3784293581d58a [file] [log] [blame]
Alexander Afanasyev7112f482011-08-17 14:05:57 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2011 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070020
21#ifndef CCNX_FACE_CONTAINER_H
22#define CCNX_FACE_CONTAINER_H
23
24#include <stdint.h>
25#include <vector>
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070026
27#include "ns3/ptr.h"
28#include "ns3/simple-ref-count.h"
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070029#include "ns3/ccnx-face.h"
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070030
31namespace ns3 {
32
33/**
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070034 * \ingroup ccnx-helpers
Alexander Afanasyev7112f482011-08-17 14:05:57 -070035 * \brief A pool for CCNx faces
36 *
37 * Provides tools to perform basic manipulation on faces, such as
38 * setting metrics and states on faces
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070039 *
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070040 * \see CcnxStackHelper
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070041 */
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070042class CcnxFaceContainer : public SimpleRefCount<CcnxFaceContainer>
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070043{
Alexander Afanasyev7112f482011-08-17 14:05:57 -070044private:
45 typedef std::vector<Ptr<CcnxFace> > FaceContainer;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070046public:
Alexander Afanasyev7112f482011-08-17 14:05:57 -070047 typedef FaceContainer::const_iterator Iterator; ///< \brief Iterator over CcnxFaceContainer
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070048
49 /**
Alexander Afanasyev7112f482011-08-17 14:05:57 -070050 * \brief Create an empty CcnxFaceContainer.
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070051 */
52 CcnxFaceContainer ();
53
54 /**
Alexander Afanasyev7112f482011-08-17 14:05:57 -070055 * \brief Copy constructor for CcnxFaceContainer. Calls AddAll method
56 *
57 * \see CcnxFaceContainer::AddAll
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070058 */
Alexander Afanasyev7112f482011-08-17 14:05:57 -070059 CcnxFaceContainer (const CcnxFaceContainer &other);
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070060
61 /**
Alexander Afanasyev7112f482011-08-17 14:05:57 -070062 * \brief Copy operator for CcnxFaceContainer. Empties vector and calls AddAll method
63 *
64 * All previously obtained iterators (Begin() and End()) will be invalidated
65 *
66 * \see CcnxFaceContainer::AddAll
67 */
68 CcnxFaceContainer& operator= (const CcnxFaceContainer &other);
69
70 /**
71 * \brief Add all entries from other container
72 *
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070073 * \param other smart pointer to a container
74 */
75 void AddAll (Ptr<CcnxFaceContainer> other);
76
77 /**
78 * \brief Add all entries from other container
79 *
Alexander Afanasyev7112f482011-08-17 14:05:57 -070080 * \param other container
81 */
82 void AddAll (const CcnxFaceContainer &other);
83
84 /**
85 * \brief Get an iterator which refers to the first pair in the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070086 * container.
87 *
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070088 * \returns an iterator which refers to the first pair in the container.
89 */
Alexander Afanasyev7112f482011-08-17 14:05:57 -070090 Iterator Begin () const;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070091
92 /**
93 * \brief Get an iterator which indicates past-the-last Node in the
94 * container.
95 *
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070096 * \returns an iterator which indicates an ending condition for a loop.
97 */
Alexander Afanasyev7112f482011-08-17 14:05:57 -070098 Iterator End () const;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070099
100 /**
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700101 * \brief Get the number of faces stored in this container
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700102 *
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700103 * \returns the number of faces stored in this container
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700104 */
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700105 uint32_t GetN () const;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700106
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -0700107 // /**
108 // * \brief Set a metric for all faces in the container
109 // *
110 // * \param metric value of metric to assign to all faces in the container
111 // */
112 // void SetMetricToAll (uint16_t metric);
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700113
114 /**
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700115 * Add an entry to the container
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700116 *
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700117 * \param face a smart pointer to a CcnxFace-derived object
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700118 *
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700119 * @see CcnxFace
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700120 */
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700121 void Add (const Ptr<CcnxFace> &face);
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700122
123 /**
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700124 * Get a smart pointer to CcnxFace-derived object stored in the container
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700125 *
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700126 * \param i the iterator corresponding to the requested object
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700127 *
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700128 * This method is redundant and simple dereferencing of the iterator should be used instead
129 *
130 * @see CcnxFace
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700131 */
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700132 Ptr<CcnxFace> Get (Iterator i) const;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700133
134private:
Alexander Afanasyev7112f482011-08-17 14:05:57 -0700135 FaceContainer m_faces;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700136};
137
138} // namespace ns3
139
140#endif /* CCNX_FACE_CONTAINER_H */