Remove OCICUC from build and repo
authorErich Keane <erich.keane@intel.com>
Thu, 15 Jan 2015 19:41:05 +0000 (11:41 -0800)
committerErich Keane <erich.keane@intel.com>
Fri, 16 Jan 2015 00:37:34 +0000 (16:37 -0800)
The OCICUC library isn't properly being maintained and isn't really being
used, so it is being removed.

Signed-off-by: Erich Keane <erich.keane@intel.com>
Change-Id: I613072d5256fd53c6d7ef179cd971356caf18d41

18 files changed:
resource/buildScript.mk
resource/examples/SConscript
resource/examples/makefile
resource/examples/ocicuc/.gitignore [deleted file]
resource/examples/ocicuc/Makefile [deleted file]
resource/examples/ocicuc/README [deleted file]
resource/examples/ocicuc/SConscript [deleted file]
resource/examples/ocicuc/client.cpp [deleted file]
resource/examples/ocicuc/demo_client.hpp [deleted file]
resource/examples/ocicuc/driver.cpp [deleted file]
resource/examples/ocicuc/exec.hpp [deleted file]
resource/examples/ocicuc/light_resource.cpp [deleted file]
resource/examples/ocicuc/light_resource.hpp [deleted file]
resource/examples/ocicuc/monoprocess.cpp [deleted file]
resource/examples/ocicuc/server.cpp [deleted file]
resource/examples/ocicuc/small_example.cpp [deleted file]
resource/examples/ocicuc/utility.cpp [deleted file]
resource/examples/ocicuc/utility.hpp [deleted file]

index 64afad1..226ff60 100644 (file)
@@ -224,12 +224,10 @@ linux_ub_examples_debug: linux_ub_stack_debug
 
 ###############################################################################
 ####      TB Stack, TB Unit Tests, TB Examples, UB Stack, UB Examples,     ####
-####      UB Unit Tests, & OCICUC - Linux Only                             ####
+####      UB Unit Tests - Linux Only                                       ####
 ###############################################################################
 
 linux_ub_dev: linux_ub_stack_all linux_ub_unittests_all linux_ub_examples_all linux_tb_examples_all
-       @echo "=====BUILD UB OCICUC - <oic-resource>/examples/ocicuc/====="
-       $(MAKE) -C examples/ocicuc/
 
 ###############################################################################
 #TB Stack, TB Unit Tests, & TB Examples - Arduino Mega Only - Ethernet & WiFi #
index f3a1e20..87623f7 100644 (file)
@@ -68,6 +68,3 @@ Alias("examples", [simpleserver, simpleserverHQ, simpleclient, simpleclientHQ,
                garageclient, devicediscoveryserver, devicediscoveryclient])
 env.AppendTarget('examples')
 
-#ios doesn't allow run application from terminal, so won't build these examples
-if target_os != 'ios':
-       SConscript('ocicuc/SConscript')
index ec87ec7..4581bda 100644 (file)
@@ -43,7 +43,7 @@ LIB_OC_LOGGER := ../oc_logger/lib/oc_logger.a
 CXX_LIBS  := ../$(BUILD)/obj/liboc.a ../csdk/$(PLATFORM)/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER)
 
 # Force metatargets to build:
-all.PHONY: prep_dirs oc_cpp_sdk simpleserver simpleserverHQ simpleclient simpleclientHQ simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient ocicuc_target threadingsample devicediscoveryserver devicediscoveryclient groupserver groupclient lightserver
+all.PHONY: prep_dirs oc_cpp_sdk simpleserver simpleserverHQ simpleclient simpleclientHQ simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient threadingsample devicediscoveryserver devicediscoveryclient groupserver groupclient lightserver
 
 apps.PHONY: prep_dirs oc_cpp_sdk simpleserver simpleserverHQ simpleclient simpleclientHQ simpleclientserver roomserver roomclient presenceserver presenceclient garageserver garageclient fridgeserver fridgeclient threadingsample devicediscoveryserver devicediscoveryclient groupserver groupclient lightserver
 
@@ -117,21 +117,12 @@ devicediscoveryserver: devicediscoveryserver.cpp
 
 devicediscoveryclient: devicediscoveryclient.cpp
        $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ devicediscoveryclient.cpp $(CXX_INC) $(CXX_LIBS)
-       
-       
-
-ocicuc_target:
-       cd ocicuc && $(MAKE) apps
 
 clean:
        rm -rf debug
        rm -rf release
        cd ../ && $(MAKE) clean_cpp_sdk
-       cd ocicuc && $(MAKE) clean
-       cd ocicuc && $(MAKE) clean_apps
 
 clean_apps:
        rm -rf debug
        rm -rf release
