added operator< to jobid
authorMichal Voců <michal@ruk.cuni.cz>
Tue, 29 Jan 2008 18:25:32 +0000 (18:25 +0000)
committerMichal Voců <michal@ruk.cuni.cz>
Tue, 29 Jan 2008 18:25:32 +0000 (18:25 +0000)
org.glite.jobid.api-cpp/interface/JobId.h

index d07e622..2e1e8e7 100755 (executable)
@@ -76,7 +76,7 @@ public:
 
        //@}
 
-       //@ Conversions, assignments
+       //@ Conversions, assignments, comparisons
        //@{
 
        /**
@@ -107,6 +107,12 @@ public:
         */
        std::string toString() const;
 
+
+       /**
+        * Comparison given by lexicographical ordering of string representations.
+        * @return Result of comparison.
+        */
+       int operator< (const JobId &j) const;
        //@}
 
 
@@ -262,6 +268,17 @@ JobId::toString() const
 
 
 inline
+int
+JobId::operator< (const JobId &j) const
+{
+       std::string me(toString());
+       std::string js(j.toString());
+
+       return(me < js);
+}
+
+
+inline
 std::string
 JobId::server() const
 {