diff --git a/pelab/magent/DelaySensor.cc b/pelab/magent/DelaySensor.cc index 3a090433e3021025b4e5847db325073b602df5ef..b90fb0d1a22f0c4c246c02059b0c758a95a80ac2 100644 --- a/pelab/magent/DelaySensor.cc +++ b/pelab/magent/DelaySensor.cc @@ -8,8 +8,8 @@ using namespace std; -DelaySensor::DelaySensor(PacketSensor * newPacketHistory, - StateSensor * newState) +DelaySensor::DelaySensor(PacketSensor const * newPacketHistory, + StateSensor const * newState) : state(newState) { lastDelay = 0; diff --git a/pelab/magent/DelaySensor.h b/pelab/magent/DelaySensor.h index 2c3a747059e143185b0ce7b32a9143aa7a740285..1ece4df89d415ba8e070b43f6e3a56900da168c7 100644 --- a/pelab/magent/DelaySensor.h +++ b/pelab/magent/DelaySensor.h @@ -11,15 +11,16 @@ class StateSensor; class DelaySensor : public Sensor { public: - DelaySensor(PacketSensor * newPacketHistory, StateSensor * newState); + DelaySensor(PacketSensor const * newPacketHistory, + StateSensor const * newState); int getLastDelay(void) const; protected: virtual void localSend(PacketInfo * packet); virtual void localAck(PacketInfo * packet); private: int lastDelay; - PacketSensor * packetHistory; - StateSensor * state; + PacketSensor const * packetHistory; + StateSensor const * state; }; #endif diff --git a/pelab/magent/EwmaThroughputSensor.cc b/pelab/magent/EwmaThroughputSensor.cc index 77cfeb0c3cb433a747ec6b348043951599aeb373..bc462b2a0890a656237ee3e56b846d5a3800dc55 100644 --- a/pelab/magent/EwmaThroughputSensor.cc +++ b/pelab/magent/EwmaThroughputSensor.cc @@ -9,8 +9,8 @@ using namespace std; EwmaThroughputSensor::EwmaThroughputSensor( - ThroughputSensor * newThroughputSource, - StateSensor * newState) + ThroughputSensor const * newThroughputSource, + StateSensor const * newState) : maxThroughput(0) , bandwidth(0.0) , throughputSource(newThroughputSource) diff --git a/pelab/magent/EwmaThroughputSensor.h b/pelab/magent/EwmaThroughputSensor.h index 409f6805b0656d9e5bcb12a5b93b2472730ae116..3e6aabaa3ca20d169b7cf118cdd70eb3ffe2da88 100644 --- a/pelab/magent/EwmaThroughputSensor.h +++ b/pelab/magent/EwmaThroughputSensor.h @@ -11,8 +11,8 @@ class StateSensor; class EwmaThroughputSensor : public Sensor { public: - EwmaThroughputSensor(ThroughputSensor * newThroughputSource, - StateSensor * newState); + EwmaThroughputSensor(ThroughputSensor const * newThroughputSource, + StateSensor const * newState); protected: virtual void localSend(PacketInfo * packet); virtual void localAck(PacketInfo * packet); @@ -21,8 +21,8 @@ private: int maxThroughput; // And EWMA of the last several solid bandwidth measurements double bandwidth; - ThroughputSensor * throughputSource; - StateSensor * state; + ThroughputSensor const * throughputSource; + StateSensor const * state; }; #endif diff --git a/pelab/magent/MaxDelaySensor.cc b/pelab/magent/MaxDelaySensor.cc index 95c51d5a737af3aa7960d1596b8f99104115b60c..35f9bfb69efb885e5d991267edcfdb1f9f3e1c14 100644 --- a/pelab/magent/MaxDelaySensor.cc +++ b/pelab/magent/MaxDelaySensor.cc @@ -8,8 +8,10 @@ using namespace std; -MaxDelaySensor::MaxDelaySensor(DelaySensor * newDelay, StateSensor * newState, - MinDelaySensor *newminDelay, PacketSensor *newpacketSensor) +MaxDelaySensor::MaxDelaySensor(DelaySensor const * newDelay, + StateSensor const * newState, + MinDelaySensor const * newminDelay, + PacketSensor const * newpacketSensor) : maximum(0, 0.01) , delay(newDelay) , state(newState) diff --git a/pelab/magent/MaxDelaySensor.h b/pelab/magent/MaxDelaySensor.h index 4413666e7851d97b9e0f8dec8514912d1e8d9bb0..945459a857d52d3b8440192a308bb2fc80365f98 100644 --- a/pelab/magent/MaxDelaySensor.h +++ b/pelab/magent/MaxDelaySensor.h @@ -16,17 +16,18 @@ class PacketSensor; class MaxDelaySensor : public Sensor { public: - MaxDelaySensor(DelaySensor * newDelay, StateSensor * newState, - MinDelaySensor * newminDelay, PacketSensor * newpacketSensor); + MaxDelaySensor(DelaySensor const * newDelay, StateSensor const * newState, + MinDelaySensor const * newminDelay, + PacketSensor const * newpacketSensor); protected: virtual void localSend(PacketInfo * packet); virtual void localAck(PacketInfo * packet); private: Decayer maximum; - DelaySensor * delay; - StateSensor * state; - MinDelaySensor * mindelay; - PacketSensor * packetsensor; + DelaySensor const * delay; + StateSensor const * state; + MinDelaySensor const * mindelay; + PacketSensor const * packetsensor; // The last delay we reported to the monitor int lastreported; diff --git a/pelab/magent/MinDelaySensor.cc b/pelab/magent/MinDelaySensor.cc index 2b67e0daf502a3ef665a5ee01b38c2dd5eab808b..2ceb7d594a1ada469ebc4a9e7451c4b995033d7a 100644 --- a/pelab/magent/MinDelaySensor.cc +++ b/pelab/magent/MinDelaySensor.cc @@ -7,7 +7,7 @@ using namespace std; -MinDelaySensor::MinDelaySensor(DelaySensor * newDelay) +MinDelaySensor::MinDelaySensor(DelaySensor const * newDelay) : minimum(1000000, -0.01), minDelay(1000000), lastreported(-1) { delay = newDelay; diff --git a/pelab/magent/MinDelaySensor.h b/pelab/magent/MinDelaySensor.h index a6c59bb86eada16b4ff0de8162390ed9f6d0e2cd..03501b2edbc686f5e6d8df42c2908914334722e2 100644 --- a/pelab/magent/MinDelaySensor.h +++ b/pelab/magent/MinDelaySensor.h @@ -14,15 +14,15 @@ class DelaySensor; class MinDelaySensor : public Sensor { public: - MinDelaySensor(DelaySensor * newDelay); + MinDelaySensor(DelaySensor const * newDelay); // Note: This is the minimum RTT, not one-way delay - int getMinDelay() { return minDelay; } + int getMinDelay(void) const { return minDelay; } protected: virtual void localSend(PacketInfo * packet); virtual void localAck(PacketInfo * packet); private: Decayer minimum; - DelaySensor * delay; + DelaySensor const * delay; int minDelay; int lastreported; }; diff --git a/pelab/magent/PacketSensor.cc b/pelab/magent/PacketSensor.cc index b5f079dcc6078c37a610df9d06c44fa3dec080b9..aa048928468e85fe53ba039ed25c7a04daf39909 100644 --- a/pelab/magent/PacketSensor.cc +++ b/pelab/magent/PacketSensor.cc @@ -6,7 +6,7 @@ using namespace std; -PacketSensor::PacketSensor(StateSensor * newState) +PacketSensor::PacketSensor(StateSensor const * newState) : globalSequence() , state(newState) { diff --git a/pelab/magent/PacketSensor.h b/pelab/magent/PacketSensor.h index 3457dd077453784fe4dccf463dc36e14b3ec1559..5f1892e2a58b194c1a84c5bbc01707ad2fbeacd7 100644 --- a/pelab/magent/PacketSensor.h +++ b/pelab/magent/PacketSensor.h @@ -13,7 +13,7 @@ class StateSensor; class PacketSensor : public Sensor { public: - PacketSensor(StateSensor * newState); + PacketSensor(StateSensor const * newState); // Get the size of the acknowledgement in bytes. int getAckedSize(void) const; // Find out if the packet in question is a retransmission @@ -42,7 +42,7 @@ private: SentPacket globalSequence; bool isRetransmit; - StateSensor * state; + StateSensor const * state; }; #endif diff --git a/pelab/magent/SensorList.h b/pelab/magent/SensorList.h index 4f1bfa292bb31e882bfc5a1b881cf87d41a61ab9..d0dee4f0993ddd932436956d4d832553c040bb60 100755 --- a/pelab/magent/SensorList.h +++ b/pelab/magent/SensorList.h @@ -10,6 +10,11 @@ // check to each associated push function to see if that pointer is // non-NULL. +// ASSUMPTION: Functions called through the dependency declarations +// are queries only. They do not change the sensor +// involved. Therefore, declare them const and any reference to them +// const and any query-functions in them const. + #ifndef SENSOR_LIST_H_STUB_2 #define SENSOR_LIST_H_STUB_2 @@ -51,13 +56,13 @@ private: void pushEwmaThroughputSensor(void); private: // Example dependency - NullSensor * depNullSensor; + NullSensor const * depNullSensor; // Dependency pointers. - StateSensor * depStateSensor; - PacketSensor * depPacketSensor; - DelaySensor * depDelaySensor; - MinDelaySensor * depMinDelaySensor; - ThroughputSensor * depThroughputSensor; + StateSensor const * depStateSensor; + PacketSensor const * depPacketSensor; + DelaySensor const * depDelaySensor; + MinDelaySensor const * depMinDelaySensor; + ThroughputSensor const * depThroughputSensor; }; #endif diff --git a/pelab/magent/ThroughputSensor.cc b/pelab/magent/ThroughputSensor.cc index b394732b731f65be912c49ee6390abd8263c79d7..a76882853aad7550f985f723360b38f392172c1f 100644 --- a/pelab/magent/ThroughputSensor.cc +++ b/pelab/magent/ThroughputSensor.cc @@ -7,8 +7,8 @@ using namespace std; -ThroughputSensor::ThroughputSensor(PacketSensor * newPacketHistory, - StateSensor * newState) +ThroughputSensor::ThroughputSensor(PacketSensor const * newPacketHistory, + StateSensor const * newState) : throughputInKbps(0) , maxThroughput(0) , packetHistory(newPacketHistory) diff --git a/pelab/magent/ThroughputSensor.h b/pelab/magent/ThroughputSensor.h index 21dcfc69478a645b5e6d35fa150c9375d6051f35..7f8f7696a3d9d85cd8fe304d5400bcb8fd4b6274 100644 --- a/pelab/magent/ThroughputSensor.h +++ b/pelab/magent/ThroughputSensor.h @@ -13,7 +13,8 @@ class StateSensor; class ThroughputSensor : public Sensor { public: - ThroughputSensor(PacketSensor * newPacketHistory, StateSensor * newState); + ThroughputSensor(PacketSensor const * newPacketHistory, + StateSensor const * newState); int getThroughputInKbps(void) const; protected: virtual void localSend(PacketInfo * packet); @@ -22,8 +23,8 @@ private: int throughputInKbps; int maxThroughput; Time lastAckTime; - PacketSensor * packetHistory; - StateSensor * state; + PacketSensor const * packetHistory; + StateSensor const * state; }; #endif