Skip to content

Commit

Permalink
Added a Cython friendly way of instantiating RequestProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyendumajumdar committed Jul 4, 2019
1 parent e48608e commit a1ff562
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 7 additions & 0 deletions cpp/request_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ std::unique_ptr<RequestProcessor> get_request_processor(std::unique_ptr<CurveBui
return std::make_unique<RequestProcessorImpl>(std::move(bootstrapper), std::move(valuation_service));
}

std::unique_ptr<RequestProcessor> get_request_processor(const char *pricing_scipt)
{
return std::make_unique<RequestProcessorImpl>(
get_curve_builder_service(std::string(pricing_scipt)),
get_valuation_service(get_default_index_service(), get_calendar_factory()));
}

Response *RequestProcessorImpl::handle_hello_request(const Request *request, Response *response)
{
HelloReply *helloReply = response->mutable_hello_reply();
Expand Down
13 changes: 8 additions & 5 deletions cpp/request_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#ifndef _REDUKTI_REQUEST_PROCESSOR_H
#define _REDUKTI_REQUEST_PROCESSOR_H

#include <valuation.h>
#include <bootstrap.h>
#include <valuation.h>

#include <services.pb.h>

Expand All @@ -36,10 +36,13 @@ class RequestProcessor

// Note that the RequestProcessor will take ownership
// of the CurveBuilderService and ValuationService
std::unique_ptr<RequestProcessor> get_request_processor(
std::unique_ptr<CurveBuilderService> bootstrapper,
std::unique_ptr<ValuationService> valuation_service);
std::unique_ptr<RequestProcessor> get_request_processor(std::unique_ptr<CurveBuilderService> bootstrapper,
std::unique_ptr<ValuationService> valuation_service);

// Create an instance that creates its own internal instances
// of bootstrapper and valuation service. This is useful for creating Cython interface
std::unique_ptr<RequestProcessor> get_request_processor(const char* pricing_scipt);

} // namespace
} // namespace redukti

#endif

0 comments on commit a1ff562

Please sign in to comment.