예제 #1
0
    //p* as in physics*
    bool PhysicsModelManager::onAgentLinkedToModel(Agent *agent, ModelId pmid)
    {
        Ogre::String intro = logName() + "::onLinked(): ";

        PhysicsModel *pmodel = at(pmid);
#ifdef DEBUG
        assert(agent->modelId(ModelType::PHYSICS) == pmid);
        assert(agent->model(ModelType::PHYSICS) == pmodel);
#endif

        ModelId omid = agent->ogreModelId();

        if(INVALID_ID == omid)
        {
            Debug::error(intro)("Invalid OgreModel id for agent ")(agent->id()).endl();
            return false;
        }

        OgreModel *omodel = mLevel->ogreModelMan()->at(omid);
        pmodel->init(mWorld, omodel);
        pmodel->setUserPointer(agent);

        // stop the physics simulation in case the agent is selected
        pmodel->setSelected(agent->isSelected());

        return true;
    }
예제 #2
0
파일: xtrun.cpp 프로젝트: reenigne/reenigne
    void run()
    {
        if (_arguments.count() < 2) {
            console.write("Syntax: " + _arguments[0] +
                " <input file name>\n");
            return;
        }

        String fileName = _arguments[1];
        Array<Byte> data;
        String contents = File(fileName, true).contents();

        String logName("nul");

        AutoStream s = File("\\\\prospero\\pipe\\xtserver", true).openPipe();
        s.write<int>(0);                        // emailLength
        s.write(String(""));                    // email
        s.write<int>(fileName.length());        // fileNameLength
        s.write(fileName);                      // fileName
        s.write<int>(contents.length());        // dataLength
        s.write(contents);                      // data
        s.write<DWORD>(GetCurrentProcessId());  // serverPId
        s.write<int>(logName.length());         // logFileLength
        s.write(logName);                       // logFile
        s.write<int>(4);                        // command

        do {
            int b = s.tryReadByte();
            if (b == -1)
                break;
            console.write<Byte>(b);
        } while (true);
    }
