int sc_main(int argc, char** argv) { Initiator1 initInst1("myInitiator1"); Initiator2 initInst2("myInitiator2"); Target targetInst1("myTarget1"); Target targetInst2("myTarget2"); //initInst.out_signal_port(targetInst.in_signal_port); gs::gp::GenericSignalBus<32> sb("signalbus"); //gs_generic_signal::genericSignalBus sb("signalBus"); initInst1.out_signal_port(sb.target_socket); initInst2.out_signal_port(sb.target_socket); sb.init_socket(targetInst1.in_signal_port); sb.init_socket(targetInst2.in_signal_port); //targetInst1.in_signal_port.set_source<GATE>(initInst1.out_signal_port.name()); targetInst2.in_signal_port.set_source<GATE>(initInst2.out_signal_port.name()); std::string srcName("myInitiator.outPort"); //targetInst1.in_signal_port.set_source(srcName); //targetInst2.in_signal_port.set_source(srcName); sc_start(11, SC_NS); return 0; }
void filestuff::copyDir(QString src, QString dest) { exMake(dest); QDir srcDir(src); QDir destDir(dest); QStringList srcList(srcDir.entryList(QDir::Files)); for (int i = 0; i < srcList.count(); i++){ QString srcName(src + "/" + srcList[i]); QString destName(dest + "/" + srcList[i]); QFile::copy(srcName, destName); } srcList.clear(); srcList = srcDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot); for (int i = 0; i < srcList.count(); i++){ QString srcName(src + "/" + srcList[i]); QString destName(dest + "/" + srcList[i]); copyDir(srcName, destName); } }
MediaSourcePrivate::AddStatus PlaybackPipeline::addSourceBuffer(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate) { WebKitMediaSrcPrivate* priv = m_webKitMediaSrc->priv; if (priv->allTracksConfigured) { GST_ERROR_OBJECT(m_webKitMediaSrc.get(), "Adding new source buffers after first data not supported yet"); return MediaSourcePrivate::NotSupported; } GST_DEBUG_OBJECT(m_webKitMediaSrc.get(), "State %d", (int)GST_STATE(m_webKitMediaSrc.get())); GST_OBJECT_LOCK(m_webKitMediaSrc.get()); guint numberOfStreams = g_list_length(priv->streams); GST_OBJECT_UNLOCK(m_webKitMediaSrc.get()); Stream* stream = g_new0(Stream, 1); GUniquePtr<gchar> srcName(g_strdup_printf("src%u", numberOfStreams)); GUniquePtr<gchar> typefindName(g_strdup_printf("typefind%u", numberOfStreams)); stream->parent = m_webKitMediaSrc.get(); stream->appsrc = gst_element_factory_make("appsrc", srcName.get()); stream->appSrcNeedDataFlag = false; stream->sourceBuffer = sourceBufferPrivate.get(); // No track has been attached yet. stream->type = Invalid; stream->parser = nullptr; stream->caps = nullptr; #if ENABLE(VIDEO_TRACK) stream->audioTrack = nullptr; stream->videoTrack = nullptr; #endif stream->presentationSize = WebCore::FloatSize(); gst_app_src_set_callbacks(GST_APP_SRC(stream->appsrc), &appsrcCallbacks, stream->parent, 0); gst_app_src_set_emit_signals(GST_APP_SRC(stream->appsrc), FALSE); gst_app_src_set_stream_type(GST_APP_SRC(stream->appsrc), GST_APP_STREAM_TYPE_SEEKABLE); GST_OBJECT_LOCK(m_webKitMediaSrc.get()); priv->streams = g_list_prepend(priv->streams, stream); GST_OBJECT_UNLOCK(m_webKitMediaSrc.get()); gst_bin_add(GST_BIN(m_webKitMediaSrc.get()), stream->appsrc); gst_element_sync_state_with_parent(stream->appsrc); return MediaSourcePrivate::Ok; }
void CmdUpdateItem::execute() { playlist_t *pPlaylist = getIntf()->p_sys->p_playlist; if( pPlaylist == NULL ) return; input_thread_t *p_input = playlist_CurrentInput( pPlaylist ); if( !p_input ) return; // Get playlist item information input_item_t *pItem = input_GetItem( p_input ); char *pszName = input_item_GetName( pItem ); char *pszUri = input_item_GetURI( pItem ); string name = pszName; // XXX: This should be done in VLC core, not here... // Remove path information if any OSFactory *pFactory = OSFactory::instance( getIntf() ); string::size_type pos = name.rfind( pFactory->getDirSeparator() ); if( pos != string::npos ) { name = name.substr( pos + 1, name.size() - pos + 1 ); } UString srcName( getIntf(), name.c_str() ); UString srcURI( getIntf(), pszUri ); free( pszName ); free( pszUri ); // Create commands to update the stream variables CmdSetText *pCmd1 = new CmdSetText( getIntf(), m_rStreamName, srcName ); CmdSetText *pCmd2 = new CmdSetText( getIntf(), m_rStreamURI, srcURI ); // Push the commands in the asynchronous command queue AsyncQueue *pQueue = AsyncQueue::instance( getIntf() ); pQueue->push( CmdGenericPtr( pCmd1 ), false ); pQueue->push( CmdGenericPtr( pCmd2 ), false ); vlc_object_release( p_input ); }
void QvisDatabaseCorrelationWindow::actionClicked() { std::string name; stringVector dbs; int method = correlationMethodComboBox->currentIndex(); // // Get the name from the line edit. // name = correlationNameLineEdit->displayText().trimmed().toStdString(); // // If we're creating a new correlation, check the name in the line edit. // if(createMode) { if(name.size() < 1) { Warning(tr("A new database correlation must have a name.")); correlationNameLineEdit->activateWindow(); correlationNameLineEdit->setFocus(); correlationNameLineEdit->setSelection(0, correlationNameLineEdit->displayText().length()); return; } else { // See if the name is already used. DatabaseCorrelationList *cL = GetViewerState()->GetDatabaseCorrelationList(); if(cL->FindCorrelation(name)) { Warning(tr("The given database correlation name is already " "being used. Please change the name of this " "correlation.")); correlationNameLineEdit->activateWindow(); correlationNameLineEdit->setFocus(); correlationNameLineEdit->setSelection(0, correlationNameLineEdit->displayText().length()); return; } } } // // Simplify the current source names. // NameSimplifier simplifier; const stringVector &sources = GetViewerState()->GetGlobalAttributes()->GetSources(); int i; for(i = 0; i < sources.size(); ++i) simplifier.AddName(sources[i]); stringVector shortSources; simplifier.GetSimplifiedNames(shortSources); std::map<std::string, std::string> shortToLong; for(i = 0; i < sources.size(); ++i) shortToLong[shortSources[i]] = sources[i]; // Get the sources from the correlated source list. for(i = 0; i < correlatedSourcesListBox->count(); ++i) { std::string srcName(correlatedSourcesListBox->item(i)->text().toStdString()); dbs.push_back(shortToLong[srcName]); } if(dbs.size() < 1) { QString msg; QString s1(tr("A database correlation must have at least one correlated " "source.")); QString s2(tr("You must add a correlated source before you can create " "this database correlation.")); QString s3(tr("You must add a correlated source before you can alter " "this database correlation.")); msg = s1 + (createMode ? s2 : s3); Warning(msg); } // // Do the right thing in the viewer. // if(createMode) { GetViewerMethods()->CreateDatabaseCorrelation(name, dbs, method); } else { GetViewerMethods()->AlterDatabaseCorrelation(name, dbs, method); } cancelClicked(); }
/*! \brief Config file parser * \param gobConf Config file to parse * \param stk STK/ITK archive file to be created * \param chunkCount Number of chunks to be written in the archive file * \return A list of chunks * * This function reads the '.gob' config file (generated by extract_gob_stk). * It creates the output archive file and a list of chunks containing the file * and compression information. * In order to have a slightly better compression ration in some cases (Playtoons), it * also detects duplicate files. */ CompressGob::Chunk *CompressGob::readChunkConf(Common::File &gobConf, Common::Filename &stkName, uint16 &chunkCount) { Chunk *chunks = new Chunk; Chunk *curChunk = chunks; Chunk *parseChunk; Common::File src1; Common::Filename srcName(""); char buffer[1024]; chunkCount = 1; // First read: Output filename gobConf.scanString(buffer); stkName.setFullName(buffer); srcName.setFullPath(stkName.getPath()); // Second read: signature gobConf.scanString(buffer); std::string signature(buffer); if (signature == confSTK21) error("STK21 not yet handled"); else if (signature != confSTK10) error("Unknown format signature %s", signature.c_str()); print("Checking duplicate files"); // All the other reads concern file + compression flag gobConf.scanString(buffer); while (!gobConf.eos()) { strcpy(curChunk->name, buffer); srcName.setFullName(buffer); gobConf.scanString(buffer); if ((strcmp(buffer, "1") == 0 )|| (_execMode & MODE_FORCE)) curChunk->packed = true; else curChunk->packed = false; src1.open(srcName, "rb"); src1.seek(0, SEEK_END); // if file is too small, force 'Store' method if ((curChunk->realSize = src1.pos()) < 8) curChunk->packed = 0; parseChunk = chunks; while (parseChunk != curChunk) { if ((parseChunk->realSize == curChunk->realSize) & (parseChunk->packed != 2)) { if (strcmp(parseChunk->name, curChunk->name) == 0) error("Duplicate filename found in conf file: %s", parseChunk->name); srcName.setFullName(parseChunk->name); if (filcmp(src1, srcName)) { // If files are identical, use the same compressed chunk instead of re-compressing the same thing curChunk->packed = 2; curChunk->replChunk = parseChunk; print("Identical files : %s %s (%d bytes)", curChunk->name, parseChunk->name, curChunk->realSize); break; } } parseChunk = parseChunk->next; } src1.close(); gobConf.scanString(buffer); if (!gobConf.eos()) { curChunk->next = new Chunk; curChunk = curChunk->next; chunkCount++; } } return chunks; }
// //------------------------------------------------------------------------------ bool BFFParser::StoreVariableToVariable( const char * varNameDstStart, const char * varNameDstEnd, const BFFIterator & varNameSrcStart, const BFFIterator & varNameSrcEnd, const BFFIterator & operatorIter ) { // find vars AStackString<> dstName( varNameDstStart, varNameDstEnd ); AStackString<> srcName( varNameSrcStart.GetCurrent(), varNameSrcEnd.GetCurrent() ); const BFFVariable * varDst = BFFStackFrame::GetVar( dstName ); const BFFVariable * varSrc = BFFStackFrame::GetVar( srcName ); // src var unknown? if ( varSrc == nullptr ) { Error::Error_1009_UnknownVariable( varNameSrcStart, nullptr ); return false; } const bool concat = ( *operatorIter == BFF_VARIABLE_CONCATENATION ); // concatenation? if ( concat ) { // can only concatenate to existing vars if ( varDst == nullptr ) { Error::Error_1026_VariableNotFoundForConcatenation( operatorIter, dstName ); return false; } } // if dst exists, types must match BFFVariable::VarType srcType = varSrc->GetType(); BFFVariable::VarType dstType = BFFVariable::VAR_ANY; if ( varDst ) { dstType = varDst->GetType(); } else { ASSERT( concat == false ); dstType = srcType; } // handle supported types if ( srcType != dstType ) { // Mismatched - is there a supported conversion? // String to ArrayOfStrings if ( ( dstType == BFFVariable::VAR_ARRAY_OF_STRINGS ) && ( srcType == BFFVariable::VAR_STRING ) ) { uint32_t num = (uint32_t)( 1 + ( concat ? varDst->GetArrayOfStrings().GetSize() : 0 ) ); Array< AString > values( num, false ); if ( concat ) { values.Append( varDst->GetArrayOfStrings() ); } values.Append( varSrc->GetString() ); BFFStackFrame::SetVarArrayOfStrings( dstName, values ); FLOG_INFO( "Registered <ArrayOfStrings> variable '%s' with %u elements", dstName.Get(), num ); return true; } // Struct to ArrayOfStructs if ( ( dstType == BFFVariable::VAR_ARRAY_OF_STRUCTS ) && ( srcType == BFFVariable::VAR_STRUCT ) ) { uint32_t num = (uint32_t)( 1 + ( concat ? varDst->GetArrayOfStructs().GetSize() : 0 ) ); Array< const BFFVariable * > values( num, false ); if ( concat ) { values.Append( varDst->GetArrayOfStructs() ); } values.Append( varSrc ); BFFStackFrame::SetVarArrayOfStructs( dstName, values ); FLOG_INFO( "Registered <ArrayOfStructs> variable '%s' with %u elements", dstName.Get(), num ); return true; } } else { // Matching Src and Dst if ( srcType == BFFVariable::VAR_STRING ) { AStackString< 2048 > finalValue; if ( concat ) { finalValue = varDst->GetString(); } finalValue += varSrc->GetString(); BFFStackFrame::SetVarString( dstName, finalValue ); FLOG_INFO( "Registered <string> variable '%s' with value '%s'", dstName.Get(), finalValue.Get() ); return true; } if ( srcType == BFFVariable::VAR_ARRAY_OF_STRINGS ) { if ( concat ) { const unsigned int num = (unsigned int)( varSrc->GetArrayOfStrings().GetSize() + varDst->GetArrayOfStrings().GetSize() ); Array< AString > values( num, false ); values.Append( varDst->GetArrayOfStrings() ); values.Append( varSrc->GetArrayOfStrings() ); BFFStackFrame::SetVarArrayOfStrings( dstName, values ); FLOG_INFO( "Registered <ArrayOfStrings> variable '%s' with %u elements", dstName.Get(), num ); } else { BFFStackFrame::SetVarArrayOfStrings( dstName, varSrc->GetArrayOfStrings() ); FLOG_INFO( "Registered <ArrayOfStrings> variable '%s' with %u elements", dstName.Get(), (unsigned int)varSrc->GetArrayOfStrings().GetSize() ); } return true; } if ( srcType == BFFVariable::VAR_ARRAY_OF_STRUCTS ) { if ( concat ) { const unsigned int num = (unsigned int)( varSrc->GetArrayOfStructs().GetSize() + varDst->GetArrayOfStructs().GetSize() ); Array< const BFFVariable * > values( num, false ); values.Append( varDst->GetArrayOfStructs() ); values.Append( varSrc->GetArrayOfStructs() ); BFFStackFrame::SetVarArrayOfStructs( dstName, values ); FLOG_INFO( "Registered <ArrayOfStructs> variable '%s' with %u elements", dstName.Get(), num ); } else { BFFStackFrame::SetVarArrayOfStructs( dstName, varSrc->GetArrayOfStructs() ); FLOG_INFO( "Registered <ArrayOfStructs> variable '%s' with %u elements", dstName.Get(), (unsigned int)varSrc->GetArrayOfStructs().GetSize() ); } return true; } if ( srcType == BFFVariable::VAR_INT ) { int newVal( varSrc->GetInt() ); if ( concat ) { newVal += varDst->GetInt(); } return StoreVariableInt( varNameDstStart, varNameDstEnd, newVal ); } if ( srcType == BFFVariable::VAR_BOOL ) { // only assignment is supported if ( concat == false ) { return StoreVariableBool( varNameDstStart, varNameDstEnd, varSrc->GetBool() ); } } if ( srcType == BFFVariable::VAR_STRUCT ) { const Array< const BFFVariable * > & srcMembers = varSrc->GetStructMembers(); if ( concat ) { BFFVariable *const newVar = BFFStackFrame::ConcatVars( dstName, varSrc, varDst ); FLOG_INFO( "Registered <struct> variable '%s' with %u members", dstName.Get(), newVar->GetStructMembers().GetSize() ); } else { // Register this variable BFFStackFrame::SetVarStruct( dstName, srcMembers ); FLOG_INFO( "Registered <struct> variable '%s' with %u members", dstName.Get(), srcMembers.GetSize() ); } return true; } } Error::Error_1034_OperationNotSupported( varNameSrcStart, varDst ? varDst->GetType() : varSrc->GetType(), varSrc->GetType(), operatorIter ); return false; }