gala_clients/DIS_group/src/GroupApp.cxx
//
// Conjure up an available group name:
//
Conjure up an available group name.
Conjure up an available group name .
char *GroupApp::DefaultResultName(const char *prefix, int &index)
{
  Initialize(GroupApp::DefaultResultName);
  char *ret = NULL;
  static int max = INT_MAX - 1;
  bool valid = false;
  genString name;
  NameCode nc;
  while ((index < max) && (valid == false)) {
    name.printf("%s%d", prefix, index);
    nc = ValidName((char *)name);
    if (nc == NAME_VALID)
      valid = true;
    else if (nc == NAME_INVALID)
      ++index;
    else
      break;
  }
  if (valid == true)
    ret = Strdup((char *)name);
  else if (index >= max)
    dis_message(NULL, MSG_ERROR, "M_SETS_MAXIDX");
  return ret;
}
char * GroupApp :: DefaultResultName ( const char * prefix , int & index ) { Initialize ( GroupApp :: DefaultResultName ) ; char * ret = NULL ; static int max = INT_MAX - 1 ; bool valid = false ; genString name ; NameCode nc ; while ( ( index < max ) && ( valid == false ) ) { name . printf ( " " , prefix , index ) ; nc = ValidName ( ( char * ) name ) ; if ( nc == NAME_VALID ) valid = true ; else if ( nc == NAME_INVALID ) ++ index ; else break ; } if ( valid == true ) ret = Strdup ( ( char * ) name ) ; else if ( index >= max ) dis_message ( NULL , MSG_ERROR , " " ) ; return ret ; }
Conjure up an available group name:
Conjure up an available group name :