-       cd ocicuc && $(MAKE) clean
-       cd ocicuc && $(MAKE) clean_apps
diff --git a/resource/examples/ocicuc/.gitignore b/resource/examples/ocicuc/.gitignore
deleted file mode 100644 (file)
index 1c17b7e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# Ignore our example executables
-client
-monoprocess
-server
-small_example
diff --git a/resource/examples/ocicuc/Makefile b/resource/examples/ocicuc/Makefile
deleted file mode 100644 (file)
index 17556f8..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-# //******************************************************************
-# //
-# // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-# //
-# // Licensed under the Apache License, Version 2.0 (the "License");
-# // you may not use this file except in compliance with the License.
-# // You may obtain a copy of the License at
-# //
-# //      http://www.apache.org/licenses/LICENSE-2.0
-# //
-# // Unless required by applicable law or agreed to in writing, software
-# // distributed under the License is distributed on an "AS IS" BASIS,
-# // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# // See the License for the specific language governing permissions and
-# // limitations under the License.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#
-BUILD:=release
-PLATFORM:=linux
-
-OCLIB=../..
-OCLIB_LIB=../../$(BUILD)/obj/liboc.a
-
-BOOST_BASE=/usr/local/boost
-BOOST_INC=$(BOOST_BASE)/include
-BOOST_LIB=$(BOOST_BASE)/lib
-
-CXX_FLAGS.debug     := -g3 -O0
-CXX_FLAGS.release   := -O3
-
-CXX_FLAGS:=-Werror -Wall -std=c++0x -ggdb $(CXX_FLAGS.$(BUILD)) -pthread
-
-# There's probably nicer Makefile magic for this, but hopefully it will suffice:
-CXX_INC=-I$(OCLIB)/include \
-       -I$(BOOST_INC) \
-       -I../../include/ \
-       -I../../oc_logger/include/ \
-       -I../../csdk/stack/include \
-       -I../../csdk/ocsocket/include \
-       -I../../csdk/ocrandom/include \
-       -I../../csdk/logger/include \
-
-BOOST_LIBS=-lboost_program_options
-#BOOST_LIBS=-L/usr/local/boost/lib/ -lboost_program_options    # for boost libraries at the specified path
-
-LIB_OC_LOGGER:=../../oc_logger/lib/oc_logger.a
-
-CXX_LIBS=$(OCLIB_LIB) ../../csdk/$(PLATFORM)/$(BUILD)/liboctbstack.a $(LIB_OC_LOGGER) $(BOOST_LIBS)
-
-APPS += client
-APPS += server
-APPS += monoprocess
-APPS += small_example
-
-.PHONY: client server
-
-all: apps
-       @echo Remember to \"export LD_LIBRARY_PATH=$(BOOST_LIB)\:\$$LD_LIBRARY_PATH\"
-
-apps: $(APPS)
-
-%.o: %.cpp
-       $(CXX) $(CXXFLAGS) $(CXX_FLAGS) $(CXX_INC) -c -o $@ $<
-
-client: client.o driver.o utility.o
-       $(CXX) $(CXX_FLAGS) -o $@ $^ $(CXX_LIBS)
-
-server: server.o driver.o utility.o light_resource.o
-       $(CXX) $(CXX_FLAGS) -o $@ $^ $(CXX_LIBS)
-
-monoprocess: monoprocess.o driver.o utility.o light_resource.o
-       $(CXX) $(CXX_FLAGS) -o $@ $^ $(CXX_LIBS)
-
-small_example: small_example.o driver.o utility.o
-       $(CXX) $(CXX_FLAGS) -o $@ $^ $(CXX_LIBS)
-
-clean:
-       rm -f *.o $(APPS)
-
-clean_apps:
-       rm -f *.o $(APPS)
diff --git a/resource/examples/ocicuc/README b/resource/examples/ocicuc/README
deleted file mode 100644 (file)
index d0d99b7..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-
-OCICUC is a light framework for rapidly building OIC test/demo/example applications. It provides pre-built
-entry points and handling for things like command line parameters and modularlizes resources, so that
-adding new features or building a new test application is a lightweight undertaking.
-
-.
-├── client.cpp                           - a multi-resource client, similar to simpleclient
-├── demo_client.hpp                      - client code, shared between client and multiprocess programs
-├── driver.cpp                           - ocicuc base driver program
-├── exec.hpp                             - header for binding with the driver
-├── light_resource.cpp           - example resource
-├── light_resource.hpp           - example resource
-├── monoprocess.cpp                      - client and server in a single process
-├── server.cpp                           - a multi-resource server, similar to simpleserver
-├── small_example.cpp            - a near-minimal example program
-├── utility.cpp                          - utility functions for the demo programs
-└── utility.hpp                          - utility functions
-
-You can extend the existing programs to add new resource types, etc.. Refer to the help screen for each program
-for further details. For instance, to start a server with 5 resources and then test it with a separate client,
-you could run:
-
-       ./server --nres=5
-
-...and, in another shell:
-
-       ./client --nres=5
-
-To build a new program that hooks into the ocicuc driver program, you just need to define the functions in "exec.hpp",
-for example:
-
-namespace Intel { namespace OCDemo {
-
-int exec(const boost::program_options::variables_map& vm);
-
-auto make_description()
-    -> boost::program_options::options_description;
-
-}} // namespace Intel::OCDemo
-
-You can see an example of a skeleton program in small_example.cpp.
-
-To run a program with default parameters, use "--", for example:
-
-./monoprocess --
-
-Have fun!
-
-
diff --git a/resource/examples/ocicuc/SConscript b/resource/examples/ocicuc/SConscript
deleted file mode 100644 (file)
index 434efd7..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-##
-# Examples build script
-##
-Import('env')
-# Add third party libraries
-lib_env = env.Clone()
-SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
-
-ocicuc_env = lib_env.Clone()
-######################################################################
-# Build flags
-######################################################################
-ocicuc_env.AppendUnique(CPPPATH = [
-               '../../include/',
-               '../../csdk/stack/include',
-               '../../csdk/ocsocket/include',
-               '../../csdk/ocrandom/include',
-               '../../csdk/logger/include',
-               '../../oc_logger/include'
-               ])
-
-ocicuc_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-ocicuc_env.PrependUnique(LIBS = ['oc', 'octbstack', 'coap', 'oc_logger'])
-
-target_os = env.get('TARGET_OS')
-if target_os not in ['windows', 'winrt']:
-       ocicuc_env.AppendUnique(CXXFLAGS = ['-std=c++0x'])
-
-if target_os == 'android':
-       ocicuc_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-       ocicuc_env.AppendUnique(LIBS = ['boost_program_options', 'boost_thread', 'gnustl_static'])
-
-       if not env.get('RELEASE'):
-               ocicuc_env.AppendUnique(LIBS = ['log'])
-
-if target_os == 'darwin':
-       ocicuc_env.AppendUnique(LIBS = ['boost_program_options'])
-
-######################################################################
-# Source files and Targets
-######################################################################
-client = ocicuc_env.Program('client', ['client.cpp', 'driver.cpp', 'utility.cpp'])
-server = ocicuc_env.Program('server', ['server.cpp', 'driver.cpp', 'utility.cpp', 'light_resource.cpp'])
-monoprocess = ocicuc_env.Program('monoprocess', ['monoprocess.cpp', 'driver.cpp', 'utility.cpp', 'light_resource.cpp'])
-small_example = ocicuc_env.Program('small_example', ['small_example.cpp', 'driver.cpp', 'utility.cpp'])
-
-Alias("examples_ocicuc", [client, server, monoprocess, small_example])
-env.AppendTarget('examples_ocicuc')
diff --git a/resource/examples/ocicuc/client.cpp b/resource/examples/ocicuc/client.cpp
deleted file mode 100644 (file)
index c3771bb..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-// This contains the Boost MPL defines required for the boost_variant
-// serialization, so it must go before the boost/program_options
-#include "OCApi.h"
-
-#include <map>
-#include <string>
-#include <memory>
-#include <utility>
-#include <ostream>
-#include <sstream>
-#include <iostream>
-
-#include <boost/program_options.hpp>
-
-#include "OCResource.h"
-#include "OCPlatform.h"
-
-#include "exec.hpp"
-#include "utility.hpp"
-
-#include "demo_client.hpp"
-
-namespace Intel { namespace OCDemo {
-
-auto make_description()
-    -> boost::program_options::options_description
-{
- using std::string;
- using std::vector;
-
- namespace po = boost::program_options;
-
- po::options_description desc("Client options");
-
- desc.add_options()
-    ("nres",        po::value<unsigned long>()->default_value(1),           "number of resources to use for testing")
-    ("host_ip",     po::value<string>()->default_value("0.0.0.0"),   "IP of host")
-    ("host_port",   po::value<uint16_t>()->default_value(0),             "port of host")
-    ("interface",   po::value<string>()->default_value("eth0"),             "network interface name")
-    ("uri",         po::value<vector<string>>(),                            "remote resource URI")
-    ;
-
- return desc;
-}
-
-int exec(const boost::program_options::variables_map& vm)
-{
- using namespace std;
-
- OC::OCPlatform::Configure({
-                          OC::ServiceType::InProc,              // in-process server
-                          OC::ModeType::Client,                 // client mode
-                          vm["host_ip"].as<string>(),           // host
-                          vm["host_port"].as<uint16_t>(),       // port
-                          OC::QualityOfService::LowQos
-                        });
-
- vector<string> resource_URIs;
-
- if(0 == vm.count("uri"))
-  {
-    std::cout << "No URI specified, looking for everything in \"core\".\n";
-
-    // Find all resources:
-    resource_URIs.push_back("coap://224.0.1.187/oc/core");
-
-    /* Example of finding specific resources:
-    const auto& nprops = vm["nres"].as<unsigned long>();
-
-    for(unsigned long instance_number = 1;
-        instance_number <= nprops;
-        instance_number++)
-     {
-        ostringstream uri;
-
-
-        uri << "coap://" << vm["host_ip"].as<string>() << "/oc/core?rt=core.light" << '_' << instance_number;
-        resource_URIs.push_back(uri.str()); // ie. "coap://224.0.1.187/oc/core?rt=core.light_1");
-     }
-    */
-  }
- else
-  {
-    const vector<string>& input_URIs = vm["uri"].as< vector<string> >();
-    copy(begin(input_URIs), end(input_URIs), back_inserter(resource_URIs));
-  }
-
- std::cout << "Requesting " << resource_URIs.size() << " URIs:\n";
-
- for(const auto& resource_URI : resource_URIs)
-  cout << resource_URI << '\n';
-
- Intel::OCDemo::client::resource_handler resources(resource_URIs);
-
- // Register callbacks and wait for resources:
- resources.find_resources();
-
- // Allow the client to receive events from the server:
- for(;;)
-  ;
-
- return 0;
-}
-
-}} // namespace Intel::OCDemo
-
diff --git a/resource/examples/ocicuc/demo_client.hpp b/resource/examples/ocicuc/demo_client.hpp
deleted file mode 100644 (file)
index d5ce578..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-
-/* Example client program (this is not a library header, don't include it in random programs): */
-
-namespace Intel { namespace OCDemo { namespace client {
-
-// Although not "done" here, this could be expanded into an interface to handle any sort of
-// resource:
-class resource_handle
-{
- friend class resource_handler;
-
- private:
- const std::string                     URI;
- std::shared_ptr<OC::OCResource>       resource;
-
- public:
- resource_handle(const std::string& URI_, std::shared_ptr<OC::OCResource> resource_)
-  : URI(URI_),
-    resource(resource_)
- {}
-
- resource_handle(const std::string& URI_)
-  : URI(URI_)
- {}
-
- // Callbacks (note that the signature after binding will match exactly:
- private:
- void onFoundResource(std::shared_ptr<OC::OCResource> in_resource);
- void onResourceGet(const OC::HeaderOptions& headerOptions,
-                OC::OCRepresentation rep, const int error_code);
- void onResourcePut(const OC::HeaderOptions& headerOptions, const OC::OCRepresentation rep,
-                const int error_code);
- void onObserve(const OC::HeaderOptions& headerOptions, const OC::OCRepresentation rep,
-                const int error_code, const int& sequence_number);
-};
-
-class resource_handler
-{
-
- static std::vector<std::shared_ptr<resource_handle>> resources;    // URI -> Maybe resource
-
- public:
- resource_handler(const std::vector<std::string>& resource_URIs_);
- resource_handler();
-
- public:
- bool has(const std::string& URI)
- {
-    for(const auto& r : resources)
-     {
-      if(URI == r->URI)
-       return true;
-     }
-
-    return false;
- }
-
- void add(const std::string& URI)
- {
-    if(!has(URI))
-     resources.emplace_back(std::make_shared<resource_handle>(URI));
- }
-
- void find_resources()
- {
-        for(const auto& resource : resources)
-         {
-                std::cout << "* Finding resources \"" << resource->URI << "\".\n";
-
-                call_timer.mark("find_resources");
-
-                OC::OCPlatform::findResource("", resource->URI,
-                                      std::bind(&resource_handle::onFoundResource, resource, std::placeholders::_1));
-         }
- }
-};
-
-std::vector<std::shared_ptr<resource_handle>> resource_handler::resources;
-
-resource_handler::resource_handler(const std::vector<std::string>& resource_URIs)
-{
- for(const auto& URI : resource_URIs)
-  add(URI);
-}
-
-void resource_handle::onFoundResource(std::shared_ptr<OC::OCResource> in_resource)
-{
- using std::cout;
-
- cout << "* onFoundResource():\n";
-
- try
-  {
-       if(nullptr == in_resource)
-        throw OC::OCException("invalid resource passed to client callback");
-
-       call_timer.report_and_reset("find_resources");
-
-       // Now, fixup our own representation ptr:
-       resource = in_resource;
-
-       /* Note: You can combine the host and URI to get a unique identifier, for
-       example to filter out events you aren't interested in. Here, we just report the
-       data: */
-       cout << "resource URI: " << resource->uri() << "; "
-            << "host address: " << resource->host() << '\n';
-
-       call_timer.mark("get_resource");
-
-       OC::QueryParamsMap qpm;
-
-       resource->get(qpm, std::bind(&resource_handle::onResourceGet, this,
-            std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
-  }
- catch(OC::OCException& e)
-  {
-        std::cerr << "onFoundResource(): exception " << e.reason() << ": " << e.what() << '\n';
-  }
- catch(std::exception& e)
-  {
-        std::cerr << "onFoundResource(): exception: " << e.what() << '\n';
-  }
-}
-
-void resource_handle::onResourceGet(const OC::HeaderOptions& headerOptions,
-                const OC::OCRepresentation rep, const int error_code)
-{
- using std::cout;
-
- cout << "onResourceGet():\n";
-
- call_timer.report_and_reset("get_resource");
-
- if(error_code)
-  {
-        std::cerr << "onResourceGet(): error: " << error_code << '\n';
-        return;
-  }
-
- if(nullptr == resource)
-  {
-        std::cerr << "onResourceGet(): empty resource pointer.\n";
-        return;
-  }
-
- std::cout << "input attributes:\n";
- std::cout << "Attribute \"" << "state" << "\": "<< rep.getValue<bool>("state")<<"; ";
- std::cout << "Attribute \"" << "power" << "\": "<< rep.getValue<int>("power")<<"; \n";
-
- // Now, make a change to the light representation (replacing, rather than parsing):
- bool state = true;
- int power = 10;
-
- std::cout << "output attributes:\n";
- std::cout << "Attribute \"" << "state" << "\": "<< state<<"; ";
- std::cout << "Attribute \"" << "power" << "\": "<< power<<"; \n";
-
- call_timer.mark("put_resource");
-
- OC::OCRepresentation out_rep;
- out_rep.setValue("state", state);
- out_rep.setValue("power", power);
-
- resource->put(out_rep, OC::QueryParamsMap(),
-               std::bind(&resource_handle::onResourcePut, this, std::placeholders::_1,
-               std::placeholders::_2, std::placeholders::_3));
-}
-
-void resource_handle::onResourcePut(const OC::HeaderOptions& headerOptions,
-            const OC::OCRepresentation rep, const int error_code)
-{
- std::cout << "onResourcePut():\n";
-
- call_timer.report_and_reset("put_resource");
-
- if(0 != error_code)
-  {
-        std::ostringstream os;
-
-        os << "onResourcePut(): error code " << error_code << " from server response.";
-
-        throw OC::OCException(os.str());
-  }
-
- std::cout << "input attributes:\n";
- std::cout << "Attribute \"" << "state" << "\": "<< rep.getValue<bool>("state")<<"; ";
- std::cout << "Attribute \"" << "power" << "\": "<< rep.getValue<int>("power")<<"; \n";
-
- call_timer.mark("observe_resource");
-
- // Start an observer:
- resource->observe(OC::ObserveType::Observe, OC::QueryParamsMap(),
-                std::bind(&resource_handle::onObserve, this,
-                std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
-                std::placeholders::_4));
-}
-
-void resource_handle::onObserve(const OC::HeaderOptions& headerOptions,
-            const OC::OCRepresentation rep, const int error_code, const int& sequence_number)
-{
- if(0 != error_code)
-  {
-    std::ostringstream os;
-    os << "onObserve(): error " << error_code << " from callback.\n";
-    throw OC::OCException(os.str());
-  }
-
- std::cout << "onObserve(): sequence number: " << sequence_number << ":\n";
-
- call_timer.report_and_reset("observe_resource");
-
- std::cout << "Attribute \"" << "state" << "\": "<< rep.getValue<bool>("state")<<"; ";
- std::cout << "Attribute \"" << "power" << "\": "<< rep.getValue<int>("power")<<"; \n";
-
- const auto oc = observe_count();
-
- std::cout << "onObserve(): observation count is: " << oc << '\n';
-
- // We don't want to be observed forever for purposes of this demo:
- if(10 <= oc)
-  {
-    std::cout << "onObserve(): cancelling observation.\n";
-
-    const auto result = resource->cancelObserve();
-
-    std::cout << "onObserve(): result of cancellation: " << result << ".\n";
-
-    this_thread::sleep_for(chrono::seconds(10));
-  }
-}
-
-}}} // namespace Intel::OCDemo::client
-
-
diff --git a/resource/examples/ocicuc/driver.cpp b/resource/examples/ocicuc/driver.cpp
deleted file mode 100644 (file)
index 9d7edb5..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-
-#include <iostream>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <boost/program_options.hpp>
-
-#include "exec.hpp"
-
-namespace Intel { namespace OCDemo {
-
-auto parse_options(boost::program_options::options_description& desc, int argc, char *argv[]) 
-    -> boost::program_options::variables_map 
-{
- namespace po = boost::program_options;
-
- po::positional_options_description popts;
- popts.add("uri", -1);
-
- po::variables_map vm;
-
- po::store(po::command_line_parser(argc,argv).options(desc).positional(popts).run(), 
-           vm);
-
- po::notify(vm);
-
- return vm;
-}
-
-}} // namespace Intel::OCDemo
-
-int main(int argc, char *argv[])
-try
-{
- using namespace std;
- auto desc = Intel::OCDemo::make_description();
- auto vm   = Intel::OCDemo::parse_options(desc, argc, argv);
-
- if(1 == argc || vm.count("help"))
-  {
-    std::cerr << desc << '\n';
-    return 1;
-  }
-
- return Intel::OCDemo::exec(vm);
-}
-catch(std::exception& e)
-{
- std::cerr << "Unhandled exception: " << e.what() << '\n';
- return 1;
-}
-catch(...)
-{
- std::cerr << "Unhandled exception.\n";
- return 1;
-}
diff --git a/resource/examples/ocicuc/exec.hpp b/resource/examples/ocicuc/exec.hpp
deleted file mode 100644 (file)
index f1ff62a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef __EXEC_HPP
- #define __EXEC_HPP 1
-
-#include <boost/program_options.hpp>
-
-/* Interface point for the driver code. Your program needs to implement these
-functions: */
-namespace Intel { namespace OCDemo {
-
-int exec(const boost::program_options::variables_map& vm);
-
-auto make_description()
-    -> boost::program_options::options_description;
-
-}} // namespace Intel::OCDemo
-
-#endif
diff --git a/resource/examples/ocicuc/light_resource.cpp b/resource/examples/ocicuc/light_resource.cpp
deleted file mode 100644 (file)
index 6586ac6..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-#include "light_resource.hpp"
-
-namespace Intel { namespace OCDemo {
-
-std::atomic<bool> LightResource::shutdown_flag(false);
-std::thread LightResource::observe_thread;
-
-void LightResource::setRepresentation(const OCRepresentation& rep)
-{
- cout << "\t\t\t" << "Received representation: " << endl;
-
- rep.getValue("state", m_state);
- rep.getValue("power", m_power);
-
- cout << "\t\t\t\t" << "power: " << m_power << endl;
- cout << "\t\t\t\t" << "state: " << m_state << endl;
-}
-
-OCRepresentation LightResource::getRepresentation(void)
-{
- m_rep.setValue("state", m_state);
- m_rep.setValue("power", m_power);
- return m_rep;
-}
-
-void LightResource::addType(const std::string& type) const
-{
- OCStackResult result = OC::OCPlatform::bindTypeToResource(m_resourceHandle, type);
-
- if(OC_STACK_OK != result)
-  cout << "Binding TypeName to Resource was unsuccessful, result was " << result << '\n';
-}
-
-void LightResource::addInterface(const std::string& interface) const
-{
- OCStackResult result = OC::OCPlatform::bindInterfaceToResource(m_resourceHandle, interface);
-
- if(OC_STACK_OK != result)
-  cout << "Binding TypeName to Resource was unsuccessful, result was " << result << '\n';
-}
-
-void LightResource::createResource(const unsigned int resource_number)
-{
- string resourceURI      { make_URI(resource_number) };
- string resourceTypeName { "core.light" };
-
- cout << "registering resource: " << resourceURI << '\n';
- cout << "registering type name \"" << resourceTypeName << "\".\n";
- // This will internally create and register the resource, binding the current instance's method as a callback:
- OCStackResult result = OC::OCPlatform::registerResource(
-                                            m_resourceHandle, resourceURI, resourceTypeName,
-                                            DEFAULT_INTERFACE,
-                                            std::bind(&LightResource::entityHandler, this, std::placeholders::_1),
-                                            OC_DISCOVERABLE | OC_OBSERVABLE);
-  if (OC_STACK_OK != result)
-   std::cout << "Resource creation failed.\n";
-}
-
-void LightResource::observe_function()
-{
- cerr << "Observation thread is spinning up.\n";
-
- while(!shutdown_flag)
-  {
-    std::this_thread::sleep_for(std::chrono::seconds(2));
-
-    if(!m_observation)
-     continue;
-
-    m_power += 10;
-
-    const auto result = OC::OCPlatform::notifyAllObservers(getHandle());
-
-    // Stop notifications when there are no more observers:
-    if(OC_STACK_NO_OBSERVERS == result)
-     {
-        m_observation = 0;
-     }
-  }
-
- cerr << "Observation thread is shutting down.\n";
-}
-
-void LightResource::unregisterResource()
-{
-    std::cout << "Unregistering light resource"<<std::endl;
-
-    OCStackResult result = OC::OCPlatform::unregisterResource(m_resourceHandle);
-
-    if(result == OC_STACK_OK)
-    {
-        std::cout << "Resource unregistered."<<std::endl;
-    }
-    else
-    {
-        cerr << "Unregister resource failed: "<<std::endl;
-    }
-}
-
-// This is just a sample implementation of entity handler.
-// Entity handler can be implemented in several ways by the manufacturer
-OCEntityHandlerResult LightResource::entityHandler(std::shared_ptr<OCResourceRequest> request)
-{
-    if(!request)
-     {
-        cerr << "entityHandler(): Received invalid request object.\n";
-        return OC_EH_ERROR;
-     }
-
-    switch(request->getRequestHandlerFlag())
-    {
-        default:
-                cerr << "entityHandler(): invalid request flag\n";
-                break;
-
-        case RequestHandlerFlag::InitFlag:
-                cerr << "entityHandler(): Initialization requested.\n";
-                break;
-
-        case RequestHandlerFlag::RequestFlag:
-                dispatch_request(request->getRequestType(), request);
-                break;
-
-        case RequestHandlerFlag::ObserverFlag:
-                handle_observe_event(request);
-                break;
-    }
-
-    return OC_EH_OK;
-}
-
-void LightResource::dispatch_request(const std::string& request_type, std::shared_ptr<OCResourceRequest> request)
-{
- std::cout << "dispatch_request(): " << request_type << '\n';
-
- if("GET" == request_type)
-  return handle_get_request(request);
-
- if("PUT" == request_type)
-  return handle_put_request(request);
-
- if("POST" == request_type)
-  return handle_post_request(request);
-
- if("DELETE" == request_type)
-  return handle_delete_request(request);
-
- cerr << "entityHandler(): Invalid request type \"" << request_type << "\".\n";
-}
-
-void LightResource::handle_get_request(std::shared_ptr<OCResourceRequest> request)
-{
- cout << "handle_get_request():\n";
-
- const auto query_params_map = request->getQueryParameters();
-
- // ...do any processing of the query here...
-
- // Get a representation of the resource and send it back as a response:
- auto pResponse = std::make_shared<OC::OCResourceResponse>();
- pResponse->setRequestHandle(request->getRequestHandle());
- pResponse->setResourceHandle(request->getResourceHandle());
- pResponse->setErrorCode(200);
- pResponse->setResponseResult(OC_EH_OK);
- pResponse->setResourceRepresentation(getRepresentation());
- OCPlatform::sendResponse(pResponse);
-}
-
-void LightResource::handle_put_request(std::shared_ptr<OCResourceRequest> request)
-{
- // Here's how you would get any query parameters:
- const auto query_params_map = request->getQueryParameters();
- // ...do something with the query parameters (if there were any)...
-
- auto rep = request->getResourceRepresentation();
-
- setRepresentation(rep);
-
- auto pResponse = std::make_shared<OC::OCResourceResponse>();
- pResponse->setRequestHandle(request->getRequestHandle());
- pResponse->setResourceHandle(request->getResourceHandle());
- pResponse->setErrorCode(200);
- pResponse->setResponseResult(OC_EH_OK);
- pResponse->setResourceRepresentation(getRepresentation());
- OCPlatform::sendResponse(pResponse);
-}
-
-void LightResource::handle_post_request(std::shared_ptr<OCResourceRequest> request)
-{
- // ...demo-code...
-}
-
-void LightResource::handle_delete_request(std::shared_ptr<OCResourceRequest> request)
-{
- // ...demo-code...
-}
-
-// Set up observation in a separate thread:
-void LightResource::handle_observe_event(std::shared_ptr<OCResourceRequest> request)
-{
- if(observe_thread.joinable())
-  return;
-
- observe_thread = thread(bind(&LightResource::observe_function, this));
- observe_thread.detach();
-}
-
-
-
-}} // namespace Intel::OCDemo
-
diff --git a/resource/examples/ocicuc/light_resource.hpp b/resource/examples/ocicuc/light_resource.hpp
deleted file mode 100644 (file)
index 494b366..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef __LIGHT_RESOURCE_HPP
- #define __LIGHT_RESOURCE_HPP
-
-#include <map>
-#include <atomic>
-#include <thread>
-#include <string>
-#include <ostream>
-#include <sstream>
-#include <iostream>
-#include <functional>
-
-#include "OCApi.h"
-#include "OCResource.h"
-#include "OCPlatform.h"
-
-/* An example of a server-side resource: */
-namespace Intel { namespace OCDemo {
-
-using namespace OC;
-using namespace std;
-
-/// This class represents a single resource named 'lightResource'. This resource has
-/// two simple properties named 'state' and 'power'
-class LightResource
-{
- public:
-    bool m_state;       // off or on?
-    int m_power;        // power level
-    OCRepresentation m_rep;
-
-    private:
-    atomic<bool> m_observation; // are we under observation?
-
-    private:
-    static atomic<bool> shutdown_flag;
-    static thread observe_thread;
-
-    private:
-    OCResourceHandle m_resourceHandle;
-
-    public:
-    LightResource()
-     : m_state(false),
-       m_power(0),
-       m_observation(false)
-    {}
-
-    ~LightResource()
-    {
-        shutdown_flag = true;
-
-        if(observe_thread.joinable())
-         observe_thread.join();
-    }
-
-    private:
-    inline std::string make_URI(const unsigned int resource_number)
-    {
-        std::string uri = std::string("/a/light") + "_" + std::to_string(resource_number);
-        m_rep.setUri(uri);
-        return uri;
-    }
-
-    public:
-    // This function internally calls registerResource API.
-    void createResource(const unsigned int resource_number);
-    void unregisterResource();
-    OCResourceHandle getHandle() const { return m_resourceHandle; }
-
-    void setRepresentation(const OCRepresentation& rep);
-    OCRepresentation getRepresentation(void);
-
-    void addType(const std::string& type) const;
-    void addInterface(const std::string& interface) const;
-
-    private:
-    OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request);
-
-    private:
-    void observe_function();
-
-    // Request handlers:
-    private:
-    void dispatch_request(const std::string& request_type, std::shared_ptr<OCResourceRequest> request);
-    void handle_get_request(std::shared_ptr<OCResourceRequest> request);
-    void handle_put_request(std::shared_ptr<OCResourceRequest> request);
-    void handle_post_request(std::shared_ptr<OCResourceRequest> request);
-    void handle_delete_request(std::shared_ptr<OCResourceRequest> request);
-    void handle_observe_event(std::shared_ptr<OCResourceRequest> request);
-};
-
-}} // namespace Intel::OCDemo
-
-#endif
diff --git a/resource/examples/ocicuc/monoprocess.cpp b/resource/examples/ocicuc/monoprocess.cpp
deleted file mode 100644 (file)
index 14566ea..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Corporation All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <map>
-#include <thread>
-#include <atomic>
-#include <string>
-#include <memory>
-#include <utility>
-#include <ostream>
-#include <sstream>
-#include <iostream>
-
-#include "OCApi.h"
-#include "OCResource.h"
-#include "OCPlatform.h"
-
-#include "exec.hpp"
-#include "utility.hpp"
-
-#include "demo_client.hpp"
-#include "light_resource.hpp"
-
-namespace Intel { namespace OCDemo {
-
-auto make_description()
-    -> boost::program_options::options_description
-{
- using std::string;
-
- namespace po = boost::program_options;
-
- po::options_description desc("Monoprocess Client/Server options");
-
- desc.add_options()
-    ("nres",        po::value<unsigned long>()->default_value(1),  "number of resources to use for testing")
-    ("host_ip",     po::value<string>()->default_value("0.0.0.0"), "IP of host")
-    ("host_port",   po::value<uint16_t>()->default_value(0),       "port of host")
-    ("interface",   po::value<string>()->default_value("eth0"),    "network interface name")
-    ("uri",         po::value<vector<string>>(),                   "resource URI")
-    ;
-
- return desc;
-}
-
-/* Unfortunately, our target compiler may not support std::async correctly, so this
-leverages RAII to save us from having to use the double-join-check pattern: */
-struct simple_join_guard
-{
- thread t;
-
- template <class FnT>
- simple_join_guard(FnT&& fn)
-  : t(fn)
- {}
-
- ~simple_join_guard()
- {
-    if(t.joinable())
-     t.join();
- }
-};
-
-struct client_t
-{
- const boost::program_options::variables_map        m_vm;
-
- atomic<bool>&                                      quit_flag;
-
- vector<string>                                     resource_URIs;
-
- public:
- client_t(const boost::program_options::variables_map vm,
-          atomic<bool>& quit_flag_)
-  : m_vm(vm),
-    quit_flag(quit_flag_)
- {}
-
- public:
- void init()
- {
-    if(0 != m_vm.count("uri"))
-     {
-        const vector<string>& input_URIs = m_vm["uri"].as< vector<string> >();
-        copy(begin(input_URIs), end(input_URIs), back_inserter(resource_URIs));
-     }
-    else
-     resource_URIs.push_back("coap://224.0.1.187/oc/core");
-  }
-
- void operator()()
- {
-    std::cout << "Requesting " << resource_URIs.size() << " URIs:\n";
-
-    for(const auto& resource_URI : resource_URIs)
-     cout << resource_URI << '\n';
-
-    Intel::OCDemo::client::resource_handler resources(resource_URIs);
-
-    // Register callbacks and wait for resources:
-    resources.find_resources();
-
-    // Allow the client to receive events from the server:
-    while(!quit_flag)
-     {
-        std::this_thread::sleep_for(std::chrono::seconds(1));
-     }
- }
-};
-
-struct server_t
-{
- const boost::program_options::variables_map        m_vm;
-
- atomic<bool>&                                      quit_flag;
-
- unsigned long                                      m_nresources;
-
- vector<string>                                     resource_URIs;
-
- vector<shared_ptr<Intel::OCDemo::LightResource>>   lights;
-
- public:
- server_t(const boost::program_options::variables_map& vm,
-          atomic<bool>& quit_flag_)
-  : m_vm(vm),
-    quit_flag(quit_flag_)
- {
-    m_nresources = vm["nres"].as<unsigned long>();
- }
-
- public:
- void init();
-
- void operator()()
- {
-    while(!quit_flag)
-     {
-        std::this_thread::sleep_for(std::chrono::seconds(5));
-     }
- }
-};
-
-void server_t::init()
-{
- lights.resize(m_nresources);
-
- for(unsigned int resource_number = 1; m_nresources >= resource_number; resource_number++)
-  {
-    cout << "Registering resource " << resource_number << ": " << std::flush;
-
-    auto lr = make_shared<Intel::OCDemo::LightResource>();
-
-    lr->createResource(resource_number);
-    lr->addType("core.brightlight");
-    lr->addInterface("oc.mi.ll");
-
-    lights.push_back(lr);
-
-    cout << "Ok." << std::endl;
-  }
-}
-
-int exec(const boost::program_options::variables_map& vm)
-{
- using namespace std;
-
- std::cout << "Starting platform: " << std::flush;
-
- OC::OCPlatform::Configure(OC::PlatformConfig {
-                          OC::ServiceType::InProc,
-                          OC::ModeType::Both,                   // run in client/server mode
-                          vm["host_ip"].as<string>(),           // host
-                          vm["host_port"].as<uint16_t>(),       // port
-                          OC::QualityOfService::LowQos
-                        });
- std::cout << "Ok." << std::endl;
-
- std::atomic<bool> quit_flag;
-
- server_t server(vm, quit_flag);
- client_t client(vm, quit_flag);
-
-std::cout << "JFW: TODO: don't need to separate these any more\n";
- server.init();
- client.init();
-
- // Run the server and client:
- {
-    simple_join_guard server_guard(server);
-    simple_join_guard client_guard(client);
-
-    // Note that at present nothing makes this true:
-    while(!quit_flag)
-     {
-        // Perform app tasks
-        std::this_thread::sleep_for(std::chrono::seconds(2));
-     }
-  }
-
- return 1;
-}
-
-}} // namespace Intel::OCDemo
-
diff --git a/resource/examples/ocicuc/server.cpp b/resource/examples/ocicuc/server.cpp
deleted file mode 100644 (file)
index 65fca0e..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include "utility.hpp"
-
-#include "exec.hpp"
-#include "light_resource.hpp"
-
-namespace Intel { namespace OCDemo {
-
-auto make_description()
-    -> boost::program_options::options_description
-{
- using std::string;
-
- namespace po = boost::program_options;
-
- po::options_description desc("Server options");
-
- desc.add_options()
-    ("nres",        po::value<unsigned long>()->default_value(1),         "number of resources to use for testing")
-    ("host_ip",     po::value<string>()->default_value("0.0.0.0"), "IP of host")
-    ("host_port",   po::value<uint16_t>()->default_value(0),          "port of host")
-    ("interface",   po::value<string>()->default_value("eth0"),           "network interface name")
-    ("uri",     po::value<vector<string>>(),                              "resource URI")
-    ("runtime", po::value<unsigned int>()->default_value(3600),             "time in seconds to keep the server alive")
-    ;
-
- return desc;
-}
-
-int exec(const boost::program_options::variables_map& vm)
-{
- using namespace std;
-
- std::cout << "Starting platform: " << std::flush;
-
- OC::OCPlatform::Configure({
-                          OC::ServiceType::InProc,              // in-process server
-                          OC::ModeType::Server,                 // run in server mode
-                          vm["host_ip"].as<string>(),           // host
-                          vm["host_port"].as<uint16_t>(),       // port
-                          OC::QualityOfService::LowQos
-                        });
-
- std::cout << "Ok." << std::endl;
-
- vector<string> resource_URIs;
-
- vector<shared_ptr<Intel::OCDemo::LightResource>> lights;
-
- const unsigned long& nresources = vm["nres"].as<unsigned long>();
-
- for(unsigned int resource_number = 1; nresources >= resource_number; resource_number++)
-  {
-        cout << "Registering resource " << resource_number << ": " << std::flush;
-
-        auto lr = make_shared<Intel::OCDemo::LightResource>();
-
-        lr->createResource(resource_number);
-        lr->addType(std::string("core.brightlight"));
-        lr->addInterface(std::string("oc.mi.ll"));
-
-        lights.push_back(lr);
-
-        cout << "Ok." << std::endl;
-  }
-
- // Perform app tasks
- cout << "Sleeping for "<< vm["runtime"].as<unsigned int>()<<" seconds."<<endl;
- std::this_thread::sleep_for(std::chrono::seconds( vm["runtime"].as<unsigned int>()));
-
- for(auto light: lights)
- {
-    light->unregisterResource();
- }
-
- return 1;
-}
-
-}} // namespace Intel::OCDemo
-
diff --git a/resource/examples/ocicuc/small_example.cpp b/resource/examples/ocicuc/small_example.cpp
deleted file mode 100644 (file)
index e641cff..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Example program illustrating how to work with the ocicuc driver program: */
-
-#include "exec.hpp"
-
-#include <iostream>
-
-namespace Intel { namespace OCDemo {
-
-/* exec() is essentially main(), and is where the driver will start your
-program after command-line options have been parsed: */
-int exec(const boost::program_options::variables_map& vm)
-{
- using std::cout;
-
- cout << "This is the start of my wonderful program!\n";
-
- cout << "My command-line options are:\n";
-
- for(const auto& o : vm)
-  cout << o.first << " => " << o.second.as<std::string>() << '\n';
-
- return 0;
-}
-
-/* make_description() is your opportunity to describe your program's help screen and command
-line parameter types. Refer to the boost::program_options library for details on how to
-add different kinds of command-line options: */
-auto make_description()
-    -> boost::program_options::options_description
-{
- namespace po = boost::program_options;     // because boost::program_options is a lot to type!
-
- po::options_description desc("My wonderful program's options! Run with \"--\" to simply use the defaults.");
-
- desc.add_options()
-    ("param",   po::value<std::string>()->default_value("Hello, World!"),   "description of param")
-    ;
-
- return desc;
-}
-
-}} // namespace Intel::OCDemo
-
-
diff --git a/resource/examples/ocicuc/utility.cpp b/resource/examples/ocicuc/utility.cpp
deleted file mode 100644 (file)
index 823e57f..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <chrono>
-#include <string>
-#include <iostream>
-#include <algorithm>
-
-#include "utility.hpp"
-
-namespace Intel { namespace OCDemo {
-
-int observe_count()
-{
- static unsigned long long oc = 0;
- return ++oc;
-}
-
-}} // namespace Intel::OCDemo
-
-// Helper for measuring call times:
-namespace Intel { namespace OCDemo {
-
-using std::cout;
-using namespace std::chrono;
-
-call_times call_timer;
-
-void call_times::reset(const std::string& entry) 
-{ 
- timings[entry] = make_pair(high_resolution_clock::now(), std::chrono::high_resolution_clock::time_point()); 
-}
-
-void call_times::mark(const std::string& name)
-{
- auto e = timings.find(name);
-
-    if(timings.end() == e)
-     {
-        reset(name);
-        return;
-     }
-
-    auto& tp = (*e).second;
-
-    if(tp.first > tp.second)
-     timings[name].second = high_resolution_clock::now();
-  }
-
-void call_times::report()
-{
- cout << "Time marks:\n";
-
- for_each(begin(timings), end(timings), 
- [](const std::pair<std::string, clock_interval>& tm) -> void 
- {
-    const std::string& name     { tm.first };
-
-    const time_point<high_resolution_clock>& request_time    { tm.second.first };
-    const time_point<high_resolution_clock>& response_time   { tm.second.second };
-
-    cout << '\t' << name << ": ";
-
-    if(request_time > response_time)
-     {
-        cout << "<waiting>\n";
-        return;
-     }
-
-    auto elapsed_ms = duration_cast<std::chrono::milliseconds>(response_time - request_time).count();
-    cout << elapsed_ms << "ms (";
-
-    auto elapsed_us = duration_cast<std::chrono::microseconds>(response_time - request_time).count();
-    cout << elapsed_us << "us)\n";
- });
-}
-
-void call_times::report_and_reset(const std::string& name)
-{
- mark(name), report(), reset(name);
-}
-
-
-}} // namespace Intel::OCDemo
diff --git a/resource/examples/ocicuc/utility.hpp b/resource/examples/ocicuc/utility.hpp
deleted file mode 100644 (file)
index bc734d7..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Intel Corporation All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef __OC_OCDEMO_UTILITY_H
- #define __OC_OCDEMO_UTILITY_H
-
-#include <map>
-#include <tuple>
-#include <chrono>
-#include <ostream>
-
-#include "OCApi.h"
-
-namespace Intel { namespace OCDemo {
-
-/* A static observation counter: */
-int observe_count();
-
-/* Helpers for measuring request times: */
-typedef std::pair<
-                    std::chrono::time_point<std::chrono::high_resolution_clock>,
-                    std::chrono::time_point<std::chrono::high_resolution_clock>
-                 > clock_interval;
-
-struct call_times
-{
- public:
- bool display_reports;
-
- public:
- std::map<std::string, clock_interval> timings;
-
- public:
- call_times()
-  : display_reports(true)
- {}
-
- call_times(const bool& display_reports_)
-  : display_reports(display_reports_)
- {}
-
- public:
- void reset(const std::string& entry);
- void mark(const std::string& name);
-
- void report();
- void report_and_reset(const std::string& name);
-};
-
-extern call_times call_timer;
-
-}} // namespace Intel::OCDemo
-
-#endif