当前位置: 首页>>代码示例>>C++>>正文


C++ FILE_LOG函数代码示例

本文整理汇总了C++中FILE_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ FILE_LOG函数的具体用法?C++ FILE_LOG怎么用?C++ FILE_LOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FILE_LOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: enumerate_moves

/**
 *
 * Execute the best play
 *
 * */
zet Agent::play(board& b,bool player){
	this->playing_color = player;
	if (lapse(get_generator())){
		std::vector<zet> s = enumerate_moves(b,player); 
		int rn_n = std::uniform_int_distribution<int>(0,s.size()-1)(get_generator());
		FILE_LOG(logDEBUG)<<" * lapsing - returning random move" <<std::endl;
		return s[rn_n];
	}
	std::vector<zet> s = solve(b,player); 
	FILE_LOG(logDEBUG)<<"Playing for player "<<((player==BLACK)?"BLACK":"WHITE")<< " there are "<< s.size() <<" moves" << std::endl;
	FILE_LOG(logDEBUG)<<" board is :" <<b<<std::endl;
	if(s.empty()){
		FILE_LOG(logERROR)<<" board with no moves "<<b <<std::endl;
	}
	assert(!s.empty());
	zet r;
	//std::random_shuffle(s.begin(),s.end());
	if (player == BLACK || is_negamax()){
		r=*std::max_element(s.begin(),s.end(),[](const zet& z1, const zet& z2 ){ return z1.val < z2.val;});
	} else{
		r=*std::min_element(s.begin(),s.end(),[](const zet& z1, const zet& z2 ){ return z1.val < z2.val;});
	}
	FILE_LOG(logDEBUG)<<((player==BLACK)?"BLACK":"WHITE")<<" playes move "<<r.zet_id<<" with value:"<<r.val <<std::endl;
	return r;
}
开发者ID:zahybnaya,项目名称:mnk,代码行数:30,代码来源:agent.cpp

示例2: FILE_LOG

void CPortmap::freePorts(San2::Utils::CProducerConsumer<std::shared_ptr<San2::Network::CCapsule> > *applicationQueue)
{
    FILE_LOG(logDEBUG4) << "CPortmap::freePorts():: freeing ports \n";
    // thanks to http://stackoverflow.com/questions/4600567/c-deleting-elements-with-iterator

    std::function<bool (std::pair<unsigned short int, San2::Utils::CProducerConsumer<std::shared_ptr<San2::Network::CCapsule> >*>)> shouldDelete = [applicationQueue] (std::pair<unsigned short int, San2::Utils::CProducerConsumer<std::shared_ptr<San2::Network::CCapsule> >*> pair) -> bool
    {
        return pair.second == applicationQueue;
    };

    std::map<unsigned short int, San2::Utils::CProducerConsumer<std::shared_ptr<San2::Network::CCapsule> >*>::iterator itr = mapPorts.begin();
    while (itr != mapPorts.end())
    {
        if (shouldDelete(*itr))
        {
            std::map<unsigned short int, San2::Utils::CProducerConsumer<std::shared_ptr<San2::Network::CCapsule> >*>::iterator toErase = itr;
            ++itr;
            mapPorts.erase(toErase);
            FILE_LOG(logDEBUG4) << "CPortmap::freePorts():: port has been freed OK\n";
        }
        else
        {
            ++itr;
        }
    }
}
开发者ID:slechta,项目名称:san2,代码行数:26,代码来源:cportmap.cpp

示例3: FILE_LOG

