// Accessor function encapsulating the static shadersystem instance
shaders::Doom3ShaderSystemPtr GetShaderSystem() {
	// Acquire the moduleptr from the module registry
	RegisterableModulePtr modulePtr(module::GlobalModuleRegistry().getModule(MODULE_SHADERSYSTEM));

	// static_cast it onto our shadersystem type
	return boost::static_pointer_cast<shaders::Doom3ShaderSystem>(modulePtr);
}
/* Read in ModuleInfo from an .ini file
*/
void CTe_LbsIniFileReader::ReadModuleInfoL(TPositionModuleInfo& aModuleInfo)
{
    TInt    intValue;
    TBool    success;

    // Technology-type - this is a binary bitmap.
    FindVar(KTechnologyTypeStr, intValue);
    TPositionModuleInfo::TTechnologyType technologyType = DecimalToBitmask(intValue);
    aModuleInfo.SetTechnologyType(technologyType);

    // Classes Supported - this is a binary bitmap, but support for each class
    // has to be set individually.
    FindVar(KClassesSupportedStr, intValue);
    TInt supportedClasses = DecimalToBitmask(intValue);

    TPositionClassFamily currentClass = EPositionInfoFamily;
    while(currentClass <= EPositionUpdateOptionsFamily)
    {
        aModuleInfo.SetClassesSupported(currentClass, supportedClasses & 1);
        supportedClasses >>= 1;
        currentClass = static_cast<TPositionClassFamily>(static_cast<TInt>(currentClass) + 1);
    }

    // Capabilities - this is a binary bitmap.
    FindVar(KCapabilitiesStr, intValue);
    TPositionModuleInfo::TCapabilities capabilities = DecimalToBitmask(intValue);
    aModuleInfo.SetCapabilities(capabilities);

    // Module Name
    TUint16* buffer = new (ELeave) TUint16[KPositionModuleMaxNameLength];
    CleanupStack::PushL(buffer);

    TPtrC16 modulePtr(reinterpret_cast<const TUint16*>(buffer),KPositionModuleMaxNameLength);
    success = FindVar(KModuleNameStr, modulePtr);

    TBuf<KPositionModuleMaxNameLength> moduleName;
    if(success)
    {
        moduleName.Copy(modulePtr);
    }
    else
    {
        moduleName.Copy(KNullDesC);
    }
    // Get rid of any delimiting " characters.
    TInt length = moduleName.Length();
    if(length > 0)
    {
        TInt lastPos = length - 1;
        TChar quote('\"');
        if(moduleName[lastPos] == quote)
        {
            moduleName.Delete(lastPos, 1);
        }
        if(modulePtr[0] == quote)
        {
            moduleName.Delete(0, 1);
        }
    }
    aModuleInfo.SetModuleName(moduleName);
    CleanupStack::PopAndDestroy(buffer);

    // Module Id
    TUid moduleUid = TUid::Uid(0);
    FindVar(KModuleIdStr,intValue);
    if(intValue>0)
    {
        moduleUid = (TUid::Uid(intValue));
    }
    aModuleInfo.SetModuleId(moduleUid);

    // Module Version
    TVersion version(0,0,0);
    FindVar(KVersionStr,version);
    aModuleInfo.SetVersion(version);

    // Device Location
    TPositionModuleInfo::TDeviceLocation deviceLocation;
    FindVar(KDeviceLocationStr,intValue);
    switch(intValue)
    {
    case 1:
        deviceLocation = TPositionModuleInfo::EDeviceInternal;
        break;
    case 2:
        deviceLocation = TPositionModuleInfo::EDeviceExternal;
        break;
    default:
        deviceLocation = TPositionModuleInfo::EDeviceUnknown;
        break;
    }
    aModuleInfo.SetDeviceLocation(deviceLocation);

    // IsAvailable - to be read from .ini file but for now ...
    aModuleInfo.SetIsAvailable(ETrue);

}