Change some codes using C++11 features which is not supported on GCC4.6.
Change-Id: I864321abdfaee960277ebfcab5fa09c33757453e
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1688
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
timer_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'libcoap'])
if target_os not in ['windows', 'winrt']:
- timer_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++11'])
+ timer_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
if target_os == 'linux':
timer_env.AppendUnique(LIBS = ['pthread'])
explicit PrimitiveException(const std::string& what) : m_what{ what } {}
explicit PrimitiveException(std::string&& what) : m_what{ std::move(what) } {}
- const char* what() const noexcept override
+ virtual ~PrimitiveException() noexcept {}
+
+ virtual const char* what() const noexcept
{
return m_what.c_str();
}
namespace Service
{
- using HeaderOption = OC::HeaderOption::OCHeaderOption;
- using HeaderOptions = std::vector<HeaderOption>;
+ typedef OC::HeaderOption::OCHeaderOption HeaderOption;
+ typedef std::vector<HeaderOption> HeaderOptions;
class ResourceAttributes;
class ResponseStatement;
class PrimitiveResource
{
public:
- using Ptr = std::shared_ptr<PrimitiveResource>;
+ typedef std::shared_ptr<PrimitiveResource> Ptr;
- using GetCallback = std::function<
- void(const HeaderOptions&, const ResponseStatement&, int)>;
+ typedef std::function<void(const HeaderOptions&, const ResponseStatement&, int)>
+ GetCallback;
- using SetCallback = std::function<
- void(const HeaderOptions&, const ResponseStatement&, int)>;
+ typedef std::function<void(const HeaderOptions&, const ResponseStatement&, int)>
+ SetCallback;
- using ObserveCallback = std::function<
- void(const HeaderOptions&, const ResponseStatement&, int, int)>;
+ typedef std::function<void(const HeaderOptions&, const ResponseStatement&, int, int)>
+ ObserveCallback;
public:
static PrimitiveResource::Ptr create(const std::shared_ptr<OC::OCResource>&);
- virtual ~PrimitiveResource() = default;
+ virtual ~PrimitiveResource() { };
virtual void requestGet(GetCallback) = 0;
virtual void requestSet(const ResourceAttributes&, SetCallback) = 0;
PrimitiveResource& operator=(PrimitiveResource&&) = delete;
};
- using DiscoverCallback = std::function<void(std::shared_ptr<PrimitiveResource>)>;
+ typedef std::function<void(std::shared_ptr<PrimitiveResource>)> DiscoverCallback;
void discoverResource(const std::string& host, const std::string& resourceURI,
OCConnectivityType, DiscoverCallback);
private:
template< typename T > struct IsSupportedTypeHelper;
- using ValueVariant = boost::variant<
+ typedef boost::variant<
std::nullptr_t,
int,
double,
bool,
std::string,
ResourceAttributes
- >;
+ > ValueVariant;
- template< typename T >
- using mpl_begin = typename boost::mpl::begin<T>::type;
-
- template< typename T, typename V = void >
- using enable_if_supported = typename std::enable_if<
- IsSupportedTypeHelper< T >::type::value, V >::type;
-
- template< typename T, typename V = void >
- using enable_if_unsupported = typename std::enable_if<
- !IsSupportedTypeHelper< T >::type::value, V >::type;
+ template< typename T, typename V = void,
+ typename = typename std::enable_if<
+ IsSupportedTypeHelper< T >::type::value, V >::type >
+ struct enable_if_supported
+ {
+ typedef V type;
+ };
template< typename VISITOR >
class KeyValueVisitorHelper: public boost::static_visitor< >
public:
template< typename T >
- using is_supported_type = typename IsSupportedTypeHelper< T >::type;
+ struct is_supported_type: public std::conditional<
+ IsSupportedTypeHelper< T >::type::value, std::true_type, std::false_type>::type { };
enum class TypeId
{
Value(const Value&);
Value(Value&&);
- template< typename T, typename = enable_if_supported< T > >
+ template< typename T, typename = typename enable_if_supported< T >::type >
Value(T&& value) :
m_data{ new ValueVariant{ std::forward< T >(value) } }
{
Value& operator=(const Value&);
Value& operator=(Value&&);
- template< typename T, typename = enable_if_supported< T > >
+ template< typename T, typename = typename enable_if_supported< T >::type >
Value& operator=(T&& rhs)
{
*m_data = std::forward< T >(rhs);
bool operator==(const char*) const;
private:
- template< typename T, typename = enable_if_supported< T > >
+ template< typename T, typename = typename enable_if_supported< T >::type >
typename std::add_lvalue_reference< T >::type checkedGet() const
{
try
template< typename T >
struct ResourceAttributes::IsSupportedTypeHelper
{
- using type = boost::mpl::contains<ValueVariant::types, typename std::decay< T >::type>;
+ typedef boost::mpl::contains<ValueVariant::types, typename std::decay< T >::type> type;
};
template <typename T>
struct ResourceAttributes::IndexOfType
{
- using iter = typename boost::mpl::find< ValueVariant::types, T >::type;
+ typedef typename boost::mpl::find< ValueVariant::types, T >::type iter;
+ typedef typename boost::mpl::begin< ValueVariant::types >::type mpl_begin;
- static constexpr int value = boost::mpl::distance< mpl_begin< ValueVariant::types >,
- iter >::value;
+ static constexpr int value = boost::mpl::distance< mpl_begin, iter >::value;
};
bool operator==(const ResourceAttributes::Type&, const ResourceAttributes::Type&);
ResourceAttributes::KeyValuePair >
{
private:
- using base_iterator = std::unordered_map< std::string, Value >::iterator;
+ typedef std::unordered_map< std::string, Value >::iterator base_iterator;
public:
iterator();
const ResourceAttributes::KeyValuePair >
{
private:
- using base_iterator = std::unordered_map< std::string, Value >::const_iterator;
+ typedef std::unordered_map< std::string, Value >::const_iterator base_iterator;
public:
const_iterator();
template <typename FUNC, typename ...PARAMS>
struct ResultType
{
- using type = decltype(std::declval<FUNC>()(std::declval<PARAMS>()...));
+ typedef decltype(std::declval<FUNC>()(std::declval<PARAMS>()...)) type;
};
template< typename A, typename B, typename ENABLER = void >
struct EnableIfTypeIs< A, OCStackResult,
typename std::enable_if< std::is_same< A, OCStackResult >::value >::type >
{
- using type = void;
+ typedef void type;
};
template< typename A >
struct EnableIfTypeIs< A, NotOCStackResult,
typename std::enable_if< !std::is_same< A, OCStackResult >::value >::type >
{
- using type = A;
+ typedef A type;
};
std::is_class<T>::value && std::is_pointer<T>::value>::type >
struct EnableIfClassPointer
{
- using type = void;
+ typedef void type;
};
- template< typename T, typename = typename std::enable_if<std::is_class<T>::value > >
- struct EnableIfClass
- {
- using type = void;
- };
+ template< typename T, typename = typename std::enable_if< std::is_class< T >::value > >
+ struct EnableIfClass
+ {
+ typedef void type;
+ };
}
inline void expectOCStackResult(OCStackResult actual,
class PrimitiveResourceImpl: public PrimitiveResource
{
private:
- using BaseResourcePtr = std::shared_ptr< BaseResource >;
+ typedef std::shared_ptr< BaseResource > BaseResourcePtr;
private:
static ResponseStatement createResponseStatement(
{
}
- void requestGet(GetCallback callback) override
+ void requestGet(GetCallback callback)
{
using namespace std::placeholders;
- using GetFunc = OCStackResult(BaseResource::*)(
+ typedef OCStackResult(BaseResource::*GetFunc)(
const OC::QueryParamsMap&, OC::GetCallback);
invokeOC(m_baseResource, static_cast< GetFunc >(&BaseResource::get),
std::bind(createResponseStatement, _2), _3));
}
- void requestSet(const ResourceAttributes& attrs, SetCallback callback) override
+ void requestSet(const ResourceAttributes& attrs, SetCallback callback)
{
using namespace std::placeholders;
- using PutFunc = OCStackResult(BaseResource::*)(
+ typedef OCStackResult(BaseResource::*PutFunc)(
const OC::OCRepresentation&,
const OC::QueryParamsMap&, OC::PutCallback);
std::bind(createResponseStatement, _2), _3));
}
- void requestObserve(ObserveCallback callback) override
+ void requestObserve(ObserveCallback callback)
{
using namespace std::placeholders;
- using ObserveFunc = OCStackResult (BaseResource::*)(OC::ObserveType,
+ typedef OCStackResult (BaseResource::*ObserveFunc)(OC::ObserveType,
const OC::QueryParamsMap&, OC::ObserveCallback);
invokeOC(m_baseResource, static_cast< ObserveFunc >(&BaseResource::observe),
bind(std::move(callback), _1, bind(createResponseStatement, _2), _3, _4));
}
- void cancelObserve() override
+ void cancelObserve()
{
- using CancelObserveFunc = OCStackResult (BaseResource::*)();
+ typedef OCStackResult (BaseResource::*CancelObserveFunc)();
invokeOC(m_baseResource,
static_cast< CancelObserveFunc >(&BaseResource::cancelObserve));
}
- std::string getSid() const override
+ std::string getSid() const
{
return invokeOC(m_baseResource, &BaseResource::sid);
}
- std::string getUri() const override
+ std::string getUri() const
{
return invokeOC(m_baseResource, &BaseResource::uri);
}
- std::string getHost() const override
+ std::string getHost() const
{
return invokeOC(m_baseResource, &BaseResource::host);
}
- std::vector< std::string > getTypes() const override
+ std::vector< std::string > getTypes() const
{
return invokeOC(m_baseResource, &BaseResource::getResourceTypes);
}
- std::vector< std::string > getInterfaces() const override
+ std::vector< std::string > getInterfaces() const
{
return invokeOC(m_baseResource, &BaseResource::getResourceInterfaces);
}
- bool isObservable() const override
+ bool isObservable() const
{
return invokeOC(m_baseResource, &BaseResource::isObservable);
}
private:
ResourceAttributesConverter() = delete;
- template< typename T >
- using SupportedType = typename std::enable_if<
- ResourceAttributes::is_supported_type< T >::type::value, T >::type;
-
- template< typename T >
- using UnsupportedType = typename std::enable_if<
- !ResourceAttributes::is_supported_type< T >::type::value, T >::type;
-
class ResourceAttributesBuilder
{
public:
private:
template< typename T >
- void putValue(const std::string key, T&& value)
- {
- putValue< T >(key, std::forward< T >(value));
- }
-
- template< typename T >
- void putValue(const std::string key, SupportedType< T > && value)
+ typename std::enable_if<ResourceAttributes::is_supported_type< T >::value >::type
+ putValue(const std::string& key, T && value)
{
m_target[key] = std::forward< T >(value);
}
template< typename T >
- void putValue(const std::string key, UnsupportedType< T > && value)
+ typename std::enable_if<!ResourceAttributes::is_supported_type< T >::value >::type
+ putValue(const std::string& key, T && value)
{
}
};
public:
- static ResourceAttributes fromOCRepresentation(const OC::OCRepresentation& ocRepresentation)
+ static ResourceAttributes fromOCRepresentation(
+ const OC::OCRepresentation& ocRepresentation)
{
ResourceAttributesBuilder builder;
return builder.extract();
}
- static OC::OCRepresentation toOCRepresentation(const ResourceAttributes& resourceAttributes)
+ static OC::OCRepresentation toOCRepresentation(
+ const ResourceAttributes& resourceAttributes)
{
OCRepresentationBuilder builder;
{
namespace Service
{
- using AttrKeyValuePair = std::pair< std::string, ResourceAttributes::Value >;
- using AttrKeyValuePairs = std::vector< AttrKeyValuePair >;
+ typedef std::pair< std::string, ResourceAttributes::Value > AttrKeyValuePair;
+ typedef std::vector< AttrKeyValuePair > AttrKeyValuePairs;
bool acceptableAttributes(const ResourceAttributes& dest, const ResourceAttributes& attr);
void subscribePresence(OCDoHandle& handle, const std::string& host,
OCConnectivityType connectivityType, SubscribeCallback presenceHandler)
{
- using SubscribePresence = OCStackResult (*)(OC::OCPlatform::OCPresenceHandle&,
+ typedef OCStackResult (*SubscribePresence)(OC::OCPlatform::OCPresenceHandle&,
const std::string&, OCConnectivityType, SubscribeCallback);
invokeOCFunc(static_cast<SubscribePresence>(OC::OCPlatform::subscribePresence),
const std::string& resourceType, OCConnectivityType connectivityType,
SubscribeCallback presenceHandler)
{
- using SubscribePresence = OCStackResult (*)(OC::OCPlatform::OCPresenceHandle&,
+ typedef OCStackResult (*SubscribePresence)(OC::OCPlatform::OCPresenceHandle&,
const std::string&, const std::string&, OCConnectivityType, SubscribeCallback);
invokeOCFunc(static_cast<SubscribePresence>(OC::OCPlatform::subscribePresence),
void discoverResource(const std::string& host, const std::string& resourceURI,
OCConnectivityType connectivityType, DiscoverCallback callback)
{
- using FindResource = OCStackResult (*)(const std::string&, const std::string&,
+ typedef OCStackResult (*FindResource)(const std::string&, const std::string&,
OCConnectivityType, OC::FindCallback);
invokeOCFunc(static_cast<FindResource>(OC::OCPlatform::findResource),
ResourceAttributes::iterator::iterator() :
- iterator{ base_iterator{} }
+ m_cur{ base_iterator{ } },
+ m_keyValuePair{ this }
{
}
ResourceAttributes::const_iterator::const_iterator() :
- const_iterator{ base_iterator{} }
+ m_cur{ base_iterator{} }, m_keyValuePair{ this }
{
}
static_assert(ResourceAttributes::is_supported_type< ResourceAttributes >::value,
"ResourceAttributes doesn't have ResourceAttributes recursively.");
-
if (dest.getType().getId() == ResourceAttributes::TypeId::ATTRIBUTES
&& !acceptableAttributes(dest.get< ResourceAttributes >(),
value.get< ResourceAttributes >()))
}
ResponseStatement::ResponseStatement(ResourceAttributes&& attrs) :
- ResponseStatement{ std::move(attrs), "", { }, { } }
+ m_attrs{ std::move(attrs) }
{
}
MockRepository mocks;
protected:
- void SetUp() override {
+ void SetUp() {
mocks.OnCallFuncOverload(
static_cast< subscribePresenceSig1 >(OC::OCPlatform::subscribePresence)).Do(
class FakeOCResource
{
public:
- virtual ~FakeOCResource() = default;
+ virtual ~FakeOCResource() {};
virtual OCStackResult get(const OC::QueryParamsMap&, OC::GetCallback) = 0;
FakeOCResource* fakeResource;
protected:
- void SetUp() override {
+ void SetUp() {
fakeResource = mocks.Mock< FakeOCResource >();
resource.reset(new PrimitiveResourceImpl< FakeOCResource >{
std::shared_ptr< FakeOCResource >(fakeResource, [](FakeOCResource*) {}) });
}
-
- void TearDown() override {
- }
};
TEST_F(PrimitiveResourceTest, RequestGetInvokesOCResourceGet)
ResourceAttributes resourceAttributes;
protected:
- void SetUp() override
+ void SetUp()
{
resourceAttributes[KEY] = 1;
}
#include <string>
#include <mutex>
-#include <atomic>
#include <thread>
+#include <boost/atomic.hpp>
+
#include <ResourceAttributes.h>
#include <PrimitiveResponse.h>
#include <PrimitiveRequest.h>
ACCEPTANCE
};
- using Ptr = std::shared_ptr< ResourceObject >;
- using ConstPtr = std::shared_ptr< const ResourceObject >;
+ typedef std::shared_ptr< ResourceObject > Ptr;
+ typedef std::shared_ptr< const ResourceObject > ConstPtr;
class Builder
{
class LockGuard;
- using GetRequestHandler = std::function< PrimitiveGetResponse(const PrimitiveRequest&,
- ResourceAttributes&) >;
- using SetRequestHandler = std::function< PrimitiveSetResponse(const PrimitiveRequest&,
- ResourceAttributes&) >;
- using AttributeUpdatedHandler = std::function< void(const ResourceAttributes::Value&,
- const ResourceAttributes::Value&) >;
+ typedef std::function< PrimitiveGetResponse(const PrimitiveRequest&,
+ ResourceAttributes&) > GetRequestHandler;
+ typedef std::function< PrimitiveSetResponse(const PrimitiveRequest&,
+ ResourceAttributes&) > SetRequestHandler;
+ typedef std::function< void(const ResourceAttributes::Value&,
+ const ResourceAttributes::Value&) > AttributeUpdatedHandler;
public:
ResourceObject(ResourceObject&&) = delete;
std::unordered_map< std::string, AttributeUpdatedHandler >
m_keyAttributesUpdatedHandlers;
- mutable std::atomic< std::thread::id > m_lockOwner;
+ mutable boost::atomic< std::thread::id > m_lockOwner;
mutable std::mutex m_mutex;
std::mutex m_mutexKeyAttributeUpdate;
LockGuard& operator=(LockGuard&&) = delete;
private:
+ void init();
+
+ private:
const ResourceObject& m_resourceObject;
AutoNotifyPolicy m_autoNotifyPolicy;
class RequestHandler
{
private:
- using BuildResponseHolder = std::function< std::shared_ptr< OC::OCResourceResponse >(
- ResourceObject&) >;
+ typedef std::function< std::shared_ptr< OC::OCResourceResponse >(ResourceObject&) >
+ BuildResponseHolder;
public:
- using Ptr = std::shared_ptr< RequestHandler >;
+ typedef std::shared_ptr< RequestHandler > Pre;
static constexpr int DEFAULT_ERROR_CODE = 200;
static constexpr OCEntityHandlerResult DEFAULT_RESULT = OC_EH_OK;
int errorCode = DEFAULT_ERROR_CODE);
- virtual ~RequestHandler() = default;
+ virtual ~RequestHandler() { };
std::shared_ptr< OC::OCResourceResponse > buildResponse(ResourceObject&);
class SetRequestHandler: public RequestHandler
{
public:
- using Ptr = std::shared_ptr< SetRequestHandler >;
+ typedef std::shared_ptr< SetRequestHandler > Ptr;
SetRequestHandler(const SetRequestHandler&) = delete;
SetRequestHandler(SetRequestHandler&&) = default;
}
PrimitiveSetResponse::PrimitiveSetResponse(std::shared_ptr< SetRequestHandler >&& handler) :
- PrimitiveSetResponse{ std::move(handler), AcceptanceMethod::DEFAULT }
+ m_acceptanceMethod { AcceptanceMethod::DEFAULT },
+ m_handler{ std::move(handler) }
{
}
{
using namespace OIC::Service;
- using OCRepresentationGetter = std::function< OC::OCRepresentation(ResourceObject&) >;
+ typedef std::function< OC::OCRepresentation(ResourceObject&) > OCRepresentationGetter;
OC::OCRepresentation getOCRepresentationFromResource(ResourceObject& resource)
{
constexpr OCEntityHandlerResult RequestHandler::DEFAULT_RESULT;
RequestHandler::RequestHandler() :
- RequestHandler { DEFAULT_RESULT, DEFAULT_ERROR_CODE }
+ m_holder{ std::bind(doBuildResponse, std::placeholders::_1, DEFAULT_RESULT,
+ DEFAULT_ERROR_CODE, getOCRepresentationFromResource) }
{
}
{
using namespace OIC::Service;
- constexpr const char LOG_TAG[]{ "PrimitiveServerResource" };
-
+ constexpr char LOG_TAG[]{ "PrimitiveServerResource" };
inline bool hasProperty(uint8_t base, uint8_t target)
{
try
{
- using RegisterResource = OCStackResult (*)(OCResourceHandle&, std::string&,
+ typedef OCStackResult (*RegisterResource)(OCResourceHandle&, std::string&,
const std::string&, const std::string&, OC::EntityHandler, uint8_t);
invokeOCFunc(static_cast<RegisterResource>(OC::OCPlatform::registerResource),
void ResourceObject::notify() const
{
- using NotifyAllObservers = OCStackResult (*)(OCResourceHandle);
+ typedef OCStackResult (*NotifyAllObservers)(OCResourceHandle);
invokeOCFuncWithResultExpect(
{ OC_STACK_OK, OC_STACK_NO_OBSERVERS },
}
ResourceObject::LockGuard::LockGuard(const ResourceObject::Ptr ptr) :
- LockGuard{ *ptr , ptr->getAutoNotifyPolicy() }
+ m_resourceObject(*ptr),
+ m_autoNotifyPolicy{ ptr->getAutoNotifyPolicy() },
+ m_isOwningLock{ false }
{
+ init();
}
ResourceObject::LockGuard::LockGuard(
const ResourceObject& serverResource) :
- LockGuard{ serverResource, serverResource.getAutoNotifyPolicy() }
+ m_resourceObject(serverResource),
+ m_autoNotifyPolicy{ serverResource.getAutoNotifyPolicy() },
+ m_isOwningLock{ false }
{
+ init();
}
ResourceObject::LockGuard::LockGuard(
const ResourceObject::Ptr ptr, AutoNotifyPolicy autoNotifyPolicy) :
- LockGuard{ *ptr, autoNotifyPolicy}
+ m_resourceObject(*ptr),
+ m_autoNotifyPolicy { autoNotifyPolicy },
+ m_isOwningLock{ false }
{
+ init();
}
ResourceObject::LockGuard::LockGuard(
m_autoNotifyPolicy { autoNotifyPolicy },
m_isOwningLock{ false }
{
- if (resourceObject.m_lockOwner != std::this_thread::get_id())
- {
- m_resourceObject.m_mutex.lock();
- m_resourceObject.m_lockOwner = std::this_thread::get_id();
- m_isOwningLock = true;
- }
- m_autoNotifyFunc = ::createAutoNotifyInvoker(&ResourceObject::autoNotify,
- m_resourceObject, m_resourceObject.m_resourceAttributes, m_autoNotifyPolicy);
+ init();
}
ResourceObject::LockGuard::~LockGuard()
}
}
+ void ResourceObject::LockGuard::init()
+ {
+ if (m_resourceObject.m_lockOwner != std::this_thread::get_id())
+ {
+ m_resourceObject.m_mutex.lock();
+ m_resourceObject.m_lockOwner = std::this_thread::get_id();
+ m_isOwningLock = true;
+ }
+ m_autoNotifyFunc = ::createAutoNotifyInvoker(&ResourceObject::autoNotify,
+ m_resourceObject, m_resourceObject.m_resourceAttributes, m_autoNotifyPolicy);
+ }
+
ResourceObject::WeakGuard::WeakGuard(
const ResourceObject& resourceObject) :
m_isOwningLock{ false },
}
protected:
- void SetUp() override
+ void SetUp()
{
mocks.OnCallFuncOverload(static_cast< registerResourceSig >(OCPlatform::registerResource))
.Return(OC_STACK_OK);
constexpr int NEW_VALUE{ 1 };
-using RegisterResource = OCStackResult (*)(OCResourceHandle&, std::string&,
+typedef OCStackResult (*RegisterResource)(OCResourceHandle&, std::string&,
const std::string&, const std::string&, OC::EntityHandler, uint8_t);
class RequestHandlerTest: public Test
MockRepository mocks;
protected:
- void SetUp() override
+ void SetUp()
{
mocks.OnCallFuncOverload(static_cast<RegisterResource>(OC::OCPlatform::registerResource))
.Return(OC_STACK_OK);
ResourceAttributes requestAttrs;
protected:
- void SetUp() override
+ void SetUp()
{
RequestHandlerTest::SetUp();
using namespace OIC::Service;
using namespace OC;
-using registerResource = OCStackResult (*)(OCResourceHandle&,
- string&,
- const string&,
- const string&,
- EntityHandler,
- uint8_t );
+typedef OCStackResult (*registerResource)(OCResourceHandle&, string&, const string&, const string&,
+ EntityHandler, uint8_t );
-using NotifyAllObservers = OCStackResult (*)(OCResourceHandle);
+typedef OCStackResult (*NotifyAllObservers)(OCResourceHandle);
constexpr char RESOURCE_URI[]{ "a/test" };
constexpr char RESOURCE_TYPE[]{ "resourceType" };
MockRepository mocks;
protected:
- void SetUp() override
+ void SetUp()
{
mocks.OnCallFuncOverload(static_cast< registerResource >(OCPlatform::registerResource))
.Return(OC_STACK_OK);
ResourceObject::Ptr server;
protected:
- void SetUp() override
+ void SetUp()
{
initMocks();
class AutoNotifyTest: public ResourceObjectTest
{
protected:
- void initMocks() override
+ void initMocks()
{
mocks.OnCallFuncOverload(static_cast< NotifyAllObservers >(
OCPlatform::notifyAllObservers)).Return(OC_STACK_OK);
reinterpret_cast<OCResourceHandle>(0x4321);
public:
- OCResourceRequest::Ptr createRequest(OCMethod method = OC_REST_GET, OCRepresentation ocRep = {})
+ OCResourceRequest::Ptr createRequest(OCMethod method = OC_REST_GET, OCRepresentation ocRep =
+ OCRepresentation{})
{
auto request = make_shared<OCResourceRequest>();
return OC_STACK_OK;
}
- void initMocks() override
+ void initMocks()
{
mocks.OnCallFuncOverload(
static_cast<registerResource>(OCPlatform::registerResource)).Do(
class SetRequestHandlerPolicyTest: public ResourceObjectHandlingRequestTest
{
public:
- using SendResponse = OCStackResult (*)(std::shared_ptr<OCResourceResponse>);
+ typedef OCStackResult (*SendResponse)(std::shared_ptr<OCResourceResponse>);
public:
OCRepresentation createOCRepresentation()
return ocRep;
}
- void initMocks() override
+ void initMocks()
{
ResourceObjectHandlingRequestTest::initMocks();
mocks.OnCallFunc(OCPlatform::sendResponse).Return(OC_STACK_OK);