A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 NS_LOG_COMPONENT_DEFINE ("EnergyHarvester");
26 
27 namespace ns3 {
28 
29 NS_OBJECT_ENSURE_REGISTERED (EnergyHarvester);
30 
31 TypeId
33 {
34  static TypeId tid = TypeId ("ns3::EnergyHarvester")
35  .SetParent<Object> ()
36  ;
37  return tid;
38 }
39 
41 {
42  NS_LOG_FUNCTION (this);
43 }
44 
46 {
47  NS_LOG_FUNCTION (this);
48 }
49 
50 void
52 {
53  NS_LOG_FUNCTION (this);
54  NS_ASSERT (node != 0);
55  m_node = node;
56 }
57 
60 {
61  NS_LOG_FUNCTION (this);
62  return m_node;
63 }
64 
65 void
67 {
68  NS_LOG_FUNCTION (this);
69  NS_ASSERT (source != 0);
70  m_energySource = source;
71 }
72 
75 {
76  NS_LOG_FUNCTION (this);
77  return m_energySource;
78 }
79 
80 
81 double
83 {
84  NS_LOG_FUNCTION (this);
85  return DoGetPower ();
86 }
87 
88 /*
89  * Private function starts here.
90  */
91 
92 void
94 {
95  NS_LOG_FUNCTION (this);
96 }
97 
98 double
100 {
101  NS_LOG_FUNCTION (this);
102  return 0.0;
103 }
104 
105 }
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Ptr< EnergySource > GetEnergySource(void) const
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition: object-base.h:38
Ptr< Node > m_node
Pointer to node containing this EnergyHarvester.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:61
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
void SetEnergySource(Ptr< EnergySource > source)
double GetPower(void) const
static TypeId GetTypeId(void)
virtual void DoDispose(void)
Defined in ns3::Object.
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:64
a unique identifier for an interface.
Definition: type-id.h:49
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergyHarvester.
Ptr< Node > GetNode(void) const
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610