rogue
Loading...
Searching...
No Matches
Core.cpp
Go to the documentation of this file.
1
17#include "rogue/Directives.h"
18
20
21#include <memory>
22
23#include "rogue/GeneralError.h"
24#include "rogue/GilRelease.h"
28
31
32#ifndef NO_PYTHON
33 #include <boost/python.hpp>
34namespace bp = boost::python;
35#endif
36
38rpp::CorePtr rpp::Core::create(bool enSsi) {
39 rpp::CorePtr r = std::make_shared<rpp::Core>(enSsi);
40 return (r);
41}
42
43void rpp::Core::setup_python() {
44#ifndef NO_PYTHON
45
46 bp::class_<rpp::Core, rpp::CorePtr, boost::noncopyable>("Core", bp::init<bool>())
47 .def("transport", &rpp::Core::transport)
48 .def("application", &rpp::Core::application)
49 .def("getDropCount", &rpp::Core::getDropCount);
50#endif
51}
52
54rpp::Core::Core(bool enSsi) {
55 tran_ = rpp::Transport::create();
56 cntl_ = rpp::ControllerV1::create(enSsi, tran_, app_);
57
58 tran_->setController(cntl_);
59}
60
62rpp::Core::~Core() {
63 uint32_t x;
64
65 tran_.reset();
66 cntl_.reset();
67
68 for (x = 0; x < 256; x++) app_[x].reset();
69}
70
72rpp::TransportPtr rpp::Core::transport() {
73 return (tran_);
74}
75
77rpp::ApplicationPtr rpp::Core::application(uint8_t dest) {
78 if (!app_[dest]) {
79 app_[dest] = rpp::Application::create(dest);
80 app_[dest]->setController(cntl_);
81 }
82 return (app_[dest]);
83}
84
86uint32_t rpp::Core::getDropCount() {
87 return (cntl_->getDropCount());
88}
89
90void rpp::Core::setTimeout(uint32_t timeout) {
91 cntl_->setTimeout(timeout);
92}
std::shared_ptr< rogue::protocols::packetizer::Transport > TransportPtr
Definition Transport.h:109
std::shared_ptr< rogue::protocols::packetizer::Core > CorePtr
Definition Core.h:111
std::shared_ptr< rogue::protocols::packetizer::Application > ApplicationPtr