void ColaTopologyAddon::handleResizes(const cola::Resizes& resizeList,
        unsigned n, std::valarray<double>& X, std::valarray<double>& Y, 
        cola::CompoundConstraints& ccs, vpsc::Rectangles& boundingBoxes,
        cola::RootCluster* clusterHierarchy)
{
    FILE_LOG(cola::logDEBUG) << "ColaTopologyAddon::handleResizes()...";
    if(topologyNodes.empty()) {
        COLA_ASSERT(topologyRoutes.empty());
        return;
    }
    // all shapes to be resized are wrapped in a ResizeInfo and
    // placed in a lookup table, resizes, indexed by id
    ResizeMap resizes;
    for(cola::Resizes::const_iterator r=resizeList.begin();r!=resizeList.end();++r) {
        topology::ResizeInfo ri(topologyNodes[r->getID()],r->getTarget());
        resizes.insert(std::make_pair(r->getID(),ri));
    }
    vpsc::Variables xvs, yvs;
    vpsc::Constraints xcs, ycs;
    cola::setupVarsAndConstraints(n, ccs, vpsc::HORIZONTAL, boundingBoxes,
            clusterHierarchy, xvs, xcs, X);
    cola::setupVarsAndConstraints(n, ccs, vpsc::VERTICAL, boundingBoxes,
            clusterHierarchy, yvs, ycs, Y);
    topology::applyResizes(topologyNodes, topologyRoutes, clusterHierarchy,
            resizes, xvs, xcs, yvs, ycs);
    for_each(xvs.begin(), xvs.end(), delete_object());
    for_each(yvs.begin(), yvs.end(), delete_object());
    for_each(xcs.begin(), xcs.end(), delete_object());
    for_each(ycs.begin(), ycs.end(), delete_object());
    FILE_LOG(cola::logDEBUG) << "ColaTopologyAddon::handleResizes()... done.";
}
开发者ID:atis--,项目名称:adaptagrams,代码行数:31,代码来源:cola_topology_addon.cpp

示例4: asCreateScriptEngine

bool CommonAPI::InitAS()
{
	engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
	engine->SetMessageCallback(asFUNCTION(MessageCallback), 0, asCALL_CDECL);
	RegisterStdString(engine);

	RegisterAPI();

	CScriptBuilder builder;

	if(builder.StartNewModule(engine, "MyModule") < 0)
		FILE_LOG(logERROR) << "Unrecoverable error while starting a new module.";

	string scriptPath = exePath.substr(0, exePath.find_last_of(".")).append(".tes");

	if(builder.AddSectionFromFile(scriptPath.c_str()) < 0)
		FILE_LOG(logERROR) << "Unable to load script." << scriptPath;
	else
		FILE_LOG(logINFO) << "Script " << scriptPath << " loaded successfully.";

	if(builder.BuildModule() < 0)
		FILE_LOG(logERROR) << "Please correct the errors in the script and try again.";

	
	module = engine->GetModule("MyModule");

	return true;
}
开发者ID:lenny93,项目名称:TouchEnabler,代码行数:28,代码来源:common.cpp

示例5: FILE_LOG

Measurement::Measurement(Picoscope *p)
{
	FILE_LOG(logDEBUG3) << "Measurement::Measurement (Picoscope=" << p << ")";

	int i;

	picoscope = p;
	trigger = NULL;
	is_triggered = false;
	max_memory_consumption    = 0;
	max_trace_length_to_fetch = 0;
	ntraces = 1;
	max_traces_to_fetch = 1;
	timebase_reported_by_osciloscope = 0.0;
	use_signal_generator = false;
	rate_per_second = 0.0;

	for(i=0; i<GetNumberOfChannels(); i++) {
		// initialize the channels
		FILE_LOG(logDEBUG4) << "Measurement::Measurement - initialize channel nr. " << i;
		channels[i]=new Channel(i, this);
		data[i] = NULL;
		data_allocated[i] = false;
		data_length[i] = 0;
	}
	// only a temporary setting; this needs to be fixed if more than a single channel is enabled
	timebase = 0UL;
}
开发者ID:enascimento,项目名称:picoscope,代码行数:28,代码来源:measurement.cpp

示例6: answer

