当前位置: 首页>>代码示例>>C++>>正文


C++ ACE_Configuration_Heap::get_integer_value方法代码示例

本文整理汇总了C++中ACE_Configuration_Heap::get_integer_value方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Configuration_Heap::get_integer_value方法的具体用法?C++ ACE_Configuration_Heap::get_integer_value怎么用?C++ ACE_Configuration_Heap::get_integer_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ACE_Configuration_Heap的用法示例。


在下文中一共展示了ACE_Configuration_Heap::get_integer_value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

//---------------------------------------------------------------------------------------------
int HA_ccifs::init ( int argc , ACE_TCHAR *argv[] )
{

               ACE_Trace _( ACE_TEXT( "%D HA_ccifs::init" ) , __LINE__ );



              //command line
              //-------------------------------------------------------------------------------
              static const ACE_TCHAR options[] = ACE_TEXT (":f:");
              ACE_Get_Opt cmd_opts (argc, argv, options, 0);
              if (cmd_opts.long_option
                  (ACE_TEXT ( "config" ), 'f', ACE_Get_Opt::ARG_REQUIRED) == -1)
              { return -1; }

              int option;
              ACE_TCHAR config_file[MAXPATHLEN];
              ACE_OS::strcpy ( config_file, ACE_TEXT ( conf_path.c_str() ) );
              while ( ( option = cmd_opts ()) != EOF)
              switch ( option )
              {
                  case 'f' :

                    ACE_OS::strncpy (config_file , cmd_opts.opt_arg () , MAXPATHLEN );
                    break;

                  case ':':

                    ACE_ERROR_RETURN ( ( LM_ERROR , ACE_TEXT ( "-%c requires an argument\n" )  ,
                                   cmd_opts.opt_opt ()) , -1 );
              default:

                ACE_ERROR_RETURN ( ( LM_ERROR , ACE_TEXT ( "parse error.\n" ) ) ,
                                  - 1);
              }

              //configuration file
              //-------------------------------------------------------------------------------
              ACE_Configuration_Heap config;
              config.open ();
              ACE_Registry_ImpExp config_importer (config);
              if ( config_importer.import_config (config_file) == -1 )
              { ACE_ERROR_RETURN ( ( LM_ERROR , ACE_TEXT ("%p\n") , config_file ) , -1 ); }


              ACE_Configuration_Section_Key dispatcher_section;
              if (config.open_section (config.root_section (),
                                       ACE_TEXT ("HA_ccifs"),
                                       0,
                                       dispatcher_section) == -1)
                ACE_ERROR_RETURN ((LM_ERROR,
                                   ACE_TEXT ("%p\n"),
                                   ACE_TEXT ( "can't open HA_ccifs section"  ) ) ,
                                  -1 );
              //fifo
              u_int dispatcher_port;
              if (config.get_integer_value ( dispatcher_section,
                                             ACE_TEXT ( "fifo" ) ,
                                             dispatcher_port ) == -1 )
              ACE_ERROR_RETURN ((LM_ERROR,
                                   ACE_TEXT ("HA_ccifs fifo")
                                   ACE_TEXT (" does not exist\n") ) ,
                                  -1 );
              //ccifs
              ACE_TString ccifs;
              if (config.get_string_value (  dispatcher_section,
                                             ACE_TEXT ( "ccifs_tmpfs_mount" ) ,
                                             ccifs ) == -1 )
              ACE_ERROR_RETURN ((LM_ERROR,
                                   ACE_TEXT ("HA_ccifs ccifs_mount")
                                   ACE_TEXT (" does not exist\n") ) ,
                                  -1 );

              if( ACE_Thread_Manager::instance()->spawn( ACE_THR_FUNC (ccifs_func) ,
                                                     (void*) this ,
                                                     THR_NEW_LWP  ,
                                                     &m_thread_id ) )
              {
                  ACE_DEBUG
                  ((LM_DEBUG, ACE_TEXT ("(%t) ..spawned ccifs notify thread..\n")));

              }
              else
              {
                   ACE_DEBUG
                  ((LM_DEBUG, ACE_TEXT ("(%t) ..spawning ccifs notify failed..\n")));

              }



              return 0;
}
开发者ID:chromatic-universe,项目名称:cci-daemon,代码行数:94,代码来源:HA_ccifs_dynamic.cpp

示例2: cmd_opts

// Listing 1 code/ch19
int
HA_Status::init (int argc, ACE_TCHAR *argv[])
{
  static const ACE_TCHAR options[] = ACE_TEXT (":f:");
  ACE_Get_Opt cmd_opts (argc, argv, options, 0);
  if (cmd_opts.long_option
      (ACE_TEXT ("config"), 'f', ACE_Get_Opt::ARG_REQUIRED) == -1)
    return -1;
  int option;
  ACE_TCHAR config_file[MAXPATHLEN];
  ACE_OS::strcpy (config_file, ACE_TEXT ("HAStatus.conf"));
  while ((option = cmd_opts ()) != EOF)
    switch (option)
      {
      case 'f':
        ACE_OS::strncpy (config_file,
                         cmd_opts.opt_arg (),
                         MAXPATHLEN);
        break;
      case ':':
        ACE_ERROR_RETURN ((LM_ERROR,
                           ACE_TEXT ("-%c requires an argument\n"),
                           cmd_opts.opt_opt ()),
                          -1);
      default:
        ACE_ERROR_RETURN ((LM_ERROR,
                           ACE_TEXT ("Parse error.\n")),
                          -1);
      }

  ACE_Configuration_Heap config;
  config.open ();
  ACE_Registry_ImpExp config_importer (config);
  if (config_importer.import_config (config_file) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("%p\n"),
                       config_file),
                      -1);

  ACE_Configuration_Section_Key status_section;
  if (config.open_section (config.root_section (),
                           ACE_TEXT ("HAStatus"),
                           0,
                           status_section) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("%p\n"),
                       ACE_TEXT ("Can't open HAStatus section")),
                      -1);

  u_int status_port;
  if (config.get_integer_value (status_section,
                                ACE_TEXT ("ListenPort"),
                                status_port) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("HAStatus ListenPort ")
                       ACE_TEXT ("does not exist\n")),
                      -1);
  this->listen_addr_.set (static_cast<u_short> (status_port));

  if (this->acceptor_.open (this->listen_addr_) != 0)
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("HAStatus %p\n"),
                       ACE_TEXT ("accept")),
                      -1);

  return 0;
}
开发者ID:CCJY,项目名称:ACE,代码行数:68,代码来源:HA_Status_Dynamic.cpp


注:本文中的ACE_Configuration_Heap::get_integer_value方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。