void CPropFunction::FillDialog()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

    SetFileName();
    string buf;
    ReadFileContent(CString(m_ProjectPath) + _T("\\") + m_sFileName, buf);
    m_FunctionText = buf.c_str();
    m_Function = (Function *)ParsePou(m_FunctionText, m_Function);
    InitFromFile(m_Function);
    COperation::FillDialog();
    GetDialog()->SetCreateUser(m_sCreateUser);
    GetDialog()->SetCreateDate(m_sCreateDate);
    GetDialog()->SetLastModUser(m_sLastModUser);
    GetDialog()->SetLastModDate(m_sLastModDate);
    GetDialog()->SetAlias(m_sAlias);
    GetDialog()->SetName(m_sName);
    GetDialog()->SetText1(m_sUsrText[0]);
	GetDialog()->SetText2(m_sUsrText[1]);
	GetDialog()->SetText3(m_sUsrText[2]);
	GetDialog()->SetHelpUrl(m_sHelpUrl);
	GetDialog()->SetUrl(m_sUrl);

    GetDialog()->SetMembers(m_pMembers);
    m_pMembers = NULL;

    GetDialog()->SetReturnType(m_sFunctionType);
}
	GLTexture::GLTexture(const UString& filePath, GLenum target /* = GL_TEXTURE_2D */)
	{
		m_width = 0;
		m_height = 0;
		m_target = target;

		ErrCode error = InitFromFile(filePath);
		if (CheckError(error)) {
			DebugPrintF(VTEXT("Texture failed to initialize"));
		}
	}
