Beispiel #1
0
void EnergyMonitor::calcLevelRect(Common::Rect &r) {
	if (getStop() == 0) {
		r = Common::Rect();
	} else {
		getBounds(r);
		r.left = r.right - r.width() * (kMaxJMPEnergy - getTime()) / getStop();
	}
}
Beispiel #2
0
void EnergyMonitor::setEnergyValue(const uint32 value) {
	if (isRunning()) {
		stop();
		setTime(getStop() - value);
		start();
	} else {
		setTime(getStop() - value);
	}
}
Error Context::removeUnreachableCode() {
  PodList<Node*>::Link* link = _unreachableList.getFirst();
  Node* stop = getStop();

  while (link != NULL) {
    Node* node = link->getValue();
    if (node != NULL && node->getPrev() != NULL) {
      // Locate all unreachable nodes.
      Node* first = node;
      do {
        if (node->isFetched())
          break;
        node = node->getNext();
      } while (node != stop);

      // Remove.
      if (node != first) {
        Node* last = (node != NULL) ? node->getPrev() : getCompiler()->getLastNode();
        getCompiler()->removeNodes(first, last);
      }
    }

    link = link->getNext();
  }

  return kErrorOk;
}
Beispiel #4
0
			virtual void * run()
			{
				while ( ! getStop() )
				{
					uint64_t const s = libmaus2::util::GetFileSize::getDirSize(fn);
					// (*sizestream) << "[S]\t" << fn << "\t" << s << std::endl;

					if ( s > maxsize )
					{
						maxsize = s;
						if ( sizestream )
							printSize(*sizestream);
					}

					struct timespec req, rem;

					req.tv_sec = sleeptime;
					req.tv_nsec = 0;
					rem.tv_sec = 0;
					rem.tv_nsec = 0;

					nanosleep(&req,&rem);
				}

				return 0;
			}
