Commit b80bfeef authored by jacobgladish's avatar jacobgladish

Renamed shared_ptr std::shared_ptr. closes #12

parent 505133a1
......@@ -75,7 +75,7 @@ bridge::AdapterSignalVector adapters::mock::MockAdapter::GetSignals()
int32_t
adapters::mock::MockAdapter::Initialize(shared_ptr<bridge::IAdapterLog> const& log)
adapters::mock::MockAdapter::Initialize(std::shared_ptr<bridge::IAdapterLog> const& log)
{
CreateMockDevices();
CreateSignals();
......@@ -105,7 +105,7 @@ int32_t
adapters::mock::MockAdapter::EnumDevices(
bridge::EnumDeviceOptions /*opts*/,
bridge::AdapterDeviceVector& deviceList,
shared_ptr<bridge::IAdapterIoRequest>* req)
std::shared_ptr<bridge::IAdapterIoRequest>* req)
{
if (req)
req->reset();
......@@ -120,21 +120,21 @@ adapters::mock::MockAdapter::EnumDevices(
int32_t
adapters::mock::MockAdapter::GetProperty(
shared_ptr<bridge::IAdapterProperty>& prop,
shared_ptr<bridge::IAdapterIoRequest>* req)
std::shared_ptr<bridge::IAdapterProperty>& prop,
std::shared_ptr<bridge::IAdapterIoRequest>* req)
{
if (req)
req->reset();
shared_ptr<MockAdapterProperty> mockAdapterProperty = dynamic_pointer_cast<MockAdapterProperty>(prop);
std::shared_ptr<MockAdapterProperty> mockAdapterProperty = std::dynamic_pointer_cast<MockAdapterProperty>(prop);
if (!mockAdapterProperty)
return ER_BAD_ARG_1;
shared_ptr<MockAdapterDevice> device = mockAdapterProperty->GetParent();
std::shared_ptr<MockAdapterDevice> device = mockAdapterProperty->GetParent();
if (!device)
return ER_INVALID_ADDRESS;
shared_ptr<MockAdapter> adapter = device->GetParent();
std::shared_ptr<MockAdapter> adapter = device->GetParent();
if (!adapter)
return ER_INVALID_ADDRESS;
......@@ -146,21 +146,21 @@ adapters::mock::MockAdapter::GetProperty(
int32_t
adapters::mock::MockAdapter::SetProperty(
shared_ptr<bridge::IAdapterProperty> const& prop,
shared_ptr<bridge::IAdapterIoRequest>* req)
std::shared_ptr<bridge::IAdapterProperty> const& prop,
std::shared_ptr<bridge::IAdapterIoRequest>* req)
{
if (req)
req ->reset();
shared_ptr<MockAdapterProperty> mockAdapterProperty = dynamic_pointer_cast<MockAdapterProperty>(prop);
std::shared_ptr<MockAdapterProperty> mockAdapterProperty = std::dynamic_pointer_cast<MockAdapterProperty>(prop);
if (!mockAdapterProperty)
return ER_BAD_ARG_1;
shared_ptr<MockAdapterDevice> device = mockAdapterProperty->GetParent();
std::shared_ptr<MockAdapterDevice> device = mockAdapterProperty->GetParent();
if (!device)
return ER_INVALID_ADDRESS;
shared_ptr<MockAdapter> adapter = device->GetParent();
std::shared_ptr<MockAdapter> adapter = device->GetParent();
if (!adapter)
return ER_INVALID_ADDRESS;
......@@ -172,23 +172,23 @@ adapters::mock::MockAdapter::SetProperty(
int32_t
adapters::mock::MockAdapter::GetPropertyValue(
shared_ptr<bridge::IAdapterProperty> const& prop,
std::shared_ptr<bridge::IAdapterProperty> const& prop,
std::string const& attributeName,
shared_ptr<bridge::IAdapterValue>& value,
shared_ptr<bridge::IAdapterIoRequest>* req)
std::shared_ptr<bridge::IAdapterValue>& value,
std::shared_ptr<bridge::IAdapterIoRequest>* req)
{
if (req)
req->reset();
shared_ptr<MockAdapterProperty> mockAdapterProperty = dynamic_pointer_cast<MockAdapterProperty>(prop);
std::shared_ptr<MockAdapterProperty> mockAdapterProperty = std::dynamic_pointer_cast<MockAdapterProperty>(prop);
if (!mockAdapterProperty)
return ER_BAD_ARG_1;
shared_ptr<MockAdapterValue> attr = mockAdapterProperty->GetAttributeByName(attributeName);
std::shared_ptr<MockAdapterValue> attr = mockAdapterProperty->GetAttributeByName(attributeName);
if (!attr)
return ER_INVALID_ADDRESS;
value = dynamic_pointer_cast<bridge::IAdapterValue>(attr);
value = std::dynamic_pointer_cast<bridge::IAdapterValue>(attr);
return ER_OK;
}
......@@ -196,18 +196,18 @@ adapters::mock::MockAdapter::GetPropertyValue(
int32_t
adapters::mock::MockAdapter::SetPropertyValue(
shared_ptr<bridge::IAdapterProperty> const& prop,
shared_ptr<bridge::IAdapterValue> const& value,
shared_ptr<bridge::IAdapterIoRequest>* req)
std::shared_ptr<bridge::IAdapterProperty> const& prop,
std::shared_ptr<bridge::IAdapterValue> const& value,
std::shared_ptr<bridge::IAdapterIoRequest>* req)
{
if (req)
req->reset();
shared_ptr<MockAdapterProperty> mockAdapterProperty = dynamic_pointer_cast<MockAdapterProperty>(prop);
std::shared_ptr<MockAdapterProperty> mockAdapterProperty = std::dynamic_pointer_cast<MockAdapterProperty>(prop);
if (!mockAdapterProperty)
return ER_BAD_ARG_1;
shared_ptr<MockAdapterValue> attr = mockAdapterProperty->GetAttributeByName(value->GetName());
std::shared_ptr<MockAdapterValue> attr = mockAdapterProperty->GetAttributeByName(value->GetName());
if (!attr)
return ER_INVALID_ADDRESS;
......@@ -219,14 +219,14 @@ adapters::mock::MockAdapter::SetPropertyValue(
int32_t
adapters::mock::MockAdapter::CallMethod(
shared_ptr<bridge::IAdapterMethod>& method,
shared_ptr<bridge::IAdapterIoRequest>* req)
std::shared_ptr<bridge::IAdapterMethod>& method,
std::shared_ptr<bridge::IAdapterIoRequest>* req)
{
shared_ptr<MockAdapterMethod> m = dynamic_pointer_cast<MockAdapterMethod>(method);
std::shared_ptr<MockAdapterMethod> m = std::dynamic_pointer_cast<MockAdapterMethod>(method);
if (!m)
return ER_BAD_ARG_1;
shared_ptr<MockAdapterDevice> device = m->GetParent();
std::shared_ptr<MockAdapterDevice> device = m->GetParent();
if (!device)
return ER_INVALID_ADDRESS;
......@@ -237,7 +237,7 @@ adapters::mock::MockAdapter::CallMethod(
int32_t
adapters::mock::MockAdapter::RegisterSignalListener(
std::string const& signalName,
shared_ptr<bridge::IAdapterSignalListener> const& listener,
std::shared_ptr<bridge::IAdapterSignalListener> const& listener,
void* argp,
bridge::IAdapter::RegistrationHandle& handle)
{
......@@ -270,7 +270,7 @@ adapters::mock::MockAdapter::UnregisterSignalListener(bridge::IAdapter::Registra
void
adapters::mock::MockAdapter::CreateMockDevices()
{
shared_ptr<MockAdapter> self = dynamic_pointer_cast<MockAdapter>(shared_from_this());
std::shared_ptr<MockAdapter> self = std::dynamic_pointer_cast<MockAdapter>(shared_from_this());
typedef std::vector<adapters::mock::MockDeviceDescriptor> vector;
......@@ -278,7 +278,7 @@ adapters::mock::MockAdapter::CreateMockDevices()
for (vector::const_iterator begin = devices.begin(), end = devices.end();
begin != end; ++begin)
{
shared_ptr<MockAdapterDevice> dev = MockAdapterDevice::Create(*begin, self);
std::shared_ptr<MockAdapterDevice> dev = MockAdapterDevice::Create(*begin, self);
m_devices.push_back(dev);
}
}
......@@ -286,18 +286,18 @@ adapters::mock::MockAdapter::CreateMockDevices()
void
adapters::mock::MockAdapter::CreateSignals()
{
shared_ptr<MockAdapterDevice> parent;
std::shared_ptr<MockAdapterDevice> parent;
bridge::AdapterValueVector values;
shared_ptr<MockAdapterValue> val(new MockAdapterValue(bridge::kDeviceArravalHandle));
shared_ptr<MockAdapterSignal> signal(new MockAdapterSignal(bridge::kDeviceArrivalSignal,
std::shared_ptr<MockAdapterValue> val(new MockAdapterValue(bridge::kDeviceArravalHandle));
std::shared_ptr<MockAdapterSignal> signal(new MockAdapterSignal(bridge::kDeviceArrivalSignal,
parent, values));
m_signals.push_back(signal);
}
int32_t
adapters::mock::MockAdapter::NotifySignalListeners(shared_ptr<MockAdapterSignal> const& signal)
adapters::mock::MockAdapter::NotifySignalListeners(std::shared_ptr<MockAdapterSignal> const& signal)
{
int32_t st = ER_FAIL;
if (!signal)
......
......@@ -4,6 +4,7 @@
#include "Common/defines.h"
#include <map>
#include <memory>
namespace adapters
{
......@@ -12,7 +13,7 @@ namespace mock
class MockAdapterDevice;
class MockAdapterSignal;
class MockAdapter : public bridge::IAdapter, public enable_shared_from_this<bridge::IAdapter>
class MockAdapter : public bridge::IAdapter, public std::enable_shared_from_this<bridge::IAdapter>
{
public:
MockAdapter();
......@@ -26,7 +27,7 @@ namespace mock
virtual common::Guid GetExposedApplicationGuid();
virtual bridge::AdapterSignalVector GetSignals();
virtual int32_t Initialize(shared_ptr<bridge::IAdapterLog> const& log);
virtual int32_t Initialize(std::shared_ptr<bridge::IAdapterLog> const& log);
virtual int32_t Shutdown();
virtual int32_t GetConfiguration(std::vector<uint8_t>* /*configData*/)
......@@ -38,40 +39,40 @@ namespace mock
virtual int32_t EnumDevices(
bridge::EnumDeviceOptions opts,
bridge::AdapterDeviceVector& deviceList,
shared_ptr<bridge::IAdapterIoRequest>* req);
std::shared_ptr<bridge::IAdapterIoRequest>* req);
virtual int32_t GetProperty(
shared_ptr<bridge::IAdapterProperty>& prop,
shared_ptr<bridge::IAdapterIoRequest>* req);
std::shared_ptr<bridge::IAdapterProperty>& prop,
std::shared_ptr<bridge::IAdapterIoRequest>* req);
virtual int32_t SetProperty(
shared_ptr<bridge::IAdapterProperty> const& prop,
shared_ptr<bridge::IAdapterIoRequest>* req);
std::shared_ptr<bridge::IAdapterProperty> const& prop,
std::shared_ptr<bridge::IAdapterIoRequest>* req);
virtual int32_t GetPropertyValue(
shared_ptr<bridge::IAdapterProperty> const& prop,
std::shared_ptr<bridge::IAdapterProperty> const& prop,
std::string const& attributeName,
shared_ptr<bridge::IAdapterValue>& value,
shared_ptr<bridge::IAdapterIoRequest>* req);
std::shared_ptr<bridge::IAdapterValue>& value,
std::shared_ptr<bridge::IAdapterIoRequest>* req);
virtual int32_t SetPropertyValue(
shared_ptr<bridge::IAdapterProperty> const& prop,
shared_ptr<bridge::IAdapterValue> const& value,
shared_ptr<bridge::IAdapterIoRequest>* req);
std::shared_ptr<bridge::IAdapterProperty> const& prop,
std::shared_ptr<bridge::IAdapterValue> const& value,
std::shared_ptr<bridge::IAdapterIoRequest>* req);
virtual int32_t CallMethod(
shared_ptr<bridge::IAdapterMethod>& method,
shared_ptr<bridge::IAdapterIoRequest>* req);
std::shared_ptr<bridge::IAdapterMethod>& method,
std::shared_ptr<bridge::IAdapterIoRequest>* req);
virtual int32_t RegisterSignalListener(
std::string const& signalName,
shared_ptr<bridge::IAdapterSignalListener> const& listener,
std::shared_ptr<bridge::IAdapterSignalListener> const& listener,
void* argp,
bridge::IAdapter::RegistrationHandle& handle);
virtual int32_t UnregisterSignalListener(bridge::IAdapter::RegistrationHandle const& h);
int32_t NotifySignalListeners(shared_ptr<MockAdapterSignal> const& signal);
int32_t NotifySignalListeners(std::shared_ptr<MockAdapterSignal> const& signal);
private:
void CreateMockDevices();
......@@ -84,14 +85,14 @@ namespace mock
std::string m_exposedAdapterPrefix;
std::string m_exposedApplicationName;
common::Guid m_exposedApplicationGuid;
shared_ptr<bridge::IAdapterLog> m_log;
std::shared_ptr<bridge::IAdapterLog> m_log;
std::vector< shared_ptr<MockAdapterDevice> > m_devices;
std::vector< shared_ptr<MockAdapterSignal> > m_signals;
std::vector< std::shared_ptr<MockAdapterDevice> > m_devices;
std::vector< std::shared_ptr<MockAdapterSignal> > m_signals;
struct RegisteredSignal
{
shared_ptr<bridge::IAdapterSignalListener> Listener;
std::shared_ptr<bridge::IAdapterSignalListener> Listener;
void* Context;
bridge::IAdapter::RegistrationHandle RegHandle;
};
......
......@@ -3,11 +3,11 @@
using namespace adapters::mock;
shared_ptr<MockAdapterDevice> MockAdapterDevice::Create(
std::shared_ptr<MockAdapterDevice> MockAdapterDevice::Create(
MockDeviceDescriptor const& desc,
weak_ptr<MockAdapter> const& parent)
std::weak_ptr<MockAdapter> const& parent)
{
shared_ptr<MockAdapterDevice> device(new MockAdapterDevice(desc, parent));
std::shared_ptr<MockAdapterDevice> device(new MockAdapterDevice(desc, parent));
for (int i = 0; i < kMockDeviceMaxProperties; ++i)
{
......@@ -15,7 +15,7 @@ shared_ptr<MockAdapterDevice> MockAdapterDevice::Create(
if (descriptor.Id == kLastDescriptorId)
break;
device->m_properties.push_back(shared_ptr<bridge::IAdapterProperty>(
device->m_properties.push_back(std::shared_ptr<bridge::IAdapterProperty>(
new MockAdapterProperty(descriptor, device)));
}
......@@ -25,7 +25,7 @@ shared_ptr<MockAdapterDevice> MockAdapterDevice::Create(
return device;
}
MockAdapterDevice::MockAdapterDevice(MockDeviceDescriptor const& desc, weak_ptr<MockAdapter> const& parent)
MockAdapterDevice::MockAdapterDevice(MockDeviceDescriptor const& desc, std::weak_ptr<MockAdapter> const& parent)
: m_name(desc.Name)
, m_parent(parent)
, m_vendor(desc.VendorName)
......@@ -41,7 +41,7 @@ MockAdapterDevice::MockAdapterDevice(MockDeviceDescriptor const& desc, weak_ptr<
void MockAdapterDevice::CreateSignals()
{
bridge::AdapterValueVector params;
m_signalPrototypes.push_back(shared_ptr<MockAdapterSignal>(new MockAdapterSignal(
m_signalPrototypes.push_back(std::shared_ptr<MockAdapterSignal>(new MockAdapterSignal(
bridge::kChangeOfValueSignal, shared_from_this(), params)));
// TODO: This is incomplete, re-visit once signal emit is worked on
......@@ -49,16 +49,16 @@ void MockAdapterDevice::CreateSignals()
void MockAdapterDevice::CreateMethods()
{
shared_ptr<MockAdapterDevice> self = shared_from_this();
std::shared_ptr<MockAdapterDevice> self = shared_from_this();
shared_ptr<MockAdapterMethod> m(new MockAdapterMethod(kDeviceResetMethod, self));
m->AddInputParam(shared_ptr<bridge::IAdapterValue>(new MockAdapterValue(kDeviceResetPropertyHandle)));
std::shared_ptr<MockAdapterMethod> m(new MockAdapterMethod(kDeviceResetMethod, self));
m->AddInputParam(std::shared_ptr<bridge::IAdapterValue>(new MockAdapterValue(kDeviceResetPropertyHandle)));
m_methods.push_back(m);
}
int32_t MockAdapterDevice::DispatchMethod(
shared_ptr<MockAdapterMethod>& method,
shared_ptr<bridge::IAdapterIoRequest>* req)
std::shared_ptr<MockAdapterMethod>& method,
std::shared_ptr<bridge::IAdapterIoRequest>* req)
{
if (req)
req->reset();
......@@ -72,8 +72,8 @@ int32_t MockAdapterDevice::DispatchMethod(
int32_t MockAdapterDevice::SendSignal(
std::string const& signalName,
shared_ptr<MockAdapterProperty> const& prop,
shared_ptr<MockAdapterValue> const& value)
std::shared_ptr<MockAdapterProperty> const& prop,
std::shared_ptr<MockAdapterValue> const& value)
{
if (!prop)
return ER_BAD_ARG_2;
......@@ -82,8 +82,8 @@ int32_t MockAdapterDevice::SendSignal(
int32_t st = ER_FAIL;
shared_ptr<MockAdapterSignal> signal;
shared_ptr<MockAdapter> parent = m_parent.lock();
std::shared_ptr<MockAdapterSignal> signal;
std::shared_ptr<MockAdapter> parent = m_parent.lock();
if (!parent)
return ER_FAIL;
......@@ -93,7 +93,7 @@ int32_t MockAdapterDevice::SendSignal(
{
if ((*begin)->GetName() == signalName)
{
signal = dynamic_pointer_cast<MockAdapterSignal>(*begin);
signal = std::dynamic_pointer_cast<MockAdapterSignal>(*begin);
DSB_ASSERT(signal != NULL);
if (signal)
signal = signal->Clone();
......@@ -107,12 +107,12 @@ int32_t MockAdapterDevice::SendSignal(
{
bridge::AdapterValueVector params;
shared_ptr<MockAdapterDevice> self = shared_from_this();
std::shared_ptr<MockAdapterDevice> self = shared_from_this();
shared_ptr<MockAdapterValue> p(new MockAdapterValue("PropertyName"));
std::shared_ptr<MockAdapterValue> p(new MockAdapterValue("PropertyName"));
p->SetData(common::Variant(prop->GetName()));
shared_ptr<MockAdapterValue> v(new MockAdapterValue("PropertyValue"));
std::shared_ptr<MockAdapterValue> v(new MockAdapterValue("PropertyValue"));
v->SetData(value->GetData());
params.push_back(p);
......@@ -125,7 +125,7 @@ int32_t MockAdapterDevice::SendSignal(
return st;
}
int32_t MockAdapterDevice::Reset(shared_ptr<MockAdapterMethod>& method)
int32_t MockAdapterDevice::Reset(std::shared_ptr<MockAdapterMethod>& method)
{
int32_t st = ER_OK;
......@@ -137,7 +137,7 @@ int32_t MockAdapterDevice::Reset(shared_ptr<MockAdapterMethod>& method)
else if (inParams.size() == 1)
{
// reset property by name
shared_ptr<bridge::IAdapterValue> arg1 = inParams[0];
std::shared_ptr<bridge::IAdapterValue> arg1 = inParams[0];
if (!arg1)
return ER_BAD_ARG_1;
}
......@@ -182,7 +182,7 @@ std::string MockAdapterDevice::GetDescription()
return m_description;
}
shared_ptr<bridge::IAdapterIcon> MockAdapterDevice::GetIcon()
std::shared_ptr<bridge::IAdapterIcon> MockAdapterDevice::GetIcon()
{
return m_icon;
}
......@@ -203,7 +203,7 @@ bridge::AdapterSignalVector const& MockAdapterDevice::GetSignals() const
}
MockAdapterProperty::MockAdapterProperty( MockPropertyDescriptor const& desc,
weak_ptr<MockAdapterDevice> const& parent)
std::weak_ptr<MockAdapterDevice> const& parent)
: m_name(desc.Name)
, m_parent(parent)
{
......@@ -214,15 +214,15 @@ std::string MockAdapterProperty::GetName()
return m_name;
}
shared_ptr<MockAdapterValue> MockAdapterProperty::GetAttributeByName(std::string const& name)
std::shared_ptr<MockAdapterValue> MockAdapterProperty::GetAttributeByName(std::string const& name)
{
typedef bridge::AdapterValueVector::const_iterator iterator;
for (iterator begin = m_attributes.begin(), end = m_attributes.end(); begin != end; ++begin)
{
if ((*begin)->GetName() == name)
return dynamic_pointer_cast<MockAdapterValue>(*begin);
return std::dynamic_pointer_cast<MockAdapterValue>(*begin);
}
return shared_ptr<MockAdapterValue>();
return std::shared_ptr<MockAdapterValue>();
}
......@@ -236,7 +236,7 @@ bridge::AdapterValueVector MockAdapterProperty::GetAttributes()
// MockAdapterMethod
MockAdapterMethod::MockAdapterMethod(
std::string const& name,
weak_ptr<MockAdapterDevice> const& parent)
std::weak_ptr<MockAdapterDevice> const& parent)
: m_name(name)
, m_parent(parent)
{
......@@ -272,12 +272,12 @@ void MockAdapterMethod::SetOutputParams(bridge::AdapterValueVector const& params
m_outputParams = params;
}
void MockAdapterMethod::AddInputParam(shared_ptr<bridge::IAdapterValue> const& p)
void MockAdapterMethod::AddInputParam(std::shared_ptr<bridge::IAdapterValue> const& p)
{
m_inputParams.push_back(p);
}
void MockAdapterMethod::AddOutputParam(shared_ptr<bridge::IAdapterValue> const& p)
void MockAdapterMethod::AddOutputParam(std::shared_ptr<bridge::IAdapterValue> const& p)
{
m_outputParams.push_back(p);
}
......@@ -315,7 +315,7 @@ void MockAdapterValue::SetData(common::Variant const& v)
MockAdapterSignal::MockAdapterSignal(
std::string const& name,
weak_ptr<MockAdapterDevice> const& parent,
std::weak_ptr<MockAdapterDevice> const& parent,
bridge::AdapterValueVector const& params)
: m_name(name)
, m_parent(parent)
......@@ -323,9 +323,9 @@ MockAdapterSignal::MockAdapterSignal(
{
}
shared_ptr<MockAdapterSignal> MockAdapterSignal::Clone()
std::shared_ptr<MockAdapterSignal> MockAdapterSignal::Clone()
{
shared_ptr<MockAdapterSignal> clone(new MockAdapterSignal(
std::shared_ptr<MockAdapterSignal> clone(new MockAdapterSignal(
m_name,
m_parent,
m_params));
......
......@@ -3,6 +3,8 @@
#include "Adapters/MockAdapter/MockDevices.h"
#include "Bridge/IAdapter.h"
#include <memory>
namespace adapters
{
namespace mock
......@@ -20,17 +22,17 @@ namespace mock
public:
MockAdapterSignal(
std::string const& name,
weak_ptr<MockAdapterDevice> const& parent,
std::weak_ptr<MockAdapterDevice> const& parent,
bridge::AdapterValueVector const& params);
virtual std::string GetName() const;
virtual bridge::AdapterValueVector const& GetParams() const;
shared_ptr<MockAdapterSignal> Clone();
std::shared_ptr<MockAdapterSignal> Clone();
private:
std::string m_name;
weak_ptr<MockAdapterDevice> m_parent;
std::weak_ptr<MockAdapterDevice> m_parent;
bridge::AdapterValueVector m_params;
};
......@@ -39,7 +41,7 @@ namespace mock
friend class MockAdapter;
public:
MockAdapterMethod(std::string const& name, weak_ptr<MockAdapterDevice> const& parent);
MockAdapterMethod(std::string const& name, std::weak_ptr<MockAdapterDevice> const& parent);
virtual std::string GetName() const;
virtual std::string GetDescription();
......@@ -50,14 +52,14 @@ namespace mock
virtual void SetInputParams(bridge::AdapterValueVector const& params);
virtual void SetOutputParams(bridge::AdapterValueVector const& params);
void AddInputParam(shared_ptr<bridge::IAdapterValue> const& p);
void AddOutputParam(shared_ptr<bridge::IAdapterValue> const& p);
void AddInputParam(std::shared_ptr<bridge::IAdapterValue> const& p);
void AddOutputParam(std::shared_ptr<bridge::IAdapterValue> const& p);
virtual int32_t GetResult();
void SetResult(int32_t st);
private:
shared_ptr<MockAdapterDevice> GetParent() const
std::shared_ptr<MockAdapterDevice> GetParent() const
{ return m_parent.lock(); }
private:
......@@ -65,14 +67,14 @@ namespace mock
std::string m_description;
bridge::AdapterValueVector m_inputParams;
bridge::AdapterValueVector m_outputParams;
weak_ptr<MockAdapterDevice> m_parent;
std::weak_ptr<MockAdapterDevice> m_parent;
int32_t m_result;
};
class MockAdapterProperty : public bridge::IAdapterProperty
{
public:
MockAdapterProperty(MockPropertyDescriptor const& desc, weak_ptr<MockAdapterDevice> const& parent);
MockAdapterProperty(MockPropertyDescriptor const& desc, std::weak_ptr<MockAdapterDevice> const& parent);
virtual std::string GetName();
virtual std::string GetInterfaceHint()
......@@ -80,15 +82,15 @@ namespace mock
virtual bridge::AdapterValueVector GetAttributes();
shared_ptr<MockAdapterDevice> GetParent()
std::shared_ptr<MockAdapterDevice> GetParent()
{ return m_parent.lock(); }
shared_ptr<MockAdapterValue> GetAttributeByName(std::string const& name);
std::shared_ptr<MockAdapterValue> GetAttributeByName(std::string const& name);
private:
std::string m_name;
bridge::AdapterValueVector m_attributes;
weak_ptr<MockAdapterDevice> m_parent;
std::weak_ptr<MockAdapterDevice> m_parent;
};
class MockAdapterValue : public bridge::IAdapterValue
......@@ -105,12 +107,12 @@ namespace mock
common::Variant m_data;
};
class MockAdapterDevice : public bridge::IAdapterDevice, public enable_shared_from_this<MockAdapterDevice>
class MockAdapterDevice : public bridge::IAdapterDevice, public std::enable_shared_from_this<MockAdapterDevice>
{
public:
static shared_ptr<MockAdapterDevice> Create(
static std::shared_ptr<MockAdapterDevice> Create(
MockDeviceDescriptor const& desc,
weak_ptr<MockAdapter> const& parent);
std::weak_ptr<MockAdapter> const& parent);
virtual std::string GetName();
virtual std::string GetVendor();
......@@ -119,42 +121,42 @@ namespace mock
virtual std::string GetFirmwareVersion();
virtual std::string GetSerialNumber();
virtual std::string GetDescription();
virtual shared_ptr<bridge::IAdapterIcon> GetIcon();
virtual std::shared_ptr<bridge::IAdapterIcon> GetIcon();
virtual bridge::AdapterPropertyVector const& GetProperties() const;
virtual bridge::AdapterMethodVector const& GetMethods() const;
virtual bridge::AdapterSignalVector const& GetSignals() const;
int32_t DispatchMethod(
shared_ptr<MockAdapterMethod>& method,
shared_ptr<bridge::IAdapterIoRequest>* req);
std::shared_ptr<MockAdapterMethod>& method,
std::shared_ptr<bridge::IAdapterIoRequest>* req);
int32_t SendSignal(
std::string const& signalName,
shared_ptr<MockAdapterProperty> const& prop,
shared_ptr<MockAdapterValue> const& attr);
std::shared_ptr<MockAdapterProperty> const& prop,
std::shared_ptr<MockAdapterValue> const& attr);
shared_ptr<MockAdapter> GetParent() const
std::shared_ptr<MockAdapter> GetParent() const
{ return m_parent.lock(); }
private:
MockAdapterDevice(MockDeviceDescriptor const& desc, weak_ptr<MockAdapter> const& parent);
MockAdapterDevice(MockDeviceDescriptor const& desc, std::weak_ptr<MockAdapter> const& parent);
void CreateMethods();
void CreateSignals();
int32_t Reset(shared_ptr<MockAdapterMethod>& method);
int32_t Reset(std::shared_ptr<MockAdapterMethod>& method);
private:
std::string m_name;
weak_ptr<MockAdapter> m_parent;
std::weak_ptr<MockAdapter> m_parent;
std::string m_vendor;
std::string m_model;
std::string m_version;
std::string m_firmwareVersion;
std::string m_serialNumber;
std::string m_description;
shared_ptr<bridge::IAdapterIcon> m_icon;
std::shared_ptr<bridge::IAdapterIcon> m_icon;
bridge::AdapterPropertyVector m_properties;
bridge::AdapterMethodVector m_methods;
bridge::AdapterSignalVector m_signalPrototypes;
......
......@@ -77,50 +77,50 @@ int32_t
adapter::zigbee::Adapter::EnumDevices(
bridge::EnumDeviceOptions,
bridge::AdapterDeviceVector&,
shared_ptr<bridge::IAdapterIoRequest>*)
std::shared_ptr<bridge::IAdapterIoRequest>*)
{
return -1;
}
int32_t
adapter::zigbee::Adapter::GetProperty(
shared_ptr<bridge::IAdapterProperty>&,
shared_ptr<bridge::IAdapterIoRequest>*)
std::shared_ptr<bridge::IAdapterProperty>&,
std::shared_ptr<bridge::IAdapterIoRequest>*)
{
return -1;
}
int32_t
adapter::zigbee::Adapter::SetProperty(
shared_ptr<bridge::IAdapterProperty> const&,
shared_ptr<bridge::IAdapterIoRequest>*)
std::shared_ptr<bridge::IAdapterProperty> const&,
std::shared_ptr<bridge::IAdapterIoRequest>*)
{
return -1;
}
int32_t
adapter::zigbee::Adapter::GetPropertyValue(