void EntityWorld::deleteManager( Manager* p_manager )
{
	// Find the correct manager-object in the vector and delete it from both the vector
	// and the bag by using the other overloaded variant of this function;
	//NOTE: break in for-loop 
	for( unsigned int i=0; i<m_managers.size(); i++ )
	{
		if(m_managers[i] == p_manager)
		{
			deleteManager((Manager::ManagerTypeIdx)i);
			break;
		}
	}
}
Exemple #2
0
//===================================================================
// Deletes a company from the BST/Hashed array (if it exists)
//===================================================================
void deleteCompany(DATA_HEAD *data)
{
    COMPANY *companyPtr;
    COMPANY *deletedPtr;
    int len;
    char name[MAX_CHARS];

    printf("Enter name of company: ");
    fgets(name, MAX_CHARS, stdin);
    len = strlen(name);
    if(name[len-1] == '\n' || name[len-1]=='\r')
            name[len-1]='\0'; // change '\n' to '\0'

    companyPtr = (COMPANY*)malloc(sizeof(COMPANY));
    if(companyPtr == NULL)
    {
        printf("Not enough memory, exiting program...\n");
        exit(1);
    }
    companyPtr->companyName = allocateString(name);

    deletedPtr = deleteManager(data, companyPtr);
    if(deletedPtr)
    {
        (data->count)--;
        printf("Deleted record: %-30s\n", deletedPtr->companyName);
        printf("\nNumber Of Data Records: %d\n", data->count);
        pushStack(data->pStack, deletedPtr);
    }
    else
        printf("Company is not in the list.\n");

    free(companyPtr->companyName);
    free(companyPtr);
    printf("\n");
}
Exemple #3
0
void refManagerImpl::releaseWeak()
{
	if (m_weakCount.decrement() <= 0)
		deleteManager();
}
//***********************************************************************************************************
// Definition operationManager
//
//***********************************************************************************************************
void operationManager(listHead *aList, char tUserInput)
{
    if (tUserInput == 'i')
    {
        insertManager(aList);
    }
    else
    {
        if (tUserInput == 'd')
        {
            deleteManager(aList);
        }
        else
        {
            if (tUserInput == 'p')
            {
                searchHashManager(aList);
            }
            else
            {
                if (tUserInput == 'n')
                {
                    // Insert search bst manager
                }
                else
                {
                    if (tUserInput == 'k')
                    {
                        // Insert list data in street number sequence
                    }
                    else
                    {
                        if (tUserInput == 'h')
                        {
                            // Insert list data in hash table sequence
                        }
                        else
                        {
                            if (tUserInput == 't')
                            {
                                // Insert print indented tree
                            }
                            else
                            {
                                if (tUserInput == 's')
                                {
                                    // Display hash statistics
                                    aList->getHashPtr()->hashStatistics();
                                }
                                else
                                {
                                    // Otherwise, display menu
                                    displayMenu();
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    
    
    return;
}// End operation manager