Logo Search packages:      
Sourcecode: condor version File versions  Download package

condor_id.h

/***************************************************************
 *
 * Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
 * University of Wisconsin-Madison, WI.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License.  You may
 * obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ***************************************************************/


#ifndef _CONDOR_ID_H_
#define _CONDOR_ID_H_

#include "condor_common.h"
#include "dc_service.h"


/** An object to represent the Condor ID of a job.  Condor uses three
    integers (cluster, proc, subproc) to identify jobs.  This
    structure will be used to store those three numbers.
      This object used to live in src/condor_dagman/types.[Ch]
*/

00034 class CondorID : public ServiceData
{
  public:
    /// Constructor
00038     CondorID () : _cluster(-1), _proc(-1), _subproc(-1) {}

    /// Copy Constructor
00041     CondorID (int cluster, int proc, int subproc):
        _cluster(cluster), _proc(proc), _subproc(subproc) {}
    
    ///
    inline void Set (int cluster, int proc, int subproc) {
        _cluster = cluster;
        _proc    = proc;
        _subproc = subproc;
    }

    /** Compares this condorID's with another.
        @param condorID the other CondorID to compare
        @return zero if they match
    */
    int Compare (const CondorID condorID) const;

      /** Parses provided string of the form "cluster[.proc][.subproc]",
            and updates this object's values accordingly.
            @param s the string to parse
            @return 0-3, corresponding to the number of elements found & set
      */
      int SetFromString( const char* s );

    /** Test for equality between two CondorID's.
        @param the other CondorID object
        @return true if equal, false if not
    */
00068     inline bool operator == (const CondorID &condorID) const {
        return Compare (condorID) == 0;
    }

            /** Comparison function for use with SelfDrainingQueue.
                  This method is static (to live in the CondorID namespace).
                  Takes pointers to two CondorID objects (though the
                  pointers are of type ServiceData* to work properly w/
                  SelfDrainingQueue and all the rest.
                  @return -1 if a < b, 0 if a == b, and 1 if a > b
            */
      static int ServiceDataCompare( ServiceData* a, ServiceData* b );

    /// The job cluster
00082     int _cluster;

    /// The job process number
00085     int _proc;

    /// The job subprocess number
00088     int _subproc;
};


#endif /* _CONDOR_ID_H_ */

Generated by  Doxygen 1.6.0   Back to index