使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 0408576e9da10015ffa9da0079b8c985113ce4b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#pragma once
#include <string>
#include <sstream>
#include <interface/SIpcObj-i.h>
#include <helper/sipcparamhelper.hpp>
 
#define CDN_SHARE_BUF_NAME_FMT _T("mbc_share_buffer_8085395F-E2FA-4F96-8BD0-FE5D7412CD22_%08x_2_%08x")
 
 
//////////////////////////////////////////////////////////////////
namespace SOUI {
 
    template<>
    inline SParamStream & SParamStream::operator<<(const std::string & str)
    {
        int nSize = (int)str.size();
        GetBuffer()->Write(&nSize, sizeof(int));
        GetBuffer()->Write(str.c_str(), nSize);
        return *this;
    }
    template<>
    inline SParamStream & SParamStream::operator >> (std::string & str)
    {
        int nSize = 0;
        GetBuffer()->Read(&nSize, sizeof(int));
        char *pBuf = new char[nSize];
        GetBuffer()->Read(pBuf, nSize);
        str = std::string(pBuf, nSize);
        delete[]pBuf;
        return *this;
    }
 
    ////////////////////////////////////////////////////////////////////////
    template<>
    inline SParamStream & SParamStream::operator<<(const std::wstring & str)
    {
        int nSize = (int)str.size();
        GetBuffer()->Write(&nSize, sizeof(int));
        GetBuffer()->Write(str.c_str(), nSize * sizeof(wchar_t));
        return *this;
    }
    template<>
    inline SParamStream & SParamStream::operator >> (std::wstring & str)
    {
        int nSize = 0;
        GetBuffer()->Read(&nSize, sizeof(int));
        wchar_t *pBuf = new wchar_t[nSize];
        GetBuffer()->Read(pBuf, nSize * sizeof(wchar_t));
        str = std::wstring(pBuf, nSize);
        delete[]pBuf;
        return *this;
    }
}
 
struct FunParams_Base : SOUI::IFunParams
{
    virtual void ToStream4Input(SOUI::SParamStream &  ps) {}
    virtual void ToStream4Output(SOUI::SParamStream &  ps) {}
    virtual void FromStream4Input(SOUI::SParamStream &  ps) {}
    virtual void FromStream4Output(SOUI::SParamStream &  ps) {}
};
 
 
enum {
    CID_AddInt = SOUI::FUN_ID_START,
    CID_AddString,
 
    SID_Hello,
    SID_AddBack,    
    BID_Sum,
    CID_GetCdnPort
};
 
struct Param_AddInt : FunParams_Base
{
    int a, b;
    int ret;
    FUNID(CID_AddInt)
        PARAMS2(Input, a,b)
        PARAMS1(Output,ret)
};
 
struct Param_AddString : FunParams_Base
{
    std::string a, b;
    std::string ret;
    FUNID(CID_AddString)
        PARAMS2(Input, a, b)
        PARAMS1(Output, ret)
};
 
struct Param_GetCdnPort : FunParams_Base
    std::string ret;
    FUNID(CID_GetCdnPort) 
        PARAMS1(Output, ret)
};
 
 
struct Param_Hello : FunParams_Base
{
    std::string text;
    FUNID(SID_Hello)
        PARAMS1(Input, text)
};
 
struct Param_AddBack : FunParams_Base
{
    std::string a,b;
    int a2, b2;
    std::string ret;
    FUNID(SID_AddBack)
        PARAMS4(Input, a,b,a2,b2)
        PARAMS1(Output,ret)
};
 
struct Param_Sum : FunParams_Base
{
    int n;
    int nRet;
    FUNID(BID_Sum)
        PARAMS1(Input, n)
        PARAMS1(Output, nRet)
};