]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
Entity ref is a better name for that attribute
authorAndreas Neiser <neiser@kph.uni-mainz.de>
Mon, 1 Jul 2013 08:26:36 +0000 (10:26 +0200)
committerAndreas Neiser <neiser@kph.uni-mainz.de>
Mon, 1 Jul 2013 08:26:36 +0000 (10:26 +0200)
xml-db/database/TrbNetSetup.xsd
xml-db/trb-setup.xml
xml-db/xml-db.pl

index 370f95104214aa4e63226a746eb04dee054753e4..4a1cda33ebebc87c7155fc58bb1ef0a94f3455aa 100644 (file)
@@ -44,7 +44,7 @@
       <xs:element ref="fifo" />
       <xs:element name="field" type="fieldtype" />
     </xs:choice>
-    <xs:attribute name="type" type="xs:string" use="required" />
+    <xs:attribute name="ref" type="nametype" use="required" />
     <xs:attribute name="address" type="addresstype" />
   </xs:complexType>
 
index 41bdfd1e7925b3714fa3ff4f7b52f4407efb4db9..27f3d749e717fafc4effd661cd808e38ab5771ca 100644 (file)
 
   <!-- we configure the trb endpoint with address 0x8000 -->
   <trb address="8000">
-    <entity type="TrbNet" />
+    <entity ref="TrbNet" />
 
     <!-- it has a TDC (at default register address) -->
-    <entity type="TDC">
+    <entity ref="TDC">
       <!-- this way we modify the number of channels to 5. This works
            since group/register/memory/fifo have unique names. It
            might be that there are several places where one should
     </entity>
 
     <!-- and it has a CTS -->
-    <entity type="CTS" />
+    <entity ref="CTS" />
   </trb>
 
 
   <trb address="0200">
     <!-- Standard TrbNet enpoint with standard 65ch TDC... -->
-    <entity type="TrbNet" />
-    <entity type="TDC" />
+    <entity ref="TrbNet" />
+    <entity ref="TDC" />
     <!-- ...but also some "external" PaDiWa frontends connected at
          chain 0 and 2. The fronend has some more registers which can
          be accessed via SPI. The idea is that there's also a
          PaDiWa.pm in the database which handles this access, usually
          via conventional TrbNet registers
          -->
-    <external type="PaDiWa" address="0000" />
-    <external type="PaDiWa" address="0002" />
+    <external ref="PaDiWa" address="0000" />
+    <external ref="PaDiWa" address="0002" />
   </trb>
 
 
   <!-- An example how to execute a setting. In general, the entities
        are identified by their type and address (if specified) -->
   <trb address="0200">
-    <entity type="TDC">
+    <entity ref="TDC">
       <!-- this field is a bitmask, so there's a converter to easily
            set single bits -->
       <field name="ChannelEnable">
index 98c285f7031a2e0b9f75b8d52c2d9ca1d8132483..d8ce18090156507cbf40f521ea3a4fcaacaacdbc 100755 (executable)
@@ -43,20 +43,24 @@ sub Main {
   my ($db,$files) = &LoadDBAndFiles;
 
   #print Dumper($files);
+  my $merged = {};
   foreach my $item (@$files) {
     my $file = $item->[0];
     my $doc = $item->[1]; print "Working on $file...\n" if $verbose;
-    my $merged = {};
+    
     foreach my $trbnode ($doc->getDocumentElement->findnodes('trb')) {
       my $trbaddress = $trbnode->getAttribute('address');
       print $trbaddress,"\n";
       foreach my $entitynode ($trbnode->findnodes('entity')) {
-        my $type = $entitynode->getAttribute('type');
+        my $ref = $entitynode->getAttribute('ref');
+
         # check if we know this type
-        FatalError($entitynode, "Entity type $type not found in database")
-          unless defined $db->{"$type.xml"};
+        FatalError($entitynode, "Entity reference $ref not found in database")
+          unless defined $db->{$ref};
+
+        # check if there's 
         
-        print $type,"\n";
+        print $ref,"\n";
       }
     }
   }
@@ -144,8 +148,9 @@ sub LoadDBAndFiles {
     while (<*.xml>) {
       my $doc = $parser->parse_file($_);
       ValidateXML($doc, $schemas);
-      $db->{$_} = $doc;
-      print "Loaded and validated <$_> from database\n" if $verbose;
+      my $dbname = $doc->getDocumentElement->getAttribute('name');
+      $db->{$dbname} = $doc;
+      print "Loaded and validated entity <$dbname> from db/$_\n" if $verbose;
     }
   }