[instance] define ot::Instance class (#2307)

This commit makes the following changes: It defines the public
`otInstance` as an empty opaque structure which is used by all public
C OpenThread APIs. It defines a new class `ot::Instance` (inheriting
from `otInstance) which is then used in core source files. The
functionality related to the instance is also moved/added into the
newly added `Instance` class (as class/static or member methods).
This commit is contained in:
Abtin Keshavarzian
2017-11-13 08:27:57 -08:00
committed by Jonathan Hui
parent a394155372
commit 02c876ef62
174 changed files with 1903 additions and 1137 deletions
+4 -4
View File
@@ -30,8 +30,8 @@
#include <openthread/openthread.h>
#include "openthread-instance.h"
#include "common/code_utils.hpp"
#include "common/instance.hpp"
#include "common/message.hpp"
#include "ncp/ncp_buffer.hpp"
@@ -58,7 +58,7 @@ static const uint8_t sMottoText[] = "Think good thoughts, say good words, d
static const uint8_t sMysteryText[] = "4871(\\):|(3$}{4|/4/2%14(\\)";
static const uint8_t sHexText[] = "0123456789abcdef";
static otInstance *sInstance;
static ot::Instance *sInstance;
static MessagePool *sMessagePool;
struct CallbackContext
@@ -378,7 +378,7 @@ void TestNcpFrameBuffer(void)
NcpFrameBuffer::WritePosition pos1, pos2;
sInstance = testInitInstance();
sMessagePool = &sInstance->mMessagePool;
sMessagePool = &sInstance->GetMessagePool();
for (i = 0; i < sizeof(buffer); i++)
{
@@ -1005,7 +1005,7 @@ void TestFuzzNcpFrameBuffer(void)
uint32_t lensArrayCount[kNumPrios];
sInstance = testInitInstance();
sMessagePool = &sInstance->mMessagePool;
sMessagePool = &sInstance->GetMessagePool();
memset(buffer, 0, sizeof(buffer));