예제 #3
0
ExeTask::ExeTask(RemoteCLI* svr, ExeTaskTreeNode* parent, std::string workName, int nameLine, std::string bhvname, RFSMtask* task, ModelBinder* tmPlugin, int exeType, int callstmtLine, unsigned int tp)
:ExeTaskTreeNode(parent, svr, workName, nameLine, task->getBlockID(), task->getFileName(), callstmtLine, tp)
{
	m_tmPlugin = tmPlugin;

	m_task				= task;
	m_startBehavior		= bhvname;
	m_behaviorTAB		= NULL;
	m_connTAB			= NULL;
//	m_outModelTAB		= new ValueMap();
	m_wVarTAB			= new ValueMap();
	m_monitorOff		= true;
	m_monCount			= 0;

	std::string logName("ExeTask-");
	logName.append(workName);

	if(TaskConfig::getIsTaskLog()){
		m_logFile = new LogFile((char*)(logName.c_str()), TaskConfig::getLogSize());
		m_logFile->setLevel( Log::LOG_LEVEL_DEBUG, true);
		m_logFile->setLevel( Log::LOG_LEVEL_TRACE, true);
		m_logFile->setLevel( Log::LOG_LEVEL_ERROR, true);
	}
	else{
		m_logFile = NULL;
	}

	pthread_cond_init(&m_SLEEPstmt_wakeup_cond, NULL);
	pthread_mutex_init(&m_SLEEPstmt_wakeup_mu, NULL);


	m_runner = new TaskRunner(this, tmPlugin, m_logFile);
	if(exeType == DEBUG){
		m_runner->setAsDebugMode();
	}
	else if(exeType == MONITOR){
		m_runner->setAsMonitorMode();
	}

	//이걸 여기서 초기화 하는 것은 LogFile  매개변수 전달 때문이다.
	//if(m_tmPlugin->isSimul()) m_tmPlugin->initSimul(m_logFile);
	
	m_running = false;

#ifdef _WIN32
	m_TimerQueue = CreateTimerQueue();
#endif
}
예제 #4
0
void CRUCache::FixupLogTblReference(CRUTbl *pTbl)
{
	const CDSString &catName = pTbl->GetCatName();
	const CDSString &schName = pTbl->GetSchName();
	CDDSchema *pddSch = GetDDSchemaByName(catName, schName);

	// Compose the IUD log table's name
	CDSString logName(pTbl->GetLogShortName(CRUTbl::iudNmspPrefix));
		
	CDDTable *pddLogTable = GetDDIUDLogTableByName(pddSch, logName);

	// Dummy fetch, just force DDOL to fetch the data
	pddLogTable->GetColumnList();

	pTbl->FixupIUDLogTbl(pddLogTable);
}
예제 #5
0
CDSString CRUTbl::GetLogFullName(const CDSString &nmsp, BOOL useNmsp)
{
	CDSString logName("");
	
	if (TRUE == useNmsp)
	{
		logName += "TABLE(" + nmsp + "_TABLE ";
	}

	logName += 
		GetCatName() + "." + GetSchName() + "." 
		+ GetLogShortName(nmsp);

	if (TRUE == useNmsp)
	{
		logName += ")";
	}

	return logName;
}
예제 #6
0
bool Logger::initialize(bool writeToConsole, bool writeToFile, Timer* timer) {
	Logger::writeToConsole = writeToConsole;
	Logger::writeToFile = writeToFile;
	Logger::timer = timer;

	if (writeToFile) {
		char buffer[80];
		strftime(buffer, 80, "%d-%m-%Y_%I:%M:%S.log", timer->getCurrentTime());

		std::string logName(buffer);
        logName = "SubZero/logs/" + logName;

		logFile.open(logName.c_str());
		if (!logFile.is_open()) {
			std::cout << "Unable to create log file." << std::endl;
			return false;
		}
	}

	return true;

}
예제 #7
0
 void setUp() 
 {
    try 
    {
       dtCore::SetDataFilePathList(dtCore::GetDeltaDataPathList());
       std::string logName("UtilTests");
 
       logger = &dtUtil::Log::GetInstance();
       //logger->SetLogLevel(dtUtil::Log::LOG_DEBUG);
         
       //ensure the example library is unloaded.
       dtDAL::LibraryManager::GetInstance().UnloadActorRegistry(mExampleLibraryName);
 
    }
    catch (const dtUtil::Exception& e)
    {
       CPPUNIT_FAIL((std::string("Error: ") + e.What()).c_str());
    }
    catch (const std::exception& e)
    {
       CPPUNIT_FAIL((std::string("Error: ") + e.what()).c_str());
    }    
 }
