Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.89 KB | None | 0 0
  1. -------------------- ConnectionManager.h --------------------
  2. #ifndef CONNECTIONMANAGER_H
  3. #define CONNECTIONMANAGER_H
  4.  
  5. #include <utility>
  6. #include "List.h"
  7.  
  8. class ModelComponent;
  9.  
  10. typedef std::pair<ModelComponent*, unsigned int> Connection;
  11.  
  12. class ConnectionManager {
  13. public:
  14.     ConnectionManager();
  15.     ConnectionManager(const ConnectionManager& orig);
  16.     virtual ~ConnectionManager();
  17. public:
  18.     unsigned int size();
  19.     ModelComponent* front(); /*!< DEPRECTED. Use  frontConnection instead */    
  20.     ModelComponent* getAtRank(unsigned int rank); /*!< DEPRECTED. Use  getConnectionAtRank instead */
  21.     Connection* frontConnection();
  22.     Connection* getConnectionAtRank(unsigned int rank);
  23.     void insert(ModelComponent* component, unsigned int inputNumber = 0);
  24.     std::list<Connection*>* getList() const;
  25. private:
  26.     List<Connection*>* _nextConnections = new List<Connection*>();
  27. };
  28.  
  29. #endif /* CONNECTIONMANAGER_H */
  30.  
  31. -------------------- ConnectionManagerWrapper.h --------------------
  32.  
  33. #ifndef CONNECTION_MANAGER_WRAPPER_H
  34. #define CONNECTION_MANAGER_WRAPPER_H
  35.  
  36. #include "../ConnectionManager.h"
  37. #include <pybind11/pybind11.h>
  38. #include <pybind11/stl.h>
  39.  
  40. namespace py = pybind11;
  41.  
  42. void initConnectionManager(py::module &m) {
  43.     py::class_<ConnectionManager>(m, "ConnectionManager")
  44.         .def(py::init())
  45.         .def(py::init<ConnectionManager&>())
  46.         .def("size", &ConnectionManager::size)
  47.         .def("front", &ConnectionManager::front)
  48.         .def("getAtRank", &ConnectionManager::getAtRank)
  49. //        .def("frontConnection", &ConnectionManager::frontConnection)
  50. //        .def("getConnectionAtRank", &ConnectionManager::getConnectionAtRank)
  51.         .def("insert", &ConnectionManager::insert,
  52.             py::arg("component"), py::arg("inputNumber") = 0)
  53.         .def("getList", &ConnectionManager::getList);
  54. }
  55.  
  56. #endif /* CONNECTION_MANAGER_WRAPPER_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement