Beispiel #1
0
 bool stringScan(const std::string & src, const std::string & pattern, std::deque<std::string> & result){
   result.clear();
   std::deque<size_t> positions;
   size_t pos = pattern.find("%", 0);
   while (pos != std::string::npos){
     positions.push_back(pos);
     pos = pattern.find("%", pos + 1);
   }
   if (positions.size() == 0){
     return false;
   }
   size_t sourcePos = 0;
   size_t patternPos = 0;
   std::deque<size_t>::iterator posIter = positions.begin();
   while (sourcePos != std::string::npos){
   //Match first part of the string
     if (pattern.substr(patternPos, *posIter - patternPos) != src.substr(sourcePos, *posIter - patternPos)){
       break;
     }
     sourcePos += *posIter - patternPos;
     std::deque<size_t>::iterator nxtIter = posIter + 1;
     if (nxtIter != positions.end()){
       patternPos = *posIter+2;
       size_t tmpPos = src.find(pattern.substr(*posIter+2, *nxtIter - patternPos), sourcePos);
       result.push_back(src.substr(sourcePos, tmpPos - sourcePos));
       sourcePos = tmpPos;
     }else{
       result.push_back(src.substr(sourcePos));
       sourcePos = std::string::npos;
     }
     posIter++;
   }
   return result.size() == positions.size();
 }
Beispiel #2
0
void AI::obedientZombie(int index, std::deque<int> myOrders)
{
  int x, y, humanIndex, wallIndex;
  Zombie* me = &zombies[index];

  switch (myOrders.front())
  {
  case 0:
    x = nextX(me->x(), me->y(), me->facing());
    y = nextY(me->x(), me->y(), me->facing());
    humanIndex = getHuman(x, y);
    if (humanIndex > -1)
    {
      myOrders.clear();
      me->attack(humans[humanIndex]);
    }
    else
      me->move();
    break;
  case 1:
    me->turn(-1);
    break;
  case 2:
    me->turn(1);
    break;
  }

  if (myOrders.size() > 0)
    myOrders.pop_front();
  if (myOrders.size() > 0)
    orders[me->id()] = myOrders;
  else
    orders.erase(me->id());
  
}
Beispiel #3
0
 virtual void doWork()
 {
     //osg::Timer timer;
     //size_t objcount = mObjects.size();
     mObjects.clear();
     //std::cout << "cleared " << objcount << " objects in " << timer.time_m() << std::endl;
 }
void cHpiSubProviderIdr::GetEntries( std::deque<HpiEntry>& entries ) const
{
    entries.clear();

    SaErrorT rv;

    SaHpiEntryIdT id = SAHPI_FIRST_ENTRY, next_id;
    bool first = true;
    while( id != SAHPI_LAST_ENTRY ) {
        SaHpiIdrAreaHeaderT ahdr;
        rv = saHpiIdrAreaHeaderGet( m_ctx.session_id,
                                    m_ctx.resource_id,
                                    m_ctx.instrument_id,
                                    SAHPI_IDR_AREATYPE_UNSPECIFIED,
                                    id,
                                    &next_id,
                                    &ahdr );
        if ( first && ( rv == SA_ERR_HPI_NOT_PRESENT ) ) {
            break;
        }

        if ( rv != SA_OK ) {
            return;
        }

        std::wstring name;
        MakeNameForIdrArea( ahdr, name );
        entries.push_back( HpiEntry( eHpiEntryIdrArea, ahdr.AreaId, name ) );

        first = false;
        id = next_id;
    }
}
Beispiel #5
0
int main() {
    FILE*fp=stdin;
    if (dbg) {
        fp = fopen ("in-624.txt", "r");
    }
    
    while (fscanf(fp,"%d%d", &limit, &nSongs)==2) {
        tracks.clear();
        for (int i=0; i<nSongs; i++) {
            int trk;
            fscanf(fp, "%d", &trk);
            tracks.push_back(trk);
        }
        
        maxLength=0;
        maxq.clear();
        
        // now search max
        deque<int> choice;
        for (int i=0; i<nSongs; i++)
            dfs (choice, i, 0);

        for (int i=0; i<maxq.size(); i++)
            printf ("%d ", maxq[i]);
        printf("sum:%d\n", maxLength);
    }
    
    return 0;
}
 void partition_resolver_simple::handle_pending_requests(std::deque<request_context_ptr>& reqs, error_code err)
 {
     for (auto& req : reqs)
     {
         if (err == ERR_OK)
         {
             rpc_address addr;
             err = get_address(req->partition_index, addr);
             if (err == ERR_OK)
             {
                 end_request(std::move(req), err, addr);
             }
             else
             {
                 call(std::move(req), true);
             }
         }
         else if (err == ERR_HANDLER_NOT_FOUND)
         {
             end_request(std::move(req), err, rpc_address());
         }
         else
         {
             call(std::move(req), true);
         }
     }
     reqs.clear();
 }
