Index: trunk/ArchTOIPipe/TestPipes/mainxmlpipe.cc
===================================================================
--- trunk/ArchTOIPipe/TestPipes/mainxmlpipe.cc	(revision 2220)
+++ trunk/ArchTOIPipe/TestPipes/mainxmlpipe.cc	(revision 2220)
@@ -0,0 +1,471 @@
+
+// main genere automatiquement par xsl
+// ne pas modifier
+// derniere mise a jour : VF le 22/10/2002
+
+// inclusions expat
+#include <stdio.h>
+#include "expat.h"
+
+// inclusions c++
+#include <string>
+#include "config.h"
+#include <map>
+using namespace std;
+#include <iostream.h>
+#include "toi.h"
+#include "toiprocessor.h"
+#include "toimanager.h"
+#include "toisegment.h"
+#include "sophyainit.h"
+#include <stdexcept>
+
+#ifndef MAXINT
+#define MAXINT 2147483647
+#endif
+
+#include "smoothtoi.h"
+#include "demopipe.h"
+#include "fitstoirdr.h"
+#include "fitstoiwtr.h"
+
+// classe de gestion des balises en design patern object call-back
+class ToiPipe
+{
+public:
+  ToiPipe(void);
+  virtual ~ToiPipe();
+  static void startElement(void *userData, const char *name, const char **atts);
+  static void endElement(void *userData, const char *name);
+private:
+  // pour concordances instances - nom
+  map<string,TOIProcessor*> toiProc;
+  string id; 
+  // gestionnaire de TOI
+  TOIManager* mgr;
+  void startElementC(const char *name, const char **atts);
+  void endElementC(const char *name);
+};
+
+
+
+ToiPipe::ToiPipe()
+{
+ // Ouverture du gestionnaire de TOI.
+ mgr = TOIManager::getManager();
+ // initialisation du processeur courant
+ id="";
+
+}
+
+ToiPipe::~ToiPipe()
+{
+
+}
+
+void ToiPipe::startElement(void *userData, const char *name, const char **atts)
+{
+  ToiPipe *toiPipe = (ToiPipe*) userData;
+  toiPipe->startElementC(name, atts);
+}
+
+void ToiPipe::endElement(void *userData, const char *name)
+{
+  ToiPipe* toiPipe = (ToiPipe*) userData;
+  toiPipe->endElementC(name);
+}
+
+
+void ToiPipe::startElementC(const char *name, const char **atts)
+{
+  int i;
+  //puts(name);
+
+  // filtrage des balises
+  if ((string)name == "connect") {
+    // mise en ordre des arguments
+    string nom;
+    TOIProcessor* procin=NULL;
+    TOIProcessor* procout=NULL;
+    string input;
+    string output;
+    int taille = 1024;
+    bool writeflag = false;
+    for (i=0; atts[i]; i+=2) {
+      if ((string)atts[i] == "name") {
+	nom=atts[i+1];
+      }
+      if ((string)atts[i] == "procin") {
+	map<string,TOIProcessor*>::iterator j=toiProc.find(atts[i+1]);
+	if (j != toiProc.end()) { 
+	  procin = (*j).second;
+	} else {
+	   throw ParmError("Connect error: processor in not found");
+	}
+      }
+      if ((string)atts[i] == "procout") {
+	map<string,TOIProcessor*>::iterator j=toiProc.find(atts[i+1]);
+	if (j != toiProc.end()) {
+	  procout = (*j).second;
+	} else {
+	   throw ParmError("Connect error: processor out not found");
+	}
+      }
+      if ((string)atts[i] == "input") {
+	input = atts[i+1];
+      }
+      if ((string)atts[i] == "output") {
+	output = atts[i+1];
+      }
+    }    
+    // connection automatique des toiprocesseurs    
+    if (procin != NULL && procout != NULL ) {
+      cout << "connect " << output << " " << input << endl;
+      mgr->connect(*procout, output, *procin, input, nom, taille, writeflag);
+       cout << "connect done" << endl;
+    }
+
+  } else if ((string)name == "constraint") {                                // si balise de contrainte     
+    TOIProcessor* proc=NULL;
+    int min=0;
+    int max=MAXINT;
+    for (i=0; atts[i]; i+=2) {
+      if ((string)atts[i] =="proc") {
+        map<string,TOIProcessor*>::iterator j=toiProc.find(atts[i+1]);
+	if (j != toiProc.end()) { 
+	  proc = (*j).second;
+	} else {
+	  throw ParmError("Constraint error: processor not found");
+	}
+      }
+      if ((string)atts[i] == "min") {
+        min = atoi(atts[i+1]);
+      }
+      if ((string)atts[i] == "max") {
+        max = atoi(atts[i+1]);
+      } 
+    }
+    cout << "setting " << proc << " " << min << " " << max << endl;
+    proc->setRequestedSample(min, max);
+    cout << "constraint done" << endl;
+  
+  } else if ((string)name == "start") {                                     // si balise de demarrage 
+    cout << "***** Starting execution *****" << endl;
+    mgr->startAll();
+    // Gestion de la re-connection des threads
+    cout<<"***** Joining threads *****"<<endl;
+    mgr->joinAll();
+    cout<<"***** End threads *****"<<endl; 
+    // destruction du toimanager et des processeurs a implementer dans toimanager pour l'utilisation de plusieurs start
+    //TOIManager::~toimanager();
+    //toiProc.clear();
+  
+  } else if (id == "") {                                            // si nouveau processeur
+
+  if ((string)name == "smooth") {
+    uint_4 lsm;
+    uint_4 deg;
+    
+	
+    // gestion des arguments du constructeur
+    for (i=0; atts[i]; i+=2) {
+      // var pour instanciation
+        if ((string)atts[i] == "id") {
+            id=atts[i+1];
+      	}
+	
+	//initialisation des arguments par defaut si existants
+	
+
+	// mise a jour des arguments
+	
+	if ((string)atts[i] == "lsm") {
+	   lsm = atoi(atts[i+1]);
+	     
+	}
+    	
+	if ((string)atts[i] == "deg") {
+	   deg = atoi(atts[i+1]);
+	     
+	}
+    	
+      }
+   
+    // creation du toiprocesseur
+    toiProc[id] = new DataSmooth (lsm, deg);
+  }
+
+  if ((string)name == "demopipe") {
+    
+	
+    // gestion des arguments du constructeur
+    for (i=0; atts[i]; i+=2) {
+      // var pour instanciation
+        if ((string)atts[i] == "id") {
+            id=atts[i+1];
+      	}
+	
+	//initialisation des arguments par defaut si existants
+	
+
+	// mise a jour des arguments
+	
+      }
+   
+    // creation du toiprocesseur
+    toiProc[id] = new DemoPipe ();
+  }
+
+  if ((string)name == "fitsreader") {
+    string fn;
+    
+	
+    // gestion des arguments du constructeur
+    for (i=0; atts[i]; i+=2) {
+      // var pour instanciation
+        if ((string)atts[i] == "id") {
+            id=atts[i+1];
+      	}
+	
+	//initialisation des arguments par defaut si existants
+	fn = "test.fits";
+	   
+
+	// mise a jour des arguments
+	
+	if ((string)atts[i] == "fn") {
+	   fn = atts[i+1];
+	     
+	}
+    	
+      }
+   
+    // creation du toiprocesseur
+    toiProc[id] = new FITSTOIReader (fn);
+  }
+
+  if ((string)name == "fitswriter") {
+    string fn;
+    
+	
+    // gestion des arguments du constructeur
+    for (i=0; atts[i]; i+=2) {
+      // var pour instanciation
+        if ((string)atts[i] == "id") {
+            id=atts[i+1];
+      	}
+	
+	//initialisation des arguments par defaut si existants
+	
+
+	// mise a jour des arguments
+	
+	if ((string)atts[i] == "fn") {
+	   fn = atts[i+1];
+	     
+	}
+    	
+      }
+   
+    // creation du toiprocesseur
+    toiProc[id] = new FITSTOIWriter (fn);
+  }
+  
+
+  } else {                                           // sinon c une methode
+    // gestion des methodes 
+
+  if (id == "smooth") {
+    
+    if ((string)name == "DoNotLookAt") {
+    uint_8 flag;
+    
+	
+    // gestion des arguments de la methode
+    for (i=0; atts[i]; i+=2) {     
+	//initialisation des arguments par defaut si existants
+	flag = FlgToiAll;
+	   
+
+	// mise a jour des arguments
+	
+	if ((string)atts[i] == "flag") {
+	   flag = atoi(atts[i+1]);
+	   
+	}
+    	
+      }
+   
+    // appelle de la methode du processeur concerne
+    ((DataSmooth*)toiProc[id])->DoNotLookAt (flag); 
+    }
+    
+    if ((string)name == "SetFlagFailed") {
+    uint_8 flag;
+    
+	
+    // gestion des arguments de la methode
+    for (i=0; atts[i]; i+=2) {     
+	//initialisation des arguments par defaut si existants
+	flag = FlgToiInterp;
+	   
+
+	// mise a jour des arguments
+	
+	if ((string)atts[i] == "flag") {
+	   flag = atoi(atts[i+1]);
+	   
+	}
+    	
+      }
+   
+    // appelle de la methode du processeur concerne
+    ((DataSmooth*)toiProc[id])->SetFlagFailed (flag); 
+    }
+    
+    if ((string)name == "SetBuff") {
+    uint_4 bupd;
+    
+	
+    // gestion des arguments de la methode
+    for (i=0; atts[i]; i+=2) {     
+	//initialisation des arguments par defaut si existants
+	bupd = 100;
+	   
+
+	// mise a jour des arguments
+	
+	if ((string)atts[i] == "bupd") {
+	   bupd = atoi(atts[i+1]);
+	   
+	}
+    	
+      }
+   
+    // appelle de la methode du processeur concerne
+    ((DataSmooth*)toiProc[id])->SetBuffUpd (bupd); 
+    }
+    
+    if ((string)name == "MinSmoothLength") {
+    uint_4 lsmin;
+    
+	
+    // gestion des arguments de la methode
+    for (i=0; atts[i]; i+=2) {     
+	//initialisation des arguments par defaut si existants
+	lsmin = 0;
+	   
+
+	// mise a jour des arguments
+	
+	if ((string)atts[i] == "lsmin") {
+	   lsmin = atoi(atts[i+1]);
+	   
+	}
+    	
+      }
+   
+    // appelle de la methode du processeur concerne
+    ((DataSmooth*)toiProc[id])->MinSmoothLength (lsmin); 
+    }
+    
+  }
+
+  if (id == "demopipe") {
+    
+  }
+
+  if (id == "fitsreader") {
+    
+  }
+
+  if (id == "fitswriter") {
+    
+  }
+
+  
+  }
+  
+}
+
+
+void ToiPipe::endElementC(const char *name)
+{
+  // verification si une balise processeur est fermee pour la gestion des methodes d'initialisation
+  
+  if ((string)name == "smooth") {
+    id="";
+  }
+  
+  if ((string)name == "demopipe") {
+    id="";
+  }
+  
+  if ((string)name == "fitsreader") {
+    id="";
+  }
+  
+  if ((string)name == "fitswriter") {
+    id="";
+  }
+  
+
+  // execution du pipeline
+  if ((string)name == "toipipe") { 
+    cout << "***** Starting execution *****" << endl;
+    mgr->startAll();
+    // Gestion de la re-connection des threads
+    cout<<"***** Joining threads *****"<<endl;
+    mgr->joinAll();
+    cout<<"***** End threads *****"<<endl; 
+  }
+}
+
+
+int main(int argc, char *argv[])
+{
+  char buf[BUFSIZ];
+  XML_Parser parser = XML_ParserCreate(NULL);
+  int done;
+  FILE* fich=fopen(argv[1],"r");
+
+  ToiPipe* toiPipe = new ToiPipe();
+  
+  // Initialisation de Sophya
+  SophyaInit();
+  cout << "-- Application start --" << endl;
+  XML_SetUserData(parser, toiPipe);
+  XML_SetElementHandler(parser, ToiPipe::startElement, ToiPipe::endElement);
+  if (fich != NULL) {
+    cout << "-- Reading file --" << endl;
+    // traitement des balises
+    do {
+      try {
+	size_t len = fread(buf, 1, sizeof(buf), fich);
+	done = len < sizeof(buf);
+	if (!XML_Parse(parser, buf, len, done)) {
+	  fprintf(stderr,
+	      "%s at line %d\n",
+              XML_ErrorString(XML_GetErrorCode(parser)),
+              XML_GetCurrentLineNumber(parser));
+	  return 1;
+	}
+      } catch (PThrowable & exc) {    // Sophya exceptions
+	cout << "\ntstdemopipe: Catched Exception \n" << (string)typeid(exc).name() 
+	<< " - Msg= " << exc.Msg() << endl;
+      } catch (const std::exception & sex) {    // Standard exceptions
+	cout << "\ntstdemopipe: Catched std::exception \n" 
+      << (string)typeid(sex).name() << endl; 
+      } catch (...) {    // Other exceptions
+	cout << "\ntstdemopipe: some other exception was caught ! " << endl;
+      }
+    } while (!done);
+    XML_ParserFree(parser);
+    fclose(fich);
+  } else {
+     fprintf(stderr,"file not found");
+     return 1;
+  }
+  return(0);
+}
+
Index: trunk/ArchTOIPipe/TestPipes/xsl/DTDProcessors.dtd
===================================================================
--- trunk/ArchTOIPipe/TestPipes/xsl/DTDProcessors.dtd	(revision 2220)
+++ trunk/ArchTOIPipe/TestPipes/xsl/DTDProcessors.dtd	(revision 2220)
@@ -0,0 +1,26 @@
+<!ELEMENT attribute ( param+ ) >
+<!ATTLIST attribute methode NMTOKEN #REQUIRED >
+<!ATTLIST attribute name NMTOKEN #REQUIRED >
+
+<!ELEMENT connection ( input*, output* ) >
+
+<!ELEMENT init ( param+ ) >
+
+<!ELEMENT input EMPTY >
+<!ATTLIST input name NMTOKEN #REQUIRED >
+
+<!ELEMENT output EMPTY >
+<!ATTLIST output name NMTOKEN #REQUIRED >
+
+<!ELEMENT param EMPTY >
+<!ATTLIST param default NMTOKEN #IMPLIED >
+<!ATTLIST param name NMTOKEN #REQUIRED >
+<!ATTLIST param type NMTOKEN #REQUIRED >
+
+<!ELEMENT processor ( init*, attribute*, connection ) >
+<!ATTLIST processor include NMTOKEN #REQUIRED >
+<!ATTLIST processor class NMTOKEN #REQUIRED >
+<!ATTLIST processor name NMTOKEN #REQUIRED >
+
+<!ELEMENT processors ( processor* ) >
+
Index: trunk/ArchTOIPipe/TestPipes/xsl/connect2.xml
===================================================================
--- trunk/ArchTOIPipe/TestPipes/xsl/connect2.xml	(revision 2220)
+++ trunk/ArchTOIPipe/TestPipes/xsl/connect2.xml	(revision 2220)
@@ -0,0 +1,54 @@
+<!-- ?xml version="1.0" encoding="UTF-8"? -->
+
+<!-- Vivien FEBVRE le 10/09/2002 -->
+<!-- creation d'un toipipe en xml version 1.0-->
+<!-- remarque: toutes les lignes non incluses dans des balizes sont gerees comme des commentaires -->
+<!DOCTYPE toipipe SYSTEM "DTDConnect.dtd">
+<toipipe>
+
+
+<!-- create processors -->
+<fitsreader id="rfits1" fn="demo1.fits"/>
+
+<fitsreader id="rfits2" fn="demo2.fits"/>
+
+<fitswriter id="wfits" fn="demo.fits"/>
+
+<demopipe id="demo"/>
+
+<demopipe id="demo1"/>
+
+
+<!-- set connections --> 
+<connect name="tuyau_bolo_10" procout="rfits1" output="boloMuV_10" procin="wfits" input="boloMuV_10"/>
+<connect name="tuyau_bolo_20" procout="rfits1" output="boloMuV_20" procin="wfits" input="boloMuV_20"/>
+<connect name="tuyau_bolo_30" procout="rfits2" output="boloMuV_30" procin="wfits" input="boloMuV_30"/>
+
+<connect name="tuyau_bolo_10" procout="rfits1" output="boloMuV_10" procin="demo" input="entree_bolo_1"/>
+<connect name="tuyau_bolo_20" procout="rfits1" output="boloMuV_20" procin="demo" input="entree_bolo_2"/>
+<connect name="tuyau_bolo_30" procout="rfits2" output="boloMuV_30" procin="demo" input="entree_bolo_3"/>
+
+<connect name="tuyau_bolo_sum" procout="demo" output="sortie_bolo_sum" procin="wfits" input="boloSum"/>
+<connect name="tuyau_bolo_mul" procout="demo" output="sortie_bolo_mul" procin="wfits" input="boloMul"/>
+
+<connect name="tuyau_bolo_10" procout="demo" output="sortie_bolo_sum" procin="demo1" input="entree_bolo_1"/>
+<connect name="tuyau_bolo_20" procout="demo" output="sortie_bolo_mul" procin="demo1" input="entree_bolo_2"/>
+
+<connect name="tuyau_bolo_30" procout="rfits2" output="boloMuV_30" procin="demo1" input="entree_bolo_3"/>
+
+<connect name="tuyau_bolo_sum2" procout="demo1" output="sortie_bolo_sum" procin="wfits" input="boloSum2"/>
+<connect name="tuyau_bolo_mul2" procout="demo1" output="sortie_bolo_mul" procin="wfits" input="boloMul22"/>
+
+
+<constraint proc="wfits" min="100000" max ="100500"/>
+
+</toipipe>
+
+
+
+
+
+
+
+
+
Index: trunk/ArchTOIPipe/TestPipes/xsl/makeDTDConnect.xsl
===================================================================
--- trunk/ArchTOIPipe/TestPipes/xsl/makeDTDConnect.xsl	(revision 2220)
+++ trunk/ArchTOIPipe/TestPipes/xsl/makeDTDConnect.xsl	(revision 2220)
@@ -0,0 +1,122 @@
+<?xml version="1.0"?> 
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:output method="text" omit-xml-declaration="no" indent="no"/>
+<xsl:strip-space elements="*"/>
+
+<xsl:template match="processors">	
+
+	<xsl:variable name="lstproc">
+	<xsl:for-each select="processor">
+	<xsl:value-of select="@name"/>
+	<xsl:if test="last() > position()"> | </xsl:if>
+	</xsl:for-each>
+	</xsl:variable>
+	
+	<xsl:variable name="lstinput">
+	<xsl:for-each select="//input">
+	<xsl:value-of select="@name"/>
+	<xsl:if test="last() > position()"> | </xsl:if>
+	</xsl:for-each>
+	</xsl:variable>
+	
+	<xsl:variable name="lstoutput">
+	<xsl:for-each select="//output">
+	<xsl:value-of select="@name"/>
+	<xsl:if test="last() > position()"> | </xsl:if>
+	</xsl:for-each>
+	</xsl:variable>
+
+	<xsl:text>
+	&lt;!ELEMENT connect EMPTY>
+	<!-- &lt;!ATTLIST connect input ( </xsl:text><xsl:value-of select="$lstinput"/><xsl:text> ) #REQUIRED> -->
+	&lt;!ATTLIST connect input NMTOKEN #REQUIRED>
+	&lt;!ATTLIST connect name NMTOKEN #REQUIRED>
+	<!-- &lt;!ATTLIST connect output ( </xsl:text><xsl:value-of select="$lstoutput"/><xsl:text> ) #REQUIRED> -->
+	&lt;!ATTLIST connect output NMTOKEN #REQUIRED>
+	</xsl:text>
+	<xsl:text>
+	&lt;!ATTLIST connect procin NMTOKEN #REQUIRED>
+	&lt;!ATTLIST connect procout NMTOKEN #REQUIRED>
+	
+	&lt;!ELEMENT constraint EMPTY>
+	&lt;!ATTLIST constraint max NMTOKEN #REQUIRED>
+	&lt;!ATTLIST constraint min NMTOKEN #REQUIRED>
+	&lt;!ATTLIST constraint proc NMTOKEN #REQUIRED>
+ 	
+	&lt;!ELEMENT start EMPTY>
+
+	&lt;!ELEMENT toipipe ( (</xsl:text><xsl:value-of select="$lstproc"/><xsl:text> | connect | constraint | start )* )>
+	&lt;!ATTLIST toipipe name NMTOKEN #IMPLIED>
+	</xsl:text>
+
+	<!-- recherche des processeurs -->
+	<xsl:apply-templates/>
+	<xsl:text>
+
+	</xsl:text>
+</xsl:template>
+
+
+<xsl:template match="processor">
+
+	<xsl:variable name="nomproc" select="@name"/>
+	
+	<!-- liste des methodes -->
+	<xsl:variable name="lstmethod">
+	<xsl:for-each select="attribute">
+	<xsl:value-of select="@name"/>
+	<xsl:if test="last() > position()"> | </xsl:if>
+	</xsl:for-each>
+	</xsl:variable>
+	
+	<!-- sortie -->
+	<xsl:if test="$lstmethod=''">
+	<xsl:text>
+	&lt;!ELEMENT </xsl:text><xsl:value-of select="$nomproc"/><xsl:text> EMPTY></xsl:text>
+	</xsl:if>
+	<xsl:if test="$lstmethod!=''">
+	<xsl:text>
+
+	&lt;!ELEMENT </xsl:text><xsl:value-of select="$nomproc"/><xsl:text> ( (</xsl:text><xsl:value-of select="$lstmethod"/><xsl:text>)* )></xsl:text>
+	</xsl:if>
+	<xsl:text>
+	&lt;!ATTLIST </xsl:text><xsl:value-of select="$nomproc"/><xsl:text> id NMTOKEN #REQUIRED></xsl:text>
+
+	<xsl:for-each select="init/param">
+	<xsl:text>
+	&lt;!ATTLIST </xsl:text><xsl:value-of select="$nomproc"/><xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text> NMTOKEN #IMPLIED></xsl:text>
+	</xsl:for-each>
+
+	<!-- recherche des attributs -->
+	<xsl:apply-templates/>
+
+</xsl:template>
+
+<xsl:template match="attribute">
+
+	<xsl:variable name="nomatt" select="@name"/>
+
+	<xsl:text>
+	&lt;!ELEMENT </xsl:text><xsl:value-of select="$nomatt"/><xsl:text> EMPTY></xsl:text>
+
+	<xsl:for-each select="param">
+	<xsl:text>
+	&lt;!ATTLIST </xsl:text><xsl:value-of select="$nomatt"/><xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text> NMTOKEN #IMPLIED>
+	</xsl:text>
+	</xsl:for-each>
+
+</xsl:template>
+
+</xsl:stylesheet>
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/ArchTOIPipe/TestPipes/xsl/makeMainConnect.xsl
===================================================================
--- trunk/ArchTOIPipe/TestPipes/xsl/makeMainConnect.xsl	(revision 2220)
+++ trunk/ArchTOIPipe/TestPipes/xsl/makeMainConnect.xsl	(revision 2220)
@@ -0,0 +1,412 @@
+<?xml version="1.0"?> 
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:output method="text" omit-xml-declaration="no" indent="no"/>
+<xsl:strip-space elements="*"/>
+
+<xsl:template match="processors">	
+
+<xsl:text>
+// main genere automatiquement par xsl
+// ne pas modifier
+// derniere mise a jour : VF le 22/10/2002
+
+// inclusions expat
+#include &lt;stdio.h>
+#include "expat.h"
+
+// inclusions c++
+#include &lt;string>
+#include "config.h"
+#include &lt;map>
+using namespace std;
+#include &lt;iostream.h>
+#include "toi.h"
+#include "toiprocessor.h"
+#include "toimanager.h"
+#include "toisegment.h"
+#include "sophyainit.h"
+#include &lt;stdexcept>
+
+#ifndef MAXINT
+#define MAXINT 2147483647
+#endif
+</xsl:text>
+
+<xsl:for-each select="processor">
+	<xsl:text>
+#include "</xsl:text><xsl:value-of select="@include"/><xsl:text>"</xsl:text>
+</xsl:for-each>
+
+<xsl:text>
+
+// classe de gestion des balises en design patern object call-back
+class ToiPipe
+{
+public:
+  ToiPipe(void);
+  virtual ~ToiPipe();
+  static void startElement(void *userData, const char *name, const char **atts);
+  static void endElement(void *userData, const char *name);
+private:
+  // pour concordances instances - nom
+  map&lt;string,TOIProcessor*> toiProc;
+  string id; 
+  // gestionnaire de TOI
+  TOIManager* mgr;
+  void startElementC(const char *name, const char **atts);
+  void endElementC(const char *name);
+};
+
+
+
+ToiPipe::ToiPipe()
+{
+ // Ouverture du gestionnaire de TOI.
+ mgr = TOIManager::getManager();
+ // initialisation du processeur courant
+ id="";
+
+}
+
+ToiPipe::~ToiPipe()
+{
+
+}
+
+void ToiPipe::startElement(void *userData, const char *name, const char **atts)
+{
+  ToiPipe *toiPipe = (ToiPipe*) userData;
+  toiPipe->startElementC(name, atts);
+}
+
+void ToiPipe::endElement(void *userData, const char *name)
+{
+  ToiPipe* toiPipe = (ToiPipe*) userData;
+  toiPipe->endElementC(name);
+}
+
+
+void ToiPipe::startElementC(const char *name, const char **atts)
+{
+  int i;
+  //puts(name);
+
+  // filtrage des balises
+  if ((string)name == "connect") {
+    // mise en ordre des arguments
+    string nom;
+    TOIProcessor* procin=NULL;
+    TOIProcessor* procout=NULL;
+    string input;
+    string output;
+    int taille = 1024;
+    bool writeflag = false;
+    for (i=0; atts[i]; i+=2) {
+      if ((string)atts[i] == "name") {
+	nom=atts[i+1];
+      }
+      if ((string)atts[i] == "procin") {
+	map&lt;string,TOIProcessor*>::iterator j=toiProc.find(atts[i+1]);
+	if (j != toiProc.end()) { 
+	  procin = (*j).second;
+	} else {
+	   throw ParmError("Connect error: processor in not found");
+	}
+      }
+      if ((string)atts[i] == "procout") {
+	map&lt;string,TOIProcessor*>::iterator j=toiProc.find(atts[i+1]);
+	if (j != toiProc.end()) {
+	  procout = (*j).second;
+	} else {
+	   throw ParmError("Connect error: processor out not found");
+	}
+      }
+      if ((string)atts[i] == "input") {
+	input = atts[i+1];
+      }
+      if ((string)atts[i] == "output") {
+	output = atts[i+1];
+      }
+    }    
+    // connection automatique des toiprocesseurs    
+    if (procin != NULL &amp;&amp; procout != NULL ) {
+      cout &lt;&lt; "connect " &lt;&lt; output &lt;&lt; " " &lt;&lt; input &lt;&lt; endl;
+      mgr->connect(*procout, output, *procin, input, nom, taille, writeflag);
+       cout &lt;&lt; "connect done" &lt;&lt; endl;
+    }
+
+  } else if ((string)name == "constraint") {                                // si balise de contrainte     
+    TOIProcessor* proc=NULL;
+    int min=0;
+    int max=MAXINT;
+    for (i=0; atts[i]; i+=2) {
+      if ((string)atts[i] =="proc") {
+        map&lt;string,TOIProcessor*>::iterator j=toiProc.find(atts[i+1]);
+	if (j != toiProc.end()) { 
+	  proc = (*j).second;
+	} else {
+	  throw ParmError("Constraint error: processor not found");
+	}
+      }
+      if ((string)atts[i] == "min") {
+        min = atoi(atts[i+1]);
+      }
+      if ((string)atts[i] == "max") {
+        max = atoi(atts[i+1]);
+      } 
+    }
+    cout &lt;&lt; "setting " &lt;&lt; proc &lt;&lt; " " &lt;&lt; min &lt;&lt; " " &lt;&lt; max &lt;&lt; endl;
+    proc->setRequestedSample(min, max);
+    cout &lt;&lt; "constraint done" &lt;&lt; endl;
+  
+  } else if ((string)name == "start") {                                     // si balise de demarrage 
+    cout &lt;&lt; "***** Starting execution *****" &lt;&lt; endl;
+    mgr->startAll();
+    // Gestion de la re-connection des threads
+    cout&lt;&lt;"***** Joining threads *****"&lt;&lt;endl;
+    mgr->joinAll();
+    cout&lt;&lt;"***** End threads *****"&lt;&lt;endl; 
+    // destruction du toimanager et des processeurs a implementer dans toimanager pour l'utilisation de plusieurs start
+    //TOIManager::~toimanager();
+    //toiProc.clear();
+  
+  } else if (id == "") {                                            // si nouveau processeur
+</xsl:text>
+<xsl:for-each select="processor">
+  if ((string)name == "<xsl:value-of select="@name"/>") {
+    <xsl:for-each select="init/param">
+    <xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>;
+    </xsl:for-each>
+    <xsl:variable name="lstparam">
+    <xsl:for-each select="init/param">
+    <xsl:value-of select="@name"/>
+    <xsl:if test="last() > position()">, </xsl:if>
+    </xsl:for-each>
+    </xsl:variable>
+	
+    // gestion des arguments du constructeur
+    for (i=0; atts[i]; i+=2) {
+      // var pour instanciation
+        if ((string)atts[i] == "id") {
+            id=atts[i+1];
+      	}
+	
+	//initialisation des arguments par defaut si existants
+	<xsl:for-each select="init/param">
+	   <xsl:variable name="typearg">
+	   <xsl:value-of select="@type"/>
+	   </xsl:variable>
+	   <xsl:variable name="defaut">
+	   <xsl:value-of select="@default"/>
+	   </xsl:variable>
+	   <xsl:if test="$defaut!=''">  
+	   <xsl:if test="$typearg='int' or $typearg='long' or $typearg='float' or $typearg='double' or $typearg='uint_4' or $typearg='int_4' or $typearg='uint_8' or $typearg='int_8'">
+	   <xsl:value-of select="@name"/> = <xsl:value-of select="$defaut"/>;
+	   </xsl:if>
+	   <xsl:if test="$typearg='string' or $typearg='char*' or $typearg='char'">
+	   <xsl:value-of select="@name"/> = "<xsl:value-of select="$defaut"/>";
+	   </xsl:if>
+	   </xsl:if>
+	</xsl:for-each>
+
+	// mise a jour des arguments
+	<xsl:for-each select="init/param">
+	if ((string)atts[i] == "<xsl:value-of select="@name"/>") {
+	   <xsl:variable name="typearg">
+	   <xsl:value-of select="@type"/>
+	   </xsl:variable>
+	    <xsl:if test="$typearg='int' or $typearg='long' or $typearg='int_4' or $typearg='uint_4' or $typearg='int_8' or $typearg='uint_8'">
+	   <xsl:value-of select="@name"/> = atoi(atts[i+1]);
+	   </xsl:if> 
+	   <xsl:if test="$typearg='float' or $typearg='double'">
+	   <xsl:value-of select="@name"/> = atof(atts[i+1]);
+	   </xsl:if>
+	   <xsl:if test="$typearg='char' or $typearg='char*' or $typearg='string'">
+	   <xsl:value-of select="@name"/> = atts[i+1];
+	   </xsl:if>  
+	}
+    	</xsl:for-each>
+      }
+   
+    // creation du toiprocesseur
+    toiProc[id] = new <xsl:value-of select="@class"/> (<xsl:value-of select="$lstparam"/>);
+  }
+</xsl:for-each>  
+
+  } else {                                           // sinon c une methode
+    // gestion des methodes 
+<xsl:for-each select="processor">
+  if (id == "<xsl:value-of select="@name"/>") {
+    <xsl:variable name="casttype">
+    <xsl:value-of select="@class"/>
+    </xsl:variable>
+    <xsl:for-each select="attribute">
+    if ((string)name == "<xsl:value-of select="@name"/>") {
+    <xsl:for-each select="param">
+    <xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>;
+    </xsl:for-each>
+    <xsl:variable name="lstparam">
+    <xsl:for-each select="param">
+    <xsl:value-of select="@name"/>
+    <xsl:if test="last() > position()">, </xsl:if>
+    </xsl:for-each>
+    </xsl:variable>
+	
+    // gestion des arguments de la methode
+    for (i=0; atts[i]; i+=2) {     
+	//initialisation des arguments par defaut si existants
+	<xsl:for-each select="param">
+	   <xsl:variable name="typearg">
+	   <xsl:value-of select="@type"/>
+	   </xsl:variable>
+	   <xsl:variable name="defaut">
+	   <xsl:value-of select="@default"/>
+	   </xsl:variable>
+	   <xsl:if test="$defaut!=''">
+	   <xsl:if test="$typearg='int' or $typearg='long' or $typearg='float' or $typearg='double' or $typearg='uint_4' or $typearg='int_4' or $typearg='uint_8' or $typearg='int_8'">
+	   <xsl:value-of select="@name"/> = <xsl:value-of select="$defaut"/>;
+	   </xsl:if>
+	   <xsl:if test="$typearg='string' or $typearg='char*' or $typearg='char'">
+	   <xsl:value-of select="@name"/> = "<xsl:value-of select="$defaut"/>";
+	   </xsl:if>
+	   </xsl:if>
+	</xsl:for-each>
+
+	// mise a jour des arguments
+	<xsl:for-each select="param">
+	if ((string)atts[i] == "<xsl:value-of select="@name"/>") {
+	   <xsl:variable name="typearg">
+	   <xsl:value-of select="@type"/>
+	   </xsl:variable>
+	   <xsl:if test="$typearg='int' or $typearg='long' or $typearg='int_4' or $typearg='uint_4' or $typearg='int_8' or $typearg='uint_8'">
+	   <xsl:value-of select="@name"/> = atoi(atts[i+1]);
+	   </xsl:if> 
+	   <xsl:if test="$typearg='float' or $typearg='double'">
+	   <xsl:value-of select="@name"/> = atof(atts[i+1]);
+	   </xsl:if>
+	   <xsl:if test="$typearg='char' or $typearg='char*' or $typearg='string'">
+	   <xsl:value-of select="@name"/> = atts[i+1];
+	   </xsl:if>
+	}
+    	</xsl:for-each>
+      }
+   
+    // appelle de la methode du processeur concerne
+    ((<xsl:value-of select="$casttype"/>*)toiProc[id])-><xsl:value-of select="@methode"/> (<xsl:value-of select="$lstparam"/>); 
+    }
+    </xsl:for-each>
+  }
+</xsl:for-each>
+  
+  }
+  
+}
+
+
+void ToiPipe::endElementC(const char *name)
+{
+  // verification si une balise processeur est fermee pour la gestion des methodes d'initialisation
+  <xsl:for-each select="processor">
+  if ((string)name == "<xsl:value-of select="@name"/>") {
+    id="";
+  }
+  </xsl:for-each>
+
+  // execution du pipeline
+  if ((string)name == "toipipe") { 
+    cout &lt;&lt; "***** Starting execution *****" &lt;&lt; endl;
+    mgr->startAll();
+    // Gestion de la re-connection des threads
+    cout&lt;&lt;"***** Joining threads *****"&lt;&lt;endl;
+    mgr->joinAll();
+    cout&lt;&lt;"***** End threads *****"&lt;&lt;endl; 
+  }
+}
+
+
+int main(int argc, char *argv[])
+{
+  char buf[BUFSIZ];
+  XML_Parser parser = XML_ParserCreate(NULL);
+  int done;
+  FILE* fich=fopen(argv[1],"r");
+
+  ToiPipe* toiPipe = new ToiPipe();
+  
+  // Initialisation de Sophya
+  SophyaInit();
+  cout &lt;&lt; "-- Application start --" &lt;&lt; endl;
+  XML_SetUserData(parser, toiPipe);
+  XML_SetElementHandler(parser, ToiPipe::startElement, ToiPipe::endElement);
+  if (fich != NULL) {
+    cout &lt;&lt; "-- Reading file --" &lt;&lt; endl;
+    // traitement des balises
+    do {
+      try {
+	size_t len = fread(buf, 1, sizeof(buf), fich);
+	done = len &lt; sizeof(buf);
+	if (!XML_Parse(parser, buf, len, done)) {
+	  fprintf(stderr,
+	      "%s at line %d\n",
+              XML_ErrorString(XML_GetErrorCode(parser)),
+              XML_GetCurrentLineNumber(parser));
+	  return 1;
+	}
+      } catch (PThrowable &amp; exc) {    // Sophya exceptions
+	cout &lt;&lt; "\ntstdemopipe: Catched Exception \n" &lt;&lt; (string)typeid(exc).name() 
+	&lt;&lt; " - Msg= " &lt;&lt; exc.Msg() &lt;&lt; endl;
+      } catch (const std::exception &amp; sex) {    // Standard exceptions
+	cout &lt;&lt; "\ntstdemopipe: Catched std::exception \n" 
+      &lt;&lt; (string)typeid(sex).name() &lt;&lt; endl; 
+      } catch (...) {    // Other exceptions
+	cout &lt;&lt; "\ntstdemopipe: some other exception was caught ! " &lt;&lt; endl;
+      }
+    } while (!done);
+    XML_ParserFree(parser);
+    fclose(fich);
+  } else {
+     fprintf(stderr,"file not found");
+     return 1;
+  }
+  return(0);
+}
+
+</xsl:template>
+
+</xsl:stylesheet>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: trunk/ArchTOIPipe/TestPipes/xsl/processors.xml
===================================================================
--- trunk/ArchTOIPipe/TestPipes/xsl/processors.xml	(revision 2220)
+++ trunk/ArchTOIPipe/TestPipes/xsl/processors.xml	(revision 2220)
@@ -0,0 +1,79 @@
+<!-- Vivien FEBVRE 26/09/2002 -->
+<!-- exemple de fichiers descriptif de processeurs -->
+
+
+<!DOCTYPE processors SYSTEM "DTDProcessors.dtd">
+
+
+<processors>
+
+
+<processor name="smooth" class="DataSmooth" include="smoothtoi.h">   
+
+<init>
+<param name="lsm" type="uint_4"/>
+<param name="deg" type="uint_4"/>
+</init>
+
+<attribute name="DoNotLookAt" methode="DoNotLookAt"> 
+<param name="flag" type="uint_8" default="FlgToiAll"/>
+</attribute>
+<attribute name="SetFlagFailed" methode="SetFlagFailed"> 
+<param name="flag" type="uint_8" default="FlgToiInterp"/>
+</attribute>
+<attribute name="SetBuff" methode="SetBuffUpd"> 
+<param name="bupd" type="uint_4" default="100"/>
+</attribute>
+<attribute name="MinSmoothLength" methode="MinSmoothLength"> 
+<param name="lsmin" type="uint_4" default="0"/>
+</attribute>
+
+<connection>
+<input name="DataIn"/>
+<output name="DataSmooth"/>
+</connection>
+
+</processor>
+
+
+<processor name="demopipe" class="DemoPipe" include="demopipe.h">   
+
+<connection>
+<input name="entree_bolo_1"/>
+<input name="entree_bolo_2"/>
+<input name="entree_bolo_3"/>
+<output name="sortie_bolo_sum"/>
+<output name="sortie_bolo_mul"/>
+</connection>
+
+</processor>
+
+<processor name="fitsreader" class="FITSTOIReader" include="fitstoirdr.h">   
+<init>
+<param name="fn" type="string" default="test.fits"/>
+</init>
+
+<connection>
+</connection>
+
+</processor>
+
+<processor name="fitswriter" class="FITSTOIWriter" include="fitstoiwtr.h">   
+<init>
+<param name="fn" type="string"/>
+</init>
+
+<connection>
+</connection>
+
+</processor>
+
+
+</processors>
+
+
+
+
+
+
+
Index: trunk/ArchTOIPipe/TestPipes/xsl/xslmake
===================================================================
--- trunk/ArchTOIPipe/TestPipes/xsl/xslmake	(revision 2220)
+++ trunk/ArchTOIPipe/TestPipes/xsl/xslmake	(revision 2220)
@@ -0,0 +1,3 @@
+#!/bin/csh
+set JAVA=/home/manip/mnt/planck/aubourg/java121/bin/java
+$JAVA -classpath $HOME/xalan-j_2_4_0/bin/xalan.jar:$HOME/xalan-j_2_4_0/bin/xercesImpl.jar:$HOME/xalan-j_2_4_0/bin/xml-apis.jar org.apache.xalan.xslt.Process -in processors.xml -xsl makeMainConnect.xsl -out mainxmlpipe.cc
