From a0f570a2464800e96bda52c1d898ad0b677905b4 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Fri, 12 Dec 2025 10:53:38 +0100 Subject: [PATCH] CALLBACK is a macro with C++Builder * TAO/docs/tutorials/Quoter/RTCORBA/Stock_Database.h: * TAO/docs/tutorials/Quoter/RTCORBA/Stock_Database.tpp: --- .../tutorials/Quoter/RTCORBA/Stock_Database.h | 12 +-- .../Quoter/RTCORBA/Stock_Database.tpp | 76 +++++++++---------- 2 files changed, 42 insertions(+), 46 deletions(-) diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/Stock_Database.h b/TAO/docs/tutorials/Quoter/RTCORBA/Stock_Database.h index cf88000c2e4df..d2f5d481f060c 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/Stock_Database.h +++ b/TAO/docs/tutorials/Quoter/RTCORBA/Stock_Database.h @@ -11,9 +11,6 @@ // ACE headers #include "ace/Task.h" -// TAO headrs -// #include "tao/orbconf.h" - // STL headers #include #include @@ -25,7 +22,7 @@ * The parameter type may be any type that has a method called "updated_stocks" and * accepts a std::vector of std::strings as an argument. */ -template +template class Stock_Database : public ACE_Task_Base { public: @@ -38,8 +35,7 @@ class Stock_Database : public ACE_Task_Base /// @param file The name of a file to read initial stocks and values from. Stock_Database (const char *file, u_int rate = 1); - typedef std::map Init_Map; + typedef std::map Init_Map; /// Constructor /// @param stockmap A map containing stocks and initial values. An initial value @@ -53,7 +49,7 @@ class Stock_Database : public ACE_Task_Base * the () operator defined accepting a std::vector of strings as the argument. * @returns A cookie to identify the registration */ - Cookie register_callback (CALLBACK &obj); + Cookie register_callback (CALLBACK_TYPE &obj); /** * Removes a callback from the notification queue. @@ -111,7 +107,7 @@ class Stock_Database : public ACE_Task_Base siginfo_t * = 0, ucontext_t * = 0); - typedef std::map Callback_Map; + typedef std::map Callback_Map; private: /// The filname initialized from, if any. diff --git a/TAO/docs/tutorials/Quoter/RTCORBA/Stock_Database.tpp b/TAO/docs/tutorials/Quoter/RTCORBA/Stock_Database.tpp index 00cd8c379746b..a6e55c0c362fd 100644 --- a/TAO/docs/tutorials/Quoter/RTCORBA/Stock_Database.tpp +++ b/TAO/docs/tutorials/Quoter/RTCORBA/Stock_Database.tpp @@ -9,17 +9,17 @@ #include #include -template +template struct Map_Init { - Map_Init (typename Stock_Database::Stock_Map &map) + Map_Init (typename Stock_Database::Stock_Map &map) : map_ (map) { } - void operator () (const typename Stock_Database::Init_Map::value_type &item) + void operator () (const typename Stock_Database::Init_Map::value_type &item) { - typename Stock_Database::StockInfo stock_info (item.first.c_str ()); + typename Stock_Database::StockInfo stock_info (item.first.c_str ()); // If the initial value is nonzero, use that - otherwise, use a number // between 0 and 100 @@ -30,12 +30,12 @@ struct Map_Init map_[item.first] = stock_info; } - typename Stock_Database::Stock_Map &map_; + typename Stock_Database::Stock_Map &map_; }; // Stock_Database -template -Stock_Database::Stock_Database (u_int rate) +template +Stock_Database::Stock_Database (u_int rate) : rate_ (rate), active_ (false) { @@ -46,11 +46,11 @@ Stock_Database::Stock_Database (u_int rate) std::for_each (map.begin (), map.end (), - Map_Init (this->stock_map_)); + Map_Init (this->stock_map_)); } -template -Stock_Database::Stock_Database (const char *file, u_int rate) +template +Stock_Database::Stock_Database (const char *file, u_int rate) : filename_ (file), rate_ (rate), active_ (false) @@ -58,21 +58,21 @@ Stock_Database::Stock_Database (const char *file, u_int rate) this->handle_signal (0, 0, 0); } -template -Stock_Database::Stock_Database (const Init_Map &stockmap, - u_int rate) +template +Stock_Database::Stock_Database (const Init_Map &stockmap, + u_int rate) : rate_ (rate), active_ (false) { std::for_each (stockmap.begin (), stockmap.end (), - Map_Init (this->stock_map_)); + Map_Init (this->stock_map_)); } // get_stock_info -template -typename Stock_Database::StockInfo -Stock_Database::get_stock_info(const char *name) +template +typename Stock_Database::StockInfo +Stock_Database::get_stock_info(const char *name) { ACE_READ_GUARD_RETURN (ACE_RW_Thread_Mutex, guard, @@ -93,9 +93,9 @@ Stock_Database::get_stock_info(const char *name) return iter->second; } -template -typename Stock_Database::Cookie -Stock_Database::register_callback (CALLBACK &obj) +template +typename Stock_Database::Cookie +Stock_Database::register_callback (CALLBACK_TYPE &obj) { ACE_Utils::UUID uuid; ACE_Utils::UUID_GENERATOR::instance ()->generate_UUID (uuid); @@ -105,16 +105,16 @@ Stock_Database::register_callback (CALLBACK &obj) return uuid.to_string ()->c_str (); } -template +template void -Stock_Database::update_rate (u_int rate) +Stock_Database::update_rate (u_int rate) { this->rate_ = rate; } -template +template void -Stock_Database::start (void) +Stock_Database::start () { if (!this->active_) { // Double checked locking @@ -129,9 +129,9 @@ Stock_Database::start (void) } } -template +template void -Stock_Database::stop (void) +Stock_Database::stop () { ACE_WRITE_GUARD (ACE_RW_Thread_Mutex, guard, @@ -140,11 +140,11 @@ Stock_Database::stop (void) this->active_ = false; } -template +template int -Stock_Database::handle_signal (int, - siginfo_t *, - ucontext_t *) +Stock_Database::handle_signal (int, + siginfo_t *, + ucontext_t *) { ACE_WRITE_GUARD_RETURN (ACE_RW_Thread_Mutex, guard, @@ -156,7 +156,7 @@ Stock_Database::handle_signal (int, std::string name; u_int value = 0; - typename Stock_Database::Init_Map map; + typename Stock_Database::Init_Map map; while (input.good ()) { @@ -169,16 +169,16 @@ Stock_Database::handle_signal (int, std::for_each (map.begin (), map.end (), - Map_Init (this->stock_map_)); + Map_Init (this->stock_map_)); return 0; } -template +template struct Stock_Updater { - void operator () (typename Stock_Database::Stock_Map::value_type &item) + void operator () (typename Stock_Database::Stock_Map::value_type &item) { // Determine if the stock has changed. if (ACE_OS::rand () % 2) @@ -203,7 +203,7 @@ struct Stock_Updater item.second.high_ = item.second.last_; } - void operator () (typename Stock_Database::Callback_Map::value_type &item) + void operator () (typename Stock_Database::Callback_Map::value_type &item) { (*item.second) (changed_); } @@ -212,9 +212,9 @@ private: std::vector changed_; }; -template +template int -Stock_Database::svc (void) +Stock_Database::svc () { ACE_DEBUG ((LM_DEBUG, "tock!\n")); @@ -222,7 +222,7 @@ Stock_Database::svc (void) { { // Init our functor - Stock_Updater updater; + Stock_Updater updater; { // Control the scope of our mutex to avoid deadlock. ACE_WRITE_GUARD_RETURN (ACE_RW_Thread_Mutex,