コード例 #1
0
bool LLCurlThread::CurlRequest::processRequest()
{
	bool completed = true ;
	if(mMulti)
	{
		completed = mCurlThread->doMultiPerform(mMulti) ;

		if(!completed)
		{
			setPriority(LLQueuedThread::PRIORITY_LOW) ;
		}
	}

	return completed ;
}
コード例 #2
0
Translator::Translator(QObject *parent, const QVariantList &args)
    : Plasma::AbstractRunner(parent, args)
{
    Q_UNUSED(args);
    
    setObjectName(QLatin1String("Translator"));
    reloadConfiguration();
    setHasRunOptions(true);
    setIgnoredTypes(Plasma::RunnerContext::Directory |
                    Plasma::RunnerContext::File |
                    Plasma::RunnerContext::NetworkLocation);
    setSpeed(AbstractRunner::SlowSpeed);
    setPriority(HighestPriority);
    setDefaultSyntax(Plasma::RunnerSyntax(QString::fromLatin1("%1:q:").arg(i18n("<language code>")),i18n("Translates the word(s) :q: into target language")));
    setDefaultSyntax(Plasma::RunnerSyntax(QString::fromLatin1("%1:q:").arg(i18n("<source languagce>-<target languagce>")), i18n("Translates the word(s) :q: from the source into target language")));
}
コード例 #3
0
 void FilterChannel::setProperty(const std::string& name, const std::string& value)
 {
   if (name.compare(0, 7, "channel") == 0)
   {
     StringTokenizer tokenizer(value, ",;", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
     for (StringTokenizer::Iterator it = tokenizer.begin(); it != tokenizer.end(); ++it)
     {
       addChannel(LoggingRegistry::defaultRegistry().channelForName(*it));
     }
   }
   else if (name.compare(0, 5, "level") == 0)
   {
     setPriority(value);
   }
   else Channel::setProperty(name, value);
 }
コード例 #4
0
ファイル: setupmatrix.cpp プロジェクト: ConePerez/frePPLe
DECLARE_EXPORT int SetupMatrix::Rule::setattro(const Attribute& attr, const PythonObject& field)
{
  if (attr.isA(Tags::tag_priority))
    setPriority(field.getInt());
  else if (attr.isA(Tags::tag_fromsetup))
    setFromSetup(field.getString());
  else if (attr.isA(Tags::tag_tosetup))
    setToSetup(field.getString());
  else if (attr.isA(Tags::tag_duration))
    setDuration(field.getTimeperiod());
  else if (attr.isA(Tags::tag_cost))
    setCost(field.getDouble());
  else
    return -1;  // Error
  return 0;  // OK
}
コード例 #5
0
ファイル: resourceskill.cpp プロジェクト: albertca/frePPLe
DECLARE_EXPORT ResourceSkill::ResourceSkill(Skill* s, Resource* r, int u, DateRange e)
{
  setSkill(s);
  setResource(r);
  setPriority(u);
  setEffective(e);
  initType(metadata);
  try { validate(ADD); }
  catch (...)
  {
    if (getSkill()) getSkill()->resources.erase(this);
    if (getResource()) getResource()->skills.erase(this);
    resetReferenceCount();
    throw;
  }
}
コード例 #6
0
ObjectMemoryDeferFree::ObjectMemoryDeferFree (Memory& m) throw()
:   ObjectMemoryBase (m),
    Threading::Thread ("Memory Deferred Free Thread")
{
    setPriority (0);
    
    getMemory().resetUserData();
    getMemory().resetFunctions();
    
    AtomicOps::memoryBarrier();
    queue = new LockFreeQueue<Element>;
    AtomicOps::memoryBarrier();
    
    getMemory().setUserData (this);
    getMemory().setFunctions (staticAlloc, staticFree); 
}
コード例 #7
0
ファイル: Daemon.cpp プロジェクト: AndreGCGuerra/dune
  void
  Daemon::onResourceInitialization(void)
  {
    try
    {
      setPriority(Concurrency::Scheduler::maximumPriority());
      inf(DTR("daemon running with maximum priority: %d"), Concurrency::Scheduler::maximumPriority());
    }
    catch (...)
    {
      inf(DTR("daemon not running with maximum priority"));
    }

    m_ctx.mbus.resume();
    m_tman->start();
    m_periodic_counter.setTop(1.0);
    setEntityState(IMC::EntityState::ESTA_NORMAL, Status::CODE_ACTIVE);
  }
コード例 #8
0
/*!
    Constructs a new QHardwareInterface object with interface type \a name,
    identity \a id and operates in \a mode.  The object is attached to
    \a parent.

    If \a id is empty the default accessory for \a name will be
    automatically selected.
*/
QHardwareInterface::QHardwareInterface( const QString& name,
                                        const QString& id,
                                        QObject* parent,
                                        QAbstractIpcInterface::Mode mode )
: QAbstractIpcInterface( HARDWAREINTERFACE_VALUEPATH,
                         name,
                         id,
                         parent,
                         mode )
{
    if ( mode == QAbstractIpcInterface::Server ) {
        QSettings defaults( "Trolltech", "HardwareAccessories" );
        defaults.beginGroup( "Defaults" );
        if ( defaults.value( name ) == id )
            setPriority( 1 );
        defaults.endGroup();
    }
}
コード例 #9
0
ファイル: node_item.cpp プロジェクト: MagicCancel/showgraph
/** We can't create nodes separately, do it through newNode method of graph */
GNode::GNode( GGraph *graph_p, int _id):
    AuxNode( ( AuxGraph *)graph_p, _id),
	_doc( NULL),
	ir_id( GRAPH_MAX_NODE_NUM),
	text_shown( false),
    _style( NULL)
{
    item_p = new NodeItem( this);
    graph()->view()->scene()->addItem( item_p);
	setIRId( id());
    graph()->invalidateRanking();
    if ( graph()->view()->isContext())
    {
        item()->hide();
        setForPlacement( false);
        setPriority( 0);
    }
}
コード例 #10
0
ファイル: package.cpp プロジェクト: marxoft/qdl2
bool Package::setData(int role, const QVariant &value) {
    switch (role) {
    case CategoryRole:
        setCategory(value.toString());
        return true;
    case CreateSubfolderRole:
        setCreateSubfolder(value.toBool());
        return true;
    case IdRole:
        setId(value.toString());
        return true;
    case NameRole:
        setName(value.toString());
        return true;
    case PriorityRole:
        setPriority(TransferItem::Priority(value.toInt()));
        return true;
    case StatusRole:
        switch (value.toInt()) {
        case Queued:
            queue();
            return true;
        case Downloading:
            start();
            return true;
        case Paused:
            pause();
            return true;
        case Canceled:
            cancel();
            return true;
        case CanceledAndDeleted:
            cancel(true);
            return true;
        default:
            return TransferItem::setData(role, value);
        }
    case SuffixRole:
        setSuffix(value.toString());
        return true;
    default:
        return TransferItem::setData(role, value);
    }
}
コード例 #11
0
ファイル: script.cpp プロジェクト: KDE/kget
void Script::run()
{
    setPriority(QThread::LowPriority);
    // use 0 as parent, see Constructor.
    m_p_action = new Kross::Action(0, m_fileName); //"ContentFetchScript");
    // quit the exec() loop after get finish/abort signal from script
    connect(m_p_kgetcore, SIGNAL(finished()), this, SLOT(quit()));
    connect(m_p_kgetcore, SIGNAL(aborted(QString)), this, SLOT(quit()));
    // add transfer
    connect(m_p_kgetcore, SIGNAL(newTransfer(QString,QString)),
            this, SIGNAL(newTransfer(QString,QString)));
    // update status signal/slot
    connect(m_p_kgetcore, SIGNAL(percentUpdated(int)),
            this, SIGNAL(percentUpdated(int)));
    connect(m_p_kgetcore, SIGNAL(textStatusUpdated(QString)),
            this, SIGNAL(textStatusUpdated(QString)));
    connect(m_p_kgetcore, SIGNAL(finished()), this, SIGNAL(finished()));
    connect(m_p_kgetcore, SIGNAL(aborted(QString)), this, SIGNAL(aborted(QString)));
    // main entry point
    connect(this, SIGNAL(startDownload(QObject*)),
            m_p_kgetcore, SIGNAL(startDownload(QObject*)));
    m_p_action->setFile(m_fileName);
    // TODO add check
    kDebug(5002) << "KGetCore Added to script at ThreadId " << QThread::currentThreadId();
    m_p_action->addObject(m_p_kgetcore, "kgetcore",
                          Kross::ChildrenInterface::AutoConnectSignals);
    m_p_action->trigger();
    ScriptConfigAdaptor config;
    emit startDownload(&config);

    //m_p_action->callFunction("startDownload", QVariantList());
    kDebug(5002) << "Script Finished!" << QThread::currentThreadId();
    //delete m_p_kgetcore;
    //delete m_p_action;
    if (m_p_action->hadError())
    {
        kDebug(5002) << "Error:" << m_p_action->errorMessage() << m_p_action->errorTrace();
    }
    else
    {
        exec();
    }
}
コード例 #12
0
ファイル: lyxHTTPCookie.cpp プロジェクト: liyustar/liblyx
HTTPCookie::HTTPCookie(const NameValueCollection& nvc):
    _version(0),
    _secure(false),
    _maxAge(-1),
    _httpOnly(false)
{
    for (NameValueCollection::ConstIterator it = nvc.begin(); it != nvc.end(); ++it) {
        const std::string& name  = it->first;
        const std::string& value = it->second;

        if (icompare(name, "comment") == 0) {
            setComment(value);
        }
        else if (icompare(name, "domain") == 0) {
            setDomain(value);
        }
        else if (icompare(name, "path") == 0) {
            setPath(value);
        }
        else if (icompare(name, "priority") == 0) {
            setPriority(value);
        }
        else if (icompare(name, "max-age") == 0) {
            throw NotImplementedException("HTTPCookie::HTTPCookie max-age");
        }
        else if (icompare(name, "secure") == 0) {
            setSecure(true);
        }
        else if (icompare(name, "expires") == 0) {
            throw NotImplementedException("HTTPCookie::HTTPCookie expires");
        }
        else if (icompare(name, "version") == 0) {
            throw NotImplementedException("HTTPCookie::HTTPCookie version");
        }
        else if (icompare(name, "HttpOnly") == 0) {
            setHttpOnly(true);
        }
        else {
            setName(name);
            setValue(value);
        }
    }
}
コード例 #13
0
ファイル: main.c プロジェクト: acamilo/TinyBowler4
void main()
{
	int i=0;
	char mymac[6]={0x74,0xf7,0x26,0x00,0x00,0x01};
	unsigned char data[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x04,0x74,0xf7,0x26,0x00,0x00,0x01,0x65,0x00,0x00,0x0a,0x05,0x00,0x01,0x02,0x03,0x05,0x06,0x07,0x08,0x09};

	bowler4_header bh;
	for (i=0; i<sizeof(bowler4_header); i++) bh.bytes[i]=0;
	bh.fields.version=0x04;
	bh.fields.affect=setPriority(5,setState(setAsync(bh.fields.affect)));
	bh.fields.payloadLength=10;
	bh.fields.payloadType=0;


	set_mac_address(mymac,&bh);
	calculate_checksum(&bh);
	printf("Verify?\t%d\n",verify_checksum(&bh));
	printf("Verify?\t%d\n",verify_checksum(&bh));
printf("%X\n",check_mac_address(mymac,&bh) );
	printHeader(bh);


	V4MicroParser_state parser;
	parser.state=align;
	parser.macaddr=&mymac;
	fifoInit(&parser.fifo);
	fifoPrint(&parser.fifo);

	for (i=0; i<sizeof(data); i++){
 		fifoPush(&parser.fifo,data[i]);
		int delta=parser.fifo.inPointer;
		printf("Pushing:\t%i\n",i);
		/*fifoPrint(&parser.fifo);*/
		runParserSM(&parser);
		if (parser.fifo.inPointer!=delta) {printf("\nNew Contents of FIFO:");fifoPrint(&parser.fifo);}

		printf("===================\n");
		

	}
		/* fifoPull(&fifo,15); */
		/* fifoPrint(&fifo); */
}
コード例 #14
0
ファイル: resourceskill.cpp プロジェクト: albertca/frePPLe
DECLARE_EXPORT void ResourceSkill::endElement (XMLInput& pIn, const Attribute& pAttr, const DataElement& pElement)
{
  if (pAttr.isA (Tags::tag_resource))
  {
    Resource *r = dynamic_cast<Resource*>(pIn.getPreviousObject());
    if (r) setResource(r);
    else throw LogicException("Incorrect object type during read operation");
  }
  else if (pAttr.isA (Tags::tag_skill))
  {
    Skill *s = dynamic_cast<Skill*>(pIn.getPreviousObject());
    if (s) setSkill(s);
    else throw LogicException("Incorrect object type during read operation");
  }
  else if (pAttr.isA(Tags::tag_priority))
    setPriority(pElement.getInt());
  else if (pAttr.isA(Tags::tag_effective_end))
    setEffectiveEnd(pElement.getDate());
  else if (pAttr.isA(Tags::tag_effective_start))
    setEffectiveStart(pElement.getDate());
  else if (pAttr.isA(Tags::tag_action))
  {
    delete static_cast<Action*>(pIn.getUserArea());
    pIn.setUserArea(
      new Action(MetaClass::decodeAction(pElement.getString().c_str()))
    );
  }
  else if (pIn.isObjectEnd())
  {
    // The resourceskill data is now all read in. See if it makes sense now...
    Action a = pIn.getUserArea() ?
        *static_cast<Action*>(pIn.getUserArea()) :
        ADD_CHANGE;
    delete static_cast<Action*>(pIn.getUserArea());
    try { validate(a); }
    catch (...)
    {
      delete this;
      throw;
    }
  }
}
コード例 #15
0
HistogramInteractorMetricMapping::HistogramInteractorMetricMapping(const PluginContext* ) : HistogramInteractor(":/i_histo_color_mapping.png", "Metric Mapping") {
    setConfigurationWidgetText(QString ("<html><head><title></title></head><body>")
                               +"<h3>Metric mapping interactor</h3>"
                               +"<p>This interactor allows to perform a metric mapping on nodes colors, nodes borders colors, nodes sizes, nodes borders widths or nodes glyphs in a visual way.</p>"
                               +"<p>To select the mapping type, do a right click on the scale located at the left of the histogram vertical axis and pick the one wanted in the popup menu which appears.</p>"
                               +"<p>To configure the metric mapping, double click on the scale located at the left of the histogram vertical axis and use the dialog which appears.</p>"
                               +"<h4>Color mapping configuration</h4>"
                               +"<p>The configuration dialog for the color mapping is illustrated below.<br />"
                               +"<img src=\":/ColorScaleConfigDialog.png\" width=\"280\" height=\"260\" border=\"0\" alt=\"\"><br />"
                               +"The first tab of this dialog allows to manually define a color scale. To do so, start by picking the number of colors to use by using the spinbox located above the colors table. "
                               +"To select the colors to use, double click on the cells of the colors table and a color picker dialog will appear. A preview of the built color scale is displayed at the right of the color table.<br />"
                               +"The built color scale can be saved using the \"Save color scale\" button.<br /><br />"
                               +"<img src=\":/ColorScaleConfigDialog2.png\" width=\"280\" height=\"260\" border=\"0\" alt=\"\"><br />"
                               +"The second tab of the dialog allow to load a previously saved color scale and give also the possibility to load a color scale from an image file (the color scale must be defined in the vertical dimension of the image). "
                               +"Previously saved color scale can be reedit by double clicking on it. <br />"
                               +"Once the color scale to use has been selected or configured, press the \"Ok\" button.</p>"
                               +"<h4>Size mapping configuration</h4>"
                               +"<p>The configuration dialog for the size mapping is illustrated below.<br />"
                               +"<img src=\":/SizeScaleConfigDialog.png\" width=\"280\" height=\"280\" border=\"0\" alt=\"\"><br />"
                               +"The top part of the dialog allows to select on which size property the mapping has to be performed : <i>viewSize</i> or <i>viewBorderWidth</i>.<br />"
                               +"The middle part of the dialog aims to configure the minimum and maximum size to use for the mapping.<br />"
                               +"The bottom part of the dialog allows to select on which dimensions the size mapping has to be applied when it is performed on the viewSize property.<br />"
                               +"Once the wanted parameters have been set, press the \"OK\" button to apply them.</p>"
                               +"<h4>Glyph mapping configuration</h4>"
                               +"<p>The configuration dialog for the size mapping is illustrated below.<br />"
                               +"<img src=\":/GlyphScaleConfigDialog.png\" width=\"280\" height=\"280\" border=\"0\" alt=\"\"><br />"
                               +"Use the spin box located at the top of the dialog to define the number of nodes glyphs to use for the mapping. <br/>"
                               +"Select the glyphs to use by the help of the combo boxes contained in the cells of the table.<br />"
                               +"Press the \"OK\" button to apply the settings. </p>"
                               +"<h4>Metric mapping instructions</h4>"
                               +"<p>The metric mapping is done with the help of the editable curve drawn on top of the histogram. By double clicking on it, control points are created which allow to modify the curve shape (by drag and drop them) and so the metric mapping. The created control points can also be removed by double clicking on them. </p>"
                               +"<p>The mapping performed can be visually interpreted as followed. For each node of the graph, get the value of the metric property associated with the current displayed histogram. "
                               +"Take the line perpendicular to the horizontal axis of the histogram (the metric axis) which passes by the point on the metric axis associated with the node metric value. "
                               +"Then take the intersection point between this line and the curve controlling the mapping. The value of the metric is then mapped on the node visual property associated to the y coordinates of this intersection point according to the scale located at the left of the histogram vertical axis (which can be a color, a size or a glyph scale). <br />"
                               +"The corresponding mapping on the whole graph metric is materialized by the scale located under the histogram horizontal axis. "
                               +"For example, if the curve is a straight line between the bottom left corner and the top right corner of the histogram, a linear mapping is performed on the metric. "
                               +"More complex mapping can be performed like the color mapping illustrated below.<br />"
                               +"<img src=\":/HistoColorMapping.png\" width=\"280\" height=\"260\" border=\"0\" alt=\"\"><br />"
                               +"</p>"
                               +"</body></html>");
    setPriority(StandardInteractorPriority::ViewInteractor1);
}
コード例 #16
0
int SpdyStream::init(uint32_t StreamID,
                     int Priority, SpdyConnection *pSpdyConn, uint8_t flags,
                     HioHandler *pHandler)
{
    HioStream::reset(DateTime::s_curTime);
    pHandler->attachStream(this);
    clearLogId();

    setState(HIOS_CONNECTED);
    setFlag((flags & (SPDY_CTRL_FLAG_FIN | SPDY_CTRL_FLAG_UNIDIRECTIONAL)), 1);

    m_bufIn.clear();
    m_uiStreamID  = StreamID;
    m_iWindowOut = pSpdyConn->getStreamOutInitWindowSize();
    m_iWindowIn = pSpdyConn->getStreamInInitWindowSize();
    setPriority(Priority);
    m_pSpdyConn = pSpdyConn;
    LS_DBG_L(this, "SpdyStream::init(), id: %d. ", StreamID);
    return 0;
}
コード例 #17
0
ファイル: threads.cpp プロジェクト: DarkLotus/Source
AbstractThread::AbstractThread(const char *name, IThread::Priority priority)
{
	if( AbstractThread::m_threadsAvailable == 0 )
	{
		// no threads were started before - initialise thread subsystem
#ifdef _WIN32
		if( CoInitializeEx(NULL, COINIT_MULTITHREADED) != S_OK )
		{
			throw CException(LOGL_FATAL, 0, "OLE is not available, threading model unimplementable");
		}
#endif
		AbstractThread::m_threadsAvailable++;
	}
	m_id = 0;
	m_name = name;
	m_handle = 0;
	m_hangCheck = 0;
	m_terminateRequested = true;
	setPriority(priority);
}
コード例 #18
0
ファイル: thread.cpp プロジェクト: KRSSG/Simurosot
  void Thread::start()
  {
#ifdef WIN32
    LPDWORD threadID = 0;
    handle = CreateThread(NULL,           // Security attributes
                          0,              // Stack size
                          threadFunc,     // Thread function
                          (Thread*)this,  // Parameter
                          0,              // Flags
                          threadID        // Thread ID
                         );
    assert(handle); // Failed to create thread
	setPriority(THREAD_PRIORITY_NORMAL);
#else
    if (pthread_create(&handle, NULL, threadFunc, this) != 0)
    {
    //  // Loggerabort("Could not create thread: %s", strerror(errno));
    }
#endif // !WIN32
  }
コード例 #19
0
DenseLevelSet::DenseLevelSet(QObject *parent) :
    QThread(parent)
{
    phi = NULL;
    externalForce = NULL;
    statusmap = NULL;
    for( int i = 0 ; i < 3 ; i++ )
    {
        dimension[i] = 0;
        spacing[i] = 0;
        dimoffset[0] = 0;
    }
    totalSize = 0;
    sliceSize = 0;
    imageW = 0;
    imageH = 0;
    imageD = 0;
    updateInterval = 5;

    its = 0;
    periods = 0;
    dampingFactor = 0.5;
    currenttrend = -1;
    maxiumStepLength = MAXSTEP;
    externalWeightFactor = 0.5;

    maxPeriod = 4;
    maxIteration = 400;

//    currentAlgorithm = MIA_ThresholdBased;
//    currentAlgorithm = MIA_GradientBased;

    isValid = false;
    isAbort = false;
    imDimension = 3;

    connect(this,SIGNAL(levelsetFunctionUpdated()), parent, SLOT(forwardLevelSetFunctionUpdated()));
    connect(this,SIGNAL(levelsetFunctionCompleted()), parent, SLOT(forwardLevelsetFunctionCompleted()));
    connect(this,SIGNAL(levelsetEnterNewPeriod(int)), parent, SLOT(forwardLevelsetEnterNewPeriod(int)));
    setPriority(QThread::HighestPriority);
}
コード例 #20
0
ファイル: statuspreset.cpp プロジェクト: psi-im/psi
void StatusPreset::fromXml(const QDomElement &el)
{
    // FIXME: This is the old format. Should be removed in the future
    if (el.tagName() == "item") {
        setName(el.attribute("name"));
        setMessage(el.text());
        return;
    }

    if (el.isNull() || el.tagName() != "preset")
        return;

    setName(el.attribute("name"));
    setMessage(el.text());
    if (el.hasAttribute("priority"))
        setPriority(el.attribute("priority").toInt());

    XMPP::Status status;
    status.setType(el.attribute("status", "away"));
    setStatus(status.type());
}
コード例 #21
0
SessionRunner::SessionRunner(QObject *parent, const QVariantList &args)
    : Plasma::AbstractRunner(parent, args)
{
    setObjectName( QLatin1String("Sessions" ));
    setPriority(LowPriority);
    setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File | 
                    Plasma::RunnerContext::NetworkLocation);

    m_canLogout = KAuthorized::authorizeAction(QStringLiteral("logout")) && KAuthorized::authorize(QStringLiteral("logout"));
    if (m_canLogout) {
        addSyntax(Plasma::RunnerSyntax(i18nc("log out command", "logout"),
                  i18n("Logs out, exiting the current desktop session")));
        addSyntax(Plasma::RunnerSyntax(i18nc("shutdown computer command", "shutdown"),
                  i18n("Turns off the computer")));
    }

    if (KAuthorized::authorizeAction(QStringLiteral("lock_screen")) && m_canLogout) {
        addSyntax(Plasma::RunnerSyntax(i18nc("lock screen command", "lock"),
                  i18n("Locks the current sessions and starts the screen saver")));
    }

    Plasma::RunnerSyntax rebootSyntax(i18nc("restart computer command", "restart"), i18n("Reboots the computer"));
    rebootSyntax.addExampleQuery(i18nc("restart computer command", "reboot"));
    addSyntax(rebootSyntax);

    m_triggerWord = i18nc("switch user command", "switch");
    addSyntax(Plasma::RunnerSyntax(i18nc("switch user command", "switch :q:"),
                     i18n("Switches to the active session for the user :q:, "
                          "or lists all active sessions if :q: is not provided")));

    Plasma::RunnerSyntax fastUserSwitchSyntax(i18n("switch user"),
                                i18n("Starts a new session as a different user"));
    fastUserSwitchSyntax.addExampleQuery(i18n("new session"));
    addSyntax(fastUserSwitchSyntax);

    //"SESSIONS" should not be translated; it's used programmaticaly
    setDefaultSyntax(Plasma::RunnerSyntax(QStringLiteral("SESSIONS"), i18n("Lists all sessions")));

}
コード例 #22
0
 virtual void initializeSecond()
   {
     SpatiocyteProcess::initializeSecond(); 
     for(unsigned int i(0); i != theProcessSpecies.size(); ++i)
       {
         if(InContact)
           {
             theProcessSpecies[i]->setIsInContact();
           }
         if(Centered)
           {
             theProcessSpecies[i]->setIsCentered();
           }
       }
     timePointCnt = 0;
     logCnt = 0;
     exposureCnt = 0;
     if(!getPriority())
       {
         setPriority(-10);
       }
   }
