• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LOGGER函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: hasAggregation

/// Record an aggregation function.  Return a math term of the type
/// variable to the caller so the caller can continue to build up a larger
/// expression.  For simplicity, the variable name is simply "__hhh", where
/// "hhh" is the size of aggr_ in hexadecimal.
///
/// @note This function takes charge of expr.  It will free the object if
/// the object is not passed on to other operations.  This can happen when
/// the particular variable appeared already in the select clause.
ibis::math::variable*
ibis::selectClause::addAgregado(ibis::selectClause::AGREGADO agr,
                                ibis::math::term *expr) {
    if (agr != ibis::selectClause::NIL_AGGR &&
        hasAggregation(expr)) {
        LOGGER(ibis::gVerbose >= 0)
            << "Warning -- selectClause can not have aggregations inside "
            "another aggregation operation (" << *expr << ')';
        throw "selectClause::addAgregado failed due to nested aggregations"
            IBIS_FILE_LINE;
    }

    const unsigned end = atms_.size();
    LOGGER(ibis::gVerbose > 5)
        << "selectClause::addAgregado  -- adding term " << end << ": "
        << aggDescription(agr, expr);
    if (expr->termType() != ibis::math::VARIABLE) {
        aggr_.push_back(agr);
        atms_.push_back(expr);
        std::ostringstream oss;
        oss << "__" << std::hex << end;
        ordered_[oss.str()] = end;
        return new ibis::selectClause::variable(oss.str().c_str(), this);
    }
    else {
        ibis::math::variable *var = static_cast<ibis::math::variable*>(expr);
        ibis::selectClause::StringToInt::const_iterator it =
            ordered_.find(var->variableName());
        if (it == ordered_.end()) { // no in the existing list
            aggr_.push_back(agr);
            atms_.push_back(expr);
            ordered_[var->variableName()] = end;
            if (agr != ibis::selectClause::NIL_AGGR) {
                std::ostringstream oss;
                oss << "__" << std::hex << end;
                ordered_[oss.str()] = end;
                return new ibis::selectClause::variable
                    (oss.str().c_str(), this);
            }
            else {
                return var->dup();
            }
        }
        else if (agr != aggr_[it->second]) { // new aggregation
            aggr_.push_back(agr);
            atms_.push_back(expr);
            if (agr != ibis::selectClause::NIL_AGGR) {
                std::ostringstream oss;
                oss << "__" << std::hex << end;
                ordered_[oss.str()] = end;
                return new ibis::selectClause::variable
                    (oss.str().c_str(), this);
            }
            else {
                ordered_[var->variableName()] = end;
                return var->dup();
            }
        }
        else { // the variable has appeared before
            delete expr;
            std::ostringstream oss;
            oss << "__" << std::hex << it->second;
            return new ibis::selectClause::variable(oss.str().c_str(), this);
        }
    }
    return 0;
} // ibis::selectClause::addAgregado
开发者ID:CESNET,项目名称:libfastbit,代码行数:75,代码来源:selectClause.cpp


示例2: process_file_receive

/**
 * Processes a File Receive message from the client, 
 * performs and finalizes the operation
 *
 * @param proc_data_arg           data structure with connection parameters 
 *                                and received message
 */
