int getClassId(void* ptrObj)
{
    if (ptrObj == NULL)
        return 0;
    else
        return ((MgObject*)ptrObj)->GetClassId();
}