-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
758 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
cpp/csp/adapters/websocket/csp_autogen/websocket_types.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
|
||
// AUTOGENERATED BY CSP_AUTOGEN | ||
// DO NOT MODIFY DIRECTLY | ||
// command: python csp/build/csp_autogen.py -m csp.adapters.websocket_types -d cpp/csp/adapters/websocket/csp_autogen/ -o websocket_types | ||
|
||
#include "websocket_types.h" | ||
#include <csp/python/Common.h> | ||
#include <csp/python/PyStruct.h> | ||
#include <csp/python/PyCspEnum.h> | ||
#include <iostream> | ||
#include <stdlib.h> | ||
#include <Python.h> | ||
|
||
namespace csp::autogen | ||
{ | ||
|
||
#define _offsetof( C, M ) ( ( char * ) &( ( C * ) nullptr ) -> M - ( char * ) 0 ) | ||
|
||
static void assert_or_die( bool assertion, const char * error ) | ||
{ | ||
if( !assertion ) | ||
{ | ||
std::cerr << "Fatal error on import of " << __FILE__ << ": " << error << std::endl; | ||
if( PyErr_Occurred() ) | ||
PyErr_Print(); | ||
abort(); | ||
} | ||
} | ||
|
||
|
||
bool WebsocketStatus::static_init() | ||
{ | ||
if( Py_IsInitialized() ) | ||
{ | ||
csp::python::AcquireGIL gil; | ||
|
||
// initialize EnumMeta from python type if we're in python | ||
PyObject * pymodule = PyImport_ImportModule( "csp.adapters.websocket_types" ); | ||
assert_or_die( pymodule != nullptr, "failed to import struct module csp.adapters.websocket_types" ); | ||
|
||
PyObject * enumType = PyObject_GetAttrString(pymodule, "WebsocketStatus" ); | ||
assert_or_die( enumType != nullptr, "failed to find num type WebsocketStatus in module csp.adapters.websocket_types" ); | ||
|
||
// should add some assertion here.. | ||
csp::python::PyCspEnumMeta * pymeta = ( csp::python::PyCspEnumMeta * ) enumType; | ||
s_meta = pymeta -> enumMeta; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
bool static_init_WebsocketStatus = WebsocketStatus::static_init(); | ||
std::shared_ptr<csp::CspEnumMeta> WebsocketStatus::s_meta; | ||
WebsocketStatus WebsocketStatus::ACTIVE = WebsocketStatus::create("ACTIVE"); | ||
WebsocketStatus WebsocketStatus::GENERIC_ERROR = WebsocketStatus::create("GENERIC_ERROR"); | ||
WebsocketStatus WebsocketStatus::CONNECTION_FAILED = WebsocketStatus::create("CONNECTION_FAILED"); | ||
WebsocketStatus WebsocketStatus::CLOSED = WebsocketStatus::create("CLOSED"); | ||
WebsocketStatus WebsocketStatus::MESSAGE_SEND_FAIL = WebsocketStatus::create("MESSAGE_SEND_FAIL"); | ||
|
||
|
||
bool WebsocketHeaderUpdate::static_init() | ||
{ | ||
|
||
if( Py_IsInitialized() ) | ||
{ | ||
//Note that windows requires we grab the GIL since the windows DLL loading code releases GIL | ||
csp::python::AcquireGIL gil; | ||
|
||
// initialize StructMeta from python type if we're in python | ||
PyObject * pymodule = PyImport_ImportModule( "csp.adapters.websocket_types" ); | ||
assert_or_die( pymodule != nullptr, "failed to import struct module csp.adapters.websocket_types" ); | ||
|
||
PyObject * structType = PyObject_GetAttrString(pymodule, "WebsocketHeaderUpdate" ); | ||
assert_or_die( structType != nullptr, "failed to find struct type WebsocketHeaderUpdate in module csp.adapters.websocket_types" ); | ||
|
||
// should add some assertion here.. | ||
csp::python::PyStructMeta * pymeta = ( csp::python::PyStructMeta * ) structType; | ||
s_meta = pymeta -> structMeta; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
bool static_init_WebsocketHeaderUpdate = WebsocketHeaderUpdate::static_init(); | ||
csp::StructMetaPtr WebsocketHeaderUpdate::s_meta; | ||
|
||
} |
Oops, something went wrong.