Changes between Initial Version and Version 1 of Doc/panc/tips


Ignore:
Timestamp:
Sep 4, 2007, 3:29:16 PM (18 years ago)
Author:
/O=GRID-FR/C=FR/O=CNRS/OU=LAL/CN=Charles Loomis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Doc/panc/tips

    v1 v1  
     1===Record Validation===
     2
     3{{{
     4type structure_enclosure = {
     5  'type' : string with match(self, 'blade|dumb|hypervisor')
     6  'children' : string[1..] with is_profile_list(self)
     7  'maxchildren' ? long(1..)
     8} with {
     9  if (exists(self['maxchildren'])) {
     10    self['maxchildren'] >= length(self['children']);
     11  } else {
     12    true;
     13  };
     14};
     15}}}
     16
     17For the older compiler (v6) you must define an intermediate type as a 'with' clause on a record definition is not valid in the older compiler.
     18
     19That is,
     20
     21{{{
     22type structure_enclosure = {
     23  'type' : string with match(self, 'blade|dumb|hypervisor')
     24  'children' : string[1..] with is_profile_list(self)
     25  'maxchildren' ? long(1..)
     26} with {
     27  if (exists(self['maxchildren'])) {
     28    self['maxchildren'] >= length(self['children']);
     29  } else {
     30    true;
     31  };
     32};
     33
     34type validated_structure_enclosure =
     35  structure_enclosure with {
     36    if (exists(self['maxchildren'])) {
     37      self['maxchildren'] >= length(self['children']);
     38    } else {
     39      true;
     40    };
     41  };
     42}}}
     43