src/Basics/ParamSet.cc
/* These are functions that output formatted information concerning the
   Parameter set to a specified output stream of file. The latter function,
   write, will produce an ASCII file that is self-readable by this class.

                Input           pset : Parameter set (this)
                                ostr : Output ASCII file stream
                                file : ASCII output file (making pset file)
                                warn : Warning level flag for write fail
                Return          void : pset is sent to the output stream 
                                int  : T/F write to output pset file.        */
These are functions that output formatted information concerning the
Parameter set to a specified output stream of file. The latter function,
write, will produce an ASCII file that is self-readable by this class.


These are functions that output formatted information concerning the Parameter set to a specified output stream of file . The latter function write will produce an ASCII file that is self - readable by this class .
vector<string> ParameterSet::printStrings() const
  {
  vector<string> PStrings;		
  int np = int(size());				
  if(!np) return PStrings;			
  string sts[5] = { "Integer", "Double",
                         "String",  "Coordinate",
                         "Tensor" };
  vector<string> PNs;			
  vector<string> PTs;			
  vector<string> PVs;			
  vector<string> PCs;			
  vector<int>         MaxLens;		
  string pline;				
  list<SinglePar>::const_iterator i;
  i = begin();					
  int k=0;					
  int maxpn = 0;				
  int maxpt = 0;				
  int maxpv = 0;				
  int maxpc = 0;				
  while(i != end())				
    {
    PNs.push_back((*i).name());			
    maxpn = gmax(maxpn, int((PNs[k]).length()));
    PTs.push_back(sts[(*i).type()]);		
    maxpt = gmax(maxpt, int((PTs[k]).length()));
    PVs.push_back((*i).data());			
    maxpv = gmax(maxpv, int((PVs[k]).length()));
    PCs.push_back((*i).state());		
    maxpc = gmax(maxpc, int((PCs[k]).length()));
    i++;					
    k++;
    }
  MaxLens.push_back(gmin(maxpn, 20));
  MaxLens.push_back(maxpt);
  MaxLens.push_back(gmin(maxpv, 30));
  MaxLens.push_back(gmin(maxpc, 50));
  vector<string> chdrs;
  chdrs.push_back("Name"); 			
  chdrs.push_back("Type"); 			
  chdrs.push_back("Value"); 			
  chdrs.push_back("Comment"); 			
  int nc = int(chdrs.size());			
  string tmp;
  int tl;
  for(k=0; k<nc; k++)
    {
    tl = chdrs[k].length();
    if(tl < MaxLens[k])
      {
      tmp =  string((MaxLens[k]-tl)/2, ' ');
      tmp += chdrs[k];
      tmp += string(MaxLens[k]-tmp.length(), ' ');
      chdrs[k] = tmp;
      }
    }
  int cspcl = 2;				
  string cspc(cspcl, ' ' );		
  int ll = -cspcl;				
  for(k=0; k<nc; k++)				
    { ll+= chdrs[k].length() + cspcl; }
  string spc(40-ll/2, ' ');		
  pline = spc;					
  for(k=0; k<nc; k++)				
    {
    pline += chdrs[k];				
    if(k<nc-1) pline += cspc;			
    }
  PStrings.push_back(pline);			
  pline = spc;					
  for(k=0; k<nc; k++)				
    {
    pline +=  string(chdrs[k].length(), '-');
    if(k<nc-1) pline += cspc;
    }
  PStrings.push_back(pline);			
  int ml;
  for(k=0; k<np; k++)				
    {
    pline = spc;				
    pline += PNs[k];				
    tl = PNs[k].length();			
    ml = MaxLens[0];				
    if(tl<ml) pline += string(ml-tl, ' ');	
    pline += cspc;				
    pline += PTs[k];				
    tl = PTs[k].length();			
    ml = MaxLens[1];				
    if(tl<ml) pline += string(ml-tl, ' ');	
    pline += cspc;				
    pline += PVs[k];				
    tl = PVs[k].length();			
    ml = MaxLens[2];				
    if(tl<ml) pline +=  string(ml-tl, ' ');
    pline += cspc;				
    pline += PCs[k];				
    PStrings.push_back(pline);			
    }
  return PStrings;
  }
