xorp

profiler_base.hh

00001 /*
00002  * obj/i386-pc-mingw32/xrl/targets/profiler_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_PROFILER_BASE_HH__
00016 #define __XRL_TARGETS_PROFILER_BASE_HH__
00017 
00018 #undef XORP_LIBRARY_NAME
00019 #define XORP_LIBRARY_NAME "XrlProfilerTarget"
00020 
00021 #include "libxorp/xlog.h"
00022 #include "libxipc/xrl_cmd_map.hh"
00023 
00024 class XrlProfilerTargetBase {
00025 protected:
00026     XrlCmdMap* _cmds;
00027 
00028 public:
00036     XrlProfilerTargetBase(XrlCmdMap* cmds = 0);
00037 
00043     virtual ~XrlProfilerTargetBase();
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 "profiler/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 
00343     virtual XrlCmdError profile_client_0_1_log(
00344     // Input values,
00345     const string&   pname,
00346     const uint32_t& sec,
00347     const uint32_t& usec,
00348     const string&   comment) = 0;
00349 #ifdef XORP_ENABLE_ASYNC_SERVER
00350     typedef
00351     XorpCallback1<void, const XrlCmdError &>::RefPtr
00352     ProfileClient01LogRF;
00353 
00354     class ProfileClient01LogCB {
00355         ProfileClient01LogRF cb;
00356 
00357     public:
00358         operator const ProfileClient01LogRF& () const { return cb; }
00359         const ProfileClient01LogRF& operator ->() const { return cb; }
00360         ProfileClient01LogCB(const ProfileClient01LogRF& cb)
00361           : cb(cb) { }
00362 
00363         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00364 
00365         void respond() const {
00366             cb->dispatch(XrlCmdError::OKAY());
00367         }
00368     };
00369 
00370     struct ProfileClient01LogRsp :
00371       public ProfileClient01LogCB {
00372         ProfileClient01LogRsp(const ProfileClient01LogRF& cb)
00373           : ProfileClient01LogCB(cb) { }
00374 
00375     };
00376 
00377     virtual void async_profile_client_0_1_log
00378        (
00379     const string&   pname,
00380     const uint32_t& sec,
00381     const uint32_t& usec,
00382     const string&   comment,
00383     ProfileClient01LogCB);
00384 #endif
00385 
00393     virtual XrlCmdError profile_client_0_1_finished(
00394     // Input values,
00395     const string&   pname) = 0;
00396 #ifdef XORP_ENABLE_ASYNC_SERVER
00397     typedef
00398     XorpCallback1<void, const XrlCmdError &>::RefPtr
00399     ProfileClient01FinishedRF;
00400 
00401     class ProfileClient01FinishedCB {
00402         ProfileClient01FinishedRF cb;
00403 
00404     public:
00405         operator const ProfileClient01FinishedRF& () const { return cb; }
00406         const ProfileClient01FinishedRF& operator ->() const { return cb; }
00407         ProfileClient01FinishedCB(const ProfileClient01FinishedRF& cb)
00408           : cb(cb) { }
00409 
00410         void fail(const XrlCmdError &e) const { cb->dispatch(e); }
00411 
00412         void respond() const {
00413             cb->dispatch(XrlCmdError::OKAY());
00414         }
00415     };
00416 
00417     struct ProfileClient01FinishedRsp :
00418       public ProfileClient01FinishedCB {
00419         ProfileClient01FinishedRsp(const ProfileClient01FinishedRF& cb)
00420           : ProfileClient01FinishedCB(cb) { }
00421 
00422     };
00423 
00424     virtual void async_profile_client_0_1_finished
00425        (
00426     const string&   pname,
00427     ProfileClient01FinishedCB);
00428 #endif
00429 
00430 private:
00431     XrlCmdRT handle_common_0_1_get_target_name(const XrlArgs& in, XrlCmdOT out);
00432 #ifdef XORP_ENABLE_ASYNC_SERVER
00433     void callback_common_0_1_get_target_name
00434        (const XrlCmdError &e,
00435     const string* arg_name,
00436         XrlRespCallback);
00437 #endif
00438 
00439     XrlCmdRT handle_common_0_1_get_version(const XrlArgs& in, XrlCmdOT out);
00440 #ifdef XORP_ENABLE_ASYNC_SERVER
00441     void callback_common_0_1_get_version
00442        (const XrlCmdError &e,
00443     const string* arg_version,
00444         XrlRespCallback);
00445 #endif
00446 
00447     XrlCmdRT handle_common_0_1_get_status(const XrlArgs& in, XrlCmdOT out);
00448 #ifdef XORP_ENABLE_ASYNC_SERVER
00449     void callback_common_0_1_get_status
00450        (const XrlCmdError &e,
00451     const uint32_t* arg_status,
00452     const string* arg_reason,
00453         XrlRespCallback);
00454 #endif
00455 
00456     XrlCmdRT handle_common_0_1_shutdown(const XrlArgs& in, XrlCmdOT out);
00457 #ifdef XORP_ENABLE_ASYNC_SERVER
00458     void callback_common_0_1_shutdown
00459        (const XrlCmdError &e,
00460         XrlRespCallback);
00461 #endif
00462 
00463     XrlCmdRT handle_common_0_1_startup(const XrlArgs& in, XrlCmdOT out);
00464 #ifdef XORP_ENABLE_ASYNC_SERVER
00465     void callback_common_0_1_startup
00466        (const XrlCmdError &e,
00467         XrlRespCallback);
00468 #endif
00469 
00470     XrlCmdRT handle_profile_client_0_1_log(const XrlArgs& in, XrlCmdOT out);
00471 #ifdef XORP_ENABLE_ASYNC_SERVER
00472     void callback_profile_client_0_1_log
00473        (const XrlCmdError &e,
00474         XrlRespCallback);
00475 #endif
00476 
00477     XrlCmdRT handle_profile_client_0_1_finished(const XrlArgs& in, XrlCmdOT out);
00478 #ifdef XORP_ENABLE_ASYNC_SERVER
00479     void callback_profile_client_0_1_finished
00480        (const XrlCmdError &e,
00481         XrlRespCallback);
00482 #endif
00483 
00484     void add_handlers();
00485     void remove_handlers();
00486 
00487     struct handler_table {
00488         const char *name;
00489         XrlCmdRT (XrlProfilerTargetBase::*method)(const XrlArgs&, XrlCmdOT);
00490     };
00491 
00492     static const struct handler_table handlers[];
00493     static const size_t num_handlers;
00494 };
00495 
00496 #endif // __XRL_TARGETS_PROFILER_BASE_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations