예제 #1
0
void MindRegionDef::createFromXml( Xml xml ) {
	// attributes are properties
	id = xml.getAttribute( "id" );
	Object::setInstance( id );

	logger.logDebug( "define region id=" + id + "..." );

	typeName = xml.getAttribute( "type" );
	serviceName = xml.getAttribute( "service" );
	size = xml.getIntAttribute( "size" , 0 );

	String roleName = xml.getAttribute( "role" );

	if( roleName.equals( "processor" ) )
		role = MIND_REGION_ROLE_PROCESSOR;
	else if( roleName.equals( "relay" ) )
		role = MIND_REGION_ROLE_RELAY;
	else if( roleName.equals( "sensory" ) )
		role = MIND_REGION_ROLE_SENSORY;
	else if( roleName.equals( "sympathetic" ) )
		role = MIND_REGION_ROLE_SYMPATHETIC;
	else if( roleName.equals( "parasympathetic" ) )
		role = MIND_REGION_ROLE_PARASYMPATHETIC;
	else if( roleName.equals( "flexor" ) )
		role = MIND_REGION_ROLE_FLEXOR;
	else if( roleName.equals( "extensor" ) )
		role = MIND_REGION_ROLE_EXTENSOR;
	else
		ASSERTFAILED( "Invalid role of region id=" + id + ", role=" + roleName );
}
예제 #2
0
void TargetRegionDef::defineEffectorRegion( Xml xml ) {
	MindRegionDef::id = xml.getAttribute( "id" );
	MindRegionDef::target = true;
	MindRegionDef::sensor = false;

	Object::setInstance( MindRegionDef::id );

	MindRegionDef::role = MIND_REGION_ROLE_TARGETEFFECTOR;
	MindRegionDef::size = xml.getIntAttribute( "size" , 0 );

	// region type for effector is the same as region itself
	TargetRegionTypeDef *regionTypeInfo = new TargetRegionTypeDef();
	regionTypeInfo -> defineEffectorRegionType( this , xml );
	MindRegionDef::type = regionTypeInfo;
	MindRegionDef::typeName = regionTypeInfo -> getName();
	MindRegionDef::serviceName = xml.getAttribute( "service" );
}