xorp

test_base.hh

00001 /*
00002  * obj/i386-pc-mingw32/xrl/targets/test_base.hh
00003  * vim:set sts=4 ts=8 ft=cpp:
00004  *
00005  * Copyright (c) 2001-2011 XORP, Inc and Others
00006  * See the XORP LICENSE.lgpl file for licensing, conditions, and warranties
00007  * on use.
00008  *
00009  * DO NOT EDIT THIS FILE - IT IS PROGRAMMATICALLY GENERATED
00010  *
00011  * Generated by 'tgt-gen'.
00012  */
00013 
00014 
00015 #ifndef __XRL_TARGETS_TEST_BASE_HH__
00016 #define __XRL_TARGETS_TEST_BASE_HH__
00017 
00018 #undef XORP_LIBRARY_NAME
00019 #define XORP_LIBRARY_NAME "XrlTestTarget"
00020 
00021 #include "libxorp/xlog.h"
00022 #include "libxipc/xrl_cmd_map.hh"
00023 
00024 class XrlTestTargetBase {
00025 protected:
00026     XrlCmdMap* _cmds;
00027 
00028 public:
00036     XrlTestTargetBase(XrlCmdMap* cmds = 0);
00037 
00043     virtual ~XrlTestTargetBase();
00044 
00055     bool set_command_map(XrlCmdMap* cmds);
00056 
00060     const string& get_name() const { return _cmds->name(); }
00061 
00065     const char* version() const { return "test/0.0"; }
00066 
00067 protected:
00068 
00074     virtual XrlCmdError common_0_1_get_target_name(
00075     // Output values,
00076     string& name) = 0;
00077 #ifdef XORP_ENABLE_ASYNC_SERVER
00078     typedef
00079     XorpCallback2<void, const XrlCmdError &,
00080     const string*>::RefPtr
00081     Common01GetTargetNameRF;
00082 
00083     class Common01GetTargetNameCB {
00084         Common01GetTargetNameRF cb;
00085 
00086     public:
00087         operator const Common01GetTargetNameRF& () const { return cb; }
00088         const Common01GetTargetNameRF& operator ->() const { return cb; }
00089         Common01GetTargetNameCB(const Common01GetTargetNameRF& cb)
00090           : cb(cb) { }
00091 
00092         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL); }
00093 
00094         void respond(const string& arg_name) const {
00095             cb->dispatch(XrlCmdError::OKAY(),
00096                          &arg_name);
00097         }
00098     };
00099 
00100     struct Common01GetTargetNameRsp :
00101       public Common01GetTargetNameCB {
00102         struct args_str {
00103             string name;
00104         };
00105 
00106     private:
00107         args_str args;
00108 
00109     public:
00110         Common01GetTargetNameRsp(const Common01GetTargetNameRF& cb)
00111           : Common01GetTargetNameCB(cb) { }
00112 
00113         void respond() const {
00114             Common01GetTargetNameCB::
00115             respond(args.name);
00116         }
00117 
00118         args_str* operator ->() {
00119             return &args;
00120         }
00121     };
00122 
00123     virtual void async_common_0_1_get_target_name
00124        (
00125     Common01GetTargetNameCB);
00126 #endif
00127 
00133     virtual XrlCmdError common_0_1_get_version(
00134     // Output values,
00135     string& version) = 0;
00136 #ifdef XORP_ENABLE_ASYNC_SERVER
00137     typedef
00138     XorpCallback2<void, const XrlCmdError &,
00139     const string*>::RefPtr
00140     Common01GetVersionRF;
00141 
00142     class Common01GetVersionCB {
00143         Common01GetVersionRF cb;
00144 
00145     public:
00146         operator const Common01GetVersionRF& () const { return cb; }
00147         const Common01GetVersionRF& operator ->() const { return cb; }
00148         Common01GetVersionCB(const Common01GetVersionRF& cb)
00149           : cb(cb) { }
00150 
00151         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL); }
00152 
00153         void respond(const string& arg_version) const {
00154             cb->dispatch(XrlCmdError::OKAY(),
00155                          &arg_version);
00156         }
00157     };
00158 
00159     struct Common01GetVersionRsp :
00160       public Common01GetVersionCB {
00161         struct args_str {
00162             string version;
00163         };
00164 
00165     private:
00166         args_str args;
00167 
00168     public:
00169         Common01GetVersionRsp(const Common01GetVersionRF& cb)
00170           : Common01GetVersionCB(cb) { }
00171 
00172         void respond() const {
00173             Common01GetVersionCB::
00174             respond(args.version);
00175         }
00176 
00177         args_str* operator ->() {
00178             return &args;
00179         }
00180     };
00181 
00182     virtual void async_common_0_1_get_version
00183        (
00184     Common01GetVersionCB);
00185 #endif
00186 
00192     virtual XrlCmdError common_0_1_get_status(
00193     // Output values,
00194     uint32_t&   status,
00195     string& reason) = 0;
00196 #ifdef XORP_ENABLE_ASYNC_SERVER
00197     typedef
00198     XorpCallback3<void, const XrlCmdError &,
00199     const uint32_t*,
00200     const string*>::RefPtr
00201     Common01GetStatusRF;
00202 
00203     class Common01GetStatusCB {
00204         Common01GetStatusRF cb;
00205 
00206     public:
00207         operator const Common01GetStatusRF& () const { return cb; }
00208         const Common01GetStatusRF& operator ->() const { return cb; }
00209         Common01GetStatusCB(const Common01GetStatusRF& cb)
00210           : cb(cb) { }
00211 
00212         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL, NULL); }
00213 
00214         void respond(const uint32_t& arg_status,
00215                      const string& arg_reason) const {
00216             cb->dispatch(XrlCmdError::OKAY(),
00217                          &arg_status,
00218                          &arg_reason);
00219         }
00220     };
00221 
00222     struct Common01GetStatusRsp :
00223       public Common01GetStatusCB {
00224         struct args_str {
00225             uint32_t status;
00226             string reason;
00227         };
00228 
00229     private:
00230         args_str args;
00231 
00232     public:
00233         Common01GetStatusRsp(const Common01GetStatusRF& cb)
00234           : Common01GetStatusCB(cb) { }
00235 
00236         void respond() const {
00237             Common01GetStatusCB::
00238             respond(args.status,
00239                         args.reason);
00240         }
00241 
00242         args_str* operator ->() {
00243             return &args;
00244         }
00245     };
00246 
00247     virtual void async_common_0_1_get_status
00248        (
00249     Common01GetStatusCB);
00250 #endif
00251 
00257     virtual XrlCmdError common_0_1_shutdown() = 0;
00258 #ifdef XORP_ENABLE_ASYNC_SERVER
00259     typedef
00260     XorpCallback1<void, const XrlCmdError &>::RefPtr
00261     Common01ShutdownRF;
00262 
00263     class Common01ShutdownCB {
00264         Common01ShutdownRF cb;
00265 
00266     public:
00267         operator const Common01ShutdownRF& () const { return cb; }
00268         const Common01ShutdownRF& operator ->() const { return cb; }
00269         Common01ShutdownCB(const Common01ShutdownRF& cb)
00270           : cb(cb) { }
00271 
00272         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00273 
00274         void respond() const {
00275             cb->dispatch(XrlCmdError::OKAY());
00276         }
00277     };
00278 
00279     struct Common01ShutdownRsp :
00280       public Common01ShutdownCB {
00281         Common01ShutdownRsp(const Common01ShutdownRF& cb)
00282           : Common01ShutdownCB(cb) { }
00283 
00284     };
00285 
00286     virtual void async_common_0_1_shutdown
00287        (
00288     Common01ShutdownCB);
00289 #endif
00290 
00296     virtual XrlCmdError common_0_1_startup() = 0;
00297 #ifdef XORP_ENABLE_ASYNC_SERVER
00298     typedef
00299     XorpCallback1<void, const XrlCmdError &>::RefPtr
00300     Common01StartupRF;
00301 
00302     class Common01StartupCB {
00303         Common01StartupRF cb;
00304 
00305     public:
00306         operator const Common01StartupRF& () const { return cb; }
00307         const Common01StartupRF& operator ->() const { return cb; }
00308         Common01StartupCB(const Common01StartupRF& cb)
00309           : cb(cb) { }
00310 
00311         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00312 
00313         void respond() const {
00314             cb->dispatch(XrlCmdError::OKAY());
00315         }
00316     };
00317 
00318     struct Common01StartupRsp :
00319       public Common01StartupCB {
00320         Common01StartupRsp(const Common01StartupRF& cb)
00321           : Common01StartupCB(cb) { }
00322 
00323     };
00324 
00325     virtual void async_common_0_1_startup
00326        (
00327     Common01StartupCB);
00328 #endif
00329 
00335     virtual XrlCmdError test_1_0_print_hello_world() = 0;
00336 #ifdef XORP_ENABLE_ASYNC_SERVER
00337     typedef
00338     XorpCallback1<void, const XrlCmdError &>::RefPtr
00339     Test10PrintHelloWorldRF;
00340 
00341     class Test10PrintHelloWorldCB {
00342         Test10PrintHelloWorldRF cb;
00343 
00344     public:
00345         operator const Test10PrintHelloWorldRF& () const { return cb; }
00346         const Test10PrintHelloWorldRF& operator ->() const { return cb; }
00347         Test10PrintHelloWorldCB(const Test10PrintHelloWorldRF& cb)
00348           : cb(cb) { }
00349 
00350         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00351 
00352         void respond() const {
00353             cb->dispatch(XrlCmdError::OKAY());
00354         }
00355     };
00356 
00357     struct Test10PrintHelloWorldRsp :
00358       public Test10PrintHelloWorldCB {
00359         Test10PrintHelloWorldRsp(const Test10PrintHelloWorldRF& cb)
00360           : Test10PrintHelloWorldCB(cb) { }
00361 
00362     };
00363 
00364     virtual void async_test_1_0_print_hello_world
00365        (
00366     Test10PrintHelloWorldCB);
00367 #endif
00368 
00376     virtual XrlCmdError test_1_0_print_hello_world_and_message(
00377     // Input values,
00378     const string&   msg) = 0;
00379 #ifdef XORP_ENABLE_ASYNC_SERVER
00380     typedef
00381     XorpCallback1<void, const XrlCmdError &>::RefPtr
00382     Test10PrintHelloWorldAndMessageRF;
00383 
00384     class Test10PrintHelloWorldAndMessageCB {
00385         Test10PrintHelloWorldAndMessageRF cb;
00386 
00387     public:
00388         operator const Test10PrintHelloWorldAndMessageRF& () const { return cb; }
00389         const Test10PrintHelloWorldAndMessageRF& operator ->() const { return cb; }
00390         Test10PrintHelloWorldAndMessageCB(const Test10PrintHelloWorldAndMessageRF& cb)
00391           : cb(cb) { }
00392 
00393         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00394 
00395         void respond() const {
00396             cb->dispatch(XrlCmdError::OKAY());
00397         }
00398     };
00399 
00400     struct Test10PrintHelloWorldAndMessageRsp :
00401       public Test10PrintHelloWorldAndMessageCB {
00402         Test10PrintHelloWorldAndMessageRsp(const Test10PrintHelloWorldAndMessageRF& cb)
00403           : Test10PrintHelloWorldAndMessageCB(cb) { }
00404 
00405     };
00406 
00407     virtual void async_test_1_0_print_hello_world_and_message
00408        (
00409     const string&   msg,
00410     Test10PrintHelloWorldAndMessageCB);
00411 #endif
00412 
00418     virtual XrlCmdError test_1_0_get_greeting_count(
00419     // Output values,
00420     int32_t&    num_msgs) = 0;
00421 #ifdef XORP_ENABLE_ASYNC_SERVER
00422     typedef
00423     XorpCallback2<void, const XrlCmdError &,
00424     const int32_t*>::RefPtr
00425     Test10GetGreetingCountRF;
00426 
00427     class Test10GetGreetingCountCB {
00428         Test10GetGreetingCountRF cb;
00429 
00430     public:
00431         operator const Test10GetGreetingCountRF& () const { return cb; }
00432         const Test10GetGreetingCountRF& operator ->() const { return cb; }
00433         Test10GetGreetingCountCB(const Test10GetGreetingCountRF& cb)
00434           : cb(cb) { }
00435 
00436         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL); }
00437 
00438         void respond(const int32_t& arg_num_msgs) const {
00439             cb->dispatch(XrlCmdError::OKAY(),
00440                          &arg_num_msgs);
00441         }
00442     };
00443 
00444     struct Test10GetGreetingCountRsp :
00445       public Test10GetGreetingCountCB {
00446         struct args_str {
00447             int32_t num_msgs;
00448         };
00449 
00450     private:
00451         args_str args;
00452 
00453     public:
00454         Test10GetGreetingCountRsp(const Test10GetGreetingCountRF& cb)
00455           : Test10GetGreetingCountCB(cb) { }
00456 
00457         void respond() const {
00458             Test10GetGreetingCountCB::
00459             respond(args.num_msgs);
00460         }
00461 
00462         args_str* operator ->() {
00463             return &args;
00464         }
00465     };
00466 
00467     virtual void async_test_1_0_get_greeting_count
00468        (
00469     Test10GetGreetingCountCB);
00470 #endif
00471 
00481     virtual XrlCmdError test_1_0_get_greeting(
00482     // Input values,
00483     const int32_t&  greeting_num,
00484     // Output values,
00485     string& greeting) = 0;
00486 #ifdef XORP_ENABLE_ASYNC_SERVER
00487     typedef
00488     XorpCallback2<void, const XrlCmdError &,
00489     const string*>::RefPtr
00490     Test10GetGreetingRF;
00491 
00492     class Test10GetGreetingCB {
00493         Test10GetGreetingRF cb;
00494 
00495     public:
00496         operator const Test10GetGreetingRF& () const { return cb; }
00497         const Test10GetGreetingRF& operator ->() const { return cb; }
00498         Test10GetGreetingCB(const Test10GetGreetingRF& cb)
00499           : cb(cb) { }
00500 
00501         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL); }
00502 
00503         void respond(const string& arg_greeting) const {
00504             cb->dispatch(XrlCmdError::OKAY(),
00505                          &arg_greeting);
00506         }
00507     };
00508 
00509     struct Test10GetGreetingRsp :
00510       public Test10GetGreetingCB {
00511         struct args_str {
00512             string greeting;
00513         };
00514 
00515     private:
00516         args_str args;
00517 
00518     public:
00519         Test10GetGreetingRsp(const Test10GetGreetingRF& cb)
00520           : Test10GetGreetingCB(cb) { }
00521 
00522         void respond() const {
00523             Test10GetGreetingCB::
00524             respond(args.greeting);
00525         }
00526 
00527         args_str* operator ->() {
00528             return &args;
00529         }
00530     };
00531 
00532     virtual void async_test_1_0_get_greeting
00533        (
00534     const int32_t&  greeting_num,
00535     Test10GetGreetingCB);
00536 #endif
00537 
00543     virtual XrlCmdError test_1_0_shoot_foot() = 0;
00544 #ifdef XORP_ENABLE_ASYNC_SERVER
00545     typedef
00546     XorpCallback1<void, const XrlCmdError &>::RefPtr
00547     Test10ShootFootRF;
00548 
00549     class Test10ShootFootCB {
00550         Test10ShootFootRF cb;
00551 
00552     public:
00553         operator const Test10ShootFootRF& () const { return cb; }
00554         const Test10ShootFootRF& operator ->() const { return cb; }
00555         Test10ShootFootCB(const Test10ShootFootRF& cb)
00556           : cb(cb) { }
00557 
00558         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00559 
00560         void respond() const {
00561             cb->dispatch(XrlCmdError::OKAY());
00562         }
00563     };
00564 
00565     struct Test10ShootFootRsp :
00566       public Test10ShootFootCB {
00567         Test10ShootFootRsp(const Test10ShootFootRF& cb)
00568           : Test10ShootFootCB(cb) { }
00569 
00570     };
00571 
00572     virtual void async_test_1_0_shoot_foot
00573        (
00574     Test10ShootFootCB);
00575 #endif
00576 
00582     virtual XrlCmdError test_1_0_float_my_point(
00583     // Input values,
00584     const fp64_t&   input,
00585     // Output values,
00586     fp64_t& output) = 0;
00587 #ifdef XORP_ENABLE_ASYNC_SERVER
00588     typedef
00589     XorpCallback2<void, const XrlCmdError &,
00590     const fp64_t*>::RefPtr
00591     Test10FloatMyPointRF;
00592 
00593     class Test10FloatMyPointCB {
00594         Test10FloatMyPointRF cb;
00595 
00596     public:
00597         operator const Test10FloatMyPointRF& () const { return cb; }
00598         const Test10FloatMyPointRF& operator ->() const { return cb; }
00599         Test10FloatMyPointCB(const Test10FloatMyPointRF& cb)
00600           : cb(cb) { }
00601 
00602         void fail(const XrlCmdError &e) const { cb->dispatch(e, NULL); }
00603 
00604         void respond(const fp64_t& arg_output) const {
00605             cb->dispatch(XrlCmdError::OKAY(),
00606                          &arg_output);
00607         }
00608     };
00609 
00610     struct Test10FloatMyPointRsp :
00611       public Test10FloatMyPointCB {
00612         struct args_str {
00613             fp64_t output;
00614         };
00615 
00616     private:
00617         args_str args;
00618 
00619     public:
00620         Test10FloatMyPointRsp(const Test10FloatMyPointRF& cb)
00621           : Test10FloatMyPointCB(cb) { }
00622 
00623         void respond() const {
00624             Test10FloatMyPointCB::
00625             respond(args.output);
00626         }
00627 
00628         args_str* operator ->() {
00629             return &args;
00630         }
00631     };
00632 
00633     virtual void async_test_1_0_float_my_point
00634        (
00635     const fp64_t&   input,
00636     Test10FloatMyPointCB);
00637 #endif
00638 
00639 private:
00640     XrlCmdRT handle_common_0_1_get_target_name(const XrlArgs& in, XrlCmdOT out);
00641 #ifdef XORP_ENABLE_ASYNC_SERVER
00642     void callback_common_0_1_get_target_name
00643        (const XrlCmdError &e,
00644     const string* arg_name,
00645         XrlRespCallback);
00646 #endif
00647 
00648     XrlCmdRT handle_common_0_1_get_version(const XrlArgs& in, XrlCmdOT out);
00649 #ifdef XORP_ENABLE_ASYNC_SERVER
00650     void callback_common_0_1_get_version
00651        (const XrlCmdError &e,
00652     const string* arg_version,
00653         XrlRespCallback);
00654 #endif
00655 
00656     XrlCmdRT handle_common_0_1_get_status(const XrlArgs& in, XrlCmdOT out);
00657 #ifdef XORP_ENABLE_ASYNC_SERVER
00658     void callback_common_0_1_get_status
00659        (const XrlCmdError &e,
00660     const uint32_t* arg_status,
00661     const string* arg_reason,
00662         XrlRespCallback);
00663 #endif
00664 
00665     XrlCmdRT handle_common_0_1_shutdown(const XrlArgs& in, XrlCmdOT out);
00666 #ifdef XORP_ENABLE_ASYNC_SERVER
00667     void callback_common_0_1_shutdown
00668        (const XrlCmdError &e,
00669         XrlRespCallback);
00670 #endif
00671 
00672     XrlCmdRT handle_common_0_1_startup(const XrlArgs& in, XrlCmdOT out);
00673 #ifdef XORP_ENABLE_ASYNC_SERVER
00674     void callback_common_0_1_startup
00675        (const XrlCmdError &e,
00676         XrlRespCallback);
00677 #endif
00678 
00679     XrlCmdRT handle_test_1_0_print_hello_world(const XrlArgs& in, XrlCmdOT out);
00680 #ifdef XORP_ENABLE_ASYNC_SERVER
00681     void callback_test_1_0_print_hello_world
00682        (const XrlCmdError &e,
00683         XrlRespCallback);
00684 #endif
00685 
00686     XrlCmdRT handle_test_1_0_print_hello_world_and_message(const XrlArgs& in, XrlCmdOT out);
00687 #ifdef XORP_ENABLE_ASYNC_SERVER
00688     void callback_test_1_0_print_hello_world_and_message
00689        (const XrlCmdError &e,
00690         XrlRespCallback);
00691 #endif
00692 
00693     XrlCmdRT handle_test_1_0_get_greeting_count(const XrlArgs& in, XrlCmdOT out);
00694 #ifdef XORP_ENABLE_ASYNC_SERVER
00695     void callback_test_1_0_get_greeting_count
00696        (const XrlCmdError &e,
00697     const int32_t* arg_num_msgs,
00698         XrlRespCallback);
00699 #endif
00700 
00701     XrlCmdRT handle_test_1_0_get_greeting(const XrlArgs& in, XrlCmdOT out);
00702 #ifdef XORP_ENABLE_ASYNC_SERVER
00703     void callback_test_1_0_get_greeting
00704        (const XrlCmdError &e,
00705     const string* arg_greeting,
00706         XrlRespCallback);
00707 #endif
00708 
00709     XrlCmdRT handle_test_1_0_shoot_foot(const XrlArgs& in, XrlCmdOT out);
00710 #ifdef XORP_ENABLE_ASYNC_SERVER
00711     void callback_test_1_0_shoot_foot
00712        (const XrlCmdError &e,
00713         XrlRespCallback);
00714 #endif
00715 
00716     XrlCmdRT handle_test_1_0_float_my_point(const XrlArgs& in, XrlCmdOT out);
00717 #ifdef XORP_ENABLE_ASYNC_SERVER
00718     void callback_test_1_0_float_my_point
00719        (const XrlCmdError &e,
00720     const fp64_t* arg_output,
00721         XrlRespCallback);
00722 #endif
00723 
00724     void add_handlers();
00725     void remove_handlers();
00726 
00727     struct handler_table {
00728         const char *name;
00729         XrlCmdRT (XrlTestTargetBase::*method)(const XrlArgs&, XrlCmdOT);
00730     };
00731 
00732     static const struct handler_table handlers[];
00733     static const size_t num_handlers;
00734 };
00735 
00736 #endif // __XRL_TARGETS_TEST_BASE_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations