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


C++ TibrvMsg::convertToString方法代码示例

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


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

示例1: onMsg

    void onMsg(TibrvListener* listener, TibrvMsg& msg)
    {
        const char* msgString = NULL;

        // Convert the incoming message to a string
        msg.convertToString(msgString);

        // Report we are processing the message
        printf("Processing message %s\n",msgString);
        fflush(stdout);

        // Imitate delay of one second
        waitQueue.timedDispatch((tibrv_f64)1.0);

        /* Increase count of processed messages. In real world
         * access to this variable should be guarded
         * because we may be changing it from multiple
         * dispatcher threads at the same time.
         */
        processedMessageCount++;

        /* If we have processed all messages then report it
         * and create a timer on the trigger queue so the
         * dispatch call on that queue returns.
         */
        if (processedMessageCount == TOTAL_MESSAGES)
        {
            /* we don't need to keep the timer here */
            TibrvTimer* timer = new TibrvTimer();
            timer->create(&triggerQueue,
                          new TimerCallback(),
                          (tibrv_f64)0, /* no delay */
                          NULL);
        }
    }
开发者ID:higgscc,项目名称:eManager,代码行数:35,代码来源:dispatcher.cpp

示例2: onMsg

    void onMsg(TibrvListener* listener, TibrvMsg& msg)
    {
        const char* sendSubject  = NULL;
        const char* msgString    = NULL;

        // Get the subject name to which this message was sent
        msg.getSendSubject(sendSubject);

        // Convert the incoming message to a string
        msg.convertToString(msgString);

        printf("Received message on subject %s: %s\n",
                   sendSubject, msgString);

        fflush(stdout);
    }
开发者ID:higgscc,项目名称:eManager,代码行数:16,代码来源:priority.cpp


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