diff options
Diffstat (limited to '')
-rw-r--r-- | tags/cpp-0.1.incubating-M1-RC3a/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.cpp | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/tags/cpp-0.1.incubating-M1-RC3a/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.cpp b/tags/cpp-0.1.incubating-M1-RC3a/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.cpp deleted file mode 100644 index 8ce6d410c2..0000000000 --- a/tags/cpp-0.1.incubating-M1-RC3a/sca/samples/BigBank/Accounts/StockQuoteServiceImpl.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -#if defined(WIN32) || defined (_WINDOWS) -#pragma warning(disable: 4786) -#endif - -#include "StockQuoteServiceImpl.h" -#include "StockQuoteExternalService.h" - -#include "osoa/sca/sca.h" -#include "commonj/sdo/SDO.h" - -using namespace osoa::sca; -using namespace commonj::sdo; - -namespace com{ - namespace bigbank{ - namespace stockquote { - - - float StockQuoteServiceImpl::getQuote(const char *symbol) - { - ComponentContext myContext = ComponentContext::getCurrent(); - - // Use an SCA reference to get the stock price - StockQuoteExternalService* stockQuoteExternalService = - (StockQuoteExternalService*)myContext. - getService("StockQuoteExternal"); - - if (stockQuoteExternalService == 0) - { - std::cout << "unable to find external stock quote service" << std::endl; - return 0.1f; - } - - // Create a data object representing the requests (use dynamic API until static is available) - DataObjectPtr requestDO; - - // Invoke the service - const char* result = stockQuoteExternalService->GetQuote(symbol); - - //std::cout << result<< std::endl; - - float stockPrice = 0.0f; - - try - { - XMLHelperPtr xmlHelper = HelperProvider::getXMLHelper(myContext.getDataFactory()); - XMLDocumentPtr stockDoc = xmlHelper->load(result); - if (stockDoc->getRootDataObject()) - { - stockPrice=stockDoc->getRootDataObject()->getFloat("Stock.0/Last"); - } - } - catch (SDORuntimeException e) - { - std::cout << e << std::endl; - return 0.0f; - } - return stockPrice; - } - } - } -}
\ No newline at end of file |