Explicit noncopyableness, static_assert.hpp --> util.hpp

This commit is contained in:
Pavel Kirienko
2014-02-09 21:28:10 +04:00
parent 56a69a4ba0
commit 017863a32d
7 changed files with 24 additions and 16 deletions
@@ -10,6 +10,7 @@
#include <algorithm>
#include <limits>
#include <stdint.h>
#include <uavcan/internal/util.hpp>
namespace uavcan
{
@@ -34,7 +35,7 @@ public:
template <int MAX_POOLS>
class PoolManager : public IAllocator
class PoolManager : public IAllocator, Noncopyable
{
IPoolAllocator* pools_[MAX_POOLS];
@@ -103,7 +104,7 @@ public:
template <std::size_t POOL_SIZE, std::size_t BLOCK_SIZE>
class PoolAllocator : public IPoolAllocator
class PoolAllocator : public IPoolAllocator, Noncopyable
{
union Node
{
@@ -4,7 +4,7 @@
#pragma once
#include <uavcan/internal/static_assert.hpp>
#include <uavcan/internal/util.hpp>
namespace uavcan
{
+3 -2
View File
@@ -9,6 +9,7 @@
#include <uavcan/internal/linked_list.hpp>
#include <uavcan/internal/impl_constants.hpp>
#include <uavcan/internal/dynamic_memory.hpp>
#include <uavcan/internal/util.hpp>
namespace uavcan
{
@@ -20,8 +21,8 @@ namespace uavcan
* Key's default constructor must initialize the object into invalid state.
* Size of Key + Value + padding must not exceed MEM_POOL_BLOCK_SIZE.
*/
template <typename Key, typename Value, unsigned int NUM_STATIC_ENTRIES = 1>
class Map
template <typename Key, typename Value, unsigned int NUM_STATIC_ENTRIES>
class Map : Noncopyable
{
#pragma pack(push, 1)
struct KVPair
@@ -10,6 +10,7 @@
#include <uavcan/internal/linked_list.hpp>
#include <uavcan/internal/dynamic_memory.hpp>
#include <uavcan/internal/impl_constants.hpp>
#include <uavcan/internal/util.hpp>
#include <uavcan/can_driver.hpp>
#include <uavcan/system_clock.hpp>
@@ -28,7 +29,7 @@ struct CanRxFrame : public CanFrame
};
class CanTxQueue
class CanTxQueue : Noncopyable
{
public:
enum Qos { VOLATILE, PERSISTENT };
@@ -109,7 +110,7 @@ public:
};
class CanIOManager
class CanIOManager : Noncopyable
{
public:
enum { MAX_IFACES = 3 };
@@ -73,8 +73,9 @@ struct Frame
enum { DATA_TYPE_ID_MAX = 1023 };
enum { NODE_ID_MAX = 127 };
enum { FRAME_INDEX_MAX = 31 };
enum { PAYLOAD_LEN_MAX = 8 };
uint8_t payload[8];
uint8_t payload[PAYLOAD_LEN_MAX];
TransferType transfer_type;
uint_fast16_t data_type_id;
uint_fast8_t payload_len;
@@ -18,7 +18,7 @@ namespace uavcan
/**
* API for transfer buffer users.
*/
class TransferBufferBase
class TransferBufferBase : Noncopyable
{
uint64_t update_timestamp_;
@@ -222,7 +222,7 @@ public:
* Buffer manager implementation.
*/
template <unsigned int STATIC_BUF_SIZE, unsigned int NUM_STATIC_BUFS>
class TransferBufferManager : public ITransferBufferManager
class TransferBufferManager : public ITransferBufferManager, Noncopyable
{
typedef StaticTransferBuffer<STATIC_BUF_SIZE> StaticBufferType;
@@ -13,12 +13,7 @@ namespace uavcan
* StaticAssert<expression>::check();
*/
template <bool VALUE>
struct StaticAssert
{
#if __CDT_PARSER__
static void check() { assert(0); }
#endif
};
struct StaticAssert;
template <>
struct StaticAssert<true>
@@ -32,4 +27,13 @@ struct StaticAssert<true>
*/
template<long N> struct ShowIntegerAsError;
class Noncopyable
{
Noncopyable(const Noncopyable&);
Noncopyable& operator=(const Noncopyable&);
protected:
Noncopyable() { }
};
}