void markStackedVariables ( Stack s ) { // Reverse the stack. Stack bts = new Stack ( ) ; // LogStream.err.println("Variables to be marked:"); while ( ! s . empty ( ) ) { // LogStream.err.println(((BaseType)s.peek()).getName()); bts . push ( s . pop ( ) ) ; } // For each but the last stack element, set the projection. // setProject(true, false) for a ctor type sets the projection for // the ctor itself but *does not* set the projection for all its // children. Thus, if a user wants the variable S.X, and S contains Y // and Z too, S's projection will be set (so serialize will descend // into S) but X, Y and Z's projection remain clear. In this example, // X's projection is set by the code that follows the while loop. // 1/28/2000 jhrg while ( bts . size ( ) > 1 ) { ServerMethods ct = ( ServerMethods ) bts . pop ( ) ; ct . setProject ( true , false ) ; } // For the last element, project the entire variable. ServerMethods bt = ( ServerMethods ) bts . pop ( ) ; bt . setProject ( true , true ) ; }
Given a stack of BaseType variables mark these as part of the current projection . This function assumes that if the TOS contains a Ctor type variable all of its members are to be projected . Also assume all variables under the TOS are Ctor variables and only the ctor itself is to be projected ; the member within the Ctor that is part of the projection will be on the stack too .