Exemplo n.º 1
0
TEST(MAIN, FollowerActions){

  //Telling what is possible to do
  
  struct : FollowingAction {
    int i;
    void Do(){i++;};
  } flw;

  flw.i = 0;
  int a = 3;
  float b = 3.0;
  V3f c( 1.0, 1.1, 1.2);

  ResetFollowers();
  Watch(&a, &flw); Watch(&b, &flw); Watch(&c, &flw);

  EXPECT_EQ(flw.i, 0);

  KickFollowers(); 

  EXPECT_EQ(flw.i, 3);

  KickFollowers(); 
  KickFollowers(); 
  KickFollowers(); 

  EXPECT_EQ(flw.i, 3);

};
Exemplo n.º 2
0
void DebuggerTree::OnDereferencePointer(wxCommandEvent& event)
{
    WatchTreeData* data = static_cast<WatchTreeData*>(m_pTree->GetItemData(m_pTree->GetSelection()));
    Watch* w = data ? data->m_pWatch : 0;
    if (w)
        m_Watches.Add(Watch(_T('*') + w->keyword));
    else
    {
        wxString itemtext = m_pTree->GetItemText(m_pTree->GetSelection());
        m_Watches.Add(Watch(_T('*') + itemtext.BeforeFirst(_T('='))));
    }
    NotifyForChangedWatches();
}
Exemplo n.º 3
0
	bool InotifyDir::Watch(const char* path)
	{
		if (m_wfd == -1)
		{
			return false;
		}

		struct stat statbuff;

		stat(path, &statbuff);

		if (!statbuff.st_mode & S_IFDIR)
		{
			return false;
		}

		int wd = inotify_add_watch(m_wfd, path,
			IN_MODIFY | IN_MOVE | IN_CREATE | IN_DELETE | IN_MOVE_SELF);

		if (wd < 0)
		{
			return false;
		}

		m_watchFd[wd] = path;

		if (*m_watchFd[wd].rbegin() != '/')
		{
			m_watchFd[wd].push_back('/');
		}

		struct dirent* item;

		DIR* dir = opendir(path);

		if (dir == NULL)
		{
			close(wd);
			return false;
		}

		while ((item = readdir(dir)) != NULL)
		{
			if (strcmp(item->d_name, ".") == 0
				|| strcmp(item->d_name, "..") == 0)
			{
				continue;
			}

			if (item->d_type == DT_DIR)
			{
				std::string s = m_watchFd[wd] + item->d_name;
				Watch(s.c_str());
			}
		}

		closedir(dir);
		return true;
	}
Exemplo n.º 4
0
void DebuggerTree::AddWatch(const wxString& watch, WatchFormat format, bool notify)
{
    if (FindWatchIndex(watch, format) != wxNOT_FOUND)
        return; // already there
    m_Watches.Add(Watch(watch, format));
    m_Watches.Sort(SortWatchesByName);

    if (notify)
        NotifyForChangedWatches();
}
Exemplo n.º 5
0
//
// CProcessTracker::RunL
//
// Called when the process exits
//
void CProcessTracker::RunL()
{
    // sometimes this is run when the process has yet to exit
    if (iProcess.ExitType() == EExitPending)
    {
        iProcess.LogonCancel(iStatus);
        Watch();
    }
    else
    {
        iToolsProcess->ProcessDied(iProcess.ExitReason());
    }
}
Exemplo n.º 6
0
void SQDbgServer::RemoveWatch(int id)
{
	WatchSetItor itor=_watches.find(Watch(id,_SC("")));
	if(itor==_watches.end()){
		BeginDocument();
		BeginElement(_SC("error"));
			Attribute(_SC("desc"),_SC("the watch does not exists"));
		EndElement(_SC("error"));
	EndDocument();
	}
	else{
		_watches.erase(itor);
		scprintf(_SC("removed watch %d\n"),id);
	}
}
Exemplo n.º 7
0
void DebuggerTree::OnWatchThis(wxCommandEvent& event)
{
    m_Watches.Add(Watch(_T("*this")));
    NotifyForChangedWatches();
}
Exemplo n.º 8
0
DWORD WINAPI ThreadProc(LPVOID lpParameter)
{
	auto p=(fileMonitor*)lpParameter;
	p->Watch();
	return 0;
}
Exemplo n.º 9
0
OP_STATUS PosixSelectorBase::Watch(int fd, Type mode, unsigned long, PosixSelectListener *listener, const OpSocketAddress* connect)
{
	return Watch(fd, mode, listener, connect, false);
}
Exemplo n.º 10
0
Dispatcher::Watch& Dispatcher::GetWatch(Connection* c) {
    Data::Map::iterator it = d_->map_.find(c);
    if (it == d_->map_.end())
        it = d_->map_.emplace(c, Watch()).first;
    return it->second;
}