本文整理汇总了C++中Stack::CountItems方法的典型用法代码示例。如果您正苦于以下问题:C++ Stack::CountItems方法的具体用法?C++ Stack::CountItems怎么用?C++ Stack::CountItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stack
的用法示例。
在下文中一共展示了Stack::CountItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
void
ServerApp::HandleMessage(int32 code, void *data, size_t size)
{
status_t rv;
TRACE("ServerApp::HandleMessage %#lx enter\n", code);
switch (code) {
case SERVER_CHANGE_ADDON_FLAVOR_INSTANCES_COUNT:
{
const server_change_addon_flavor_instances_count_request *request = reinterpret_cast<const server_change_addon_flavor_instances_count_request *>(data);
server_change_addon_flavor_instances_count_reply reply;
ASSERT(request->delta == 1 || request->delta == -1);
if (request->delta == 1)
rv = gNodeManager->IncrementAddonFlavorInstancesCount(request->addonid, request->flavorid, request->team);
else
rv = gNodeManager->DecrementAddonFlavorInstancesCount(request->addonid, request->flavorid, request->team);
request->SendReply(rv, &reply, sizeof(reply));
break;
}
case SERVER_RESCAN_DEFAULTS:
{
gNodeManager->RescanDefaultNodes();
break;
}
case SERVER_REGISTER_ADDONSERVER:
{
const server_register_addonserver_request *request = reinterpret_cast<const server_register_addonserver_request *>(data);
server_register_addonserver_reply reply;
rv = gAppManager->RegisterAddonServer(request->team);
request->SendReply(rv, &reply, sizeof(reply));
break;
}
case SERVER_REGISTER_APP:
{
const server_register_app_request *request = reinterpret_cast<const server_register_app_request *>(data);
server_register_app_reply reply;
rv = gAppManager->RegisterTeam(request->team, request->messenger);
request->SendReply(rv, &reply, sizeof(reply));
break;
}
case SERVER_UNREGISTER_APP:
{
const server_unregister_app_request *request = reinterpret_cast<const server_unregister_app_request *>(data);
server_unregister_app_reply reply;
rv = gAppManager->UnregisterTeam(request->team);
request->SendReply(rv, &reply, sizeof(reply));
break;
}
case SERVER_GET_MEDIAADDON_REF:
{
server_get_mediaaddon_ref_request *msg = (server_get_mediaaddon_ref_request *)data;
server_get_mediaaddon_ref_reply reply;
entry_ref tempref;
reply.result = gNodeManager->GetAddonRef(&tempref, msg->addonid);
reply.ref = tempref;
write_port(msg->reply_port, 0, &reply, sizeof(reply));
break;
}
case SERVER_NODE_ID_FOR:
{
const server_node_id_for_request *request = reinterpret_cast<const server_node_id_for_request *>(data);
server_node_id_for_reply reply;
rv = gNodeManager->FindNodeId(&reply.nodeid, request->port);
request->SendReply(rv, &reply, sizeof(reply));
break;
}
case SERVER_GET_LIVE_NODE_INFO:
{
const server_get_live_node_info_request *request = reinterpret_cast<const server_get_live_node_info_request *>(data);
server_get_live_node_info_reply reply;
rv = gNodeManager->GetLiveNodeInfo(&reply.live_info, request->node);
request->SendReply(rv, &reply, sizeof(reply));
break;
}
case SERVER_GET_LIVE_NODES:
{
const server_get_live_nodes_request *request = reinterpret_cast<const server_get_live_nodes_request *>(data);
server_get_live_nodes_reply reply;
Stack<live_node_info> livenodes;
rv = gNodeManager->GetLiveNodes(
&livenodes,
request->maxcount,
request->has_input ? &request->inputformat : NULL,
request->has_output ? &request->outputformat : NULL,
request->has_name ? request->name : NULL,
request->require_kinds);
reply.count = livenodes.CountItems();
if (reply.count <= MAX_LIVE_INFO) {
for (int32 index = 0; index < reply.count; index++)
livenodes.Pop(&reply.live_info[index]);
reply.area = -1;
} else {
// we create an area here, and pass it to the library, where it will be deleted.
//.........这里部分代码省略.........