Esempio n. 1
0
ProgramValue::ProgramValue (std::string name, std::string type,std::string context,std::string valueof, int id, bool inSpecML) : m_Cardinality (0)
{
	int attr;
	nau::Enums::DataType dt;
	m_Values = NULL;
//	m_IntValue = NULL;
	m_InSpecML = inSpecML;
	m_TypeString = type;

	m_Name = name;
	m_Context = context;
	m_Id = id;
	std::string what;

	//if (type == "CURRENT")
	//	what = context;
	//else
		what = type;

	AttribSet *attrSet = NAU->getAttribs(what);
	if (attrSet == NULL)
		NAU_THROW("Exception creating a program value. name=%s, type=%s, context=%s, component=%s, int=%d", name.c_str(), type.c_str(), context.c_str(), valueof.c_str(), id);
	
	attrSet->getPropTypeAndId(valueof, &dt, &attr);
	m_ValueOf = attr;
	m_ValueType = dt;
	m_Cardinality = Enums::getCardinality(dt);
	void *def = attrSet->getDefault(attr, dt);
	if (def != NULL)
		m_Values = def;
	else
		m_Values = (void *)malloc(Enums::getSize(dt));
}
Esempio n. 2
0
ProgramBlockValue::ProgramBlockValue (std::string name, std::string block, std::string type, std::string context,std::string valueof, int id, bool inSpecML) : m_Cardinality (0) {

	IUniformBlock *aBlock = UNIFORMBLOCKMANAGER->getBlock(name);
	//if (aBlock == NULL) {
	//	NAU_THROW("Uniform Block %s is not defined", block.c_str());
	//}
	//if (!aBlock->hasUniform(name))
	//	NAU_THROW("Uniform Block %s does not hava a uniform named %s", block.c_str(), name.c_str());

	//if (!aBlock->getUniformType(name) != Enums::getType(type))
	//	NAU_THROW("Uniform Block %s, uniform %s - type does not match", block.c_str(), name.c_str());

	int attr;
	nau::Enums::DataType dt;
	m_InSpecML = inSpecML;
	m_TypeString = type;

	m_Name = name;
	m_Block = block;
	m_Context = context;
	m_Id = id;
	std::string what;

	//if (type == "CURRENT")
	//	what = context;
	//else
		what = type;

	AttribSet *attrSet = NAU->getAttribs(what);
	if (attrSet == NULL)
		NAU_THROW("Exception creating a program value. name=%s, type=%s, context=%s, component=%s, int=%d", name.c_str(), type.c_str(), context.c_str(), valueof.c_str(), id);
	
	attrSet->getPropTypeAndId(valueof, &dt, &attr);
	m_ValueOf = attr;
	m_ValueType = dt;
	m_Cardinality = Enums::getCardinality(dt);
	void *def = attrSet->getDefault(attr, dt);
	if (def != NULL)
		m_Values = def;
	else
		m_Values = (void *)malloc(Enums::getSize(dt));
}