signal.hpp

00001 
00002 #ifndef SIGNAL_H
00003 #define SIGNAL_H
00004 
00005 #include <iostream>
00006 using namespace std;
00007 #include <boost/shared_ptr.hpp>
00008 
00009 #include "location.hpp"
00010 #include "utility.hpp"
00011 
00012 class WirelessCommSignal;
00013 
00017 class Signal {
00018    friend ostream& operator<< (ostream& s, const Signal& rhs);
00019    friend ostream& operator<< (ostream& s, const WirelessCommSignal& rhs);
00020 public:
00022    typedef boost::shared_ptr<Signal> SignalPtr;
00023 
00025    virtual ~Signal();
00026 
00031    static inline SignalPtr create(const Location& location, 
00032       double dbStrength);
00033    
00038    static inline SignalPtr create(const Signal& rhs);
00039 
00044    inline Location getLocation() const;
00045 
00050    inline double getDbStrength() const;
00051 
00052 protected:
00053 
00055    Signal(const Location& location, double dbStrength);
00056 
00058    Signal(const Signal& rhs);
00059 
00066    virtual SignalPtr clone() const;
00067 
00068 private:
00069 
00072    Location m_location;
00073 
00076    double m_dbStrength;
00077 
00079    Signal& operator= (const Signal& rhs);
00080 
00081 };
00082 typedef boost::shared_ptr<Signal> SignalPtr;
00083 
00085 // Inline Functions
00087 
00088 inline SignalPtr Signal::create(const Location& location, 
00089    double dbStrength)
00090 {
00091    SignalPtr p(new Signal(location, dbStrength));
00092    return p;
00093 }
00094 
00095 inline SignalPtr Signal::create(const Signal& rhs)
00096 {
00097    return rhs.clone();
00098 }
00099 
00100 inline Location Signal::getLocation() const
00101 {
00102    return m_location;
00103 }
00104 
00105 inline double Signal::getDbStrength() const
00106 {
00107    return m_dbStrength;
00108 }
00109 
00111 // Overloaded Operators
00113 
00114 inline ostream& operator<< (ostream& s, const Signal& rhs)
00115 {
00116    return s << "Signal state (pointer= " << &rhs <<
00117       ", location=(" << rhs.m_location << 
00118       "), db strength= " << rhs.m_dbStrength << ")";
00119 }
00120 
00121 #endif // SIGNAL_H
00122 

Generated on Tue Dec 12 17:04:38 2006 for rfidsim by  doxygen 1.4.7