Esempio n. 1
0
/** Looks recursively upwards in the component tree for the first instance of a
* component with a matching type.
* @param comp :: The component to start the search with
* @param type :: Parameter type
* @returns the first matching parameter.
*/
Parameter_sptr ParameterMap::getRecursiveByType(const IComponent *comp,
                                                const std::string &type) const {
  boost::shared_ptr<const IComponent> compInFocus(comp, NoDeleting());
  while (compInFocus != NULL) {
    Parameter_sptr param = getByType(compInFocus.get(), type);
    if (param) {
      return param;
    }
    compInFocus = compInFocus->getParent();
  }
  // Nothing was found!
  return Parameter_sptr();
}
Esempio n. 2
0
Trait *Trait::get( Reader *r, int end, Context *ctx ) {
	int type = r->getNBitInt( 4 );
	int len = end - r->getPosition();
	
	Trait* ret = getByType( type );

	if( !ret ) {
		ret = handleError( type );
	}

	if( ret ) {
		ret->setType( type );
		ret->setLength( len );
		ret->parse( r, end, ctx );
	} 

	return ret;
}	
Esempio n. 3
0
Action *Action::get( Reader *r, int end, Context *ctx ) {
	uint16_t h = r->getByte();
	int type = h;
	int len = 0;
	if( type >= 0x80 ) {
		len = r->getWord();
	}
	
	if( type == 0 ) return( new EndAction ); // terminator
	
	Action *ret = getByType( type );
	
//	printf("ACTION %02X len %i: %p\n", type, len, ret );

	if( !ret ) {
		ret = new UnknownAction;
	}

	ret->setType( type );
	ret->setLength( len );
	ret->parse( r, r->getPosition()+len, ctx );
	
	return ret;
}