Beispiel #5
0
void Camera::setStop(const Parameter & p, const Stop & s)
{
    if (getStop(p) != s)
    {
	LOCK_MUTEX;
	requestedStopChanges[p] = s;
	UNLOCK_MUTEX;
    }
}
Beispiel #6
0
int CServerLinker::addInLoop(void)
{
    int iRtn = Q_RTN_OK;
    OrderMsg stOrderMsg;
    
    stOrderMsg.emType = OrderType_AddServerLinker;
    stOrderMsg.pHandle = this;

    if (!getStop())
    {
        iRtn = m_pEvent->sendOrderMsg((const char*)(&stOrderMsg),  sizeof(stOrderMsg));
    }

    return iRtn;
}
Beispiel #7
0
bool TimeBase::isRunning() {
	if (_paused && _pausedRate != 0)
		return true;

	Common::Rational rate = getRate();

	if (rate == 0)
		return false;

	if (getFlags() & kLoopTimeBase)
		return true;

	if (rate > 0)
		return getTime() != getStop();

	return getTime() != getStart();
}
void TransferFunctionControlPointConnection::updateShape() {
    if (left_ == nullptr && right_ == nullptr) {
        path_ = QPainterPath();
    }
    
    path_ = QPainterPath(getStart());
    path_.lineTo(getStop());
    
    rect_ = path_.boundingRect();
    
    QPainterPathStroker pathStrocker;
    pathStrocker.setWidth(10.0);
    shape_ = pathStrocker.createStroke(path_);
    
    prepareGeometryChange();
    update();
}
Beispiel #9
0
void ChannelAccessThr::run()
{
	//printchannel();	//for Debug
    CHNODE	mynode[register_chacc.size()];
	unsigned int i = 0;
	//const char  SHM_KEY[]  = "0x50000000";
	//const key_t  SHM_KEY  = 0x50000000;
	//char *shmPtr = m_pattach->mCachedData.open (SHM_KEY, register_chacc.size()*sizeof(CachedData), CachedChannelAccess::RT_SHM_CREAT | CachedChannelAccess::RT_SHM_RDWR);
	mutex.lock();
	for ( reg_chacciter = register_chacc.begin(); reg_chacciter != register_chacc.end(); ++reg_chacciter, i++)
	{
		mynode[i].objname	= QString(reg_chacciter->objname.c_str());
		mynode[i].acacc		= m_pattach;
		mynode[i].pvname	= QString(reg_chacciter->pvname.c_str());
		mynode[i].dbrequest	= reg_chacciter->dbrequest;
		mynode[i].chindex	= reg_chacciter->chindex;
		ca_create_channel(reg_chacciter->pvname.c_str(), connectionCallback, &mynode[i], 10, (oldChannelNotify**)&mynode[i].ch_id);
	};
	ca_pend_event(1.0);
	for ( reg_chacciter = register_chacc.begin(), i=0; reg_chacciter != register_chacc.end(); ++reg_chacciter, i++)
	{
		if (mynode[i].onceConnected)
		{
			//qDebug("Conn PV:%s", mynode[i].pvname.toStdString().c_str() );
		}
		else if (mynode[i].onceConnected == 0)
		{
			//qDebug("NotConn PV:%s", mynode[i].pvname.toStdString().c_str() );
			m_pattach->ConnectionStatusObj(mynode[i].objname, -1);
		};
	}
	mutex.unlock();
#if 1
	//in vm image, ca_pend_event(0.0001) stop processing on running;
	while(true)
	{
		if(getStop() == true) break;
		ca_pend_event(0.0001);
	};
    ca_context_destroy();
	exit();
#else
	//in vm image, this code no problem why?? U know?
	ca_pend_event(0.0);
#endif
}
Beispiel #10
0
Error Context::removeUnreachableCode() {
  Compiler* compiler = getCompiler();

  PodList<HLNode*>::Link* link = _unreachableList.getFirst();
  HLNode* stop = getStop();

  while (link != nullptr) {
    HLNode* node = link->getValue();
    if (node != nullptr && node->getPrev() != nullptr && node != stop) {
      // Locate all unreachable nodes.
      HLNode* first = node;
      do {
        if (node->isFetched())
          break;
        node = node->getNext();
      } while (node != stop);

      // Remove unreachable nodes that are neither informative nor directives.
      if (node != first) {
        HLNode* end = node;
        node = first;

        // NOTE: The strategy is as follows:
        // 1. The algorithm removes everything until it finds a first label.
        // 2. After the first label is found it removes only removable nodes.
        bool removeEverything = true;
        do {
          HLNode* next = node->getNext();
          bool remove = node->isRemovable();

          if (!remove) {
            if (node->isLabel())
              removeEverything = false;
            remove = removeEverything;
          }

          if (remove) {
            ASMJIT_TSEC({
              this->_traceNode(this, node, "[REMOVED UNREACHABLE] ");
            });
            compiler->removeNode(node);
          }

          node = next;
        } while (node != end);
      }
Beispiel #11
0
void ChannelAccessThr::run()
{
	unsigned int i = 0;
	vecnode.reserve(register_chacc.size());
	mutex.lock();
	for ( reg_chacciter = register_chacc.begin(); reg_chacciter != register_chacc.end(); ++reg_chacciter, i++)
	{
		CHNODE node;
		node.objname   = QString(reg_chacciter->objname.c_str());
		node.acacc     = m_pattach;
		node.pvname    = QString(reg_chacciter->pvname.c_str());
		node.dbrequest = reg_chacciter->dbrequest;
		node.chindex   = reg_chacciter->chindex;
		node.pItem   = reg_chacciter->pItem;
		vecnode.push_back(node);
		ca_create_channel(reg_chacciter->pvname.c_str(), connectionCallback, (void*)&(vecnode.at(i)), 10, (oldChannelNotify**)&((vecnode.at(i)).ch_id));
	};
	ca_pend_event(1.0);
	for ( reg_chacciter = register_chacc.begin(), i=0; reg_chacciter != register_chacc.end(); ++reg_chacciter, i++)
	{
		CHNODE *pNode  = &vecnode.at(i); 
		if (pNode->onceConnected)
		{
		}
		else if (pNode->onceConnected == 0)
		{
			m_pattach->ConnectionStatusObj(pNode->objname, -1);
		};
	}
	mutex.unlock();

	while(true)
	{
		if(getStop() == true) break;
		ca_pend_event(0.0001);
	};
    ca_context_destroy();
	exit();
}
Beispiel #12
0
Error Context::removeUnreachableCode() {
  Compiler* compiler = getCompiler();

  PodList<HLNode*>::Link* link = _unreachableList.getFirst();
  HLNode* stop = getStop();

  while (link != NULL) {
    HLNode* node = link->getValue();
    if (node != NULL && node->getPrev() != NULL && node != stop) {
      // Locate all unreachable nodes.
      HLNode* first = node;
      do {
        if (node->isFetched())
          break;
        node = node->getNext();
      } while (node != stop);

      // Remove unreachable nodes that are neither informative nor directives.
      if (node != first) {
        HLNode* end = node;
        node = first;
        do {
          HLNode* next = node->getNext();
          if (!node->isInformative() && node->getType() != kHLNodeTypeAlign) {
            ASMJIT_TLOG("[%05d] Unreachable\n", node->getFlowId());
            compiler->removeNode(node);
          }
          node = next;
        } while (node != end);
      }
    }

    link = link->getNext();
  }

  return kErrorOk;
}
Beispiel #13
0
 bool Interval::operator<(const Interval & b) const {
   if(getStart() == b.getStart()){
     return (getStop() < b.getStop());
   }
   return (getStart() < b.getStart());
 }
Beispiel #14
0
 bool Interval::overlaps(const Interval & b, bool strand_specific){
   if(getStrand() == b.getStrand() || getStrand() == BOTH || b.getStrand() == BOTH || !strand_specific){
     return (getStart() < b.getStop() && b.getStart() < getStop());
   }
   return false;
 }
Beispiel #15
0
void SinglePlotThread::run()
{
#if 0
	// event gathering
	//printchannel();	//for Debug
	mutex.lock();
	mynode.plot	= m_plot;
	chid unit_chid;
	dbr_string_t units;
	QString unitch = m_pvname + ".EGU";
	ca_create_channel(unitch.toStdString().c_str(), 0, 0, 0, &unit_chid);
	ca_pend_io(0.1);
	ca_get(DBR_STRING, unit_chid, (void *)&units);
	ca_pend_io(0.1);
	m_plot->SetUnit(units);

	ca_create_channel(m_pvname.toStdString().c_str(), connectionCallback, &mynode, 0, (oldChannelNotify**)&mynode.mychid);
	ca_replace_access_rights_event(mynode.mychid, accessRightsCallback);
	ca_create_subscription (DBR_TIME_DOUBLE, 0, mynode.mychid, DBE_VALUE|DBE_ALARM, eventCallback, &mynode, &mynode.myevid);
	//ca_add_event(DBR_GR_DOUBLE, mynode.mychid, eventCallback, &mynode, &mynode.myevid);
	mutex.unlock();
	ca_pend_event(0.0);
#else
	//periodic gathering
	mutex.lock();
	chid unit_chid, val_chid;
	dbr_string_t units;

	QString unitch = m_pvname + ".EGU";
	ca_create_channel(unitch.toStdString().c_str(), 0, 0, 0, &unit_chid); ca_pend_io(0.2);
	ca_get(DBR_STRING, unit_chid, (void *)&units); ca_pend_io(0.2);
	m_plot->SetUnit(units);

	struct dbr_time_double data;
	ca_create_channel(m_pvname.toStdString().c_str(), 0, 0, 0, &val_chid);
	ca_pend_io(0.2);

	epicsTime  stamp;

	struct local_tm_nano_sec tm;
	int totsec = 0;
	//for periodic single plot local time
	int year, month, day, hour, min, sec;
	int factor = 1;
	switch(mperiodic)
	{
		case PointOne:
			factor *= 0.1;
			break;
		case PointFive:
			factor *= 0.5;
			break;
		case FiveSec:
			factor *= 5;
			break;
		case TenSec:
			factor *= 10;
			break;
		case OneSec:
		default:
			break;
	};
	while(getStop()==false)
	{
		ca_get(DBR_TIME_DOUBLE, val_chid, (void *)&data);
		ca_pend_io(0.2);
		//qDebug("%s : %f\n",ca_name(val_chid), data.value);
		Epoch2Datetime(year, month, day, hour, min, sec);
#if 0
		stamp = data.stamp;
		tm = (local_tm_nano_sec) stamp;
		totsec = tm.ansi_tm.tm_hour*3600+tm.ansi_tm.tm_min*60+tm.ansi_tm.tm_sec;
		m_plot->GetValue(data.value, totsec,tm.ansi_tm.tm_year,tm.ansi_tm.tm_mon, tm.ansi_tm.tm_mday );
#else
		totsec = hour*3600+min*60+sec;
		m_plot->GetValue(data.value, totsec, year, month, day);
#endif
		usleep(1000000*factor);
	};
	//ca_clear_channel(unit_chid);
	//ca_clear_channel(val_chid);
	ca_context_destroy();
	mutex.unlock();
	exit();
	qDebug("SinglePlot Exit");
#endif
}
Beispiel #16
0
void TimeBase::getSegment(TimeValue &startTime, TimeValue &stopTime, const TimeScale scale) const {
	startTime = getStart(scale);
	stopTime = getStop(scale);
}
Beispiel #17
0
void EnergyMonitor::timeChanged(const TimeValue currentTime) {
	if (currentTime == getStop()) {
		PegasusEngine *vm = (PegasusEngine *)g_engine;
		if (vm->getEnergyDeathReason() != -1)
			vm->die(vm->getEnergyDeathReason());
	} else {
		uint32 currentEnergy = kMaxJMPEnergy - currentTime;

		EnergyStage newStage;
		if (currentEnergy > kWorriedEnergy)
			newStage = kStageCasual;
		else if (currentEnergy > kNervousEnergy)
			newStage = kStageWorried;
		else if (currentEnergy > kPanicStrickenEnergy)
			newStage = kStageNervous;
		else
			newStage = kStagePanicStricken;

		if (_stage != newStage) {
			uint32 newFrame;

			switch (newStage) {
			case kStageCasual:
				_barColor = g_system->getScreenFormat().RGBToColor(0x48, 0xB0, 0xD8);
				newFrame = kFrameLightOff;
				break;
			case kStageWorried:
				_barColor = g_system->getScreenFormat().RGBToColor(0xD8, 0xC0, 0x30);
				newFrame = kFrameLightYellow;
				break;
			case kStageNervous:
				_barColor = g_system->getScreenFormat().RGBToColor(0xD8, 0x78, 0x38);
				newFrame = kFrameLightOrange;
				break;
			case kStagePanicStricken:
				_barColor = g_system->getScreenFormat().RGBToColor(0xD8, 0x40, 0x38);
				newFrame = kFrameLightRed;
				break;
			default:
				error("no stage in energy monitor?");
				break;
			}

			_stage = newStage;
			uint32 oldFrame = _energyLight.getCurrentFrameIndex();

			if (!_calibrating) {
				if (oldFrame > newFrame || oldFrame == 0xffffffff || _dontFlash) {
					_energyLight.setCurrentFrameIndex(newFrame);
					_dontFlash = false;
				} else {
					_lightBlinker.startBlinking(&_energyLight, oldFrame, newFrame, 4, 1, 3);
					triggerRedraw();
				}
			}
		}

		Common::Rect r;
		calcLevelRect(r);
		if (r != _levelRect) {
			_levelRect = r;
			triggerRedraw();
		}
	}
}