本文整理汇总了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";
}
示例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;
}
示例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;
}
示例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"));
//
//.........这里部分代码省略.........
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例9: polygonVertexList
/* ****************************************************************************
*
* polygonVertexList -
*/
static int polygonVertexList(xml_node<>* node, ParseData* reqData)
{
LM_T(LmtParse, ("Got a polygonVertexList"));
return 0;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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";
}
示例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, "");
//.........这里部分代码省略.........