コード例 #23
0
void Fmod4SoundStitching::play(bool destroyWhenDone)
{
    if (!isValid())
    {
        load();
    }

    FMOD_RESULT res = mDriver->_getFmodSystem()->playSound(
        FMOD_CHANNEL_FREE, 
        mSound, 
        true,
        &mChannel);

    CHECK_FMOD4_ERRORS(res);

    RlAssert1(mChannel != NULL);
    mAutoDestroy = destroyWhenDone;
//    mDriver->_registerChannel(mChannel, this);

    float vol;
	if (is3d())
	{
		vol = mDriver->getDefaultSoundVolume();
	}
	else
	{
		vol = mDriver->getDefaultMusicVolume();
	}
	setVolume(vol);

    setPriority(mPriority);
    setPosition(mPosition);
    setDirection(mDirection);
	setVelocity(mVelocity); 
    pause(false);
    SoundPlayEvent event = SoundPlayEvent(this, SoundPlayEvent::STARTEVENT);
    dispatchEvent(&event);
}
コード例 #24
0
ResourceRequest::ResourceRequest(CrossThreadResourceRequestData* data)
    : ResourceRequest()
{
    setURL(data->m_url);
    setCachePolicy(data->m_cachePolicy);
    setTimeoutInterval(data->m_timeoutInterval);
    setFirstPartyForCookies(data->m_firstPartyForCookies);
    setRequestorOrigin(data->m_requestorOrigin);
    setHTTPMethod(AtomicString(data->m_httpMethod));
    setPriority(data->m_priority, data->m_intraPriorityValue);

    m_httpHeaderFields.adopt(data->m_httpHeaders.release());

    setHTTPBody(data->m_httpBody);
    setAllowStoredCredentials(data->m_allowStoredCredentials);
    setReportUploadProgress(data->m_reportUploadProgress);
    setHasUserGesture(data->m_hasUserGesture);
    setDownloadToFile(data->m_downloadToFile);
    setUseStreamOnResponse(data->m_useStreamOnResponse);
    setSkipServiceWorker(data->m_skipServiceWorker);
    setShouldResetAppCache(data->m_shouldResetAppCache);
    setRequestorID(data->m_requestorID);
    setRequestorProcessID(data->m_requestorProcessID);
    setAppCacheHostID(data->m_appCacheHostID);
    setRequestContext(data->m_requestContext);
    setFrameType(data->m_frameType);
    setFetchRequestMode(data->m_fetchRequestMode);
    setFetchCredentialsMode(data->m_fetchCredentialsMode);
    setFetchRedirectMode(data->m_fetchRedirectMode);
    setLoFiState(data->m_loFiState);
    m_referrerPolicy = data->m_referrerPolicy;
    m_didSetHTTPReferrer = data->m_didSetHTTPReferrer;
    m_checkForBrowserSideNavigation = data->m_checkForBrowserSideNavigation;
    m_uiStartTime = data->m_uiStartTime;
    m_isExternalRequest = data->m_isExternalRequest;
    m_inputPerfMetricReportPolicy = data->m_inputPerfMetricReportPolicy;
    m_followedRedirect = data->m_followedRedirect;
}
コード例 #25
0
ファイル: RTMFPServer.cpp プロジェクト: huangshan309/Cumulus
void RTMFPServer::start(RTMFPServerParams& params) {
	if(running()) {
		ERROR("RTMFPServer server is yet running, call stop method before");
		return;
	}
	_port = params.port;
	if(_port==0) {
		ERROR("RTMFPServer port must have a positive value");
		return;
	}
	_shellPort = params.shellPort;

	if(params.pCirrus) {
		_pCirrus = new Target(*params.pCirrus);
		NOTE("RTMFPServer started in man-in-the-middle mode with server %s (unstable debug mode)",_pCirrus->address.toString().c_str());
	}
	_middle = params.middle;
	if(_middle)
		NOTE("RTMFPServer started in man-in-the-middle mode between peers (unstable debug mode)");

	_pSocket = new DatagramSocket();
	if (_pSocket == NULL) {
		ERROR("RTMFPServer allocation of pSocket failed");
	        return;	
	}
	 (UInt32&)udpBufferSize = params.udpBufferSize==0 ? _pSocket->getReceiveBufferSize() : params.udpBufferSize;
	_pSocket->setReceiveBufferSize(udpBufferSize);_pSocket->setSendBufferSize(udpBufferSize);
	NOTE("Socket buffer receiving/sending size = %u/%u", udpBufferSize, udpBufferSize);

	(UInt32&)keepAliveServer = params.keepAliveServer<5 ? 5000 : params.keepAliveServer*1000;
	(UInt32&)keepAlivePeer = params.keepAlivePeer<5 ? 5000 : params.keepAlivePeer*1000;

	poolThreads.launch();
	sockets.launch();

	Startable::start();
	setPriority(params.threadPriority);
}
コード例 #26
0
ファイル: Thread.cpp プロジェクト: darkfall/exlibs
result_t Thread::start ()
{
    TAutoLock<Mutex> lock(m_threadMutex);

    // If the thread is already started
    if ( !isStopped() )
    {
        ex_warning ( "Thread(%s) start failed: the thread already started.", m_name.c_str() );
        return EResult::failed;
    }

    // start the thread
    uint threadID; 
    m_handle = (void*) _beginthreadex( 0,                                   // security
                                       m_stackSize,                         // stack size
                                       _private::ThreadRunCallback,
                                       this,                                // ThreadRunCallback arg_list
                                       CREATE_SUSPENDED,                    // create suspended.
                                       &threadID );
    // error creating thread.
    if ( m_handle == NULL )
    {
        ex_error ( "Thread(%s) start failed: the thread can't be create.", m_name.c_str() );
        return EResult::create_failed;
    }
    m_ID = threadID;

    // suspend the thread
    m_state = eState_Paused;
    setPriority ((EPriority)m_priority);
    usePriorityBoost (m_usePriorityBoost);
    setName (m_name);

    // now start the thread
    ex_check_return ( resume (true) == EResult::ok, EResult::failed, "failed to start thread %s", m_name.c_str() );
    return EResult::ok;
}
コード例 #27
0
bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString *errorString)
{
    // Register objects in the plugin manager's object pool
    // Load settings
    // Add actions to menus
    // Connect to other plugins' signals
    // In the initialize method, a plugin can be sure that the plugins it
    // depends on have initialized their members.

    Q_UNUSED(arguments);
    Q_UNUSED(errorString);

    auto panelFactory = new ProjectPanelFactory();
    panelFactory->setPriority(100);
    panelFactory->setDisplayName(tr("Clang Static Analyzer"));
    panelFactory->setCreateWidgetFunction([](Project *project) { return new ProjectSettingsWidget(project); });
    ProjectPanelFactory::registerFactory(panelFactory);

    m_analyzerTool = new ClangStaticAnalyzerTool(this);
    addAutoReleasedObject(new ClangStaticAnalyzerRunControlFactory(m_analyzerTool));
    addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage);

    return true;
}
コード例 #28
0
ファイル: UHDDevice.cpp プロジェクト: sazoo/openbts-p2.8
bool uhd_device::start()
{
	LOG(INFO) << "Starting USRP...";

	if (started) {
		LOG(ERR) << "Device already started";
		return false;
	}

	setPriority();

	// Start asynchronous event (underrun check) loop
	async_event_thrd.start((void * (*)(void*))async_event_loop, (void*)this);

	// Start streaming
	restart(uhd::time_spec_t(0.0));

	// Display usrp time
	double time_now = usrp_dev->get_time_now().get_real_secs();
	LOG(INFO) << "The current time is " << time_now << " seconds";

	started = true;
	return true;
}
コード例 #29
0
EmailMessage::EmailMessage(QObject *parent)
    : QObject(parent)
    , m_newMessage(true)
{
    setPriority(NormalPriority);
}
コード例 #30
0
void IMuseDigital::parseScriptCmds(int cmd, int b, int c, int d, int e, int f, int g, int h) {
	int soundId = b;
	int sub_cmd = c;

	if (!cmd)
		return;

	switch (cmd) {
	case 10: // ImuseStopAllSounds
		stopAllSounds();
		break;
	case 12: // ImuseSetParam
		switch (sub_cmd) {
		case 0x400: // select group volume
			selectVolumeGroup(soundId, d);
			break;
		case 0x500: // set priority
			setPriority(soundId, d);
			break;
		case 0x600: // set volume
			setVolume(soundId, d);
			break;
		case 0x700: // set pan
			setPan(soundId, d);
			break;
		default:
			warning("IMuseDigital::doCommand SetParam DEFAULT command %d", sub_cmd);
			break;
		}
		break;
	case 14: // ImuseFadeParam
		switch (sub_cmd) {
		case 0x600: // set volume fading
			if ((d != 0) && (e == 0))
				setVolume(soundId, d);
			else if ((d == 0) && (e == 0))
				stopSound(soundId);
			else
				setFade(soundId, d, e);
			break;
		default:
			warning("IMuseDigital::doCommand FadeParam DEFAULT sub command %d", sub_cmd);
			break;
		}
		break;
	case 25: // ImuseStartStream
		debug(3, "ImuseStartStream (%d, %d, %d)", soundId, c, d);
		break;
	case 26: // ImuseSwitchStream
		debug(3, "ImuseSwitchStream (%d, %d, %d, %d, %d)", soundId, c, d, e, f);
		break;
	case 0x1000: // ImuseSetState
		debug(5, "ImuseSetState (%d)", b);
		if ((_vm->_game.id == GID_DIG) && (_vm->_game.features & GF_DEMO)) {
			if (b == 1) {
				fadeOutMusic(200);
				startMusic(1, 127);
			} else {
				if (getSoundStatus(2) == 0) {
					fadeOutMusic(200);
					startMusic(2, 127);
				}
			}
		} else if ((_vm->_game.id == GID_CMI) && (_vm->_game.features & GF_DEMO)) {
			if (b == 2) {
				fadeOutMusic(108);
				startMusic("in1.imx", 1100, 0, 127);
			} else if (b == 4) {
				fadeOutMusic(108);
				startMusic("in2.imx", 1120, 0, 127);
			} else if (b == 8) {
				fadeOutMusic(108);
				startMusic("out1.imx", 1140, 0, 127);
			} else if (b == 9) {
				fadeOutMusic(108);
				startMusic("out2.imx", 1150, 0, 127);
			} else if (b == 16) {
				fadeOutMusic(108);
				startMusic("gun.imx", 1210, 0, 127);
			} else {
				fadeOutMusic(120);
			}
		} else if (_vm->_game.id == GID_DIG) {
			setDigMusicState(b);
		} else if (_vm->_game.id == GID_CMI) {
			setComiMusicState(b);
		} else if (_vm->_game.id == GID_FT) {
			setFtMusicState(b);
		}
		break;
	case 0x1001: // ImuseSetSequence
		debug(5, "ImuseSetSequence (%d)", b);
		if (_vm->_game.id == GID_DIG) {
			setDigMusicSequence(b);
		} else if (_vm->_game.id == GID_CMI) {
			setComiMusicSequence(b);
		} else if (_vm->_game.id == GID_FT) {
			setFtMusicSequence(b);
		}
		break;
	case 0x1002: // ImuseSetCuePoint
		debug(5, "ImuseSetCuePoint (%d)", b);
		if (_vm->_game.id == GID_FT) {
			setFtMusicCuePoint(b);
		}
		break;
	case 0x1003: // ImuseSetAttribute
		debug(5, "ImuseSetAttribute (%d, %d)", b, c);
		assert((_vm->_game.id == GID_DIG) || (_vm->_game.id == GID_FT));
		if (_vm->_game.id == GID_DIG) {
			_attributes[b] = c;
		}
		break;
	case 0x2000: // ImuseSetGroupSfxVolume
		break;
	case 0x2001: // ImuseSetGroupVoiceVolume
		break;
	case 0x2002: // ImuseSetGroupMusicVolume
		break;
	default:
		error("IMuseDigital::doCommand DEFAULT command %d", cmd);
	}
}