Static-forever assignment of JobStatus::Attr enum values
authorAleš Křenek <ljocha@ics.muni.cz>
Mon, 30 Jul 2007 17:48:51 +0000 (17:48 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Mon, 30 Jul 2007 17:48:51 +0000 (17:48 +0000)
org.glite.lb.client-interface/interface/JobStatus.h.T
org.glite.lb.client-interface/src/StatusAttrNames.pl [new file with mode: 0644]

index 94a1866..c50bf3a 100644 (file)
@@ -59,6 +59,13 @@ public:
         */
        enum Attr {
 @@@{
+       require '../src/StatusAttrNames.pl';
+       my %StatusAttrNums;
+       my $stno = 0;
+       for (@main::StatusAttrNames) {
+               $StatusAttrNums{$_} = $stno++;
+       }
+
        selectType $status '_common_';
        for my $u (sort {$a cmp $b} getAllFields $status) {
                selectField $status $u;
@@ -66,7 +73,7 @@ public:
                $u =~ s/([a-z])([A-Z])/$1_$2/g;
                $u = uc $u;
 
-               gen "\t/** $f->{comment} */\n\t\t$u,\n";
+               gen "\t/** $f->{comment} */\n\t\t$u = $StatusAttrNums{$u},\n";
        }
 @@@}
                 ATTR_MAX /**< Limit for range checking. */
diff --git a/org.glite.lb.client-interface/src/StatusAttrNames.pl b/org.glite.lb.client-interface/src/StatusAttrNames.pl
new file mode 100644 (file)
index 0000000..30dcbb5
--- /dev/null
@@ -0,0 +1,69 @@
+# The order of strings in this array determines assigned numeric value in the JobStatus::Attr enum.
+# It must not be changed unless API major number is incremented
+
+@main::StatusAttrNames = qw/
+       ACL
+       CANCEL_REASON
+       CANCELLING
+       CE_NODE
+       CHILDREN
+       CHILDREN_HIST
+       CHILDREN_NUM
+       CHILDREN_STATES
+       CONDOR_ID
+       CONDOR_DEST_HOST
+       CONDOR_ERROR_DESC
+       CONDOR_JDL
+       CONDOR_JOB_EXIT_STATUS
+       CONDOR_JOB_PID
+       CONDOR_OWNER
+       CONDOR_PREEMPTING
+       CONDOR_REASON
+       CONDOR_SHADOW_EXIT_STATUS
+       CONDOR_SHADOW_PID
+       CONDOR_STARTER_EXIT_STATUS
+       CONDOR_STARTER_PID
+       CONDOR_STATUS
+       CONDOR_UNIVERSE
+       CPU_TIME
+       DESTINATION
+       DONE_CODE
+       EXIT_CODE
+       EXPECT_FROM
+       EXPECT_UPDATE
+       GLOBUS_ID
+       JDL
+       JOB_ID
+       JOBTYPE
+       LAST_UPDATE_TIME
+       LOCAL_ID
+       LOCATION
+       MATCHED_JDL
+       NETWORK_SERVER
+       OWNER
+       PARENT_JOB
+       PAYLOAD_RUNNING
+       PBS_DEST_HOST
+       PBS_ERROR_DESC
+       PBS_EXIT_STATUS
+       PBS_NAME
+       PBS_OWNER
+       PBS_PID
+       PBS_QUEUE
+       PBS_REASON
+       PBS_RESOURCE_USAGE
+       PBS_SCHEDULER
+       PBS_STATE
+       POSSIBLE_CE_NODES
+       POSSIBLE_DESTINATIONS
+       REASON
+       RESUBMITTED
+       RSL
+       SEED
+       STATE_ENTER_TIME
+       STATE_ENTER_TIMES
+       SUBJOB_FAILED
+       SUSPEND_REASON
+       SUSPENDED
+       USER_TAGS
+/;