Example #1
0
  inline int operator () (EArgs&&... args) // O(n)
  {
    if(slots.empty())
      return default_return_value;
    auto it = slots.cbegin(), end = slots.cend();
    auto prev = slots.cbefore_begin();
    while(it != end)
    {
      try
      {
        (it->second)(std::forward<EArgs>(args)...);
        prev = it;
        ++it;
      }
      catch(slot_remove)
      {
        it = slots.erase_after(prev);
      }
      catch(signal_return e)
      {
        return e.get();
      }
    }

    return default_return_value;
  }
		void runDeferred(DeferredHandler f) {
			__EVENTEMITTER_LOCK_GUARD(mutex);
			auto it = deferredQueue.cbegin();
			auto prevIt = deferredQueue.cbefore_begin();
			for(; it != deferredQueue.cend(); prevIt = it, ++it);
			deferredQueue.emplace_after(prevIt, std::move(f));
		}
Example #3
0
inline void save(
    Archive & ar,
    const std::forward_list<U, Allocator> &t,
    const unsigned int file_version
){
    const collection_size_type count(std::distance(t.cbegin(), t.cend()));
    boost::serialization::stl::save_collection<
        Archive,
        std::forward_list<U, Allocator>
    >(ar, t, count);
}
Example #4
0
	int remove_follower(const std::string& base, const std::string& filter)
	{
		SteamWorks::Logging::Logger& log = SteamWorks::Logging::getLogger("steamworks.pulley");
		log.debugStream() << "Looking for SyncRepl base=" << base << " filter=" << filter;

#ifndef NDEBUG
		for(auto it = m_following.cbegin(); it != m_following.cend(); it++)
		{
			auto& f = *it;
			log.debugStream() << "  .. SyncRepl @" << (void *)f.get() << " base=" << f->base() << " filter=" << f->filter();
		}
#endif

		m_following.remove_if([&](const SyncReplUPtr& f) { return (f->base() == base) && (f->filter() == filter); });
		return 0;
	}
Example #5
0
 inline bool disconnect(connection_type con) // O(n)
 {
     auto it = slots.cbegin(), end = slots.cend();
     auto prev = slots.cbefore_begin();
     while(it != end)
     {
         if(it == con)
         {
             slots.erase_after(prev);
             return true;
         }
         prev = it;
         ++it;
     }
     return false;
 }
Example #6
0
 inline connection_type connect(long priority, Slot&& f) // O(n)
 {
     auto prev = slots.cbefore_begin(),
             next = slots.cbegin(),
             end = slots.cend();
     while(next != end)
     {
         // <=
         if(priority < next->first)
         {
             return slots.insert_after(prev, std::make_pair(priority, std::move(f)));
         }
         prev = next;
         ++next;
     }
     return slots.insert_after(prev, std::make_pair(priority, std::move(f)));
 }
Example #7
0
// Wait until a process in the given list has begun. The function checks whether any are running and if none are,
// sleeps for half a second before trying again. If a process is found to be active it will be returned. The wait
// can also be interrupted by a CTRL + SHIFT + END key hit. If that happens, the function returns the end iterator.
std::forward_list<HOOK_TCHARSTR>::const_iterator procWaitLoop(const std::forward_list<HOOK_TCHARSTR> &procList)
{
	auto start(procList.cbegin());
	auto end(procList.cend());
	auto iter(Hook::checkProcessActive(start, end));

	while (iter == end)
	{
		std::this_thread::sleep_for(std::chrono::milliseconds(500));

		if (GetAsyncKeyState(VK_CONTROL) && GetAsyncKeyState(VK_END) && GetAsyncKeyState(VK_SHIFT))
		{
			break;
		}

		iter = Hook::checkProcessActive(start, end);
	}

	return iter;
}
Example #8
0
	unsigned int count_followers()
	{
		return std::distance(m_following.cbegin(), m_following.cend());
	}
void good_emplace_front_forward_list1(std::forward_list<int> &FL, int n) {
  auto i0 = FL.cbegin(), i1 = FL.cend();
  FL.emplace_front(n);
  *i0; // no-warning
}