Example #1
0
void freeModel(_md)
{
	size_t predNum, funcNum, axNum, taskNum,
		   factNum, restrNum, typeNum, srcNum, errNum;

	freeServData(modelPtr);

	/* Predicates */
	forVect(predNum, preds_m)
		freeFunc(getPredPtr(predNum));
	
	/* Functions */
	forVect(funcNum, funcs_m)
		freeFunc(getFuncPtr(funcNum));
		
	/* Axioms */
	forVect(axNum, axioms_m)
		freeAxiom(getAxPtr(axNum));

	/* Tasks */
	forVect(taskNum, taskPtrs_m)
		freeTask(getTaskPtr(taskNum));

	/* Temp Facts */
	forVect(factNum, tmpFacts_m)
		freeFact(ptr(Fact, tmpFacts_m) + factNum);

	/* Restrictions */
	forVect(restrNum, restrs_m)
		freeRestriction(getRestrPtr(restrNum));

	/* DataTypes */
	forVect(typeNum, types_m)
		freeDataType(getTypePtr(typeNum));

	/* Sources */
	forVect(srcNum, modelPtr->sources)
		freeSource(ptr(Source, modelPtr->sources) + srcNum);
	
	/* Errors */
	forVect(errNum, modelPtr->errors)
		freeError(ptr(Error, modelPtr->errors) + errNum);

	/* Vectors */
	freeVect(preds_m);
	freeVect(funcs_m);
	freeVect(axioms_m);
	freeVect(taskPtrs_m);
	freeVect(tmpFacts_m)
	freeVect(restrs_m); 
	freeVect(types_m);
	freeVect(modelPtr->errors);
	freeVect(modelPtr->sources);
}
Example #2
0
Registry *
Registry::getFactoryPtr(
  const NamePair &      name_pair) const
{
  Registry *creator_function = (Registry *) getFuncPtr(name_pair);
  if (creator_function)
    return creator_function;
  else {
    std::ostringstream strout;
    strout << "Registry does not contain function with signature " << demangle(name_pair.first->name())
           << " and derived name '" << name_pair.second << "'";
    throw std::invalid_argument(strout.str());
  }
}
Example #3
0
void *
Registry::getFunctionPtr(
  const NamePair &      name_pair) const
{
  void *creator_function = getFuncPtr(name_pair);
  if (creator_function)
    return creator_function;
  else {
    std::ostringstream strout;
    strout << "User subroutine " << name_pair.second << "\n"
           << " with signature " << demangle(name_pair.first->name()) << "\n"
           << " not found in registry";
    throw std::invalid_argument(strout.str());
  }
}
Example #4
0
void *
Registry::getPluginPtr(
  const KeyPair &      key_pair) const
{
  void *creator_function = getFuncPtr(key_pair);
  if (creator_function)
    return creator_function;
  else {
    std::ostringstream strout;

    strout << "User plugin creator function with base class '" << demangle(name_pair.first->name())
           << "' and derived class name '" << name_pair.second
           << "' not found in registry";
    throw std::invalid_argument(strout.str());
  }
}
Example #5
0
int main(void)
{
	getFuncPtr()();
	return 0;
}