vector < string > ParameterSet :: printStrings ( ) const { vector < string > PStrings ; int np = int ( size ( ) ) ; if ( ! np ) return PStrings ; string sts [ 5 ] = { " " , " " , " " , " " , " " } ; vector < string > PNs ; vector < string > PTs ; vector < string > PVs ; vector < string > PCs ; vector < int > MaxLens ; string pline ; list < SinglePar > :: const_iterator i ; i = begin ( ) ; int k = 0 ; int maxpn = 0 ; int maxpt = 0 ; int maxpv = 0 ; int maxpc = 0 ; while ( i != end ( ) ) { PNs . push_back ( ( * i ) . name ( ) ) ; maxpn = gmax ( maxpn , int ( ( PNs [ k ] ) . length ( ) ) ) ; PTs . push_back ( sts [ ( * i ) . type ( ) ] ) ; maxpt = gmax ( maxpt , int ( ( PTs [ k ] ) . length ( ) ) ) ; PVs . push_back ( ( * i ) . data ( ) ) ; maxpv = gmax ( maxpv , int ( ( PVs [ k ] ) . length ( ) ) ) ; PCs . push_back ( ( * i ) . state ( ) ) ; maxpc = gmax ( maxpc , int ( ( PCs [ k ] ) . length ( ) ) ) ; i ++ ; k ++ ; } MaxLens . push_back ( gmin ( maxpn , 20 ) ) ; MaxLens . push_back ( maxpt ) ; MaxLens . push_back ( gmin ( maxpv , 30 ) ) ; MaxLens . push_back ( gmin ( maxpc , 50 ) ) ; vector < string > chdrs ; chdrs . push_back ( " " ) ; chdrs . push_back ( " " ) ; chdrs . push_back ( " " ) ; chdrs . push_back ( " " ) ; int nc = int ( chdrs . size ( ) ) ; string tmp ; int tl ; for ( k = 0 ; k < nc ; k ++ ) { tl = chdrs [ k ] . length ( ) ; if ( tl < MaxLens [ k ] ) { tmp = string ( ( MaxLens [ k ] - tl ) / 2 , ' ' ) ; tmp += chdrs [ k ] ; tmp += string ( MaxLens [ k ] - tmp . length ( ) , ' ' ) ; chdrs [ k ] = tmp ; } } int cspcl = 2 ; string cspc ( cspcl , ' ' ) ; int ll = - cspcl ; for ( k = 0 ; k < nc ; k ++ ) { ll += chdrs [ k ] . length ( ) + cspcl ; } string spc ( 40 - ll / 2 , ' ' ) ; pline = spc ; for ( k = 0 ; k < nc ; k ++ ) { pline += chdrs [ k ] ; if ( k < nc - 1 ) pline += cspc ; } PStrings . push_back ( pline ) ; pline = spc ; for ( k = 0 ; k < nc ; k ++ ) { pline += string ( chdrs [ k ] . length ( ) , ' ' ) ; if ( k < nc - 1 ) pline += cspc ; } PStrings . push_back ( pline ) ; int ml ; for ( k = 0 ; k < np ; k ++ ) { pline = spc ; pline += PNs [ k ] ; tl = PNs [ k ] . length ( ) ; ml = MaxLens [ 0 ] ; if ( tl < ml ) pline += string ( ml - tl , ' ' ) ; pline += cspc ; pline += PTs [ k ] ; tl = PTs [ k ] . length ( ) ; ml = MaxLens [ 1 ] ; if ( tl < ml ) pline += string ( ml - tl , ' ' ) ; pline += cspc ; pline += PVs [ k ] ; tl = PVs [ k ] . length ( ) ; ml = MaxLens [ 2 ] ; if ( tl < ml ) pline += string ( ml - tl , ' ' ) ; pline += cspc ; pline += PCs [ k ] ; PStrings . push_back ( pline ) ; } return PStrings ; }
These are functions that output formatted information concerning the
Parameter set to a specified output stream of file.
These are functions that output formatted information concerning the Parameter set to a specified output stream of file .
// Strings for parameters // # of parameters // Nothing if no parameters //                    Arrays For Strings We Will Oputput // For parameter names // For parameter types // For parameter values // For parameter comments // For column lengths // For parameter line //           Fill String Arrays & Find Maximum Column Lengths // Begin at input pset start // Temp for array index // Max parameter name length // Max parameter type length // Max parameter value length // Max parameter comment length // So long as Pix is OK //   Store ith parameter name //   Set maximum name length //   Store ith parameter type //   Set maximum value length //   Store ith parameter value //   Set maximum value length //   Store ith parameter comment //   Set maximum comment length //   Get next Pix //                       Set Up Column Headers To Use //        Their Widths Are Adjusted To Handle Parameters In Set // 1st column header // 2nd column header // 3rd column header // 4th column header // Number of columns //                        Set Column Header Strings  // Spacing between columns // For spacing between cols // Total line length // Get total line length // Spacer to center line // Space to 1st column start // Loop columns and add //   Add the column title //   Space to next column // Store title header // Space to 1st column start // Loop columns and output // Store header underlines //                  Make And Store Strings For Each Parameter //            (Each String Will Be A Line Containing Parameter Info) // Loop over all parameters // Space to 1st column start // Set parameter name // Length of name // Length of column // Space to end of column // Space to next column // Set parameter type // Length of name // Length of column // Space to end of column // Space to next column // Set parameter value // Length of name // Length of column // Space to end of column // Space to next column // Set parameter comment // Store parameter string