FeedbackState::FeedbackState(const string &text): answer("", App::white, 1, TXT_BLEND), suggestion("", App::white, 1, TXT_BLEND){
	name = "Feedback";
	instruction = string("Press Enter to Continue.");
//	this->text = string(text);
	
	FILE_LOG(logDEBUG3) << "FeedbackState cstruct " << text;
	result = App::get()->judge.calcScore(text);
	/*
	screen_text.push_back(Text(text, App::white));
	screen_text.push_back(Text(result.answer, App::white));
	screen_text.push_back(Text(result.suggestion, App::white));
	*/
//	FILE_LOG(logDEBUG3) << "FeedbackState cstruct " << screen_text[1].getText();
	stringstream s;
	s << "Score: " << result.score;
	caption.setText(s.str());
	
	answer.setText(result.answer);
	suggestion.setText(result.suggestion);

	FILE_LOG(logDEBUG3) << "FeedbackState cstruct " << caption.getText();
	App::get()->judge.talk = 600;
	App::get()->judge.head_nod = 700 -2*result.score;
	
}
开发者ID:jomoho,项目名称:10SecondPitch,代码行数:25,代码来源:FeedbackState.cpp

示例7: string

void Store::_initDB()
{
    string connectionString = string(_ndbConnectString) + ":" + to_string(_ndbPort);
    setenv("NDB_CONNECTSTRING", connectionString.c_str(), 1);
    
    ndb_init();

    //_mysql.reset(new MYSQL[_noExecutorThreads], ArrayDeleter<MYSQL>());

    _clusterConnections.reset(new Ndb_cluster_connection[_totalClusterConnections], ArrayDeleter<Ndb_cluster_connection>());

    for (int i = 0; i < _totalClusterConnections; i++)
    {
        if(_clusterConnections.get()[i].connect(12, 5, 1) != 0)
        {
            FILE_LOG(logERROR)<<"Failed to connect to ndb cluster connection no "<<i+1;
            exit(EXIT_FAILURE);
        }
    }
    
   FILE_LOG(logINFO)<<"Initialzing NDB ";
    
//    _initNDB(_ndbDefiners, _noDefinerThread);
    _initNDB(_ndbExecutors, _noExecutorThreads);
    
   FILE_LOG(logINFO)<<"NDB Initialzed";
    
    NDBMessageExecutor::initialize(_mysql.get(), _ndbExecutors.get(), &_tableInfoCache);
//    NDBMessageProcessor::initialize(_ndbDefiners.get(), &_tableInfoCache);

}
开发者ID:dc-sics,项目名称:VoloDB,代码行数:31,代码来源:Store.cpp

示例8: FILE_LOG

  void MCMCModel::setCriteria(randEngine& eng)
  {
    CriteriaFactory mCFactory;

    for(size_t i = 0; i<nParticles; ++i)
      {
	mCrit.push_back(mCFactory.create(mParameters.crit_name,&mGP[i]));
	mCrit[i].setRandomEngine(eng);

	if (mCrit[i].nParameters() == mParameters.crit_params.size())
	  {
	    mCrit[i].setParameters(mParameters.crit_params);
	  }
	else // If the number of parameters is different, use default.
	  {
	    if (mParameters.crit_params.size() != 0)
	      {
		FILE_LOG(logERROR) << "Expected " << mCrit[i].nParameters() 
				   << " parameters. Got " 
				   << mParameters.crit_params.size() << " instead.";
	      }
	    FILE_LOG(logINFO) << "Using default parameters for criteria.";
	  }
      }
  } // setCriteria
开发者ID:MLDL,项目名称:bayesopt,代码行数:25,代码来源:posterior_mcmc.cpp

示例9: FILE_LOG