Exemplo n.º 3
0
void LearnableParameter<ElemType>::ReviseFromFile(const std::wstring& reviseFromFilePath)
{
    try
    {
        InitFromFile(reviseFromFilePath);
    }
    catch (const std::exception & e)
    {
        RuntimeError("ReviseFromFile: Failed to reload %ls %ls operation from file %ls: %s", NodeName().c_str(), OperationName().c_str(), reviseFromFilePath.c_str(), e.what());
    }
}
Exemplo n.º 4
0
// Constructor: builds a Grammar from given file, or empty gram if no file
AGram::AGram(const string& name, const string& fname):AResource(name)
{
   ConfParam *cParm[MAXGLOBS];       /* config parameters */
   int numParm,i;
   char buf[100];

   main = NULL; isOpen = TRUE;
   // Read configuration file
   strcpy(buf,name.c_str());
   for (i=0; i<int(strlen(buf)); i++) buf[i] = toupper(buf[i]);
   numParm = GetConfig(buf, TRUE, cParm, MAXGLOBS);
   if (numParm>0){
      if (GetConfInt(cParm,numParm,"TRACE",&i)) trace = i;
   }
   if (fname!="") InitFromFile(fname.c_str());
   isOpen = FALSE;
}
Exemplo n.º 5
0
// Constructor: builds a Grammar from name:info in the config file
AGram::AGram(const string& name):AResource(name)
{
   ConfParam *cParm[MAXGLOBS];       /* config parameters */
   int numParm,i;
   char buf[100],buf1[100],gramFN[100];

   main = NULL; isOpen = TRUE; gramFN[0] = '\0';
   // Read configuration file
   strcpy(buf,name.c_str());
   for (i=0; i<int(strlen(buf)); i++) buf[i] = toupper(buf[i]);
   numParm = GetConfig(buf, TRUE, cParm, MAXGLOBS);
   if (numParm>0){
      if (GetConfInt(cParm,numParm,"TRACE",&i)) trace = i;
      if (GetConfStr(cParm,numParm,"GRAMFILE",buf1)) strcpy(gramFN,buf1);
   }
   if (gramFN[0] != '\0') InitFromFile(gramFN);
   isOpen = FALSE;
}
/**
 * Function name			CInsertConstant::FillDialog
 * Description			
 * @return			void 
 * @exception			
 * @see			
*/
void CInsertConstant::FillDialog()
{
    SetFileName();
    ParseConstFile();
    if(!m_pConstList)
    {
        return;
    }
    InitFromFile(m_pConstList);
    //Standart name
    CString strName = _T("Const");
    strName = GetNameProposal(strName);
    
    GetDialog()->SetCreateUser(m_sCreateUser);
    GetDialog()->SetCreateDate(m_sCreateDate);
    GetDialog()->SetLastModUser(m_sLastModUser);
    GetDialog()->SetLastModDate(m_sLastModDate);
    
    GetDialog()->SetName(strName);
}
Exemplo n.º 7
0
LearnableParameter<ElemType>::LearnableParameter(const ScriptableObjects::IConfigRecordPtr configp) :
    LearnableParameter(configp->Get(L"deviceId"), L"<placeholder>", configp->Get(L"shape"))
{
    // TODO: Change dimensions to take a generic tensor instead. That will be a (minor) breaking change that will require fix-ups when converting from NDL to BrainScript.
    AttachInputsFromConfig(configp, this->GetExpectedNumInputs());
    // parameters[rows, [cols=1]] plus other optional parameters (learningRateMultiplier=[1|0|float], init=[uniform|gaussian|fixedvalue], initValueScale=[1|float], value=[0|float])
    if (configp->Exists(L"learningRateMultiplier"))
        SetLearningRateMultiplier(configp->Get(L"learningRateMultiplier"));
    else if (configp->Exists(L"needsGradient") || configp->Exists(L"needGradient") || configp->Exists(L"computeGradient"))
        InvalidArgument("Deprecated parameter names needsGradient|needGradient|computeGradient are not supported in BrainScript. Use learningRateMultiplier instead.");

    wstring initString = configp->Get(L"init");
    if (initString == L"fixedValue")
        Value().SetValue((ElemType) configp->Get(L"value"));
    else if (initString == L"uniform" || initString == L"gaussian")
    {
        // TODO: add these options also to old NDL
        static unsigned long randomSeed = 1;
        int forcedRandomSeed = configp->Get(L"randomSeed"); // forcing a specific random seed is useful for testing to get repeatable initialization independent of evaluation order
        InitRandom((initString == L"uniform"), forcedRandomSeed < 0 ? randomSeed++ : (unsigned long) forcedRandomSeed, configp->Get(L"initValueScale"), configp->Get(L"initOnCPUOnly"));
    }
    else if (initString == L"fromFile")
    {
        wstring initFromFilePath = configp->Get(L"initFromFilePath");
        if (initFromFilePath.empty())
            RuntimeError("initFromFilePath parameter must be provided when using \"fromFile\" initialization method");
        InitFromFile(initFromFilePath);
    }
    else if (initString == L"fromLiteral")
    {
        wstring initFromLiteral = configp->Get(L"initFromLiteral");
        if (initFromLiteral.empty())
            RuntimeError("initFromLiteral parameter must be provided when using \"fromLiteral\" initialization method");
        size_t numRows, numCols;
        auto array = File::LoadMatrixFromStringLiteral<ElemType>(msra::strfun::utf8(initFromLiteral), numRows, numCols);
        InitFromArray(array, numRows, numCols);
    }
    else
        RuntimeError("init must be one of the values of [ uniform | gaussian | fixedValue | fromFile ]");
}
/**
 * Function name			CInsertConstant::Execute
 * Description			
 * @return			void 
 * @exception			
 * @see			
*/
BOOL CInsertConstant::Execute()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

    Init();
    SetFileName();
    ParseConstFile();
    InitFromFile(m_pConstList);
    if(DoesConstExist(m_Const.GetObjName()))
    {
        return FALSE;
    }
    InsertConst();
    CString ConstFileText = CString(m_ConstFileText.c_str());
    WriteFile(ConstFileText);
    InformProjectManager();
    
    m_ConstFileText.empty();
    m_aVarList.RemoveAll();
    ConstFileText.Empty();
    return TRUE;
}
Exemplo n.º 9
0
void CPropTask::FillDialog()
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

    SetFileName();
    string buf;
    ReadFileContent(CString(m_ProjectPath) + _T("\\") + m_sFileName, buf);
    m_ResourceText = buf.c_str();
    m_sName = GetNameFromId();
    ASSERT(!m_ResourceText.IsEmpty());
    m_Resource = (Resource *)ParsePou(m_ResourceText, m_Resource);
    InitFromFile(m_Resource);
    if(!m_bAutomationMode)
    {
        COperation::FillDialog();
        GetDialog()->SetCreateUser(m_sCreateUser);
        GetDialog()->SetCreateDate(m_sCreateDate);
        GetDialog()->SetLastModUser(m_sLastModUser);
        GetDialog()->SetLastModDate(m_sLastModDate);
        GetDialog()->SetAlias(m_sAlias);
        GetDialog()->SetName(m_sName);
        GetDialog()->SetText1(m_sUsrText[0]);
	    GetDialog()->SetText2(m_sUsrText[1]);
	    GetDialog()->SetText3(m_sUsrText[2]);
	    GetDialog()->SetHelpUrl(m_sHelpUrl);
	    GetDialog()->SetUrl(m_sUrl);
        BOOL bAutoStart = IsAutoStart();
        GetDialog()->SetAutoStart(bAutoStart);
		GetDialog()->SetLoaded(IsLoaded());		// NFTASKHANDLING 19.05.05 SIS
        GetDialog()->SetInterval(m_sInterval);
        GetDialog()->SetIoSync(m_sIOSync);
        GetDialog()->SetPriority(m_sPriority);
        GetDialog()->SetEventString(m_sEvent);
        GetDialog()->SetWatchdog(m_sWatchdog);
    }
}
Exemplo n.º 10
0
IntegerTree::IntegerTree(string filename) {
  InitFromFile(filename);
}
Exemplo n.º 11
0
 Texture2D::Texture2D(const char *file, bool mipmaps, TextureType type)
     : Texture(GL_TEXTURE_2D)
 {
     InitFromFile(Target(), file, mipmaps, type);
 }
Exemplo n.º 12
0
 void Texture2D::Init(const char *file, bool mipmaps, TextureType type)
 {
     InitFromFile(Target(), file, mipmaps, type);
 }
Exemplo n.º 13
0
 NullPrivateKey::NullPrivateKey(const QString &filename)
 {
   _valid = InitFromFile(filename) && _private;
 }
Exemplo n.º 14
0
 NullPublicKey::NullPublicKey(const QString &filename)
 {
   _valid = InitFromFile(filename) && !_private;
 }