model_server/DIS_cm/src/ui_cm_oper.cxx
// Check all pre-conditions for the operation.
// 1. Make sure that the home project exists.
// 2. Make sure that something was selected.
// 3. Make sure that we can create an array of modules.
// 4. Optionally, make sure that the modules are checked out.
Check all pre-conditions for the operation.
1. Make sure that the home project exists.
2. Make sure that something was selected.
3. Make sure that we can create an array of modules.
4. Optionally, make sure that the modules are checked out.
Check all pre - conditions for the operation . 1 . Make sure that the home project exists . 2 . Make sure that something was selected . 3 . Make sure that we can create an array of modules . 4 . Optionally make sure that the modules are checked out .
bool ui_cm_oper::CheckPreConditions(const symbolArr& file_syms)
{
	bool status = true;
	home_project_ = projNode::get_home_proj();
	if (home_project_ == NULL) {
		dis_message(NULL, MSG_ERROR,
			"M_HOME_PROJECT_SELECT", (char*)name_);
		status = false;
	}
	if (file_syms.size() == 0) {
		dis_message(NULL, MSG_ERROR,
			"Nothing Selected '%s' CM Operation",
			(char*)name_);
		status = false;
	}
	if (status) {
		symbolPtr sym;
		ForEachS(sym, file_syms) {
			projModulePtr mod = NULL;
			if (sym.is_xrefSymbol() )
				mod = projModule_of_symbol(sym);
			else if (is_projModule(sym) )
				mod = projModulePtr(RelationalPtr(sym) );
			if (mod)
				modules_.insert_last(mod);
		}
		if (modules_.size() > 1)
			modules_.remove_dup_syms();
	}
	if (status && module_must_be_checked_out_) {
		symbolArr unchecked_modules(modules_);
		symbolPtr sym;
		ForEachS(sym, unchecked_modules) {
			projModule* mod = projModulePtr(RelationalPtr(sym) );
			if (!mod) {
				dis_message(NULL, MSG_INFORM,
					"Invalid project module found.");
				modules_.remove(sym);
			} else if (!mod->is_home_project() ) {
				dis_message(NULL, MSG_INFORM,
					"Module '%s' is not in the home project.",
					realOSPATH(mod->get_name()) );
				modules_.remove(sym);
			}
		}
		status = (modules_.size() > 0);
	}
	return(status);
}
bool ui_cm_oper :: CheckPreConditions ( const symbolArr & file_syms ) { bool status = true ; home_project_ = projNode :: get_home_proj ( ) ; if ( home_project_ == NULL ) { dis_message ( NULL , MSG_ERROR , " " , ( char * ) name_ ) ; status = false ; } if ( file_syms . size ( ) == 0 ) { dis_message ( NULL , MSG_ERROR , " " , ( char * ) name_ ) ; status = false ; } if ( status ) { symbolPtr sym ; ForEachS ( sym , file_syms ) { projModulePtr mod = NULL ; if ( sym . is_xrefSymbol ( ) ) mod = projModule_of_symbol ( sym ) ; else if ( is_projModule ( sym ) ) mod = projModulePtr ( RelationalPtr ( sym ) ) ; if ( mod ) modules_ . insert_last ( mod ) ; } if ( modules_ . size ( ) > 1 ) modules_ . remove_dup_syms ( ) ; } if ( status && module_must_be_checked_out_ ) { symbolArr unchecked_modules ( modules_ ) ; symbolPtr sym ; ForEachS ( sym , unchecked_modules ) { projModule * mod = projModulePtr ( RelationalPtr ( sym ) ) ; if ( ! mod ) { dis_message ( NULL , MSG_INFORM , " " ) ; modules_ . remove ( sym ) ; } else if ( ! mod -> is_home_project ( ) ) { dis_message ( NULL , MSG_INFORM , " " , realOSPATH ( mod -> get_name ( ) ) ) ; modules_ . remove ( sym ) ; } } status = ( modules_ . size ( ) > 0 ) ; } return ( status ) ; }
Check all pre-conditions for the operation.
Check all pre - conditions for the operation .
// 1. Make sure that the home project exists. // 2. Make sure that something was selected. // 4. Optionally, make sure that the modules are checked out. // Make sure we didn't empty the modules_ array.