IOT-1994 Simplify OCStack public header file requirements
authorWay Vadhanasin <wayvad@microsoft.com>
Fri, 14 Apr 2017 14:47:47 +0000 (07:47 -0700)
committerDave Thaler <dthaler@microsoft.com>
Tue, 25 Apr 2017 16:48:45 +0000 (16:48 +0000)
commitc6a633d6bfebae13da8c61a34cd9f0e15fee671e
tree9bd4b1299f5864682d7a3b8471f77c553d9014c1
parente65c43b752c35ab8f807452f935c78a9713f34a3
IOT-1994 Simplify OCStack public header file requirements

Applications that need to include ocstack.h for access to OC* APIs currently need to bring in
multiple unrelated (and platform-specific) headers. This is because octypes.h, a public type
definition header used by ocstack.h, is including more headers than it needs to. It is more
desirable for applications to bring in only requird headers.

This change reduces the number of required headers from the public surface, specifically ocstack.h,
by taking advantange of IoTivity's requirement that all supported compilers are at least
C++11-compliant. See https://wiki.iotivity.org/compiler_support?s[]=compiler for details.

Before this change, users of ocstack.h must also bring in (this example is from Windows):

    Ocstack.h
    Octypes.h
    Iotivity_config.h
    Ocpresence.h
    Ocstackconfig.h
    Platform_features.h
    Windows\include\memmem.h
    Windows\include\pthread_create.h
    Windows\include\vs12_snprintf.h
    Windows\include\win_sleep.h

After this change, the list becomes:

    Ocstack.h
    Octypes.h
    Ocpresence.h
    Ocstackconfig.h

Arguably ocpresence.h and ocstackconfig.h could be combined into octypes.h since they are just
simple type definitions, just like octypes.h. That work is lower priority as both ocpresence.h
and ocstackconfig.h are already platform independent.

Change-Id: I9943589603453730446b2d616b497fbb235774a5
Signed-off-by: Way Vadhanasin <wayvad@microsoft.com>
(cherry picked from commit 140b6c46e2fc6c6ef896bd9ddac9b190bc9e6fd7)
Reviewed-on: https://gerrit.iotivity.org/gerrit/18869
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Reviewed-by: Mats Wichmann <mats@linux.com>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
24 files changed:
plugins/samples/linux/IotivityandZigbeeClient.c
resource/IPCA/samples/ElevatorClient/ElevatorClient.cpp
resource/IPCA/src/ipca.cpp
resource/IPCA/unittests/IPCAElevatorClient.cpp
resource/c_common/platform_features.h
resource/csdk/include/octypes.h
resource/csdk/resource-directory/samples/rd_publishingClient.cpp
resource/csdk/resource-directory/samples/rd_queryClient.cpp
resource/csdk/resource-directory/src/rd_server.c
resource/csdk/resource-directory/unittests/rdtests.cpp
resource/csdk/security/provisioning/src/multipleownershiptransfermanager.c
resource/csdk/security/provisioning/src/ownershiptransfermanager.c
resource/csdk/security/provisioning/src/secureresourceprovider.c
resource/csdk/security/src/amaclresource.c
resource/csdk/security/src/directpairing.c
resource/csdk/security/src/pstatresource.c
resource/csdk/security/unittest/srmtestcommon.cpp
resource/csdk/stack/samples/linux/OCSample/occlient.c
resource/csdk/stack/samples/linux/OCSample/ocserver.c
resource/csdk/stack/samples/linux/SimpleClientServer/ocremoteaccessclient.cpp
resource/csdk/stack/samples/tizen/SimpleClientServer/occlient.cpp
resource/include/OCApi.h
resource/include/OCProvisioningManager.hpp
resource/src/OCRepresentation.cpp