The definition for struct GapValue in header file UController.h.

class UController
{
public:
  struct GapValue{
      int nodeId1, nodeId2;
      double value;
      GapValue(){ nodeId1 = -1; nodeId2 = -1; value = -1; }
      GapValue( int id1, int id2, double __value ){ nodeId1 = id1; nodeId2 = id2; value = __value; };
  };

//...

std::vector<UController::GapValue> GetIPRReport(int archType);
};

Struct usage and binding for wasm in UController.cpp.

std::vector<UController::GapValue> UController::GetIPRReport(int archType)
{
  std::vector<GapValue> values;
  //...
  values.push_back( GapValue(id1, id2, value) );
}


#ifdef __EMSCRIPTEN__
using namespace emscripten;
EMSCRIPTEN_BINDINGS(UController)
{
    value_object<UController::GapValue>("UController::GapValue")
    .field("nodeId1", &UController::GapValue::nodeId1)
    .field("nodeId2", &UController::GapValue::nodeId2)
    .field("value", &UController::GapValue::value)
    ;

    register_vector<UController::GapValue>("std::vector<UController::GapValue>");
}
#endif // __EMSCRIPTEN__
Categories: Web

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X
0
Would love your thoughts, please comment.x
()
x