Exemplo n.º 1
0
    Property* Property::Create(const char* typeName, const char* fullName, bool bIsStatic, const char* arrayIndexStr)
    {
        BEHAVIAC_UNUSED_VAR(bIsStatic);
        char instanceName[kInstanceLength];
        char agentType[kInstanceLength];
        const char* variableName = ParseInstanceNameProperty(fullName, instanceName, agentType);

        Property*  pProperty = AgentProperties::GetProperty(agentType, variableName);

        if (pProperty != 0)
        {
            BEHAVIAC_ASSERT(pProperty != 0);

            if (strcmp(pProperty->GetInstanceName(), instanceName) != 0)
            {
                //Properties().insert(std::pair<Property*, bool>(pProperty, true));
                BEHAVIAC_ASSERT(strcmp(pProperty->Name(), variableName) == 0);

				Property* pNew = pProperty->clone();
				pNew->SetInstanceName(instanceName);

				pProperty = pNew;

				AgentProperties::AddPropertyInstance(agentType, pNew);
            }
            else
            {
            }


            BEHAVIAC_ASSERT(pProperty->m_bIsStatic == bIsStatic);

            if (arrayIndexStr)
            {
                Property*  vectorAccessor = pProperty->CreateElelmentAccessor(arrayIndexStr);

                return vectorAccessor;
            }
        }
        else
        {
            //BEHAVIAC_ASSERT(false, "accessing a not declared local variable");
            const char* valueStr = 0;
            pProperty = AgentProperties::AddLocal(agentType, typeName, variableName, valueStr);
        }

        return pProperty;
    }