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


C++ LM_T函数代码示例

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


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

示例1: attributeDomainName

/* ****************************************************************************
*
* attributeDomainName - 
*/
static std::string attributeDomainName(std::string path, std::string value, ParseData* reqData)
{
   LM_T(LmtParse, ("Got an attributeDomainName"));
   reqData->ucer.res.attributeDomainName.set(value);
   return "OK";
}
开发者ID:Aeronbroker,项目名称:fiware-orion,代码行数:10,代码来源:jsonUpdateContextElementRequest.cpp

示例2: errorCodeCode

/* ****************************************************************************
*
* errorCodeCode - 
*/
static int errorCodeCode(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got a errorCode code: '%s'", node->value()));
  reqData->rcrs.res.errorCode.code = (HttpStatusCode) atoi(node->value());
  return 0;
}
开发者ID:Aeronbroker,项目名称:fiware-orion,代码行数:10,代码来源:xmlRegisterContextResponse.cpp

示例3: errorCodeDetails

/* ****************************************************************************
*
* errorCodeDetails - 
*/
static int errorCodeDetails(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got an errorCode details string: '%s'", node->value()));
  reqData->rcrs.res.errorCode.details = node->value();
  return 0;
}
开发者ID:Aeronbroker,项目名称:fiware-orion,代码行数:10,代码来源:xmlRegisterContextResponse.cpp

示例4: LM_T

