About the new version of Ace 6.0.0 Supplement to ace_static_case macro usage in the APG book

Source: Internet
Author: User

The

     new ACE has canceled the use of Ace_static_case macros, using static_cast as a direct conversion. In response to this change, a change was made to the 47-page example in the APG book:

#include "ace/streams.h" #include "ace/log_msg_callback.h" #include "ace/log_record.h" #include "ace/sstring.h" # Include "Ace/os_ns_time.h" #include "ace/time_value.h" class Callback:public Ace_log_msg_callback {public:void Log (Ace _log_record &log_record) {cerr << "Log Message Received:" << Endl; unsigned long msg_severity = Log_record.type (); Ace_log_priority Prio = static_cast<ace_log_priority> (msg_severity);//(ace_log_priority) msg_severity; Const Ace_tchar *prio_name = Ace_log_record::p riority_name (Prio); Cerr << "/ttype:" << Ace_text_always_char (prio_name) << Endl; Cerr << "/tlength:" << log_record.length () << Endl; Const time_t epoch = Log_record.time_stamp (). SEC (); Cerr << "/ttime_stamp:" << Ace_text_always_char (Ace_os::ctime (&epoch)) << flush; Cerr << "/tpid:" << log_record.pid () << Endl; Ace_cstring data (">>"); Data + = Ace_text_always_char (Log_record.msg_data ()); CeRR << "/tmsgdata:" << data.c_str () << Endl;}};  

Reference: Ace Programmer's Guide: Using Design patterns for network and system programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.