A Discrete-Event Network Simulator
API
energy-harvester.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Wireless Communications and Networking Group (WCNG),
4  * University of Rochester, Rochester, NY, USA.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Author: Cristiano Tapparello <cristiano.tapparello@rochester.edu>
20  */
21 
22 #include "energy-harvester.h"
23 #include "ns3/log.h"
24 
25 namespace ns3 {
26 
27 NS_LOG_COMPONENT_DEFINE ("EnergyHarvester");
28 
29 NS_OBJECT_ENSURE_REGISTERED (EnergyHarvester);
30 
31 TypeId
33 {
34  static TypeId tid = TypeId ("ns3::EnergyHarvester")
35  .SetParent<Object> ()
36  .SetGroupName ("Energy")
37  ;
38  return tid;
39 }
40 
42 {
43  NS_LOG_FUNCTION (this);
44 }
45 
47 {
48  NS_LOG_FUNCTION (this);
49 }
50 
51 void
53 {
54  NS_LOG_FUNCTION (this);
55  NS_ASSERT (node != 0);
56  m_node = node;
57 }
58 
61 {
62  NS_LOG_FUNCTION (this);
63  return m_node;
64 }
65 
66 void
68 {
69  NS_LOG_FUNCTION (this);
70  NS_ASSERT (source != 0);
71  m_energySource = source;
72 }
73 
76 {
77  NS_LOG_FUNCTION (this);
78  return m_energySource;
79 }
80 
81 
82 double
84 {
85  NS_LOG_FUNCTION (this);
86  return DoGetPower ();
87 }
88 
89 /*
90  * Private function starts here.
91  */
92 
93 void
95 {
96  NS_LOG_FUNCTION (this);
97 }
98 
99 double
101 {
102  NS_LOG_FUNCTION (this);
103  return 0.0;
104 }
105 
106 }
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Ptr< Node > m_node
Pointer to node containing this EnergyHarvester.
Ptr< Node > GetNode(void) const
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
void SetEnergySource(Ptr< EnergySource > source)
static TypeId GetTypeId(void)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void DoDispose(void)
Defined in ns3::Object.
Ptr< EnergySource > GetEnergySource(void) const
virtual double DoGetPower(void) const
This method is called by the GetPower method and it needs to be implemented by the subclasses of the ...
Ptr< EnergySource > m_energySource
Pointer to the Energy Source to which this EnergyHarvester is connected.
A base class which provides memory management and object aggregation.
Definition: object.h:87
double GetPower(void) const
a unique identifier for an interface.
Definition: type-id.h:58
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergyHarvester.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915