void process_file_receive( PROCESS_DATA_T * proc_data ) {

  const int NOT_FOUND = -1;

  char * filename   = NULL;
  char l_msg[4096];

  char * request    = NULL;
  char * response   = NULL;

  int search_filename_res    = 0;
  unsigned long response_len = 0;

  int result = RESULT_UNDEFINED;
  const int param_len = (proc_data->received_msg_len - HEADER_LEN - strlen(PARAM_FILENAME));

  // Copies the request to a safe buffer for searching
  request = (char*)malloc(sizeof(char) * proc_data->received_msg_len + 1);
  memcpy(request, proc_data->received_message, proc_data->received_msg_len);
  request[proc_data->received_msg_len] = '\0';

  search_filename_res = STR_SEARCH( request, PARAM_FILENAME, HEADER_LEN);
  if ( search_filename_res == NOT_FOUND ) {

    result = RESULT_INVALID_REQUEST;
    goto END_PROCESS_FILE_RECEIVE;
  }
  
  // Gets name of file to send
  filename = (char*)malloc(sizeof(char) * proc_data->received_msg_len);
  memcpy( filename, &(request[ ( search_filename_res + strlen(PARAM_FILENAME) ) ]), param_len );
  filename[param_len] = '\0';

  sprintf(l_msg, "A request has been received to send the following file: %s", filename);
  LOGGER(__FUNCTION__, l_msg);

  //
  // Find, pack, and encode file
  //
  {
    long long filesize = file_size(filename);

    if ( ! file_exists(filename) || filesize <= 0 ) {

      LOGGER(__FUNCTION__, "No files have been found for the specified mask.");
      result = RESULT_FILE_NOT_FOUND;
    } else {

      char gzip_output[256];
      char b64_output[256];

      sprintf(gzip_output, ".\\%d-%lu.gz", proc_data->process_id, GetTickCount() );
      sprintf(b64_output, ".\\%d-%lu.b64", proc_data->process_id, GetTickCount() );

      if ( gz_pack_file(filename, gzip_output) == TRUE )
      {

        if ( base64_process_file('e', gzip_output, b64_output, filesize) == TRUE )
        {
          unsigned long bytes_read;
          char * buffer = NULL;
          FILE * f = NULL;

          filesize = file_size(b64_output);
          buffer = (char*)malloc(sizeof(char) * filesize + 1);
          memset(buffer, 0x00, filesize + 1);

          f = fopen(b64_output, "r");
          if (f != NULL)
          {
            bytes_read = fread(buffer, 1, filesize, f);

            sprintf(l_msg, "%lu bytes read from file %s to process and send.", bytes_read, b64_output);
            LOGGER(__FUNCTION__, l_msg);

            fclose(f);

            result = RESULT_SUCCESS;

            // Generates response message with file content
            response = message_file_receive_response( result, strlen(buffer), buffer, &response_len );

            // Sends a File Receive response message
            if ( !process_outgoing_message( proc_data->connection, response, response_len ) ) {
    
              LOGGER(__FUNCTION__, "File Receive message could not be sent.");
            }
            
            // Deletes generated temporary files
            remove(gzip_output);
            remove(b64_output);

            // Frees response
//.........这里部分代码省略.........
开发者ID:julianbachiller,项目名称:QuickFT,代码行数:101,代码来源:process.c


示例3: process_file_delete

/**
 * Processes a File Delete message from the client, 
 * performs and finalizes the operation
 *
 * @param proc_data_arg           data structure with connection parameters 
 *                                and received message
 */
void process_file_delete( PROCESS_DATA_T * proc_data ) {

  const int NOT_FOUND = -1;

  char * filename   = NULL;
  char l_msg[4096];

  char * request    = NULL;
  char * response   = NULL;

  unsigned long response_len  = 0;
  int search_filename_res     = 0;

  int result = RESULT_UNDEFINED;
  const int param_len = (proc_data->received_msg_len - HEADER_LEN - strlen(PARAM_FILENAME));

  // Copies the request to a safe buffer for searching
  request = (char*)malloc(sizeof(char) * proc_data->received_msg_len + 1);
  memcpy(request, proc_data->received_message, proc_data->received_msg_len);
  request[proc_data->received_msg_len] = '\0';

  // Gets name of file to delete
  search_filename_res = STR_SEARCH( proc_data->received_message, PARAM_FILENAME, HEADER_LEN);
  if ( search_filename_res == NOT_FOUND ) {

    result = RESULT_INVALID_REQUEST;
    goto END_PROCESS_FILE_DELETE;
  }

  filename = (char*)malloc(sizeof(char) * proc_data->received_msg_len);
  memcpy( filename, &(request[ ( search_filename_res + strlen(PARAM_FILENAME) ) ]), param_len );
  filename[param_len] = '\0';
  
  sprintf(l_msg, "A request has been received to delete the file: %s", filename);
  LOGGER(__FUNCTION__, l_msg);
  
  if (file_exists(filename) == TRUE) {
  
    if (file_delete(filename) == TRUE) {
    
      result = RESULT_SUCCESS;
    }
    else {
      result = RESULT_FILE_DELETE_ERROR;
    }    
  }
  else {
    result = RESULT_FILE_NOT_FOUND;
  }
    
  // Generates response message
  response = message_file_delete_response( result, &response_len );  

  // Sends response message
  if ( !process_outgoing_message( proc_data->connection, response, response_len ) ) {
    
    LOGGER(__FUNCTION__, "File Receive response message could not be sent.");
  }

END_PROCESS_FILE_DELETE:

  // Cleanup
  if (request != NULL) {
    free(request);
  }
  if (response != NULL) {
    free(response);
  }
  if (filename != NULL) {
    free(filename);
  }

  return;
}
开发者ID:julianbachiller,项目名称:QuickFT,代码行数:81,代码来源:process.c


示例4: stateOperatorControl

	void stateOperatorControl() {
		// DRIVING
		move = stick->GetRawAxis(1) * -1.0;
		rotate = stick->GetRawAxis(4) * -1.0;

		// Deadband
		if (fabs(move) < 0.1) {
			move = 0.0;
		}
		if (fabs(rotate) < 0.15) {
			rotate = 0.0;
		}
		drive->ArcadeDrive(move, rotate, false);

		// Joystick Buttons
		bool button4 = stick->GetRawButton(4);
		bool button1 = stick->GetRawButton(1);
		bool button5 = stick->GetRawButton(5);
		bool button6 = stick->GetRawButton(6);
		bool button3 = stick->GetRawButton(3);

		// Manual Gatherer
		if (stick->GetRawAxis(2) != 0) {
			gatherSpeed = stick->GetRawAxis(2);
			LOGGER(DEBUG) << "[stateOperatorControl] Gather Angle:" << gatherPIDSource.PIDGet();

		}
		else if (stick->GetRawAxis(3) != 0) {
			gatherSpeed = stick->GetRawAxis(3) * -1;
			LOGGER(DEBUG) << "[stateOperatorControl] Gather Angle:" << gatherPIDSource.PIDGet();
		}
		else {
			gatherSpeed = 0.0;
		}
		gatherer->Set(gatherSpeed);

		// Launch Angle
		double launcherAngle = launchPIDSource.PIDGet();
		if (button5 && !button6  && (launcherAngle < kLaunchMaxAngle)) {
			elevator->Set(-0.5); // Up
			LOGGER(DEBUG) << "[stateOperatorControl] Launcher Angle:" << launcherAngle;
		} else if (button6 && !button5 && (launcherAngle > kLaunchMinAngle)) {
			LOGGER(DEBUG) << "[stateOperatorControl] Launcher Angle:" << launcherAngle;
			elevator->Set(0.5); // Down
		} else {
			elevator->Set(0.0);
		}

		// Auto-Gather
		if (button3 && !lastButton3) {
			wheelsGathererIn = !wheelsGathererIn;
			gatherController->SetSetpoint(kGatherAngle);
			gatherController->Enable();
		}
		if (wheelsGathererIn) {
			gathererWheels->Set(1.0);
			gatherer->Set(gatherPIDOutput.correction);
			LOGGER(DEBUG) << "[stateOperatorControl] Gather Correction:" << gatherPIDOutput.correction
					      << " Gather Angle: " << gatherPIDSource.PIDGet();
		} else {
			gathererWheels->Set(0.0);
			gatherController->Disable();
		}

		if (button4 && !lastButton4) {
			stateTimer   = 0;
			robotState   = kCentering;
			shootingHigh = true;
		}
		if (button1 && !lastButton1) {
			stateTimer   = 0;
			robotState   = kLaunching;
			shootingHigh = true;
		}
		lastButton4 = button4;
		lastButton1 = button1;
		lastButton3 = button3;
	}
开发者ID:FRC2240,项目名称:Nova2016Redux,代码行数:78,代码来源:Robot.cpp


示例5: MCFG_CPU_PERIODIC_INT_DRIVER

	MCFG_CPU_PERIODIC_INT_DRIVER(midcoin24cdjuke_state, irq0_line_hold, 500)

	MCFG_DEFAULT_LAYOUT(layout_24cdjuke)

	MCFG_DEVICE_ADD("ic11", I8255A, 0)
	MCFG_I8255_IN_PORTA_CB(IOPORT("MD1"))
	MCFG_I8255_IN_PORTB_CB(IOPORT("MD2"))
	MCFG_I8255_IN_PORTC_CB(IOPORT("MD3"))

	MCFG_DEVICE_ADD("ic25", I8255A, 0)
	MCFG_I8255_IN_PORTB_CB(IOPORT("PB"))
	MCFG_I8255_IN_PORTC_CB(READ8(midcoin24cdjuke_state, kb_row_r))
	MCFG_I8255_OUT_PORTC_CB(WRITE8(midcoin24cdjuke_state, kb_col_w))

	MCFG_DEVICE_ADD("ic31", I8255A, 0)
	MCFG_I8255_OUT_PORTB_CB(LOGGER("PPI8255 - unmapped write port B", 0))
	MCFG_I8255_IN_PORTC_CB(IOPORT("MD4"))
MACHINE_CONFIG_END


ROM_START( 24cdjuke )
	ROM_REGION( 0x4000, "maincpu", 0 )
	ROM_LOAD( "1.ic5", 0x0000, 0x4000,  CRC(df2419ad) SHA1(dd9dd85011d46581dccabcfdb5959a8b018df937)  )

	ROM_REGION16_LE( 0x200, "charset", 0 )
	ROM_LOAD16_BYTE( "dm74ls471n.ic20", 0x000, 0x100, CRC(d05765e6) SHA1(119ec6ca1a4afa0ea6ab1020ba2a8b02fd434e3f) )
	ROM_LOAD16_BYTE( "dm74ls471n.ic21", 0x001, 0x100, CRC(e12d5a04) SHA1(be52ee4e4a5ea225fce39c759645a7cf49cea370) )

	// MAB8441T-T042 internal ROM?
	ROM_REGION( 0x80000, "misc", 0 )
	ROM_LOAD( "m1-7611a-5.ic27", 0x000, 0x100, CRC(29b068e8) SHA1(477e2445c58b7d14c56a3ad4050eb22474d56005) )
开发者ID:DragonMinded,项目名称:mame,代码行数:31,代码来源:24cdjuke.cpp


示例6: socket_select

/**
 * Checks if a socket is available for reading and/or writing
 *
 * @param timeout               timeout, or 0 for blocking
 * @param socket                socket to check state on
 * @param operation_type        operation type: S_READ, S_WRITE, S_RW
 *
 * @return                      type of operation the socket is available for,
 *                              can be S_READ, S_WRITE, S_RW, 
 *                              or -1 if an error occurred
 */
int socket_select(int timeout, SOCKET_T * select_socket, int operation_type) {

  fd_set* readfds = NULL;
  fd_set* writefds = NULL;
  struct timeval tval_timeout;
  char buffer[1024];
  int retval = 0;
  int res;

  // Validates parameters
  if ( ( select_socket == NULL ) || ( (operation_type != S_READ) && (operation_type != S_WRITE) && (operation_type != S_RW) ) ) {

    sprintf(buffer, "socket_select fail: invalid parameters");
    LOGGER(__FUNCTION__, buffer);
    return -1;

  }

  // Configures timeout
  tval_timeout.tv_sec = timeout;
  tval_timeout.tv_usec = 0;

  // Allocates memory for sets
  readfds = (fd_set*)malloc(sizeof(fd_set));
  writefds = (fd_set*)malloc(sizeof(fd_set));

  // Initializes sets
  FD_ZERO(readfds);
  FD_ZERO(writefds);

  // Locks the socket's mutex
  MUTEX_LOCK(select_socket->mutex);

  // If has to check for reading
  if (operation_type & S_READ) {
    
    // Adds socket to the read set
    FD_SET( select_socket->handle, readfds );
  }

  // If has to check for writing
  if (operation_type & S_WRITE) {

    // Adds socket to the write set
    FD_SET(select_socket->handle, writefds);
  }

  // Calls select function
  res = select( (select_socket->handle)+1, readfds, writefds, NULL, &tval_timeout );
  if (res == -1) {

    sprintf(buffer, "select failed with error: %d\n", errno);
    LOGGER(__FUNCTION__, buffer);
    
    retval = -1;
    goto end_select;
  }

  // If socket is on the read result set
  // adds to return value
  if ( FD_ISSET(select_socket->handle, readfds ) ) {
    retval += S_READ;
  }

  // If socket is on the write result set
  // adds to return value
  if ( FD_ISSET(select_socket->handle, writefds ) ) {
    retval += S_WRITE;
  }

end_select:

  // Unlocks the socket's mutex
  MUTEX_UNLOCK(select_socket->mutex);

  // Frees allocated memory
  free(readfds);
  free(writefds);

  return retval;

}
开发者ID:julianbachiller,项目名称:QuickFT,代码行数:93,代码来源:socket.c


示例7: socket_create

/**
 * Creates a new socket and connects to server if it is a client,
 * or does the binding and starts listening on a port if it is server.
 * Returns a reference to the newly created connection.
 *
 * @param side                  0 if it is a client, 1 if it is a server
 * @param addr                  address to connect for clients or to listen on
 *                              for server, if NULL for server listens on INADDR_ANY
 * @param port                  port to connect or to listen on
 * @param max_connections       max number of connections that the server can
 *                              accept. does not apply for clients.
 * @param nonblocking           TRUE if nonblocking is desired, otherwise FALSE
 * 
 * @return                      pointer to the newly created socket, on error
 *                              returns NULL
 */
SOCKET_T* socket_create(int side, char* addr, int port, int max_connections, int nonblocking) {

  SOCKET_T* new_socket = NULL;
  struct sockaddr_in service;
  
  char buffer[_BUFFER_SIZE_S];
  int res;

  int socket_handle;

  // Validates paramter
  if (side < 0 || side > 1) {
    sprintf(buffer, "socket_create fail: parametros no validos");
    return NULL;
  }

  // Configurates the service
  service.sin_family = AF_INET;
  service.sin_port = htons((unsigned short)port);
  if (addr == NULL) {
    service.sin_addr.s_addr = htonl(INADDR_ANY);
  } else {
    service.sin_addr.s_addr = inet_addr(addr);
  }

  //
  // Creates socket and does the binding and listening
  // operations for server or connect for clients
  //

  // Creates socket
  if (nonblocking == TRUE) {
    socket_handle = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
  } else {
    socket_handle = socket(AF_INET, SOCK_STREAM, 0);
  }
    
  if (socket_handle == -1) {
      
    sprintf(buffer, "socket failed with error: %d\n", errno);
    LOGGER(__FUNCTION__, buffer);
    return NULL;
  }  

  // If it is server
  if (side == 1) {

    // Binds the socket to the port
    res = bind (socket_handle, (struct sockaddr *) &service, sizeof (service));
    if (res == -1)
    {
      sprintf(buffer, "socket failed with error: %d\n", errno);
      LOGGER(__FUNCTION__, buffer);

      shutdown(socket_handle, SHUT_RDWR);
      return NULL;
    }

    // Starts listening on the port
    res = listen(socket_handle, max_connections);
    if (res == -1) {

      sprintf(buffer, "listen fallo con el error: %d\n", errno);
      LOGGER(__FUNCTION__, buffer);
      
      shutdown(socket_handle, SHUT_RDWR);      
      return NULL;
    }
  
  }
  // If it is client
  else {

    // Connects to the server
    res = connect(socket_handle, (struct sockaddr *) &service, sizeof (service));
    if ( res == -1) {

      // Unless connection is in progress
      if ( errno != EINPROGRESS ) {

        sprintf(buffer, "connect failed with error: %d\n", errno);
        LOGGER(__FUNCTION__, buffer);
      
        shutdown(socket_handle, SHUT_RDWR);      
//.........这里部分代码省略.........
开发者ID:julianbachiller,项目名称:QuickFT,代码行数:101,代码来源:socket.c


示例8: count

ibis::table* ibis::jRange::select(const char *sstr) const {
    if (nrows < 0) {
        int64_t ierr = count();
        if (ierr < 0) {
            LOGGER(ibis::gVerbose > 0)
                << "Warning -- jRange::count failed with error code"
                << ierr;
            return 0;
        }
    }
    if (sstr == 0 || *sstr == 0) { // default
        std::string tn = ibis::util::shortName(desc_.c_str());
        return new ibis::tabula(tn.c_str(), desc_.c_str(), nrows);
    }

    ibis::selectClause sel(sstr);
    uint32_t features=0; // 1: arithmetic operation, 2: aggregation
    // use a barrel to collect all unique names
    ibis::math::barrel brl;
    for (uint32_t j = 0; j < sel.aggSize(); ++ j) {
        const ibis::math::term* t = sel.aggExpr(j);
        brl.recordVariable(t);
        if (t->termType() != ibis::math::VARIABLE &&
            t->termType() != ibis::math::NUMBER &&
            t->termType() != ibis::math::STRING) {
            features |= 1; // arithmetic operation
        }
        if (sel.getAggregator(j) != ibis::selectClause::NIL_AGGR) {
            features |= 2; // aggregation
        }
    }
    // convert the barrel into a stringArray for processing
    ibis::table::stringArray sl;
    sl.reserve(brl.size());
    for (unsigned j = 0; j < brl.size(); ++ j) {
        const char* str = brl.name(j);
        if (*str != 0) {
            if (str[0] != '_' || str[1] != '_')
                sl.push_back(str);
        }
    }

    std::unique_ptr<ibis::table> res1(select(sl));
    if (res1.get() == 0 || res1->nRows() == 0 || res1->nColumns() == 0 ||
        features == 0)
        return res1.release();

    if (ibis::gVerbose > 2) {
        ibis::util::logger lg;
        lg() << "jRange::select(" << sstr << ", " << desc_
             << ") produced the first intermediate table:\n";
        res1->describe(lg());
    }

    if ((features & 1) != 0) { // arithmetic computations
        res1.reset(static_cast<const ibis::bord*>(res1.get())->evaluateTerms
                   (sel, desc_.c_str()));
        if (res1.get() != 0) {
            if (ibis::gVerbose > 2) {
                ibis::util::logger lg;
                lg() << "jRange::select(" << sel << ", " << desc_
                     << ") produced the second intermediate table:\n";
                res1->describe(lg());
            }
        }
        else {
            LOGGER(ibis::gVerbose > 0)
                << "Warning -- jRange::select(" << sel
                << ") failed to evaluate the arithmetic expressions";
            return 0;
        }
    }

    if ((features & 2) != 0) { // aggregation operations
        res1.reset(static_cast<const ibis::bord*>(res1.get())->groupby(sel));
        if (res1.get() != 0) {
            if (ibis::gVerbose > 2) {
                ibis::util::logger lg;
                lg() << "jRange::select(" << *sel_ << ", " << desc_
                     << ") produced the third intermediate table:\n";
                res1->describe(lg());
            }
        }
        else {
            LOGGER(ibis::gVerbose > 0)
                << "Warning -- jRange::select(" << *sel_
                << ") failed to evaluate the aggregations";
        }
    }
    return res1.release();
} // ibis::jRange::select
开发者ID:CESNET,项目名称:libfastbit,代码行数:91,代码来源:jrange.cpp


示例9: tm

int64_t ibis::jRange::count() const {
    if (nrows >= 0) return nrows; // already have done this
    if (maskr_.cnt() == 0 || masks_.cnt() == 0) {
        return 0;
    }

    std::string mesg;
    mesg = "jRange::count(";
    mesg += desc_;
    mesg += ")";
    ibis::util::timer tm(mesg.c_str(), 1);
    // allocate space for ordering arrays
    orderr_ = new array_t<uint32_t>;
    orders_ = new array_t<uint32_t>;

    // Retrieve and sort the values
    switch (colr_.type()) {
    default:
        LOGGER(ibis::gVerbose > 1)
            << "Warning -- jRange[" << desc_
            << "] cann't handle join column of type " << colr_.type();
        return -2;
    case ibis::BYTE: {
        valr_ = colr_.selectBytes(maskr_);
        if (valr_ == 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange::count(" << desc_
                << ") call to " << colr_.name() << "->selectBytes("
                << maskr_.cnt() << ") failed";
            return -3;
        }
        vals_ = cols_.selectBytes(masks_);
        if (vals_ == 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange::count(" << desc_
                << ") call to " << cols_.name() << "->selectBytes("
                << masks_.cnt() << ") failed";
            return -4;
        }
        nrows = ibis::util::sortMerge
            (*static_cast<array_t<signed char>*>(valr_), *orderr_,
             *static_cast<array_t<signed char>*>(vals_), *orders_,
             delta1_, delta2_);
        break;}
    case ibis::UBYTE: {
        valr_ = colr_.selectUBytes(maskr_);
        if (valr_ == 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange::count(" << desc_
                << ") call to " << colr_.name() << "->selectUBytes("
                << maskr_.cnt() << ") failed";
            return -3;
        }
        vals_ = cols_.selectUBytes(masks_);
        if (vals_ == 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange::count(" << desc_
                << ") call to " << cols_.name() << "->selectUBytes("
                << masks_.cnt() << ") failed";
            return -4;
        }
        nrows = ibis::util::sortMerge
            (*static_cast<array_t<unsigned char>*>(valr_),
             *orderr_,
             *static_cast<array_t<unsigned char>*>(vals_),
             *orders_, delta1_, delta2_);
        break;}
    case ibis::SHORT: {
        valr_ = colr_.selectShorts(maskr_);
        if (valr_ == 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange::count(" << desc_
                << ") call to " << colr_.name() << "->selectShorts("
                << maskr_.cnt() << ") failed";
            return -3;
        }
        vals_ = cols_.selectShorts(masks_);
        if (vals_ == 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange::count(" << desc_
                << ") call to " << cols_.name() << "->selectShorts("
                << masks_.cnt() << ") failed";
            return -4;
        }
        nrows = ibis::util::sortMerge
            (*static_cast<array_t<int16_t>*>(valr_), *orderr_,
             *static_cast<array_t<int16_t>*>(vals_), *orders_,
             delta1_, delta2_);
        break;}
    case ibis::USHORT: {
        valr_ = colr_.selectUShorts(maskr_);
        if (valr_ == 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange::count(" << desc_
                << ") call to " << colr_.name() << "->selectUShorts("
                << maskr_.cnt() << ") failed";
            return -3;
        }
        vals_ = cols_.selectUShorts(masks_);
        if (vals_ == 0) {
//.........这里部分代码省略.........
开发者ID:CESNET,项目名称:libfastbit,代码行数:101,代码来源:jrange.cpp


示例10: sel_

/// Constructor.
ibis::jRange::jRange(const ibis::part& partr, const ibis::part& parts,
                     const ibis::column& colr, const ibis::column& cols,
                     double delta1, double delta2,
                     const ibis::qExpr* condr, const ibis::qExpr* conds,
                     const ibis::selectClause* sel, const ibis::fromClause* frm,
                     const char* desc)
    : sel_(sel ? new ibis::selectClause(*sel) : 0),
      frm_(frm ? new ibis::fromClause(*frm) : 0),
      partr_(partr), parts_(parts), colr_(colr), cols_(cols),
      delta1_(delta1), delta2_(delta2), orderr_(0), orders_(0),
      valr_(0), vals_(0), nrows(-1) {
    if (desc == 0 || *desc == 0) { // build a description string
        std::ostringstream oss;
        oss << "From " << partr.name() << " Join " << parts.name()
            << " On " << delta1 << " <= " << partr.name() << '.'
            << colr.name() << " - " << parts.name() << '.' << cols.name()
            << " <= " << delta2 << " Where ...";
        desc_ = oss.str();
    }
    else {
        desc_ = desc;
    }
    int ierr;
    if (condr != 0) {
        ibis::countQuery que(&partr);
        ierr = que.setWhereClause(condr);
        if (ierr < 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange(" << desc_ << ") could apply "
                << condr << " on partition " << partr.name()
                << ", ierr = " << ierr;
            throw "jRange::ctor failed to apply conditions on partr"
                IBIS_FILE_LINE;
        }
        ierr = que.evaluate();
        if (ierr < 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange(" << desc_
                << ") could not evaluate " << que.getWhereClause()
                << " on partition " << partr.name() << ", ierr = " << ierr;
            throw "jRange::ctor failed to evaluate constraints on partr"
                IBIS_FILE_LINE;
        }
        maskr_.copy(*que.getHitVector());
    }
    else {
        colr.getNullMask(maskr_);
    }
    if (conds != 0) {
        ibis::countQuery que(&parts);
        ierr = que.setWhereClause(conds);
        if (ierr < 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange(" << desc_ << ") could apply "
                << conds << " on partition " << parts.name()
                << ", ierr = " << ierr;
            throw "jRange::ctor failed to apply conditions on parts"
                IBIS_FILE_LINE;
        }
        ierr = que.evaluate();
        if (ierr < 0) {
            LOGGER(ibis::gVerbose > 1)
                << "Warning -- jRange(" << desc_
                << ") could not evaluate " << que.getWhereClause()
                << " on partition " << parts.name() << ", ierr = " << ierr;
            throw "jRange::ctor failed to evaluate constraints on parts"
                IBIS_FILE_LINE;
        }
        masks_.copy(*que.getHitVector());
    }
    else {
        cols.getNullMask(masks_);
    }
    LOGGER(ibis::gVerbose > 2)
        << "jRange(" << desc_ << ") construction complete";
} // ibis::jRange::jRange
开发者ID:CESNET,项目名称:libfastbit,代码行数:77,代码来源:jrange.cpp


示例11: LOGGER

ibis::table*
ibis::jRange::fillResult(size_t nrows, double delta1, double delta2,
                         const std::string &desc,
                         const ibis::array_t<T>& rjcol,
                         const ibis::table::typeArray& rtypes,
                         const ibis::table::bufferArray& rbuff,
                         const ibis::array_t<T>& sjcol,
                         const ibis::table::typeArray& stypes,
                         const ibis::table::bufferArray& sbuff,
                         const ibis::table::stringArray& tcname,
                         const std::vector<uint32_t>& tcnpos) {
    if (nrows > (rjcol.size() * sjcol.size()) ||
        rtypes.size() != rbuff.size() || stypes.size() != sbuff.size() ||
        tcname.size() != rtypes.size() + stypes.size() ||
        tcnpos.size() != tcname.size()) {
        LOGGER(ibis::gVerbose > 1)
            << "Warning -- jRange::fillResult can not proceed due "
            "to invalid arguments";
        return 0;
    }
    std::string tn = ibis::util::shortName(desc.c_str());
    if (nrows == 0 || rjcol.empty() || sjcol.empty() ||
        (stypes.empty() && rtypes.empty()))
        return new ibis::tabula(tn.c_str(), desc.c_str(), nrows);

    ibis::table::bufferArray tbuff(tcname.size());
    ibis::table::typeArray   ttypes(tcname.size());
    IBIS_BLOCK_GUARD(ibis::table::freeBuffers, ibis::util::ref(tbuff),
                     ibis::util::ref(ttypes));
    try {
        // allocate enough space for the output table
        for (size_t j = 0; j < tcname.size(); ++ j) {
            if (tcnpos[j] < rtypes.size()) {
                ttypes[j] = rtypes[tcnpos[j]];
                tbuff[j] = ibis::table::allocateBuffer
                    (rtypes[tcnpos[j]], nrows);
            }
            else if (tcnpos[j] < rtypes.size()+stypes.size()) {
                ttypes[j] = stypes[tcnpos[j]-rtypes.size()];
                tbuff[j] = ibis::table::allocateBuffer
                    (stypes[tcnpos[j]-rtypes.size()], nrows);
            }
            else { // tcnpos is out of valid range
                ttypes[j] = ibis::UNKNOWN_TYPE;
                tbuff[j] = 0;
                LOGGER(ibis::gVerbose > 0)
                    << "Warning -- jRange::fillResult detects an "
                    "invalid tcnpos[" << j << "] = " << tcnpos[j]
                    << ", should be less than " << rtypes.size()+stypes.size();
                return 0;
            }
        }
    }
    catch (...) {
        LOGGER(ibis::gVerbose > 0)
            << "Warning -- jRange::fillResult failed to allocate "
            "sufficient memory for " << nrows << " row" << (nrows>1?"s":"")
            << " and " << rtypes.size()+stypes.size()
            << " column" << (rtypes.size()+stypes.size()>1?"s":"");
        return 0;
    }

    size_t tind = 0; // row index into the resulting table
    uint32_t ir0 = 0;
    uint32_t ir1 = 0;
    uint32_t is = 0;
    const uint32_t nr = rjcol.size();
    const uint32_t ns = sjcol.size();
    while (ir0 < nr && is < ns) {
        while (ir0 < nr && rjcol[ir0] < sjcol[is]+delta1)
            ++ ir0;
        ir1 = (ir1>=ir0?ir1:ir0);
        while (ir1 < nr && rjcol[ir1] <= sjcol[is]+delta2)
            ++ ir1;
        if (ir1 > ir0) { // found matches
            size_t is0 = is;
            while (is < ns && sjcol[is] == sjcol[is0])
                ++ is;
            LOGGER(ibis::gVerbose > 5)
                << "DEBUG -- jRange::fillResult: ir0=" << ir0 << ", ir1="
                << ir1 << ", is0=" << is0 << ", is1=" << is << ", rjcol["
                << ir0 << "]=" << rjcol[ir0] << ", rjcol[" << ir1 << "]="
                << rjcol[ir1] << ", sjcol[" << is0 << "]=" << sjcol[is0]
                << ", sjcol[" << is << "]=" << sjcol[is];
            for (size_t jr = ir0; jr < ir1; ++ jr) {
                for (size_t js = is0; js < is; ++ js) {
                    for (size_t jt = 0; jt < tcnpos.size(); ++ jt) {
                        if (tcnpos[jt] < rbuff.size()) {
                            ibis::bord::copyValue(rtypes[tcnpos[jt]],
                                                  tbuff[jt], tind,
                                                  rbuff[tcnpos[jt]], jr);
                        }
                        else {
                            ibis::bord::copyValue
                                (stypes[tcnpos[jt]-rtypes.size()],
                                 tbuff[jt], tind,
                                 sbuff[tcnpos[jt]-rtypes.size()], js);
                        }
                    } // jt
                    ++ tind;
//.........这里部分代码省略.........
开发者ID:CESNET,项目名称:libfastbit,代码行数:101,代码来源:jrange.cpp


示例12: main

return_type main(int argc, 		/*argument count*/
                 char* argv[]	/*argument array*/
                )
{
    int err_no = ZERO;
    char *sdp_msg_string = NULL;
    sdp_session_t *my_session = NULL;
    char buff[FILE_SIZE];

    if(argc  !=  ARGC)
    {
        error_handling(ERR_MAJOR, SDP_ARGC_ERROR,
                       "Usage : <executable> <file name>");
        exit(EXIT_FAILURE);
    }

    memset(buff, 0, FILE_SIZE);
    if(gethostname(buff, FILE_SIZE) != SUCCESS)
    {
        error_handling(ERR_MAJOR, SDP_GETHOSTNAME_ERROR,
                       "sdp_server_main : Gethostname error");
        exit(EXIT_FAILURE);
    }
    printf("Hostname is : %s\n ", buff);
    LOGGER(LOG_CRITICAL, "Start of sdp_hash_append");
    if(sdp_hash_append(argv[1]) != SUCCESS)
    {
        error_handling(ERR_MAJOR, SDP_FILE_HASH_ERROR,
                       "sdp_server_main : sdp_hash_append error.");
        LOGGER(LOG_CRITICAL, "End of sdp_hash_append");
        exit(EXIT_FAILURE);
    }
    LOGGER(LOG_CRITICAL, "End of sdp_hash_append");

    log_level = LOG_CRITICAL;
    log_max = LOG_MAX;
    if(NULL == strncpy(log_file,"sdp_server.log", strlen("sdp_server.log") + 1))
    {
        error_handling(ERR_MAJOR, SDP_STRNCPY_ERROR,
                       "sdp_server_main : strncpy error.");
        exit(EXIT_FAILURE);
    }
    if(NULL == strncpy(program_name,"main_server.c", strlen("main_server.c") + 1))
    {
        error_handling(ERR_MAJOR, SDP_STRNCPY_ERROR,
                       "sdp_server_main : strncpy error.");
        exit(EXIT_FAILURE);
    }

    LOGGER(LOG_CRITICAL, "Start of sdp_checker");
    err_no=sdp_checker(inputfile);
    if(err_no  != SUCCESS)
    {
        error_handling(ERR_MAJOR, SDP_CHECKER_ERROR,
                       "sdp_server_main : sdp_checker error.");
        LOGGER(LOG_CRITICAL, "End of sdp_checker");
        exit(EXIT_FAILURE);
    }
    LOGGER(LOG_CRITICAL, "End of sdp_checker");

    my_session = (sdp_session_t *)calloc(1, sizeof(sdp_session_t));

    if(NULL == my_session)
    {
        error_handling(ERR_MAJOR, SDP_STRING_MALLOC_ERROR,
                       "sdp_server_main : malloc error.");
        exit(EXIT_FAILURE);
    }

    LOGGER(LOG_CRITICAL, "Start of sdp_populate_message");
    if(sdp_populate_message(my_session, inputfile) != SUCCESS)
    {
        error_handling(ERR_MAJOR, SDP_POPULATE_ERROR,
                       "sdp_server_main : sdp_populate_message error.");
        LOGGER(LOG_CRITICAL, "End of sdp_populate_message");
        myfree(my_session);
        exit(EXIT_FAILURE);
    }
    LOGGER(LOG_CRITICAL, "End of sdp_populate_message");

    LOGGER(LOG_CRITICAL, "Start of sdp_session_to_string");
    sdp_msg_string = sdp_session_to_str(my_session, &err_no);
    if(sdp_msg_string == NULL)
    {
        error_handling(ERR_MAJOR, SDP_SESSION_TO_STR_ERROR,
                       "sdp_server_main : sdp_session_to_str error.");
        LOGGER(LOG_CRITICAL, "End of sdp_session_to_string");
        myfree(my_session);
        exit(EXIT_FAILURE);
    }
    LOGGER(LOG_CRITICAL, "End of sdp_session_to_string");
    myfree(my_session);

    printf("%s\n",sdp_msg_string);

    LOGGER(LOG_CRITICAL, "Start of sdp_sender");
    if(sdp_server_sender(sdp_msg_string) != SUCCESS)
    {
        error_handling(ERR_MAJOR, SDP_SENDER_ERROR,
                       "sdp_server_main : sdp_server_sender error.");
//.........这里部分代码省略.........
开发者ID:ahmadharis4u,项目名称:ahmadharis.github.io,代码行数:101,代码来源:main_server.c


示例13: switch

ibis::math::term* ibis::selectClause::addRecursive(ibis::math::term*& tm) {
    if (tm == 0) return tm;

    switch (tm->termType()) {
    default:
    case ibis::math::NUMBER:
    case ibis::math::STRING:
        break; // nothing to do
    case ibis::math::VARIABLE: {
        ibis::selectClause::variable *var =
            dynamic_cast<ibis::selectClause::variable *>(tm);
        if (var == 0) { // a bare variable
            const char* vname =
                static_cast<ibis::math::variable*>(tm)->variableName();
            if (ordered_.find(vname) == ordered_.end()) {
                const unsigned pos = atms_.size();
                aggr_.push_back(ibis::selectClause::NIL_AGGR);
                atms_.push_back(tm->dup());
                ordered_[vname] = pos;

                LOGGER(ibis::gVerbose > 5)
                    << "selectClause::addRecursive -- adding term "
                    << pos << ": " << vname;
            }
        }
        break;}
    case ibis::math::STDFUNCTION1:
    case ibis::math::CUSTOMFUNCTION1:
    case ibis::math::STRINGFUNCTION1: {
        ibis::math::term *nxt =
            reinterpret_cast<ibis::math::term*>(tm->getLeft());
        if (nxt == 0) {
            return nxt;
        }
        else if (hasAggregation(nxt)) {
            ibis::math::term *tmp = addRecursive(nxt);
            if (tmp != nxt)
                tm->getLeft() = tmp;
        }
        else {
            const unsigned pos = atms_.size();
            aggr_.push_back(ibis::selectClause::NIL_AGGR);
            atms_.push_back(tm);
            LOGGER(ibis::gVerbose > 5)
                << "selectClause::addRecursive -- adding term "
                << pos << ": " << aggDescription(pos);

            std::ostringstream oss;
            oss << "__" << std::hex << pos;
            ordered_[oss.str()] = pos;
            return new ibis::selectClause::variable(oss.str().c_str(), this);
        }
        break;}
    case ibis::math::OPERATOR:
    case ibis::math::STDFUNCTION2:
    case ibis::math::CUSTOMFUNCTION2:
    case ibis::math::STRINGFUNCTION2: {
        ibis::math::term *left =
            reinterpret_cast<ibis::math::term*>(tm->getLeft());
        ibis::math::term *right =
            reinterpret_cast<ibis::math::term*>(tm->getRight());
        if (left == 0) {
            if (right == 0) {
                return 0;
            }
            else if (dynamic_cast<ibis::selectClause::variable*>(right) == 0) {
                tm->getRight() = addRecursive(right);
            }
        }
        else if (dynamic_cast<ibis::selectClause::variable*>(left) != 0) {
            if (dynamic_cast<ibis::selectClause::variable*>(right) == 0) {
                tm->getRight() = addRecursive(right);
            }
        }
        else if (dynamic_cast<ibis::selectClause::variable*>(right) != 0) {
            tm->getLeft() = addRecursive(left);
        }
        else if (hasAggregation(tm)) {
            tm->getLeft() = addRecursive(left);
            tm->getRight() = addRecursive(right);
        }
        else {
            const unsigned pos = atms_.size();
            aggr_.push_back(ibis::selectClause::NIL_AGGR);
            atms_.push_back(tm);
            LOGGER(ibis::gVerbose > 5)
                << "selectClause::addRecursive -- adding term "
                << pos << ": " << aggDescription(pos);

            std::ostringstream oss;
            oss << "__" << std::hex << pos;
            ordered_[oss.str()] = pos;
            return new ibis::selectClause::variable(oss.str().c_str(), this);
        }
        break;}
    }
    return tm;
} // ibis::selectClause::addRecursive
开发者ID:CESNET,项目名称:libfastbit,代码行数:98,代码来源:selectClause.cpp


示例14: stub_call

void stub_call(int log_level,char* message)
{
	LOGGER(log_level, message);
}
开发者ID:Ayushtyagi,项目名称:Multiple-Client-Chat-Server,代码行数:4,代码来源:stub_logger.c


示例15: result

bool EflResources::copyResource( Evas_Object* const _ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOGGER_ERROR函数代码示例发布时间:2022-05-30
下一篇:
C++ LOGF_LEAVE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap