⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 naming_context.h

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 H
字号:
/* -*- C++ -*- */
// Naming_Context.h,v 1.2 2004/01/03 13:05:45 jwillemsen Exp

#ifndef NAMING_CONTEXT_H
#define NAMING_CONTEXT_H

#include "ace/Naming_Context.h"
#include "ace/OS_NS_stdio.h"
#include "Name_Binding.h"

// Listing 1 code/ch21
class Naming_Context : public ACE_Naming_Context
{
public:
  typedef ACE_Naming_Context inherited;

  int rebind (const char *name_in,
              const char *value_in,
              const char *type_in = "")
  {
    return this->inherited::rebind (name_in, value_in, type_in);
  }

  int rebind (const char *name_in,
              float value_in,
              const char *type_in = "")
  {
    char buf[BUFSIZ];
    ACE_OS::sprintf (buf, "%2f", value_in);
    return this->inherited::rebind (name_in,
                                    (const char *)buf,
                                    type_in);
  }

  int rebind (const char *name_in,
              int value_in,
              const char *type_in = "")
  {
    char buf[BUFSIZ];
    ACE_OS::sprintf (buf, "%d", value_in );
    return this->inherited::rebind (name_in,
                                    (const char *)buf,
                                    type_in);
  }
  // Listing 1

  // Listing 2 code/ch21
  Name_Binding *fetch (const char *name)
  {
    ACE_NS_WString value;
    char *type;

    if (this->resolve (name, value, type) != 0 ||
        value.length () < 1)
      {
        return 0;
      }

    Name_Binding *rval =
      new Name_Binding (ACE_NS_WString (name),
                        value,
                        type);
    return rval;
  }
// Listing 2
};

#endif /* NAMING_CONTEXT_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -