5 #ifndef SRC_BGP_BGP_SHOW_HANDLER_H__
6 #define SRC_BGP_BGP_SHOW_HANDLER_H__
10 #include <sandesh/request_pipeline.h>
36 template <
typename ReqT,
typename ReqIterateT,
typename RespT,
typename ShowT>
63 static void FillShowList(RespT *resp,
const std::vector<ShowT> &show_list);
76 template <
typename ReqT,
typename ReqIterateT,
typename RespT,
typename ShowT>
78 const ReqT *req,
Data *data) {
90 template <
typename ReqT,
typename ReqIterateT,
typename RespT,
typename ShowT>
92 const ReqIterateT *req_iterate,
Data *data) {
99 std::string iterate_info = req_iterate->get_iterate_info();
103 if (pos1 == std::string::npos)
106 data->
next_entry = iterate_info.substr(0, pos1);
117 template <
typename ReqT,
typename ReqIterateT,
typename RespT,
typename ShowT>
119 const std::string &next_entry,
bool done,
Data *data) {
130 template <
typename ReqT,
typename ReqIterateT,
typename RespT,
typename ShowT>
132 RespT *resp,
const std::vector<ShowT> &show_list) {
145 template <
typename ReqT,
typename ReqIterateT,
typename RespT,
typename ShowT>
158 template <
typename ReqT,
typename ReqIterateT,
typename RespT,
typename ShowT>
162 Data *mydata =
static_cast<Data *
>(data);
163 const ReqT *req =
static_cast<const ReqT *
>(ps.
snhRequest_.get());
168 ConvertReqToData(req, mydata);
172 if (!CallbackCommon(bsc, mydata))
176 RespT *resp =
new RespT;
177 resp->set_context(req->context());
194 template <
typename ReqT,
typename ReqIterateT,
typename RespT,
typename ShowT>
198 Data *mydata =
static_cast<Data *
>(data);
199 const ReqIterateT *req_iterate =
200 static_cast<const ReqIterateT *
>(ps.
snhRequest_.get());
205 if (!ConvertReqIterateToData(req_iterate, mydata)) {
206 RespT *resp =
new RespT;
207 resp->set_context(req_iterate->context());
214 if (!CallbackCommon(bsc, mydata))
218 RespT *resp =
new RespT;
219 resp->set_context(req_iterate->context());
228 #endif // SRC_BGP_BGP_SHOW_HANDLER_H__
static void FillShowList(RespT *resp, const std::vector< ShowT > &show_list)
static bool CallbackCommon(const BgpSandeshContext *bsc, Data *data)
static void ConvertReqToData(const ReqT *req, Data *data)
static const uint32_t kIterLimit
static const uint32_t kPageLimit
std::vector< ShowT > show_list
static bool Callback(const Sandesh *sr, const RequestPipeline::PipeSpec ps, int stage, int instNum, RequestPipeline::InstData *data)
std::string search_string
static void SaveContextToData(const std::string &next_entry, bool done, Data *data)
static char kIterSeparator[]
boost::shared_ptr< const SandeshRequest > snhRequest_
static bool ConvertReqIterateToData(const ReqIterateT *req_iterate, Data *data)
static RequestPipeline::InstData * CreateData(int stage)
static bool CallbackIterate(const Sandesh *sr, const RequestPipeline::PipeSpec ps, int stage, int instNum, RequestPipeline::InstData *data)