Assets.c++ 1.45 KB
/*****************************************************************************
 *  File:  Assets.c++ 
 *
 *  General AEAsset Class Implementations
 *
 ****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>

#include "Assets.h"

/*****************************************************************************
 *
 *   Initialization Routines
 * 
 ****************************************************************************/
AEAsset::AEAsset()
{
    refList = new RefList;
    assert(refList);

    hdwrXRef = 0;
    name = 0;
    AssetMgrNode = 0;
}

AEAsset::~AEAsset()
{
    delete refList;
    if(name)
        free(name);
}


/*****************************************************************************
 *
 *    Asset's Methods
 *
 ****************************************************************************/

void AEAsset::SetName(char *n)
{
    name = (char*)malloc(strlen(n));
    assert(name);
    strcpy(name,n);
}

char* AEAsset::GetName(void)
{
    return name;
}

void AEAsset::AddReference(AEAsset *asset)
{
    refList->Append(asset);
}

void AEAsset::RemoveReference(AEAsset *asset)
{
    refList->RemoveByData(asset);
}

int AEAsset::GetRefCt(void)
{
    return refList->count;
}


void AEAsset::SetHdwrXRef(void *ref)
{
    hdwrXRef = ref;
}

void* AEAsset::GetHdwrXRef(void)
{
    return hdwrXRef;
}
       
int AEAsset::GetClass(void)
{
    return classType;
}