diff --git a/build/src.pro b/build/src.pro index feff1ae..05d1fb5 100644 --- a/build/src.pro +++ b/build/src.pro @@ -15,7 +15,8 @@ INCLUDEPATH += \ HEADERS += \ ../include/export.h \ ../include/shm.h \ - ../include/circ_elem_array.h + ../include/circ_elem_array.h \ + ../include/circ_queue.h SOURCES += \ ../src/shm.cpp diff --git a/include/circ_elem_array.h b/include/circ_elem_array.h index 3f7e4a5..3be3e9a 100644 --- a/include/circ_elem_array.h +++ b/include/circ_elem_array.h @@ -76,7 +76,6 @@ private: public: elem_array(void) = default; - ~elem_array(void) = delete; elem_array(const elem_array&) = delete; elem_array& operator=(const elem_array&) = delete; diff --git a/include/circ_queue.h b/include/circ_queue.h new file mode 100644 index 0000000..fe79a70 --- /dev/null +++ b/include/circ_queue.h @@ -0,0 +1,15 @@ +#pragma once + +#include "circ_elem_array.h" + +namespace ipc { +namespace circ { + +template +class queue { +private: + elem_array elems_; +}; + +} // namespace circ +} // namespace ipc diff --git a/test/test_circ_elem_array.cpp b/test/test_circ_elem_array.cpp index 933bbf9..d59d16f 100644 --- a/test/test_circ_elem_array.cpp +++ b/test/test_circ_elem_array.cpp @@ -17,6 +17,9 @@ class Unit : public TestSuite { Q_OBJECT private slots: + void initTestCase(void); + void cleanupTestCase(void); + void test_inst(void); void test_prod_cons_1v1(void); void test_prod_cons_1v3(void); @@ -28,6 +31,14 @@ private slots: using cq_t = ipc::circ::elem_array<12>; cq_t* cq__; +void Unit::initTestCase(void) { + cq__ = new cq_t; +} + +void Unit::cleanupTestCase(void) { + delete cq__; +} + void Unit::test_inst(void) { std::cout << "cq_t::head_size = " << cq_t::head_size << std::endl; std::cout << "cq_t::data_size = " << cq_t::data_size << std::endl; @@ -37,7 +48,6 @@ void Unit::test_inst(void) { QCOMPARE(static_cast(cq_t::data_size) , static_cast(12)); QCOMPARE(sizeof(cq_t), static_cast(cq_t::block_size + cq_t::head_size)); - cq__ = new cq_t; std::cout << "sizeof(ipc::circ::elem_array<4096>) = " << sizeof(*cq__) << std::endl; auto a = cq__->take(1);