本文整理汇总了C++中qpid::types::variant::Map类的典型用法代码示例。如果您正苦于以下问题:C++ Map类的具体用法?C++ Map怎么用?C++ Map使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Map类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doMethod
void Parent::doMethod (string& methodName, const ::qpid::types::Variant::Map& inMap, ::qpid::types::Variant::Map& outMap, const string& userId)
{
Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
std::string text;
if (methodName == "create_child") {
ArgsParentCreate_child ioArgs;
::qpid::types::Variant::Map::const_iterator _i;
if ((_i = inMap.find("name")) != inMap.end()) {
ioArgs.i_name = (_i->second).getString();
} else {
ioArgs.i_name = "";
}
bool allow = coreObject->AuthorizeMethod(METHOD_CREATE_CHILD, ioArgs, userId);
if (allow)
status = coreObject->ManagementMethod (METHOD_CREATE_CHILD, ioArgs, text);
else
status = Manageable::STATUS_FORBIDDEN;
outMap["_status_code"] = (uint32_t) status;
outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
outMap["childRef"] = ::qpid::types::Variant(ioArgs.o_childRef);
return;
}
outMap["_status_code"] = (uint32_t) status;
outMap["_status_text"] = Manageable::StatusText(status, text);
}
示例2: variantMapToJSONString
std::string agocontrol::variantMapToJSONString(qpid::types::Variant::Map map) {
string result;
result += "{";
for (Variant::Map::const_iterator it = map.begin(); it != map.end(); ++it) {
result += "\""+ it->first + "\":";
std::string tmpstring;
switch (it->second.getType()) {
case VAR_MAP:
result += variantMapToJSONString(it->second.asMap());
break;
case VAR_LIST:
result += variantListToJSONString(it->second.asList());
break;
case VAR_STRING:
tmpstring = it->second.asString();
replaceString(tmpstring, "\"", "\\\"");
result += "\"" + tmpstring + "\"";
break;
default:
if (it->second.asString().size() != 0) {
result += it->second.asString();
} else {
result += "null";
}
}
if ((it != map.end()) && (next(it) != map.end())) result += ",";
}
result += "}";
return result;
}
示例3: getEncodedSizeForElements
size_t MessageEncoder::getEncodedSizeForElements(const qpid::types::Variant::Map& map)
{
size_t total = 0;
for (qpid::types::Variant::Map::const_iterator i = map.begin(); i != map.end(); ++i) {
total += 1/*code*/ + encodedSize(i->first) + getEncodedSizeForValue(i->second);
}
return total;
}
示例4: mapDecodeValues
void Parent::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
::qpid::types::Variant::Map::const_iterator _i;
Mutex::ScopedLock mutex(accessLock);
if ((_i = _map.find("name")) != _map.end()) {
name = (_i->second).getString();
} else {
name = "";
}
}
示例5: getEncodedSizeForElements
size_t MessageEncoder::getEncodedSizeForElements(const qpid::types::Variant::Map& map)
{
size_t total = 0;
for (qpid::types::Variant::Map::const_iterator i = map.begin(); i != map.end(); ++i) {
total += 1/*code*/ + encodedSize(i->first);
switch (i->second.getType()) {
case qpid::types::VAR_MAP:
case qpid::types::VAR_LIST:
case qpid::types::VAR_VOID:
case qpid::types::VAR_BOOL:
total += 1;
break;
case qpid::types::VAR_UINT8:
case qpid::types::VAR_INT8:
total += 2;
break;
case qpid::types::VAR_UINT16:
case qpid::types::VAR_INT16:
total += 3;
break;
case qpid::types::VAR_UINT32:
case qpid::types::VAR_INT32:
case qpid::types::VAR_FLOAT:
total += 5;
break;
case qpid::types::VAR_UINT64:
case qpid::types::VAR_INT64:
case qpid::types::VAR_DOUBLE:
total += 9;
break;
case qpid::types::VAR_UUID:
total += 17;
break;
case qpid::types::VAR_STRING:
total += 1/*code*/ + encodedSize(i->second);
break;
}
}
return total;
}
示例6: getEncodedSize
size_t MessageEncoder::getEncodedSize(const qpid::types::Variant::Map& map, bool alwaysUseLargeMap)
{
size_t total = getEncodedSizeForElements(map);
//its not just the count that determines whether we can use a small map, but the aggregate size:
if (alwaysUseLargeMap || map.size()*2 > 255 || total > 255) total += 4/*size*/ + 4/*count*/;
else total += 1/*size*/ + 1/*count*/;
total += 1 /*code for map itself*/;
return total;
}
示例7: mapDecodeValues
void Journal::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
::qpid::types::Variant::Map::const_iterator _i;
Mutex::ScopedLock mutex(accessLock);
if ((_i = _map.find("queueRef")) != _map.end()) {
queueRef = _i->second;
}
if ((_i = _map.find("name")) != _map.end()) {
name = (_i->second).getString();
}
if ((_i = _map.find("directory")) != _map.end()) {
directory = (_i->second).getString();
}
if ((_i = _map.find("bdbDir")) != _map.end()) {
bdbDir = (_i->second).getString();
}
if ((_i = _map.find("num_jfiles")) != _map.end()) {
num_jfiles = _i->second;
}
}
示例8: createObject
bool Interconnects::createObject(Broker& broker, const std::string& type, const std::string& name, const qpid::types::Variant::Map& properties,
const std::string& /*userId*/, const std::string& /*connectionId*/)
{
if (type == DOMAIN_TYPE) {
qpid::sys::ScopedLock<qpid::sys::Mutex> l(lock);
DomainMap::iterator i = domains.find(name);
if (i == domains.end()) {
boost::shared_ptr<Domain> domain(new Domain(name, properties, broker));
domains[name] = domain;
if (domain->isDurable()) broker.getStore().create(*domain);
return true;
} else {
return false;
}
} else if (type == INCOMING_TYPE || type == OUTGOING_TYPE) {
QPID_LOG(notice, "Creating interconnect " << name << ", " << properties);
boost::shared_ptr<Domain> domain;
{
qpid::sys::ScopedLock<qpid::sys::Mutex> l(lock);
qpid::types::Variant::Map::const_iterator p = properties.find(DOMAIN_TYPE);
if (p != properties.end()) {
std::string domainName = p->second;
DomainMap::iterator i = domains.find(domainName);
if (i != domains.end()) {
domain = i->second;
} else {
throw qpid::Exception(QPID_MSG("No such domain: " << domainName));
}
} else {
throw qpid::Exception(QPID_MSG("Domain must be specified"));
}
}
domain->connect(type == INCOMING_TYPE, name, properties, *context);
return true;
} else {
return false;
}
}
示例9: mapDecodeValues
void TestObject::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
::qpid::types::Variant::Map::const_iterator _i;
Mutex::ScopedLock mutex(accessLock);
if ((_i = _map.find("string1")) != _map.end()) {
string1 = (_i->second).getString();
} else {
string1 = "";
}
if ((_i = _map.find("bool1")) != _map.end()) {
bool1 = _i->second;
} else {
bool1 = false;
}
if ((_i = _map.find("map1")) != _map.end()) {
map1 = (_i->second).asMap();
} else {
map1 = ::qpid::types::Variant::Map();
}
}
示例10: doMethod
void Broker::doMethod (string& methodName, const ::qpid::types::Variant::Map& inMap, ::qpid::types::Variant::Map& outMap, const string& userId)
{
Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
std::string text;
if (methodName == "echo") {
ArgsBrokerEcho ioArgs;
::qpid::types::Variant::Map::const_iterator _i;
if ((_i = inMap.find("sequence")) != inMap.end()) {
ioArgs.io_sequence = _i->second;
} else {
ioArgs.io_sequence = 0;
}
if ((_i = inMap.find("body")) != inMap.end()) {
ioArgs.io_body = (_i->second).getString();
} else {
ioArgs.io_body = "";
}
bool allow = coreObject->AuthorizeMethod(METHOD_ECHO, ioArgs, userId);
if (allow)
status = coreObject->ManagementMethod (METHOD_ECHO, ioArgs, text);
else
status = Manageable::STATUS_FORBIDDEN;
outMap["_status_code"] = (uint32_t) status;
outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
outMap["sequence"] = ::qpid::types::Variant(ioArgs.io_sequence);
outMap["body"] = ::qpid::types::Variant(ioArgs.io_body);
return;
}
if (methodName == "connect") {
ArgsBrokerConnect ioArgs;
::qpid::types::Variant::Map::const_iterator _i;
if ((_i = inMap.find("host")) != inMap.end()) {
ioArgs.i_host = (_i->second).getString();
} else {
ioArgs.i_host = "";
}
if ((_i = inMap.find("port")) != inMap.end()) {
ioArgs.i_port = _i->second;
} else {
ioArgs.i_port = 0;
}
if ((_i = inMap.find("durable")) != inMap.end()) {
ioArgs.i_durable = _i->second;
} else {
ioArgs.i_durable = false;
}
if ((_i = inMap.find("authMechanism")) != inMap.end()) {
ioArgs.i_authMechanism = (_i->second).getString();
} else {
ioArgs.i_authMechanism = "";
}
if ((_i = inMap.find("username")) != inMap.end()) {
ioArgs.i_username = (_i->second).getString();
} else {
ioArgs.i_username = "";
}
if ((_i = inMap.find("password")) != inMap.end()) {
ioArgs.i_password = (_i->second).getString();
} else {
ioArgs.i_password = "";
}
if ((_i = inMap.find("transport")) != inMap.end()) {
ioArgs.i_transport = (_i->second).getString();
} else {
ioArgs.i_transport = "";
}
bool allow = coreObject->AuthorizeMethod(METHOD_CONNECT, ioArgs, userId);
if (allow)
status = coreObject->ManagementMethod (METHOD_CONNECT, ioArgs, text);
else
status = Manageable::STATUS_FORBIDDEN;
outMap["_status_code"] = (uint32_t) status;
outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
return;
}
if (methodName == "queueMoveMessages") {
ArgsBrokerQueueMoveMessages ioArgs;
::qpid::types::Variant::Map::const_iterator _i;
if ((_i = inMap.find("srcQueue")) != inMap.end()) {
ioArgs.i_srcQueue = (_i->second).getString();
} else {
ioArgs.i_srcQueue = "";
}
if ((_i = inMap.find("destQueue")) != inMap.end()) {
ioArgs.i_destQueue = (_i->second).getString();
} else {
ioArgs.i_destQueue = "";
}
if ((_i = inMap.find("qty")) != inMap.end()) {
ioArgs.i_qty = _i->second;
} else {
ioArgs.i_qty = 0;
}
if ((_i = inMap.find("filter")) != inMap.end()) {
ioArgs.i_filter = (_i->second).asMap();
} else {
//.........这里部分代码省略.........
示例11: mapDecodeValues
void Broker::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
::qpid::types::Variant::Map::const_iterator _i;
Mutex::ScopedLock mutex(accessLock);
bool _found;
if ((_i = _map.find("name")) != _map.end()) {
name = (_i->second).getString();
} else {
name = "";
}
if ((_i = _map.find("systemRef")) != _map.end()) {
systemRef = _i->second;
} else {
systemRef = ::qpid::management::ObjectId();
}
if ((_i = _map.find("port")) != _map.end()) {
port = _i->second;
} else {
port = 0;
}
if ((_i = _map.find("workerThreads")) != _map.end()) {
workerThreads = _i->second;
} else {
workerThreads = 0;
}
if ((_i = _map.find("connBacklog")) != _map.end()) {
connBacklog = _i->second;
} else {
connBacklog = 0;
}
if ((_i = _map.find("stagingThreshold")) != _map.end()) {
stagingThreshold = _i->second;
} else {
stagingThreshold = 0;
}
if ((_i = _map.find("mgmtPublish")) != _map.end()) {
mgmtPublish = _i->second;
} else {
mgmtPublish = false;
}
if ((_i = _map.find("mgmtPubInterval")) != _map.end()) {
mgmtPubInterval = _i->second;
} else {
mgmtPubInterval = 0;
}
if ((_i = _map.find("version")) != _map.end()) {
version = (_i->second).getString();
} else {
version = "";
}
_found = false;
if ((_i = _map.find("dataDir")) != _map.end()) {
dataDir = (_i->second).getString();
_found = true;
} else {
dataDir = "";
}
if (_found) {
presenceMask[presenceByte_dataDir] |= presenceMask_dataDir;
}
}
示例12: doMethod
void Queue::doMethod (string& methodName, const ::qpid::types::Variant::Map& inMap, ::qpid::types::Variant::Map& outMap, const string& userId)
{
Manageable::status_t status = Manageable::STATUS_UNKNOWN_METHOD;
std::string text;
if (methodName == "purge") {
ArgsQueuePurge ioArgs;
::qpid::types::Variant::Map::const_iterator _i;
if ((_i = inMap.find("request")) != inMap.end()) {
ioArgs.i_request = _i->second;
} else {
ioArgs.i_request = 0;
}
if ((_i = inMap.find("filter")) != inMap.end()) {
ioArgs.i_filter = (_i->second).asMap();
} else {
ioArgs.i_filter = ::qpid::types::Variant::Map();
}
bool allow = coreObject->AuthorizeMethod(METHOD_PURGE, ioArgs, userId);
if (allow)
status = coreObject->ManagementMethod (METHOD_PURGE, ioArgs, text);
else
status = Manageable::STATUS_FORBIDDEN;
outMap["_status_code"] = (uint32_t) status;
outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
return;
}
if (methodName == "reroute") {
ArgsQueueReroute ioArgs;
::qpid::types::Variant::Map::const_iterator _i;
if ((_i = inMap.find("request")) != inMap.end()) {
ioArgs.i_request = _i->second;
} else {
ioArgs.i_request = 0;
}
if ((_i = inMap.find("useAltExchange")) != inMap.end()) {
ioArgs.i_useAltExchange = _i->second;
} else {
ioArgs.i_useAltExchange = false;
}
if ((_i = inMap.find("exchange")) != inMap.end()) {
ioArgs.i_exchange = (_i->second).getString();
} else {
ioArgs.i_exchange = "";
}
if ((_i = inMap.find("filter")) != inMap.end()) {
ioArgs.i_filter = (_i->second).asMap();
} else {
ioArgs.i_filter = ::qpid::types::Variant::Map();
}
bool allow = coreObject->AuthorizeMethod(METHOD_REROUTE, ioArgs, userId);
if (allow)
status = coreObject->ManagementMethod (METHOD_REROUTE, ioArgs, text);
else
status = Manageable::STATUS_FORBIDDEN;
outMap["_status_code"] = (uint32_t) status;
outMap["_status_text"] = ::qpid::management::Manageable::StatusText(status, text);
return;
}
outMap["_status_code"] = (uint32_t) status;
outMap["_status_text"] = Manageable::StatusText(status, text);
}
示例13: mapDecodeValues
void Queue::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
::qpid::types::Variant::Map::const_iterator _i;
Mutex::ScopedLock mutex(accessLock);
bool _found;
if ((_i = _map.find("vhostRef")) != _map.end()) {
vhostRef = _i->second;
} else {
vhostRef = ::qpid::management::ObjectId();
}
if ((_i = _map.find("name")) != _map.end()) {
name = (_i->second).getString();
} else {
name = "";
}
if ((_i = _map.find("durable")) != _map.end()) {
durable = _i->second;
} else {
durable = false;
}
if ((_i = _map.find("autoDelete")) != _map.end()) {
autoDelete = _i->second;
} else {
autoDelete = false;
}
if ((_i = _map.find("exclusive")) != _map.end()) {
exclusive = _i->second;
} else {
exclusive = false;
}
if ((_i = _map.find("arguments")) != _map.end()) {
arguments = (_i->second).asMap();
} else {
arguments = ::qpid::types::Variant::Map();
}
_found = false;
if ((_i = _map.find("altExchange")) != _map.end()) {
altExchange = _i->second;
_found = true;
} else {
altExchange = ::qpid::management::ObjectId();
}
if (_found) {
presenceMask[presenceByte_altExchange] |= presenceMask_altExchange;
}
}
示例14: writeApplicationProperties
void MessageEncoder::writeApplicationProperties(const qpid::types::Variant::Map& properties)
{
writeApplicationProperties(properties, !optimise || properties.size()*2 > 255 || getEncodedSizeForElements(properties) > 255);
}
示例15: mapDecodeValues
void Connection::mapDecodeValues (const ::qpid::types::Variant::Map& _map)
{
::qpid::types::Variant::Map::const_iterator _i;
Mutex::ScopedLock mutex(accessLock);
bool _found;
if ((_i = _map.find("vhostRef")) != _map.end()) {
vhostRef = _i->second;
} else {
vhostRef = ::qpid::management::ObjectId();
}
if ((_i = _map.find("address")) != _map.end()) {
address = (_i->second).getString();
} else {
address = "";
}
if ((_i = _map.find("incoming")) != _map.end()) {
incoming = _i->second;
} else {
incoming = false;
}
if ((_i = _map.find("SystemConnection")) != _map.end()) {
SystemConnection = _i->second;
} else {
SystemConnection = false;
}
if ((_i = _map.find("userProxyAuth")) != _map.end()) {
userProxyAuth = _i->second;
} else {
userProxyAuth = false;
}
if ((_i = _map.find("federationLink")) != _map.end()) {
federationLink = _i->second;
} else {
federationLink = false;
}
if ((_i = _map.find("authIdentity")) != _map.end()) {
authIdentity = (_i->second).getString();
} else {
authIdentity = "";
}
_found = false;
if ((_i = _map.find("remoteProcessName")) != _map.end()) {
remoteProcessName = (_i->second).getString();
_found = true;
} else {
remoteProcessName = "";
}
if (_found) {
presenceMask[presenceByte_remoteProcessName] |= presenceMask_remoteProcessName;
}
_found = false;
if ((_i = _map.find("remotePid")) != _map.end()) {
remotePid = _i->second;
_found = true;
} else {
remotePid = 0;
}
if (_found) {
presenceMask[presenceByte_remotePid] |= presenceMask_remotePid;
}
_found = false;
if ((_i = _map.find("remoteParentPid")) != _map.end()) {
remoteParentPid = _i->second;
_found = true;
} else {
remoteParentPid = 0;
}
if (_found) {
presenceMask[presenceByte_remoteParentPid] |= presenceMask_remoteParentPid;
}
if ((_i = _map.find("shadow")) != _map.end()) {
shadow = _i->second;
} else {
shadow = false;
}
if ((_i = _map.find("saslMechanism")) != _map.end()) {
saslMechanism = (_i->second).getString();
} else {
saslMechanism = "";
}
if ((_i = _map.find("saslSsf")) != _map.end()) {
saslSsf = _i->second;
} else {
saslSsf = 0;
}
}