예제 #8
0
파일: nownext.cpp 프로젝트: WMFO/rivendell
void LogPlay::SendNowNext()
{
  QTime end_time;
  QTime time;
  int now_line=-1;
  RDLogLine *logline[2];
  RDLogLine *ll;
  RDLogLine *default_now_logline=NULL;
  RDLogLine *default_next_logline=NULL;

  //
  // Get NOW PLAYING Event
  //
  if(play_nownext_address.isNull()&&play_nownext_rml.isEmpty()&&
     (play_rlm_hosts->size()==0)) {
    return;
  }
  QString cmd=play_nownext_string;
  int lines[TRANSPORT_QUANTITY];
  int running=runningEvents(lines,false);
  for(int i=0;i<running;i++) {
    if((time=logLine(lines[i])->startTime(RDLogLine::Actual).
	addMSecs(logLine(lines[i])->effectiveLength()))>end_time) {
      end_time=time;
      now_line=lines[i];
    }
  }
  if((now_line>=0)&&(logLine(now_line)->nowNextEnabled())) {
    logline[0]=logLine(now_line);
  }
  else {
    if(play_now_cartnum==0) {
      logline[0]=NULL;
    }
    else {
      default_now_logline=new RDLogLine(play_now_cartnum);
      logline[0]=default_now_logline;
    }
  }

  //
  // Get NEXT Event
  //
  logline[1]=NULL;
  for(int i=nextLine();i<size();i++) {
    if((ll=logLine(i))!=NULL) {
      if((ll->status()==RDLogLine::Scheduled)&&
	 logLine(i)->nowNextEnabled()&&(!logLine(i)->asyncronous())) {
	logline[1]=logLine(i);
	i=size();
      }
    }
  }
  if((logline[1]==NULL)&&(play_next_cartnum!=0)) {
    default_next_logline=new RDLogLine(play_next_cartnum);
    logline[1]=default_next_logline;
  }

  //
  // Process and Send It
  //
  unsigned nowcart=0;
  unsigned nextcart=0;
  if(logline[0]!=NULL) {
    if(!logline[0]->asyncronous()) {
      nowcart=logline[0]->cartNumber();
    }
  }
  if(logline[1]!=NULL) {
    nextcart=logline[1]->cartNumber();
  }
  if((nowcart==play_prevnow_cartnum)&&(nextcart==play_prevnext_cartnum)) {
    return;
  }
  if(logline[0]==NULL) {
    play_prevnow_cartnum=0;
  }
  else {
    play_prevnow_cartnum=logline[0]->cartNumber();
  }
  if(logline[1]==NULL) {
    play_prevnext_cartnum=0;
  }
  else {
    play_prevnext_cartnum=logline[1]->cartNumber();
  }
  QString svcname=play_svc_name;
  if(svcname.isEmpty()) {
    svcname=play_defaultsvc_name;
  }
  for(unsigned i=0;i<play_rlm_hosts->size();i++) {
    play_rlm_hosts->at(i)->
      sendEvent(svcname,logName().left(logName().length()-4),play_id,logline,
		play_onair_flag,play_op_mode);
  }
  RDResolveNowNext(&cmd,logline,0);
  play_nownext_socket->
    writeBlock(cmd,cmd.length(),play_nownext_address,play_nownext_port);

  cmd=play_nownext_rml;
  RDResolveNowNext(&cmd,logline,0);
  rdevent_player->exec(cmd);

  //
  // Clean up
  //
  if(default_now_logline!=NULL) {
    delete default_now_logline;
  }
  if(default_next_logline!=NULL) {
    delete default_next_logline;
  }
}
예제 #9
0
SymbianLog::SymbianLog(bool resetLog, const char* path, const char* name) 
{
    TInt err = KErrNone;
    
    const char* p = (path)? path : SYMBIAN_LOG_PATH;
    const char* n = (name)? name : SYMBIAN_LOG_NAME;
    
    // assign all the paths and names
    StringBuffer logName(p);
    logName += n;
    iLogName.Assign(charToNewBuf(logName.c_str()));
    
    StringBuffer rollName(logName);
    rollName += ".0";
    iRollLogName.Assign(charToNewBuf(rollName.c_str()));
    
    StringBuffer pathSb(p);
    iLogPathName.Assign(charToNewBuf(pathSb.c_str()));
    
    StringBuffer nameSb(n);
    iLogFileName.Assign(charToNewBuf(nameSb.c_str()));
    
    // try open log
    err = iSemaphore.OpenGlobal(KLogSemaphoreName);

    if (err == KErrNotFound) {
        // Create a semaphore, to avoid accessing the FileSystem at
        // the same time by different threads.
        // The semaphore is global, so that it could be used also by
        // other processes that (in future) will use this Log.
        err = iSemaphore.CreateGlobal(KLogSemaphoreName, 1);
        if (err != KErrNone) {
            setError(ERR_SEMAPHORE_CREATION, ERR_SEMAPHORE_CREATION_MSG);
        }
    }

    iSemaphore.Wait();
    
    // Connect to the file server session.
    fsSession.Connect();
    err = fsSession.ShareAuto();
    if (err != KErrNone) {
        setErrorF(err, "SymbianLog error: unable to share RFs session (code %d)", err);
        return;
    }
    
    // ensure path exists!
    BaflUtils::EnsurePathExistsL(fsSession, iLogPathName);
    
    if (resetLog) {
        err = file.Replace(fsSession, iLogName, EFileWrite|EFileShareAny);
        if (err != KErrNone) {
            setErrorF(err, "SymbianLog: could not open the log file '%ls'", iLogName.Ptr());
            return;
        }
        
        // Write the Header
        StringBuffer header = createHeader();
        RBuf8 data;
        data.Assign(stringBufferToNewBuf8(header));
        file.Write(data);
        data.Close();
        file.Close();
    }
    
    iSemaphore.Signal();
    return;
}