Beispiel #7
0
 void do_stop (CompletionCounter)
 {
     m_journal.debug << "Stopped";
     m_stopped = true;
     m_work.clear ();
     m_resolver.cancel ();
     removeReference ();
 }
	void TriggerScriptParam::clear()
	{
		m_isEnter.clear();
		m_names.clear();
		m_sources.clear();
		m_targets.clear();
		m_sourcesCount.clear();
		m_targetsCount.clear();
	}
Beispiel #9
0
/**
**  Game will start now.
*/
void NetworkOnStartGame()
{
	ThisPlayer->SetName(Parameters::Instance.LocalPlayerName);
	for (int i = 0; i < HostsCount; ++i) {
		Players[Hosts[i].PlyNr].SetName(Hosts[i].PlyName);
	}
	DebugPrint("Updates %d, Lag %d, Hosts %d\n" _C_
			   CNetworkParameter::Instance.gameCyclesPerUpdate _C_
			   CNetworkParameter::Instance.NetworkLag _C_ HostsCount);

	NetworkInSync = true;
	CommandsIn.clear();
	MsgCommandsIn.clear();
	// Prepare first time without syncs.
	for (int i = 0; i != 256; ++i) {
		for (int p = 0; p != PlayerMax; ++p) {
			for (int j = 0; j != MaxNetworkCommands; ++j) {
				NetworkIn[i][p][j].Clear();
			}
		}
	}
	CNetworkCommandSync nc;
	//nc.syncHash = SyncHash;
	//nc.syncSeed = SyncRandSeed;

	for (unsigned int i = 0; i <= CNetworkParameter::Instance.NetworkLag; i += CNetworkParameter::Instance.gameCyclesPerUpdate) {
		for (int n = 0; n < HostsCount; ++n) {
			CNetworkCommandQueue(&ncqs)[MaxNetworkCommands] = NetworkIn[i][Hosts[n].PlyNr];

			ncqs[0].Time = i;
			ncqs[0].Type = MessageSync;
			ncqs[0].Data.resize(nc.Size());
			nc.Serialize(&ncqs[0].Data[0]);
			ncqs[1].Time = i;
			ncqs[1].Type = MessageNone;
		}
	}
	memset(NetworkSyncSeeds, 0, sizeof(NetworkSyncSeeds));
	memset(NetworkSyncHashs, 0, sizeof(NetworkSyncHashs));
	memset(PlayerQuit, 0, sizeof(PlayerQuit));
	memset(NetworkLastFrame, 0, sizeof(NetworkLastFrame));
	memset(NetworkLastCycle, 0, sizeof(NetworkLastCycle));
}
void cHpiSubProviderFUMIComponent::GetInfo( std::deque<HpiInfo>& info ) const
{
    info.clear();

    // TODO bank id == bank num?
    Line( info, L"Bank Num", m_ctx.bank_num, UI8_SaHpiBankNum );

    GetComponentInfo( info );
    GetLogicalComponentInfo( info );
}
Beispiel #11
0
bool RegionWellsReader::loadNextRegion(std::deque<int> &wellX, std::deque<int> &wellY, std::deque<std::vector<float> > &wellMeasurements, int &iRegion)
{
  wellX.clear();
  wellY.clear();
  wellMeasurements.clear();

  pthread_mutex_lock(read_mutex);
  int Y = std::min(nextRegionY*sizeRegionY,(int)wells->NumRows());
  int X = std::min(nextRegionX*sizeRegionX,(int)wells->NumCols());
  int nY = ((nextRegionY+1)*sizeRegionY);
  int nX = ((nextRegionX+1)*sizeRegionX);
  wells->SetChunk(Y, std::min(nY-Y,(int)wells->NumRows() - Y),
                  X, std::min(nX-X,(int)wells->NumCols() - X),
                  0, wells->NumFlows());
  wells->ReadWells();
  if (nextRegionX >= numRegionsX) {
    pthread_mutex_unlock(read_mutex);
    return false; // All regions read already
  }
  iRegion = nextRegionY + numRegionsY * nextRegionX;
  for (int nextY = nextRegionY * sizeRegionY; (nextY < (nextRegionY + 1) * sizeRegionY) && (nextY < sizeY); nextY++) {
   for (int nextX = nextRegionX * sizeRegionX; (nextX < (nextRegionX + 1) * sizeRegionX) && (nextX < sizeX); nextX++) {
      wellX.push_back(nextX);
      wellY.push_back(nextY);
      wellMeasurements.push_back(std::vector<float>());
      wellMeasurements.back().resize(numFlows);
      const WellData *w = wells->ReadXY(nextX, nextY);
      copy(w->flowValues, w->flowValues + numFlows, wellMeasurements.back().begin());
    }
  }

  nextRegionY++;
  if (nextRegionY == numRegionsY) {
    nextRegionY = 0;
    nextRegionX++;
  }

  pthread_mutex_unlock(read_mutex);

  return true; // Region reading successful

}
Beispiel #12
0
void clearAnimation()
{
	level = 0;
	nCurrentLevel = 1;
	nNextLevel = 0;
	t = 0.0;

	triangles.clear();
	vertices.clear();
	directions.clear();
} // end function clearCurrentAnimation
Beispiel #13
0
void YN_Init()
{
    static int IsInit = 0;

    if (IsInit == 0)
    {
        s_UserLoginInfoQueue.clear();
        IsInit = 1;
        s_s32LoginID = 0;
    }
}
bool MLPClass::checkPattern(std::deque<double> inPattern, double &mlpVal, double threshold)
{
	USES_CONVERSION;

	char msgBuf[MAX_PATH];
	std::string msgStr;

	if(m_openCV_MLP==NULL)
	{
		return -1.0;
	}
	
	float _testSample[MLP_NO_OF_INPUT_LAYERS];
	CvMat testSample_mat = cvMat(1, MLP_NO_OF_INPUT_LAYERS, CV_32FC1, _testSample);
	float _classificationResult[MLP_NO_OF_OUTPUT_LAYERS];
	CvMat classificationResult_mat = cvMat(1, MLP_NO_OF_OUTPUT_LAYERS, CV_32FC1, _classificationResult);

	if(inPattern.size()!=MLP_NO_OF_INPUT_LAYERS)
	{
		inPattern.clear();
		return -1;
	}

	for(int i=0; i<MLP_NO_OF_INPUT_LAYERS; i++)
	{
		testSample_mat.data.fl[i] = inPattern[i];
	}
	inPattern.clear();		

	m_openCV_MLP->predict(&testSample_mat, &classificationResult_mat);		// run neural network prediction
	mlpVal = classificationResult_mat.data.fl[0];

	if(mlpVal>=threshold)
	{
		return true;
	}
	else
	{
		return false;
	}
}
Beispiel #15
0
    //-------------------------------------------------------------------------
    // Resolver
    void do_stop (CompletionCounter)
    {
        assert (m_stop_called == true);

        if (m_stopped.exchange (true) == false)
        {
            m_work.clear ();
            m_resolver.cancel ();

            removeReference ();
        }
    }
    // ------------------------------------------------------------------------
    void addAndSetTime(uint32_t ping, uint64_t server_time)
    {
        if (m_synchronised.load() == true)
            return;

        if (m_force_set_timer.load() == true)
        {
            m_force_set_timer.store(false);
            m_synchronised.store(true);
            STKHost::get()->setNetworkTimer(server_time + (uint64_t)(ping / 2));
            return;
        }

        const uint64_t cur_time = StkTime::getMonoTimeMs();
        // Discard too close time compared to last ping
        // (due to resend when packet loss)
        // 10 packets per second as seen in STKHost
        const uint64_t frequency = (uint64_t)((1.0f / 10.0f) * 1000.0f) / 2;
        if (!m_times.empty() &&
            cur_time - std::get<2>(m_times.back()) < frequency)
            return;

        // Take max 20 averaged samples from m_times, the next addAndGetTime
        // is used to determine that server_time if it's correct, if not
        // clear half in m_times until it's correct
        if (m_times.size() >= 20)
        {
            uint64_t sum = std::accumulate(m_times.begin(), m_times.end(),
                (uint64_t)0, [cur_time](const uint64_t previous,
                const std::tuple<uint32_t, uint64_t, uint64_t>& b)->uint64_t
                {
                    return previous + (uint64_t)(std::get<0>(b) / 2) +
                        std::get<1>(b) + cur_time - std::get<2>(b);
                });
            const int64_t averaged_time = sum / 20;
            const int64_t server_time_now = server_time + (uint64_t)(ping / 2);
            int difference = (int)std::abs(averaged_time - server_time_now);
            if (std::abs(averaged_time - server_time_now) <
                UserConfigParams::m_timer_sync_difference_tolerance)
            {
                STKHost::get()->setNetworkTimer(averaged_time);
                m_times.clear();
                m_force_set_timer.store(false);
                m_synchronised.store(true);
                Log::info("NetworkTimerSynchronizer", "Network "
                    "timer synchronized, difference: %dms", difference);
                return;
            }
            m_times.erase(m_times.begin(), m_times.begin() + 10);
        }
        m_times.emplace_back(ping, server_time, cur_time);
    }