void Consensus::initialize(const vector<Point2f> & points_normalized)
{
    FILE_LOG(logDEBUG) << "Consensus::initialize() call";

    //Copy normalized points
    this->points_normalized = points_normalized;

    size_t num_points = points_normalized.size();

    //Create matrices of pairwise distances/angles
    distances_pairwise = Mat(num_points, num_points, CV_32FC1);
    angles_pairwise = Mat(num_points, num_points, CV_32FC1);

    for (size_t i = 0; i < num_points; i++)
    {
        for (size_t j = 0; j < num_points; j++)
        {
            Point2f v = points_normalized[i] - points_normalized[j];

            float distance = norm(v);
            float angle = atan2(v.y,v.x);

            distances_pairwise.at<float>(i,j) = distance;
            angles_pairwise.at<float>(i,j) = angle;
        }

    }

    FILE_LOG(logDEBUG) << "Consensus::initialize() return";
}
开发者ID:ArminPCM,项目名称:OpenCMToolTracking,代码行数:30,代码来源:Consensus.cpp

示例10: main

int main(int argc, char* argv[])
{
  try
    {
      // levels: logERROR, logWARNING, logINFO, logDEBUG, 
      // logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4
      
      //
      // Set a reporting level
      //
      FILELog::ReportingLevel() = FILELog::FromString("DEBUG4");

      //
      // Set an output file
      //
      FILE* pFile = fopen("application.log", "a");
      Output2FILE::Stream() = pFile;

      const int count = 3;
      FILE_LOG(logDEBUG) << "A loop with " << count << " iterations";
      for (int i = 0; i != count; ++i)
        {
	  FILE_LOG(logDEBUG1) << "the counter i = " << i;
        }
      return 0;
    }
  catch(const std::exception& e)
    {
      FILE_LOG(logERROR) << e.what();
    }
  return -1;
}
开发者ID:sburke56,项目名称:example_code,代码行数:32,代码来源:main.cpp

示例11: bayes_optimization_disc

int bayes_optimization_disc(int nDim, eval_func f, void* f_data,
			    double *valid_x, size_t n_points,
			    double *x, double *minf, bopt_params parameters)
{
  vectord result(nDim);
  vectord input(nDim);
  vecOfvec xSet;

  for(size_t i = 0; i<n_points;++i)
    {
      for(int j = 0; j<nDim; ++j)
	{
	 input(j) = valid_x[i*nDim+j]; 
	}
      xSet.push_back(input);
    }

  if(parameters.n_init_samples > n_points)
    {
      parameters.n_init_samples = n_points;
      parameters.n_iterations = 0;
    }

  try
    {
      CDiscreteModel optimizer(xSet,parameters);
      
      optimizer.set_eval_funct(f);
      optimizer.save_other_data(f_data);
      optimizer.optimize(result);

      std::copy(result.begin(), result.end(), x);

      *minf = optimizer.getValueAtMinimum();
    }
  catch (std::bad_alloc& e)
    {
      FILE_LOG(logERROR) << e.what(); 
      return  BAYESOPT_OUT_OF_MEMORY; 
    }
  catch (std::invalid_argument& e)
    { 
      FILE_LOG(logERROR) << e.what(); 
      return BAYESOPT_INVALID_ARGS; 
    }
  catch (std::runtime_error& e)
    { 
      FILE_LOG(logERROR) << e.what(); 
      return BAYESOPT_RUNTIME_ERROR;
    }
  catch (...)
    { 
      FILE_LOG(logERROR) << "Unknown error";
      return BAYESOPT_FAILURE; 
    }

  return 0; /* everything ok*/
}
开发者ID:mathkann,项目名称:bayesopt,代码行数:58,代码来源:bayesoptwpr.cpp

