A Discrete-Event Network Simulator
API
energy-harvester.h
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 #ifndef ENERGY_HARVESTER_H
23 #define ENERGY_HARVESTER_H
24 
25 #include <iostream>
26 
27 // include from ns-3
28 #include "ns3/object.h"
29 #include "ns3/ptr.h"
30 #include "ns3/type-id.h"
31 #include "ns3/node.h"
32 #include "ns3/energy-source-container.h"
33 
34 namespace ns3 {
35 
36 class EnergySource;
37 
51 class EnergyHarvester : public Object
52 {
53 public:
54  static TypeId GetTypeId (void);
55 
56  EnergyHarvester ();
57 
58  virtual ~EnergyHarvester ();
59 
65  void SetNode (Ptr<Node> node);
66 
73  Ptr<Node> GetNode (void) const;
74 
82  void SetEnergySource (Ptr<EnergySource> source);
83 
91 
98  double GetPower (void) const;
99 
100 private:
105  virtual void DoDispose (void);
106 
115  virtual double DoGetPower (void) const;
116 
117 private:
123 
130 
131 protected:
132 
133 };
134 
135 } // namespace ns3
136 
137 #endif /* defined(ENERGY_HARVESTER_H) */
Energy harvester base class.
Ptr< Node > GetNode(void) const
Ptr< EnergySource > m_energySource
Pointer to the Energy Source to which this EnergyHarvester is connected.
virtual void DoDispose(void)
Defined in ns3::Object.
static TypeId GetTypeId(void)
Ptr< Node > m_node
Pointer to node containing this EnergyHarvester.
virtual double DoGetPower(void) const
This method is called by the GetPower method and it needs to be implemented by the subclasses of the ...
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergyHarvester.
void SetEnergySource(Ptr< EnergySource > source)
double GetPower(void) const
Ptr< EnergySource > GetEnergySource(void) const
A base class which provides memory management and object aggregation.
Definition: object.h:88
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.