/* ****************************************************************************
*
* mongoConnect -
*
* Default value for writeConcern == 1 (0: unacknowledged, 1: acknowledged)
*/
static DBClientBase* mongoConnect
(
    const char*  host,
    const char*  db,
    const char*  rplSet,
    const char*  username,
    const char*  passwd,
    bool         multitenant,
    int          writeConcern,
    double       timeout
)
{
    std::string   err;
    DBClientBase* connection = NULL;

    LM_T(LmtMongo, ("Connection info: dbName='%s', rplSet='%s', timeout=%f", db, rplSet, timeout));

    bool connected     = false;
    int  retries       = RECONNECT_RETRIES;

    if (strlen(rplSet) == 0)
    {
        /* Setting the first argument to true is to use autoreconnect */
        connection = new DBClientConnection(true);

        /* Not sure of how to generalize the following code, given that DBClientBase class doesn't have a common connect() method (surprisingly) */
        for (int tryNo = 0; tryNo < retries; ++tryNo)
        {
            if ( ((DBClientConnection*)connection)->connect(host, err))
            {
                connected = true;
                break;
            }

            if (tryNo == 0)
            {
                LM_E(("Database Startup Error (cannot connect to mongo - doing %d retries with a %d microsecond interval)", retries, RECONNECT_DELAY));
            }
            else
            {
                LM_T(LmtMongo, ("Try %d connecting to mongo failed", tryNo));
            }

            usleep(RECONNECT_DELAY * 1000); // usleep accepts microseconds
        }
    }
    else
    {
        LM_T(LmtMongo, ("Using replica set %s", rplSet));

        // autoReconnect is always on for DBClientReplicaSet connections.
        std::vector<std::string>  hostTokens;
        int components = stringSplit(host, ',', hostTokens);

        std::vector<HostAndPort> rplSetHosts;
        for (int ix = 0; ix < components; ix++)
        {
            LM_T(LmtMongo, ("rplSet host <%s>", hostTokens[ix].c_str()));
            rplSetHosts.push_back(HostAndPort(hostTokens[ix]));
        }

        connection = new DBClientReplicaSet(rplSet, rplSetHosts, timeout);

        /* Not sure of to generalize the following code, given that DBClientBase class hasn't a common connect() method (surprisingly) */
        for (int tryNo = 0; tryNo < retries; ++tryNo)
        {
            if ( ((DBClientReplicaSet*)connection)->connect())
            {
                connected = true;
                break;
            }

            if (tryNo == 0)
            {
                LM_E(("Database Startup Error (cannot connect to mongo - doing %d retries with a %d microsecond interval)", retries, RECONNECT_DELAY));
            }
            else
            {
                LM_T(LmtMongo, ("Try %d connecting to mongo failed", tryNo));
            }

            usleep(RECONNECT_DELAY * 1000); // usleep accepts microseconds
        }
    }

    if (connected == false)
    {
        LM_E(("Database Error (connection failed, after %d retries: '%s')", retries, err.c_str()));
        return NULL;
    }

    LM_I(("Successful connection to database"));

    //
//.........这里部分代码省略.........
开发者ID:fgalan,项目名称:fiware-orion,代码行数:101,代码来源:mongoConnectionPool.cpp

示例5: duration

/* ****************************************************************************
*
* duration - 
*/
static int duration(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got a duration: '%s'", node->value()));
  reqData->rcrs.res.duration.set(node->value());
  return 0;
}
开发者ID:Aeronbroker,项目名称:fiware-orion,代码行数:10,代码来源:xmlRegisterContextResponse.cpp

示例6: contextMetadataType

/* ****************************************************************************
*
* contextMetadataType - 
*/
static int contextMetadataType(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got a metadata type '%s'", node->value()));
  reqData->acer.metadataP->type = node->value();
  return 0;
}
开发者ID:PascaleBorscia,项目名称:fiware-orion,代码行数:10,代码来源:xmlAppendContextElementRequest.cpp

示例7: attributeDomainName

/* ****************************************************************************
*
* attributeDomainName - 
*/
static int attributeDomainName(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got an attributeDomainName"));
  reqData->acer.res.attributeDomainName.set(node->value());
  return 0;
}
开发者ID:PascaleBorscia,项目名称:fiware-orion,代码行数:10,代码来源:xmlAppendContextElementRequest.cpp

示例8: polygon

/* ****************************************************************************
*
* polygon -
*/
static int polygon(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got a polygon"));
  reqData->scr.scopeP->areaType = orion::PolygonType;
  return 0;
}
开发者ID:jmmovilla,项目名称:fiware-orion,代码行数:10,代码来源:xmlSubscribeContextRequest.cpp

示例9: polygonVertexList

/* ****************************************************************************
*
* polygonVertexList -
*/
static int polygonVertexList(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got a polygonVertexList"));
  return 0;
}
开发者ID:jmmovilla,项目名称:fiware-orion,代码行数:9,代码来源:xmlSubscribeContextRequest.cpp

示例10: circleCenterLongitude

/* ****************************************************************************
*
* circleCenterLongitude -
*/
static int circleCenterLongitude(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got a circleCenterLongitude: %s", node->value()));
  reqData->scr.scopeP->circle.center.longitudeSet(node->value());
  return 0;
}
开发者ID:jmmovilla,项目名称:fiware-orion,代码行数:10,代码来源:xmlSubscribeContextRequest.cpp

示例11: circleRadius

/* ****************************************************************************
*
* circleRadius -
*/
static int circleRadius(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got a circleRadius: %s", node->value()));
  reqData->scr.scopeP->circle.radiusSet(node->value());
  return 0;
}
开发者ID:jmmovilla,项目名称:fiware-orion,代码行数:10,代码来源:xmlSubscribeContextRequest.cpp

示例12: circle

/* ****************************************************************************
*
* circle -
*/
static int circle(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got a circle"));
  reqData->scr.scopeP->areaType = orion::CircleType;
  return 0;
}
开发者ID:jmmovilla,项目名称:fiware-orion,代码行数:10,代码来源:xmlSubscribeContextRequest.cpp

示例13: scopeType

/* ****************************************************************************
*
* scopeType -
*/
static int scopeType(xml_node<>* node, ParseData* reqData)
{
  LM_T(LmtParse, ("Got a scopeType: '%s'", node->value()));
  reqData->scr.scopeP->type = node->value();
  return 0;
}
开发者ID:jmmovilla,项目名称:fiware-orion,代码行数:10,代码来源:xmlSubscribeContextRequest.cpp

示例14: contextAttributeValue

/* ****************************************************************************
*
* contextAttributeValue - 
*/
static std::string contextAttributeValue(std::string path, std::string value, ParseData* reqData)
{
   LM_T(LmtParse, ("Got an attribute value: %s", value.c_str()));
   reqData->ucer.attributeP->value = value;
   return "OK";
}
开发者ID:Aeronbroker,项目名称:fiware-orion,代码行数:10,代码来源:jsonUpdateContextElementRequest.cpp

示例15: atoi

/* ****************************************************************************
*
* mongoAttributesForEntityType -
*/
HttpStatusCode mongoAttributesForEntityType
(
  std::string                           entityType,
  EntityTypeResponse*         responseP,
  const std::string&                    tenant,
  const std::vector<std::string>&       servicePathV,
  std::map<std::string, std::string>&   uriParams
)
{  
  unsigned int   offset         = atoi(uriParams[URI_PARAM_PAGINATION_OFFSET].c_str());
  unsigned int   limit          = atoi(uriParams[URI_PARAM_PAGINATION_LIMIT].c_str());
  std::string    detailsString  = uriParams[URI_PARAM_PAGINATION_DETAILS];
  bool           details        = (strcasecmp("on", detailsString.c_str()) == 0)? true : false;
  bool           reqSemTaken    = false;

  // Setting the name of the entity type for the response
  responseP->entityType.type = entityType;

  LM_T(LmtMongo, ("Query Types Attribute for <%s>", entityType.c_str()));
  LM_T(LmtPagination, ("Offset: %d, Limit: %d, Details: %s", offset, limit, (details == true)? "true" : "false"));

  reqSemTake(__FUNCTION__, "query types attributes request", SemReadOp, &reqSemTaken);


  /* Compose query based on this aggregation command:   
   *
   * db.runCommand({aggregate: "entities",
   *                pipeline: [ {$match: { "_id.type": "TYPE" , "_id.servicePath": /.../ } },
   *                            {$project: {_id: 1, "attrNames": 1} },
   *                            {$unwind: "$attrNames"},
   *                            {$group: {_id: "$_id.type", attrs: {$addToSet: "$attrNames"}} },
   *                            {$unwind: "$attrs"},
   *                            {$group: {_id: "$attrs" }},
   *                            {$sort: {_id: 1}}
   *                          ]
   *                })
   *
   */

  BSONObj result;
  BSONObj cmd = BSON("aggregate" << COL_ENTITIES <<
                     "pipeline" << BSON_ARRAY(
                                              BSON("$match" << BSON(C_ID_ENTITY << entityType << C_ID_SERVICEPATH << fillQueryServicePath(servicePathV))) <<
                                              BSON("$project" << BSON("_id" << 1 << ENT_ATTRNAMES << 1)) <<
                                              BSON("$unwind" << S_ATTRNAMES) <<
                                              BSON("$group" << BSON("_id" << CS_ID_ENTITY << "attrs" << BSON("$addToSet" << S_ATTRNAMES))) <<
                                              BSON("$unwind" << "$attrs") <<
                                              BSON("$group" << BSON("_id" << "$attrs")) <<
                                              BSON("$sort" << BSON("_id" << 1))
                                             )
                    );

  std::string err;
  if (!runCollectionCommand(composeDatabaseName(tenant), cmd, &result, &err))
  {
    responseP->statusCode.fill(SccReceiverInternalError, err);
    reqSemGive(__FUNCTION__, "query types request", reqSemTaken);
    return SccOk;
  }

  /* Processing result to build response */
  LM_T(LmtMongo, ("aggregation result: %s", result.toString().c_str()));

  std::vector<BSONElement> resultsArray = getField(result, "result").Array();

  responseP->entityType.count = countEntities(tenant, servicePathV, entityType);

  if (resultsArray.size() == 0)
  {
    responseP->statusCode.fill(SccContextElementNotFound);
    reqSemGive(__FUNCTION__, "query types request", reqSemTaken);
    return SccOk;
  }

  /* See comment above in the other method regarding this strategy to implement pagination */
  for (unsigned int ix = offset; ix < MIN(resultsArray.size(), offset + limit); ++ix)
  {
    BSONElement  idField    = resultsArray[ix].embeddedObject().getField("_id");

    //
    // BSONElement::eoo returns true if 'not found', i.e. the field "_id" doesn't exist in 'sub'
    //
    // Now, if 'resultsArray[ix].embeddedObject().getField("_id")' is not found, if we continue,
    // calling embeddedObject() on it, then we get an exception and the broker crashes.
    //
    if (idField.eoo() == true)
    {
      LM_E(("Database Error (error retrieving _id field in doc: %s)", resultsArray[ix].embeddedObject().toString().c_str()));
      continue;
    }

    /* Note that we need and extra query() to the database (inside attributeType() function) to get each attribute type.
     * This could be unefficient, specially if the number of attributes is large */
    std::string attrType = attributeType(tenant, servicePathV, entityType , idField.str());

    ContextAttribute*  ca = new ContextAttribute(idField.str(), attrType, "");
//.........这里部分代码省略.........
开发者ID:NozomiNetworks,项目名称:fiware-orion,代码行数:101,代码来源:mongoQueryTypes.cpp


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