示例12: memset

	// TODO: socket closing in open() and receive(), add cleanup() and destructor again
	TcpErrorCode CTcpClient::open()
	{
		if (m_sock != SNET_BADSOCKET) SNET_SOCKCLOSE(m_sock);
		m_sock = SNET_BADSOCKET;
		struct addrinfo hints, *servinfo, *p;
		int ret;

		memset(&hints, 0, sizeof hints);
		hints.ai_family = AF_INET; // force IPv4
		hints.ai_socktype = SOCK_STREAM;

		if ((ret = getaddrinfo(m_ip.c_str(), m_port.c_str(), &hints, &servinfo)) != 0) 
		{
            #ifdef LINUX
			    FILE_LOG(logDEBUG3) << "CTcpClient::open():getaddrinfo: " << gai_strerror(ret);
            #endif

            #ifdef WINDOWS
                FILE_LOG(logDEBUG3) << "CTcpClient::open():getaddrinfo: WSAGetLastError() " <<  WSAGetLastError();
            #endif

			return TcpErrorCode::FAILURE;
		}

		// loop through all the results and connect to the first we can
		for(p = servinfo; p != NULL; p = p->ai_next) 
		{
			if ((m_sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) 
			{
				FILE_LOG(logDEBUG3) << "CTcpClient::open():socket()" << strerror(errno);
				continue;
			}

			if (connect(m_sock, p->ai_addr, p->ai_addrlen) == -1) 
			{
				san_cleanup_socket(&m_sock);
				// perror("client: connect");
				continue;
			}

			break;
		}

		if (p == NULL) 
		{
			// FILE_LOG(logDEBUG3) << "CTcpClient::open(): failed to connect";
			san_cleanup_socket(&m_sock);
			return TcpErrorCode::FAILURE;
		}

		// inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), s, sizeof s);
		// printf("client: connecting to %s\n", s);

		freeaddrinfo(servinfo); // all done with this structure

		//close(m_sock);
		return TcpErrorCode::SUCCESS;
	}
开发者ID:SmartActiveNode2,项目名称:san2,代码行数:59,代码来源:ctcpclient.cpp

示例13: FILE_LOG

	void CLIENT::netHandler::connect(char *remoteIPAddress, unsigned short serverPort) {
		FILE_LOG(logINFO) << "Connecting to " << remoteIPAddress << ":" << serverPort;
		bool tryingToConnect;
		tryingToConnect = peer->Connect(remoteIPAddress, serverPort, 0, 0, 0) == RakNet::CONNECTION_ATTEMPT_STARTED;
		if (tryingToConnect == false)
		{
			FILE_LOG(logINFO) << "Client wont start connecting?";
		}
	}
开发者ID:remcoplasmeyer,项目名称:client_server_practice,代码行数:9,代码来源:netHandler.cpp

示例14: FILE_LOG

Agent* Agent_builder::create_instance(std::string type){

	FILE_LOG(logDEBUG) << " Creating instance of agent from type "<<type<<std::endl;
	if (agent_constructors.find(type)==agent_constructors.end()){
		FILE_LOG(logERROR)<< " Cannot create agent of type ["<<type<<"]"<< std::endl;
		exit(-1);
	}
	Agent *a=agent_constructors[type]();
	return a;
}
开发者ID:zahybnaya,项目名称:mnk,代码行数:10,代码来源:agent_builder.cpp

示例15: concrete

/***
 * Look for the values of ?? and fills it with the relevant data
 * Suggestion: ?<index>{lower,upper}
 * */
inline void concrete(Agent_params& ap,double* paramptr){
	FILE_LOG(logDEBUG) << "starting concrete " << std::endl;
	for (properties::iterator i = ap.m_properties.begin(); i != ap.m_properties.end(); ++i) {
		if(is_concrete_param(i->second)){
			FILE_LOG(logDEBUG) << "need to concrete: ["<<i->first << "] with value:" << i->second<< std::endl; 
			ap.m_properties[i->first]=assigned_val(i->second,paramptr);
			FILE_LOG(logDEBUG) << " concrete-assgined ("<< ap.m_properties[i->first]<<")"<< std::endl;
	       	}

	}
}
开发者ID:zahybnaya,项目名称:mnk,代码行数:15,代码来源:mexfunction.cpp


注:本文中的FILE_LOG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。