资源简介
ACE 程序员指南 配套源代码,书中的示例代码

代码片段和文件信息
// $Id: AO.cpp 94310 2011-07-09 19:10:06Z schmidt $
#include “ace/config-lite.h“
#if defined (ACE_HAS_THREADS)
#include “ace/OS_NS_unistd.h“
#include “ace/Activation_Queue.h“
#include “ace/Method_Request.h“
#include “ace/Task.h“
#include “ace/Future.h“
#include “ace/Auto_Ptr.h“
// Listing 1 code/ch15
class HA_ControllerAgent
{
// Proxy to the HA_Controller that is on the network.
public:
HA_ControllerAgent ()
{
ACE_TRACE(“HA_ControllerAgent::HA_ControllerAgent“);
status_result_ = 1;
}
int status_update (void)
{
ACE_TRACE (“HA_ControllerAgent::status_update“);
ACE_DEBUG ((LM_DEBUG
ACE_TEXT (“Obtaining a status_update in %t “)
ACE_TEXT (“thread of control\n“)));
// Simulate time to send message and get status.
ACE_OS::sleep (2);
return next_result_id ();
}
private:
int next_result_id (void)
{
ACE_TRACE (“HA_ControllerAgent::next_cmd_id“);
return status_result_++;
}
int status_result_;
};
// Listing 1
// Listing 2 code/ch15
class StatusUpdate : public ACE_Method_Request
{
public:
StatusUpdate (HA_ControllerAgent& controller
ACE_Future& returnVal)
: controller_(controller) returnVal_(returnVal)
{
ACE_TRACE (“StatusUpdate::StatusUpdate“);
}
virtual int call (void)
{
ACE_TRACE (“StatusUpdate::call“);
// status_update with the controller.
this->returnVal_.set (this->controller_.status_update ());
return 0;
}
private:
HA_ControllerAgent& controller_;
ACE_Future returnVal_;
};
// Listing 2
// Listing 3 code/ch15
class ExitMethod : public ACE_Method_Request
{
public:
virtual int call (void)
{
// Cause exit.
return -1;
}
};
// Listing 3
// Listing 4 code/ch15
class Scheduler : public ACE_Task_base
{
public:
Scheduler ()
{
ACE_TRACE (“Scheduler::Scheduler“);
this->activate ();
}
virtual int svc (void)
{
ACE_TRACE (“Scheduler::svc“);
while (1)
{
// Dequeue the next method object
auto_ptr
request (this->activation_queue_.dequeue ());
// Invoke the method request.
if (request->call () == -1)
break;
}
return 0;
}
int enqueue (ACE_Method_Request *request)
{
ACE_TRACE (“Scheduler::enqueue“);
return this->activation_queue_.enqueue (request);
}
private:
ACE_Activation_Queue activation_queue_;
};
// Listing 4
// Listing 5 code/ch15
class HA_ControllerAgentProxy
{
// This acts as a Proxy to the controller impl object.
public:
ACE_Future status_update (void)
{
ACE_TRACE(“HA_ControllerAgentProxy::status_update“);
ACE_Future result;
// Create and enqueue a method request on the scheduler.
this->scheduler_.enqueue
(new StatusUpdate (this->controller_ result));
// Return Future to the cl
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-06-10 13:20 APG\
目录 0 2014-06-30 11:12 APG\Active_ob
文件 284 2009-04-29 15:53 APG\Active_ob
文件 2716 2013-05-27 10:22 APG\Active_ob
文件 2709 2013-05-27 10:31 APG\Active_ob
文件 4176 2011-07-09 21:10 APG\Active_ob
文件 4294 2011-07-09 21:10 APG\Active_ob
文件 17462 2013-05-27 10:22 APG\Active_ob
文件 798 2013-05-27 10:22 APG\Active_ob
文件 9571 2013-05-27 10:31 APG\Active_ob
文件 2629 2014-06-30 11:12 APG\Active_ob
文件 17447 2013-05-27 10:22 APG\Active_ob
文件 797 2013-05-27 10:22 APG\Active_ob
文件 9560 2013-05-27 10:31 APG\Active_ob
文件 2629 2014-06-30 11:12 APG\Active_ob
文件 1403 2013-05-27 10:16 APG\Active_ob
文件 5051 2013-05-27 10:16 APG\Active_ob
文件 5058 2013-05-27 10:16 APG\Active_ob
文件 84272 2013-05-27 10:22 APG\APG_vc10.sln
文件 84055 2013-05-27 10:31 APG\APG_vc9.sln
目录 0 2014-06-30 11:12 APG\Config\
文件 1854 2008-03-04 15:51 APG\Config\ARGV_Example.cpp
文件 17670 2013-05-27 10:22 APG\Config\ARGV_Example_vc10.vcxproj
文件 1119 2013-05-27 10:22 APG\Config\ARGV_Example_vc10.vcxproj.filters
文件 9798 2013-05-27 10:31 APG\Config\ARGV_Example_vc9.vcproj
文件 2629 2014-06-30 11:12 APG\Config\ARGV_Example_vc9.vcproj.LIUJINLI.liujinli_.user
文件 510 2009-04-29 15:53 APG\Config\config.mpc
文件 17667 2013-05-27 10:22 APG\Config\Config_HA_Status_vc10.vcxproj
文件 1116 2013-05-27 10:22 APG\Config\Config_HA_Status_vc10.vcxproj.filters
文件 9807 2013-05-27 10:31 APG\Config\Config_HA_Status_vc9.vcproj
文件 2629 2014-06-30 11:12 APG\Config\Config_HA_Status_vc9.vcproj.LIUJINLI.liujinli_.user
............此处省略804个文件信息
- 上一篇:Windows xp sp3 repair文件夹
- 下一篇:SSH框架项目时序图
相关资源
- bp神经网络源代码,可直接运行
- 仿知乎界面小程序源代码
- 贪吃蛇源代码.fla
- dotnet 写字板 实验 源代码 不好请要不
- 图像二维小波变换的实现源代码
- 八三编码器设计 VHDL代码 简单,包附
- linux应用层的华容道游戏源代码
- Packet Tracer 5.2.1
- 网上拍卖系统完整源代码
- CSMA/CD等动画演示加源代码
- silicon lab公司的收音IC SI47XX全套开发工
- 合同管理系统的源代码(附数据库)
- 用VC 编写的仿QQ聊天室程序源代码
- STM32F103 串口程序(完整版)
- VPC3_DPV1源代码,Profibus
- PB做的托盘程序(最小化后在左下角显
- 透明加密源码及说明
- 排队机叫号 源代码
- 五子棋C 源代码
- CAD LISP24个源代码
- 二叉树基本操作源代码
- 推箱子及人工智能寻路C 源代码
- opengl轮廓字体源代码
- 冈萨雷斯 数字图像处理 源代码(m文
- 直流伺服电机电路原理图(内附单片
- mtrace 源码
- 哈哈冒险岛登入器源代码
- midi电子琴简单设计(附源代码).ra
- PESQ C源代码
- 画图程序MFC/VC/VC CRectTracker 串行化
评论
共有 条评论