Beispiel #17
0
bool RegionWellsReader::loadRegion(std::deque<int> &wellX, std::deque<int> &wellY, std::deque<std::vector<float> > &wellMeasurements,
    int regionX, int regionY, Mask *mask)
{
  if ((regionX >= numRegionsX) || (regionY >= numRegionsY))
    return false;

  wellX.clear();
  wellY.clear();
  wellMeasurements.clear();
  pthread_mutex_lock(read_mutex);
  int Y = std::min(regionY*sizeRegionY,(int)wells->NumRows());
  int X = std::min(regionX*sizeRegionX,(int)wells->NumCols());
  int nY = ((regionY+1)*sizeRegionY);
  int nX = ((regionX+1)*sizeRegionX);
  wells->SetChunk(Y, std::min(nY-Y,(int)wells->NumRows() - Y),
                  X, std::min(nX-X,(int)wells->NumCols() - X),
                  0, wells->NumFlows());
  wells->ReadWells();
  for (int nextY = regionY * sizeRegionY; (nextY < (regionY + 1) * sizeRegionY) && (nextY < sizeY); nextY++) {
    for (int nextX = regionX * sizeRegionX; (nextX < (regionX + 1) * sizeRegionX) && (nextX < sizeX); nextX++) {

      if (!mask->Match(nextX, nextY, MaskTF) && !mask->Match(nextX, nextY, MaskLib))
        continue;

      wellX.push_back(nextX);
      wellY.push_back(nextY);
      wellMeasurements.push_back(std::vector<float>());
      wellMeasurements.back().resize(numFlows);


      const WellData *w = wells->ReadXY(nextX, nextY);
      copy(w->flowValues, w->flowValues + numFlows, wellMeasurements.back().begin());

    }
  }
  pthread_mutex_unlock(read_mutex);
  return true; // Region reading successful

}
Beispiel #18
0
template <typename Item> inline bool
threaded_queue<Item>::pop_all(std::deque<Item> &data) {
	data.clear();
	boost::mutex::scoped_lock lock(mutex_);
	while (!finished_ && items_.empty()) {
		condition_.wait(lock);
	}
	if (finished_) {
		return false;
	}
	items_.swap(data);
	return true;
}
void RunVisualizationOnly() {
	pcl::visualization::PCLVisualizer viewer("SfMToyLibrary Viewe");
    	
	viewer.registerKeyboardCallback (keyboardEventOccurred, (void*)&viewer);
	
    while (!viewer.wasStopped ())
    {
		if (show_cloud) {
			cout << "Show cloud: ";
			if(cloud_to_show_name != "") {
				cout << "show named cloud " << cloud_to_show_name << endl;
				viewer.removePointCloud(cloud_to_show_name);
				viewer.addPointCloud(cloud,cloud_to_show_name);
			} else {
				if(show_cloud_A) {
					cout << "show cloud A" << endl;
					viewer.removePointCloud("orig");
					viewer.addPointCloud(cloud,"orig");
				} else {
					cout << "show cloud B" << endl;
					viewer.removePointCloud("orig");
					viewer.addPointCloud(cloud1,"orig");
				}
			}
			show_cloud = false;
		}
		if(cam_meshes.size() > 0) {
			int num_cams = cam_meshes.size();
			cout << "showing " << num_cams << " cameras" << endl;
			while(cam_meshes.size()>0) {
				viewer.removeShape(cam_meshes.front().first);
				viewer.addPolygonMesh(cam_meshes.front().second,cam_meshes.front().first);
				cam_meshes.pop_front();
			}
		}
		if(linesToShow.size() > 0) {
			cout << "showing " << linesToShow.size() << " lines" << endl;
			while(linesToShow.size()>0) {
				vector<Matrix<float,6,1> > oneline = linesToShow.front().second;
				pcl::PointXYZRGB	A(oneline[0][3],oneline[0][4],oneline[0][5]),
									B(oneline[1][3],oneline[1][4],oneline[1][5]);
				for(int j=0;j<3;j++) {A.data[j] = oneline[0][j]; B.data[j] = oneline[1][j];}
				viewer.removeShape(linesToShow.front().first);
				viewer.addLine<pcl::PointXYZRGB,pcl::PointXYZRGB>(A,B,linesToShow.front().first);
				linesToShow.pop_front();
			} 
			linesToShow.clear();
		}
		viewer.spinOnce();
    }
}	
void cHpiSubProviderEntity::GetEntries( std::deque<HpiEntry>& entries ) const
{
    entries.clear();

    GetEntityEntries( entries );
    GetResourceEntries( entries );
    GetInstrumentEntries( SAHPI_CTRL_RDR, entries );
    GetInstrumentEntries( SAHPI_SENSOR_RDR, entries );
    GetInstrumentEntries( SAHPI_INVENTORY_RDR, entries );
    GetInstrumentEntries( SAHPI_WATCHDOG_RDR, entries );
    GetInstrumentEntries( SAHPI_ANNUNCIATOR_RDR, entries );
    GetInstrumentEntries( SAHPI_DIMI_RDR, entries );
    GetInstrumentEntries( SAHPI_FUMI_RDR, entries );
}
Beispiel #21
0
 void clear() {
     active = false;
     for (size_t i=0; i<threads.size(); i++) {
         produce.post();
     }
     for (std::list<MessageStackThread *>::iterator it = threads.begin(); it != threads.end(); ++it) {
         (*it)->stop();
         delete (*it);
         *it = YARP_NULLPTR;
     }
     threads.clear();
     msgs.clear();
     active = true;
 }
 void start() {
     std::lock_guard<std::recursive_mutex> api_lock(api_mutex_);
     if (is_running_) {
         return;
     }
     is_running_ = true;
     requires_stop_ = false;
     // Clear all works
     {
         std::lock_guard<std::mutex> lock(works_mutex_);
         works_.clear();
     }
     thread_ = std::thread(&serial_dispatcher::execute, this);
 }
