12.07.2015 Views

VisiBroker Edition

VisiBroker Edition

VisiBroker Edition

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

实 现 工 厂C++:class PointFactory:public CORBA::ValueFactoryBase{public:PointFactory(){}virtual ~PointFactory(){}CORBA::ValueBase* create_for_unmarshal() {return new PointImpl();}};Java 中 的 点 valuetype 工 厂 :Java: public class PointDefaultFactory implements PointValueFactory {public java.io.Serializable read_value (org.omg.CORBA.portable.InputStreamis) {java.io.Serializable val = new PointImpl();// 创 建 并 初 始 化 值// 进 行 此 调 用 非 常 重 要 。val = ((org.omg.CORBA_2_3.portable.InputStream)is).read_value(val);return val;}public Point create (int x, int y, java.lang.String z) {// 实 现 :return NO_IMPLEMENT;}}C++:<strong>VisiBroker</strong> <strong>Edition</strong> 4.5 或 以 后 的 版 本 将 为 JDK 1.2 或 JDK 1.3 默 认 值 工 厂 方 法 生成 相 应 的 签 名 。 现 有 (4.0) 的 生 成 代 码 并 不 是 为 了 在 JDK 1.3 中 运 行 , 除 非 您 按 照以 下 方 法 修 改 默 认 值 工 厂 方 法 签 名 。 如 果 您 在 JDK 1.3 中 使 用 现 有 代 码 , 但 并 未 修改 默 认 值 工 厂 , 则 代 码 将 不 会 进 行 编 译 , 或 者 会 出 现 NO_IMPLEMENT 例 外 。 因 此 ,建 议 您 重 新 生 成 代 码 以 生 成 相 应 的 签 名 。以 下 代 码 示 例 说 明 了 应 该 如 何 修 改 默 认 值 工 厂 方 法 签 名 , 以 确 保 代 码 会 在 JDK 1.3中 进 行 编 译 。class PointFactory:public CORBA::ValueFactoryBase{public:PointFactory(){}virtual ~PointFactory(){}CORBA::ValueBase* create_for_unmarshal() {return new PointImpl();}};Java 中 用 于 显 示 生 成 的 JDK 1.3 代 码 的 方 法 签 名 的 工 厂 代 码 :Java: public class PointDefaultFactory implements PointValueFactory {public java.io.Serializable read_value(org.omg.CORBA_2_3.portable.InputStreamis) {java.io.Serializable val = new PointImpl();// 创 建 并 初 始 化 值// 进 行 此 调 用 非 常 重 要 。val = ((org.omg.CORBA_2_3.portable.InputStream)is).read_value(val);26-6 <strong>VisiBroker</strong> 开 发 者 指 南

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!