Reputation: 23
I have started using Doxygen (precompiled 1.8.14) to generate simple code documentation for my C++ project on Windows 10.
In a header file I define three templated functions and my definitions are placed in a .tpp file included at the end of the header file. Looking at the generated output, it seems doxygen does not read this file. Thus I concluded doxygen does not support this.
However according to the manual (http://www.doxygen.nl/manual/starting.html) it says that "Any other extension is parsed as if it is a C/C++ file." Is this sort of feature indeed not implemented?
IPC.hpp (sample)
class IPC {
public:
template <class T, int N>
bool setData(std::vector<T> data, Offsets offset);
template <class T, int N>
std::array<T, N> getData(Offsets offset);
template <class T, int N>
bool getData(std::array<T, N> &data, Offsets offset);
bool getTrigger(Offsets selector, long timeout_ms = 0);
void setTrigger(Offsets selector, Status on);
};
#include "IPC.tpp"
IPC.tpp (sample)
#pragma once
/*! Writes to the shared memory object.
\param data gives the data that will be written.
\param offset gives the byte offset from the start of the file.
\return bool: true on completion
\sa getData()
*/
template <class T, int N>
bool IPC::setData(std::vector<T> data, Offsets offset) {
//Calculate the memory block size from the type and number
unsigned int block_size = sizeof(T) * N;
//Safety check
if (block_size + offset > _size) {
std::cerr << "Error at IPC::setData(): Block size is bigger than memory block size" << std::endl;
return false;
}
if (data.size() < N) {
std::cerr << "Error at IPC::setData(): Data array is smaller than N" << std::endl;
return false;
}
//Create mapped_region
mapped_region region(_shm, read_write, offset, block_size);
for (int i = 0; i < N; i++) {
std::memcpy((char* ) region.get_address() + sizeof(T) * i, &(data.at(i)), sizeof(T));
}
return true;
}
Upvotes: 0
Views: 473
Reputation: 23
For future reference: add tpp=C++
to EXTENSION_MAPPING
(under expert/project
in doxywizard) and *.tpp
to FILE_PATTERNS
(under expert/input
in doxywizard).
Upvotes: 1