commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/appserver/doc/geasarch outline.txt


From: Daniel E. Baumann
Subject: gnue/appserver/doc/geasarch outline.txt
Date: Mon, 15 Jul 2002 17:29:22 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Daniel E. Baumann <address@hidden>      02/07/15 17:29:22

Modified files:
        appserver/doc/geasarch: outline.txt 

Log message:
        Add section to the ODMG Python binding for handling idl union types.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/doc/geasarch/outline.txt.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gnue/appserver/doc/geasarch/outline.txt
diff -c gnue/appserver/doc/geasarch/outline.txt:1.1 
gnue/appserver/doc/geasarch/outline.txt:1.2
*** gnue/appserver/doc/geasarch/outline.txt:1.1 Mon May 27 15:42:39 2002
--- gnue/appserver/doc/geasarch/outline.txt     Mon Jul 15 17:29:22 2002
***************
*** 341,346 ****
--- 341,386 ----
                 s=segment(-3,7)
                 print s.left_limit, s.right_limit
  
+            Unions
+              - Union types are mapped to classes with two attributes,
+              first being the descriminant _d, the second the associated
+              value _v
+              - for each branch, there is an additional attribute,
+              which can only be accessed if the branch has been set,
+              there are three possibilities:
+ 
+                - if the discriminant was explicitly listed in a case
+                  statement, the value is of the branch associated
+                  with the case
+                - if the discriminant is not explicitly listed and
+                  there is a default case label, the value is of the
+                  branch associated with the case label
+                - if the discriminant is not listed, and there is no
+                  default, the value is None
+ 
+              - constructor of the class expects the discriminator and
+              the value as arguments
+              - alternatively, the union can also be constructed by
+              passing a keyword argument, with the field name of the
+              union as the key, if more than one discriminator is
+              associated with a field, the discriminator must be
+              set explicitly
+ 
+              Example:
+  
+              union MyUnion switch(long)
+              {
+                case 1: string s;
+                default: long x;
+              };
+ 
+              can be accessed as
+ 
+              u = MyUnion(17, 42)
+              print u.x
+              u = MyUnion(s = 'string')
+              print u._d, u._v
+ 
        Exceptions
          - when error detected, exception is raised using standard Python
          exception mechanism, which consists of deriving from



reply via email to

[Prev in Thread] Current Thread [Next in Thread]