GDTR tracing

This commit is contained in:
Pavel Kirienko
2014-03-09 16:49:59 +04:00
parent 326f7082d5
commit c1a8f818f8
2 changed files with 16 additions and 1 deletions
@@ -13,6 +13,9 @@
#include <uavcan/data_type.hpp>
#include <uavcan/internal/linked_list.hpp>
#include <uavcan/internal/impl_constants.hpp>
#if UAVCAN_DEBUG
#include <uavcan/internal/debug.hpp>
#endif
namespace uavcan
{
@@ -92,7 +95,7 @@ public:
}
/// Further calls to regist<>() will fail
void freeze() { frozen_ = true; }
void freeze();
bool isFrozen() const { return frozen_; }
const DataTypeDescriptor* find(DataTypeKind kind, const char* name) const;
@@ -108,6 +111,8 @@ public:
/// Required for unit testing
void reset()
{
UAVCAN_TRACE("GlobalDataTypeRegistry", "Reset; was frozen: %i, num msgs: %u, num srvs: %u",
int(frozen_), getNumMessageTypes(), getNumServiceTypes());
frozen_ = false;
while (msgs_.get())
msgs_.remove(msgs_.get());
@@ -5,6 +5,7 @@
#include <cassert>
#include <cstdlib>
#include <uavcan/global_data_type_registry.hpp>
#include <uavcan/internal/debug.hpp>
namespace uavcan
{
@@ -111,6 +112,15 @@ GlobalDataTypeRegistry& GlobalDataTypeRegistry::instance()
return inst;
}
void GlobalDataTypeRegistry::freeze()
{
if (!frozen_)
{
frozen_ = true;
UAVCAN_TRACE("GlobalDataTypeRegistry", "Frozen");
}
}
const DataTypeDescriptor* GlobalDataTypeRegistry::find(DataTypeKind kind, const char* name) const
{
const List* list = selectList(kind);