PlanSubcomponentPortEndpoint PSPE_Handler::sub_component_port_endpoint ( const Deployment::PlanSubcomponentPortEndpoint &src) { // @@MAJO DANCE_TRACE("PSPE_Handler::sub_component_port_endpoint - reverse"); XMLSchema::string< ACE_TCHAR > pname ( ACE_TEXT_CHAR_TO_TCHAR (src.portName)); XMLSchema::string< ACE_TCHAR > tval (ACE_TEXT ("true")); XMLSchema::string< ACE_TCHAR > prov (ACE_TEXT ("")); ACE_TString id; IDD_Handler::IDREF.find_ref(src.instanceRef, id); XMLSchema::IDREF < ACE_TCHAR > idref(id.c_str()); if (src.provider) prov = tval; IdRef idr; idr.idref (idref); PlanSubcomponentPortEndpoint pspe (pname, CCMComponentPortKind::Facet, idr); pspe.provider (prov); switch (src.kind) { case ::Deployment::Facet: pspe.kind (CCMComponentPortKind::Facet); break; case ::Deployment::SimplexReceptacle: pspe.kind (CCMComponentPortKind::SimplexReceptacle); break; case ::Deployment::MultiplexReceptacle: pspe.kind (CCMComponentPortKind::MultiplexReceptacle); break; case ::Deployment::EventEmitter: pspe.kind (CCMComponentPortKind::EventEmitter); break; case ::Deployment::EventPublisher: pspe.kind (CCMComponentPortKind::EventPublisher); break; case ::Deployment::EventConsumer: pspe.kind (CCMComponentPortKind::EventConsumer); break; default: DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, (LM_ERROR, "Invalid port kind in PSPE\n")); } return pspe; }
void daeSIDResolver::resolve() { char * str = (char *)target; char * pos = strchr( str, '/'); char * id; if ( pos == NULL ) { pos = strchr( str, '.' ); } if ( pos == NULL ) { pos = strchr( str, '(' ); } if ( pos != NULL ) { id = new char[ pos - str + 1 ]; strncpy( id, str, pos - str ); id[ pos - str ] = 0; str = pos; } else { id = new char[ strlen( str ) + 1 ]; strcpy( id, str ); str = str + strlen( str ); } if ( strcmp( id, "." ) == 0 ) { element = container; state = sid_success_element; } else { daeIDRef idref( id ); idref.setContainer( container ); idref.resolveElement(); if ( idref.getState() != daeIDRef::id_success ) { state = sid_failed_not_found; delete[] id; element = NULL; return; } element = idref.getElement(); state = sid_success_element; } char * next = NULL; while ( *str != '.' && *str != '(' && *str != 0 ) { if ( *str == '/' ) { str++; } if ( next != NULL ) { delete[] next; next = NULL; } pos = strchr( str, '/'); if ( pos == NULL ) { pos = strchr( str, '.' ); } if ( pos == NULL ) { pos = strchr( str, '(' ); } if ( pos != NULL ) { next = new char[ pos - str + 1 ]; strncpy( next, str, pos - str ); next[ pos - str ] = 0; str = pos; } else { next = new char[ strlen( str ) + 1 ]; strcpy( next, str ); str = str + strlen( str ); } //find the child element with SID of next daeElement *el = findSID( element, next ); element = el; if ( element == NULL ) { //failed state = sid_failed_not_found; if ( id != NULL ) { delete[] id; } if ( next != NULL ) { delete[] next; next = NULL; } return; } } //check for the double array if ( strcmp( element->getTypeName(), "source" ) == 0 ) { daeElementRefArray children; element->getChildren( children ); size_t cnt = children.getCount(); for ( size_t x = 0; x < cnt; x++ ) { if ( strcmp( children[x]->getTypeName(), "float_array" ) == 0 ) { doubleArray = (daeDoubleArray*)children[x]->getMeta()->getValueAttribute()->getWritableMemory( children[x] ); state = sid_success_array; break; } } } else { daeMetaAttribute *ma = element->getMeta()->getValueAttribute(); if ( ma != NULL ) { if ( ma->isArrayAttribute() && ma->getType()->getTypeEnum() == daeAtomicType::DoubleType ) { doubleArray = (daeDoubleArray*)ma->getWritableMemory( element ); state = sid_success_array; } } } if( state == sid_success_array ) { //found the double array if ( *str == '.' ) { //do the double lookup stuff based on COMMON profile offset str++; if ( strcmp( str, "ANGLE" ) == 0 ) { doublePtr = &(doubleArray->get(3)); state = sid_success_double; } else if ( strlen( str ) == 1 ) { switch ( *str ) { case 'X': case 'R': case 'U': case 'S': doublePtr = &(doubleArray->get(0)); state = sid_success_double; break; case 'Y': case 'G': case 'V': case 'T': doublePtr = &(doubleArray->get(1)); state = sid_success_double; break; case 'Z': case 'B': case 'P': doublePtr = &(doubleArray->get(2)); state = sid_success_double; break; case 'W': case 'A': case 'Q': doublePtr = &(doubleArray->get(3)); state = sid_success_double; break; }; } } else if ( *str == '(' ) { //do the double lookup stuff based on the offset given str++; pos = strchr( str, '(' ); daeInt i = atoi( str ); if ( pos != NULL && doubleArray->getCount() == 16 ) { //we are doing a matrix lookup pos++; daeInt j = atoi( pos ); doublePtr = &(doubleArray->get( i*4 + j )); state = sid_success_double; } else { //vector lookup if ( (daeInt)doubleArray->getCount() > i ) { doublePtr = &(doubleArray->get(i)); state = sid_success_double; } } } } if ( id != NULL ) { delete[] id; } if ( next != NULL ) { delete[] next; } }