Beispiel #23
0
//quits the game and clears all associated memory and clears round score. notifies observers
void Model::quit()
{
    tableC.clear();
    tableD.clear();
    tableH.clear();
    tableS.clear();
    winners.clear();
    roundScores = "";
    currentPlayer=-1;
    for(int i = 0; i<CARD_COUNT; i++){
        delete cards_[i];
    }
    notify();
}
void cHpiSubProviderWatchdog::GetInfo( std::deque<HpiInfo>& info ) const
{
    info.clear();

    SaErrorT rv;
    SaHpiRdrT rdr;
    rv = saHpiRdrGetByInstrumentId( m_ctx.session_id,
                                    m_ctx.resource_id,
                                    SAHPI_WATCHDOG_RDR,
                                    m_ctx.instrument_id,
                                    &rdr );
    if ( rv != SA_OK ) {
        Line( info, L"saHpiRdrGetByInstrumentId failed", rv, I32_SaError );
        return;
    }

    Line( info, L"Resource Id", m_ctx.resource_id, UI32_SaHpiResourceId );
    Line( info, L"Entity", rdr.Entity );
    Line( info, L"IsFru", rdr.IsFru, UI8_SaHpiBool );

    const SaHpiWatchdogRecT& wr = rdr.RdrTypeUnion.WatchdogRec;

    Line( info, L"Watchdog Num", wr.WatchdogNum, UI32_SaHpiWatchdogNum );
    Line( info, L"OEM", wr.Oem );
    Line( info, L"IdString", rdr.IdString );

    SaHpiWatchdogT w;
    rv = saHpiWatchdogTimerGet( m_ctx.session_id,
                                m_ctx.resource_id,
                                m_ctx.instrument_id,
                                &w );
    if ( rv != SA_OK ) {
        Line( info, L"saHpiWatchdogTimerGet failed", rv, I32_SaError );
        return;
    }

    Line( info, L"Current Settings and Configuration", L"" );
    Line( info, L"  Log", w.Log, UI8_SaHpiBool );
    Line( info, L"  Running", w.Running, UI8_SaHpiBool );
    Line( info, L"  Timer Use", w.TimerUse );
    Line( info, L"  Timer Action", w.TimerAction );
    Line( info, L"  Pre-Timer Interrupt", w.PretimerInterrupt );
    Line( info, L"  Pre-Timeout Interval, ms", w.PreTimeoutInterval );
    Line( info, L"  Timer Use Expiration Flags",
          w.TimerUseExpFlags,
          UI8_SaHpiWatchdogExpFlags );
    Line( info, L"  Initial Count", w.InitialCount );
    Line( info, L"  Present Count", w.PresentCount );
}
/**
 * Converts std::deque to Java array.
 * @param std::deque<CppHibernateJObject *>& objects Stores the constraints for CppHibernateRestrictions::in() method. The specified deque is cleared
 * during the method call.
 * @return jobject Returns the Java array. The returned object must be deleted when the job is done.
 * @throw Throws exceptions when JNI encounters exceptions.
 */
