event.cc (12041:52b3b120dbc0) | event.cc (12172:33b5ccf51d7f) |
---|---|
1/* 2 * Copyright (c) 2017 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 121 unchanged lines hidden (view full) --- 130 // TODO: Ownership of global exit events has always been a bit 131 // questionable. We currently assume they are owned by the C++ 132 // world. This is what the old SWIG code did, but that will result 133 // in memory leaks. 134 py::class_<GlobalSimLoopExitEvent, 135 std::unique_ptr<GlobalSimLoopExitEvent, py::nodelete>>( 136 m, "GlobalSimLoopExitEvent") 137 .def("getCause", &GlobalSimLoopExitEvent::getCause) | 1/* 2 * Copyright (c) 2017 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 121 unchanged lines hidden (view full) --- 130 // TODO: Ownership of global exit events has always been a bit 131 // questionable. We currently assume they are owned by the C++ 132 // world. This is what the old SWIG code did, but that will result 133 // in memory leaks. 134 py::class_<GlobalSimLoopExitEvent, 135 std::unique_ptr<GlobalSimLoopExitEvent, py::nodelete>>( 136 m, "GlobalSimLoopExitEvent") 137 .def("getCause", &GlobalSimLoopExitEvent::getCause) |
138 .def("getCode", &GlobalSimLoopExitEvent::getCode) | 138 .def("getCode", [](GlobalSimLoopExitEvent *e) { 139 return py::reinterpret_steal<py::object>( 140 PyInt_FromLong(e->getCode())); 141 }) |
139 ; 140 141 // Event base class. These should never be returned directly to 142 // Python since they don't have a well-defined life cycle. Python 143 // events should be derived from PyEvent instead. 144 py::class_<Event> c_event( 145 m, "Event"); 146 c_event --- 31 unchanged lines hidden --- | 142 ; 143 144 // Event base class. These should never be returned directly to 145 // Python since they don't have a well-defined life cycle. Python 146 // events should be derived from PyEvent instead. 147 py::class_<Event> c_event( 148 m, "Event"); 149 c_event --- 31 unchanged lines hidden --- |