Casablanca: C++ on Principal Consultant Senior Architect MYOB AZR331
demo Getting started
var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 'text/plain'}); respose.end('Hello World!'); }).listen(8080, ' '); var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 'text/plain'}); respose.end('Hello World!'); }).listen(8080, ' '); Node.js Hello World example
using namespace http; http_listener::create(" [](http_request request) { return request.reply(status_codes::OK, "text/plain", "Hello World!"); }).listen(); using namespace http; http_listener::create(" [](http_request request) { return request.reply(status_codes::OK, "text/plain", "Hello World!"); }).listen(); Casablanca Hello World example
demo ‘nuff talk. Let’s see some C++
demo RESTful Azure Service
using namespace value jsonObj = value::object(); jsonObj[L"Isbn"] = value::string(isbn); jsonObj[L"Title"] = value::string(title);... request.reply( jsonObj); using namespace value jsonObj = value::object(); jsonObj[L"Isbn"] = value::string(isbn); jsonObj[L"Title"] = value::string(title);... request.reply( jsonObj);
using namespace value jsonValue = request.extract_json().get(); wstring isbn(jsonValue[L"Isbn"].as_string()), using namespace value jsonValue = request.extract_json().get(); wstring isbn(jsonValue[L"Isbn"].as_string()), Json => C++ object
storage_credentials creds(storageName, storageKey); cloud_table_client table_client(tableUrl, creds); cloud_blob_client blob_client(blobUrl, creds); cloud_queue_client queue_client(queueUrl, creds); storage_credentials creds(storageName, storageKey); cloud_table_client table_client(tableUrl, creds); cloud_blob_client blob_client(blobUrl, creds); cloud_queue_client queue_client(queueUrl, creds); Connecting to Azure storage
cloud_table table(table_client, tableName); query_params params; auto results = table.query_entities(params).get().results(); for (auto i = results.begin(); i != result_vector.end(); ++i) { cloud_table_entity entity = *i; entity.match_property(L"ISBN", isbn);... } cloud_table table(table_client, tableName); query_params params; auto results = table.query_entities(params).get().results(); for (auto i = results.begin(); i != result_vector.end(); ++i) { cloud_table_entity entity = *i; entity.match_property(L"ISBN", isbn);... } Reading from table storage
cloud_table table(table_client, L"Books"); cloud_table_entity entity(partitionKey, rowKey); entity.set(L"ISBN", isbn, cloud_table_entity::String);... cloud_table.insert_or_replace_entity(entity); cloud_table table(table_client, L"Books"); cloud_table_entity entity(partitionKey, rowKey); entity.set(L"ISBN", isbn, cloud_table_entity::String);... cloud_table.insert_or_replace_entity(entity); Writing to table storage
demo Deploying to the cloud
demo Text to Speech
Async File I/O Timers Binary Serializers JSON Parser & Writer Azure / IIS HostWindows Server Windows 7 / 8 IOCP PPLWinHTTP HTTP Client & Listener TCP Client & Listener Web Sockets Client & Listener UDP Client & Listener Apps & Libraries Azure Storage Windows Live Xbox Live C++ Actors Bing Maps Foundation Casablanca Lib Service Host Possible 3rd Party
client(L" client.request(methods::GET, L"/foo.html").then( [=](pplx::task task) { http_response response = task.get(); //Do something with response... }); client(L" client.request(methods::GET, L"/foo.html").then( [=](pplx::task task) { http_response response = task.get(); //Do something with response... }); Casablanca Client APIs with task library
Mandelbrot
(Casablanca) (C++) (PPL) (Forum)