import of CE statistics
authorAleš Křenek <ljocha@ics.muni.cz>
Fri, 10 Dec 2004 12:27:57 +0000 (12:27 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Fri, 10 Dec 2004 12:27:57 +0000 (12:27 +0000)
org.glite.lb.common/src/xml_conversions.c

index 515a6d6..d914cce 100644 (file)
@@ -1,6 +1,7 @@
 #ident "$Header$"
 
 #include <string.h>
+#include <stdlib.h>
 #include <expat.h>
 
 #include "trio.h"
@@ -64,6 +65,16 @@ void edg_wll_initXMLCtx(edg_wll_XML_ctx *c) {
        c->attrsGlobal  = NULL;
        c->errCode = 0;
        c->bound = 0;
+       c->statsFunction = NULL;
+       c->statsConditions = NULL;
+       c->statsMajor = EDG_WLL_JOB_UNDEF;
+       c->statsMinor = 0;
+       c->statsRate = 0;
+       c->statsDuration = 0;
+       c->statsFrom = 0;
+       c->statsTo = 0;
+       c->statsResFrom = 0;
+       c->statsResTo = 0;
        c->errDesc = NULL;
        c->stat_begin = 0;
        c->jobQueryRec_begin = 0;
@@ -136,6 +147,22 @@ void edg_wll_add_int_to_XMLBody(char **body, const int toAdd, const char *tag, c
 }
 
 
+/* edg_wll_add_float_to_XMLBody(&body, rate, "rate", 0) */
+
+void edg_wll_add_float_to_XMLBody(char **body, const float toAdd, const char *tag, const float null)
+{
+       if (toAdd != null) {
+                char *newBody;
+
+                trio_asprintf(&newBody,"%s\t\t\t<%s>%|Xf</%s>\r\n", *body, tag, toAdd, tag);
+
+                free(*body);
+                *body = newBody;
+       }
+}
+
+
+
 /* edg_wll_add_timeval_to_XMLBody(&body, eventsOut[i].any.tv, "timestamp", -1) */
 
 void edg_wll_add_timeval_to_XMLBody(char **body, struct timeval toAdd, const char *tag, const struct timeval null)
@@ -543,6 +570,21 @@ int edg_wll_from_string_to_int(edg_wll_XML_ctx *XMLCtx)
 }
 
 
+
+/* XMLCtx->eventsOutGlobal[XMLCtx->position].jobClear.clearReason = 
+       edg_wll_from_string_to_int(XMLCtx);                             */
+float edg_wll_from_string_to_float(edg_wll_XML_ctx *XMLCtx)
+{
+        float out;
+
+        out = strtof(XMLCtx->char_buf, (char **) NULL);
+        edg_wll_freeBuf(XMLCtx);
+
+        return(out);
+}
+
+
+
 long edg_wll_from_string_to_long(edg_wll_XML_ctx *XMLCtx)
 {
         long out;