Exemplo n.º 1
0
bool Fact::set_slot( const std::string & slot_name, const Values & values )
{
  DATA_OBJECT* clipsdo = value_to_data_object( m_environment, values );
  if ( !clipsdo || !m_cobj ) {
    delete clipsdo;
    return false;
  }
  bool rv = EnvPutFactSlot( m_environment.cobj(),
			    m_cobj,
			    const_cast<char*>(slot_name.c_str()),
			    clipsdo);
  delete clipsdo;
  return rv;
}
Exemplo n.º 2
0
void *entryPoint(void * m_theEnv)
{
	void *newFact;
	void *templatePtr;
	void *theMultifield;
	DATA_OBJECT theValue;
	char *templatename = "InputSource";


	/* Create the fact. */
	/*==================*/
	templatePtr = EnvFindDeftemplate(m_theEnv,templatename);
	newFact = EnvCreateFact(m_theEnv,templatePtr);
	if (newFact == NULL) return 0;
	

	theValue.type = INTEGER;
	theValue.value = EnvAddLong(m_theEnv,100);		
	EnvPutFactSlot(m_theEnv,newFact,"speed",&theValue);
	
	theValue.type = FLOAT;
	theValue.value = EnvAddDouble(m_theEnv,1.0);
	EnvPutFactSlot(m_theEnv,newFact,"astatus",&theValue);
	
	theValue.type = INTEGER;
	theValue.value = EnvAddLong(m_theEnv,2);		
	EnvPutFactSlot(m_theEnv,newFact,"rclass",&theValue);
	
	theValue.type = INTEGER;
	theValue.value = EnvAddLong(m_theEnv,10000);		
	EnvPutFactSlot(m_theEnv,newFact,"distance",&theValue);
	
	EnvAssignFactSlotDefaults(m_theEnv,newFact);
	EnvAssert(m_theEnv,newFact);
	return newFact;
	
}