jobject CppHibernateRestrictions::convertFrom(
		std::deque<CppHibernateJObject*> & objects) {
	int size = objects.size();
	jclass objectClass = this->env->FindClass("java/lang/Object");
	jobjectArray array = this->env->NewObjectArray(objects.size(), objectClass,
			NULL);
	this->checkAndThrow();
	int i;
	for (i = 0; i < size; i++) {
		this->env->SetObjectArrayElement(array, i, objects[i]->getObj());
		this->checkAndThrow();
	}
	objects.clear();
	return this->env->NewGlobalRef(array);
}
Beispiel #26
0
 int reverse(int x) {
   digits.clear();
   auto copy = x;
   while (copy != 0) {
     digits.push_back(copy % 10);
     copy /= 10;
   }
   long long sum = 0;
   for (auto &digit: digits) {
     sum *= 10;
     sum += digit;
   }
   if (sum > INT_MAX || sum < INT_MIN) return 0;
   else return static_cast<int>(sum);
 }
Beispiel #27
0
size_t ScrollAdapterBase::GetVisibleItems(
    cursespp::ScrollableWindow* window,
    size_t desiredTopIndex,
    std::deque<EntryPtr>& target)
{
    size_t actualTopIndex = desiredTopIndex;

    /* ensure we have enough data to draw from the specified position
    to the end. if we don't try to back up a bit until we can fill
    the buffer */
    int totalHeight = (int) this->height;
    int entryCount = (int) this->GetEntryCount();

    /* we assume the general case -- we're some where in the middle of the
    list. we'll start from the specified first item and work our way down */
    for (int i = (int) desiredTopIndex; i < entryCount && totalHeight > 0; i++) {
        EntryPtr entry = this->GetEntry(window, i);
        entry->SetWidth(this->width);
        totalHeight -= entry->GetLineCount();
        target.push_back(entry);
    }

    /* however, if the list is short, we can actually draw more items above
    the specified one. let's work our way backwards! */
    if (totalHeight > 0) {
        target.clear();

        totalHeight = this->height;
        int i = GetEntryCount() - 1;
        while (i >= 0 && totalHeight >= 0) {
            EntryPtr entry = this->GetEntry(window, i);
            entry->SetWidth(this->width);

            int lines = entry->GetLineCount();
            if (lines > totalHeight) {
                break; /* this Entry won't fit. bail. */
            }

            totalHeight -= lines;
            target.push_front(entry);
            --i;
        }

        actualTopIndex = i + 1;
    }

    return actualTopIndex;
}
void cHpiSubProviderReset::GetInfo( std::deque<HpiInfo>& info ) const
{
    info.clear();

    Line( info, L"Resource Id", m_ctx.resource_id, UI32_SaHpiResourceId );

    SaErrorT rv;
    SaHpiResetActionT reset_action;

    rv = saHpiResourceResetStateGet( m_ctx.session_id, m_ctx.resource_id, &reset_action );
    if ( rv != SA_OK ) {
        Line( info, L"saHpiResourceResetStateGet failed", rv, I32_SaError );
        return;
    }

    Line( info, L"State", reset_action );
}
Beispiel #29
0
void CwCheatScreen::CreateCodeList() {
	cheatEngine2 = new CWCheatEngine();
	cheatList = cheatEngine2->GetCodesList();
	bEnableCheat.clear();
	formattedList_.clear();
	for (size_t i = 0; i < cheatList.size(); i++) {
		if (cheatList[i].substr(0, 3) == "_C1") {
			formattedList_.push_back(cheatList[i].substr(4));
			bEnableCheat.push_back(true);
		}
		if (cheatList[i].substr(0, 3) == "_C0") {
			formattedList_.push_back(cheatList[i].substr(4));
			bEnableCheat.push_back(false);
		}
	}
	delete cheatEngine2;
}
void FastTrailsApp::setup()
{
	// initialize camera
	CameraPersp cam( getWindowWidth(), getWindowHeight(), 60.0f, 0.1f, 500.0f );
	cam.setEyePoint( Vec3f(0, 0, -100.0f) );
	cam.setCenterOfInterestPoint( Vec3f::zero() );

	mCamera.setCurrentCam( cam );

	// load texture
	try { mTexture = gl::Texture( loadImage( loadAsset("gradient.png") ) ); }
	catch( const std::exception &e ) { console() << e.what() << std::endl; }

	// create VBO mesh
	gl::VboMesh::Layout layout;
	layout.setDynamicPositions();
	layout.setStaticIndices();
	layout.setStaticTexCoords2d();

	mVboMesh = gl::VboMesh( TRAIL_LENGTH, TRAIL_LENGTH, layout, GL_TRIANGLE_STRIP );

	// observation: indices and texture coordinates never change
	std::vector< uint32_t >	indices;	indices.reserve( TRAIL_LENGTH );
	std::vector< Vec2f >	texcoords;	texcoords.reserve( TRAIL_LENGTH );
	for( size_t i=0; i<TRAIL_LENGTH; ++i ) {
		indices.push_back( i );

		float x = math<float>::floor( i * 0.5f ) / ( TRAIL_LENGTH * 0.5f );
		float y = float( i % 2 );
		texcoords.push_back( Vec2f( x, y ) );
	}

	// create index and texture coordinate buffers
	mVboMesh.bufferIndices( indices );
	mVboMesh.bufferTexCoords2d( 0, texcoords );

	// clear our trail buffer
	mTrail.clear();
	
	// initialize time and angle
	mTime = getElapsedSeconds();
	mAngle= 0.0f;

	// disable vertical sync, so we can see the actual frame rate
	gl::disableVerticalSync();
}