IOT-1994 Simplify OCStack public header file requirements
authorWay Vadhanasin <wayvad@microsoft.com>
Wed, 12 Apr 2017 05:44:54 +0000 (22:44 -0700)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Thu, 13 Apr 2017 02:32:26 +0000 (02:32 +0000)
commit140b6c46e2fc6c6ef896bd9ddac9b190bc9e6fd7
treed432b6cb43c69744bbccd3f24125f0520e9555b2
parent50fe8ac68c06c6d98aa605d6a5b6028d599ec447
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>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18487
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
22 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/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/tizen/SimpleClientServer/occlient.cpp
resource/include/OCApi.h
resource/include/OCProvisioningManager.hpp
resource/src/OCRepresentation.cpp