The code.ill.fr has been recreated and upgraded with the latest version this weekend, If you encounter any problem please inform the Helpdesk.

Commit 33226efc authored by legoc's avatar legoc
Browse files

(split) Added operator== for Endpoint

parent afb2a09b
......@@ -28,11 +28,15 @@ std::vector<std::string> split(const std::string& str, char c);
class Endpoint {
friend std::ostream& operator<<(std::ostream&, const Endpoint&);
public:
Endpoint(const std::string& protocol, const std::string& address, int port);
Endpoint(const std::string& address, int port);
Endpoint();
bool operator==(const Endpoint& endpoint) const;
const std::string& getProtocol() const;
const std::string& getAddress() const;
int getPort() const;
......@@ -88,4 +92,6 @@ private:
}
std::ostream& operator<<(std::ostream& os, const cameo::Endpoint& endpoint);
#endif
......@@ -56,6 +56,12 @@ Endpoint::Endpoint() :
m_port(0) {
}
bool Endpoint::operator==(const Endpoint& endpoint) const {
return m_protocol == endpoint.m_protocol
&& m_address == endpoint.m_address
&& m_port == endpoint.m_port;
}
const std::string& Endpoint::getProtocol() const {
return m_protocol;
}
......@@ -214,5 +220,12 @@ std::string ApplicationWithStarterIdentity::toJSONString() const {
return jsonObject.toString();
}
std::ostream& operator<<(std::ostream& os, const cameo::Endpoint& endpoint) {
os << endpoint.toString();
return os;
}
}
......@@ -29,6 +29,10 @@ int main(int argc, char *argv[]) {
CAMEO_ASSERT_TRUE("175.29.285.15" == endpoint.getAddress());
CAMEO_ASSERT_EQUAL(9999, endpoint.getPort());
Endpoint endpoint2("tcp", "175.29.285.15", 9999);
CAMEO_ASSERT_TRUE(endpoint == endpoint2);
bool error = false;
try {
Endpoint::parse("gamma75:9999");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment