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 
44 class EnergyHarvester : public Object
45 {
46 public:
51  static TypeId GetTypeId (void);
52 
53  EnergyHarvester ();
54 
55  virtual ~EnergyHarvester ();
56 
62  void SetNode (Ptr<Node> node);
63 
70  Ptr<Node> GetNode (void) const;
71 
79  void SetEnergySource (Ptr<EnergySource> source);
80 
88 
95  double GetPower (void) const;
96 
97 private:
102  virtual void DoDispose (void);
103 
114  virtual double DoGetPower (void) const;
115 
116 private:
122 
129 
130 protected:
131 
132 };
133 
134 } // namespace ns3
135 
136 #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)
Get the type ID.
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.