UAVCAN_EXPORT

This commit is contained in:
Pavel Kirienko
2014-04-08 15:40:51 +04:00
parent 159b14e129
commit e8fa4a2369
55 changed files with 187 additions and 153 deletions
@@ -8,6 +8,7 @@
#pragma once
#include <uavcan/impl_constants.hpp>
#include <uavcan/node/global_data_type_registry.hpp>
#include <uavcan/marshal/types.hpp>
@@ -47,7 +48,7 @@ UAVCAN_PACKED_BEGIN
% if t.kind != t.KIND_SERVICE:
template <int _tmpl>
% endif
struct ${t.cpp_type_name}
struct UAVCAN_EXPORT ${t.cpp_type_name}
{
<%def name="generate_primary_body(type_name, max_bitlen, fields, constants)" buffered="True">
typedef const ${type_name}<_tmpl>& ParameterType;
@@ -259,7 +260,7 @@ namespace uavcan
<%def name="define_yaml_streamer(type_name, fields)">
template <>
struct YamlStreamer< ${type_name} >
struct UAVCAN_EXPORT YamlStreamer< ${type_name} >
{
template <typename Stream>
static void stream(Stream& s, ${type_name}::ParameterType obj, const int level)
+6 -5
View File
@@ -9,12 +9,13 @@
#include <string>
#include <algorithm>
#include <uavcan/stdint.hpp>
#include <uavcan/impl_constants.hpp>
#include <uavcan/transport/transfer.hpp>
namespace uavcan
{
class TransferCRC;
class UAVCAN_EXPORT TransferCRC;
enum DataTypeKind
{
@@ -24,7 +25,7 @@ enum DataTypeKind
};
class DataTypeID
class UAVCAN_EXPORT DataTypeID
{
uint16_t value_;
@@ -62,7 +63,7 @@ public:
* Output xor: 0xFFFFFFFFFFFFFFFF
* Check: 0x62EC59E3F1A4F00A
*/
class DataTypeSignatureCRC
class UAVCAN_EXPORT DataTypeSignatureCRC
{
uint64_t crc_;
@@ -99,7 +100,7 @@ public:
};
class DataTypeSignature
class UAVCAN_EXPORT DataTypeSignature
{
uint64_t value_;
@@ -120,7 +121,7 @@ public:
};
class DataTypeDescriptor
class UAVCAN_EXPORT DataTypeDescriptor
{
DataTypeKind kind_;
DataTypeID id_;
+5 -5
View File
@@ -18,7 +18,7 @@ namespace uavcan
* Raw CAN frame, as passed to/from the CAN driver.
*/
UAVCAN_PACKED_BEGIN
struct CanFrame
struct UAVCAN_EXPORT CanFrame
{
static const uint32_t MaskStdID = 0x000007FF;
static const uint32_t MaskExtID = 0x1FFFFFFF;
@@ -74,7 +74,7 @@ UAVCAN_PACKED_END
/**
* CAN hardware filter config struct. @ref ICanIface::configureFilters().
*/
struct CanFilterConfig
struct UAVCAN_EXPORT CanFilterConfig
{
uint32_t id;
uint32_t mask;
@@ -83,7 +83,7 @@ struct CanFilterConfig
/**
* Events to look for during @ref ICanDriver::select() call
*/
struct CanSelectMasks
struct UAVCAN_EXPORT CanSelectMasks
{
uint8_t read;
uint8_t write;
@@ -103,7 +103,7 @@ typedef uint16_t CanIOFlags;
/**
* Single non-blocking CAN interface.
*/
class ICanIface
class UAVCAN_EXPORT ICanIface
{
public:
virtual ~ICanIface() { }
@@ -150,7 +150,7 @@ public:
/**
* Generic CAN driver.
*/
class ICanDriver
class UAVCAN_EXPORT ICanDriver
{
public:
virtual ~ICanDriver() { }
@@ -15,7 +15,7 @@ namespace uavcan
/**
* System clock interface - monotonic and UTC.
*/
class ISystemClock
class UAVCAN_EXPORT ISystemClock
{
public:
virtual ~ISystemClock() { }
+4 -4
View File
@@ -17,7 +17,7 @@ namespace uavcan
/**
* This interface is used by other library components that need dynamic memory.
*/
class IAllocator
class UAVCAN_EXPORT IAllocator
{
public:
virtual ~IAllocator() { }
@@ -26,7 +26,7 @@ public:
};
class IPoolAllocator : public IAllocator
class UAVCAN_EXPORT IPoolAllocator : public IAllocator
{
public:
virtual bool isInPool(const void* ptr) const = 0;
@@ -35,7 +35,7 @@ public:
template <int MaxPools>
class PoolManager : public IAllocator, Noncopyable
class UAVCAN_EXPORT PoolManager : public IAllocator, Noncopyable
{
IPoolAllocator* pools_[MaxPools];
@@ -108,7 +108,7 @@ public:
template <std::size_t PoolSize, std::size_t BlockSize>
class PoolAllocator : public IPoolAllocator, Noncopyable
class UAVCAN_EXPORT PoolAllocator : public IPoolAllocator, Noncopyable
{
union Node
{
+3
View File
@@ -4,6 +4,8 @@
#pragma once
#include <uavcan/impl_constants.hpp>
namespace uavcan
{
/**
@@ -33,6 +35,7 @@ enum
#if __GNUC__
__attribute__ ((noreturn))
#endif
UAVCAN_EXPORT
void handleFatalError(const char* msg);
}
+13 -4
View File
@@ -4,8 +4,6 @@
#pragma once
#include <uavcan/util/compile_time.hpp>
/**
* UAVCAN version definition
* // TODO: Use git short hash as build id
@@ -54,6 +52,13 @@
# define UAVCAN_PACKED_END
#endif
/**
* Declaration visibility
* http://gcc.gnu.org/wiki/Visibility
*/
#ifndef UAVCAN_EXPORT
# define UAVCAN_EXPORT
#endif
namespace uavcan
{
@@ -78,9 +83,13 @@ enum { MemPoolAlignment = 16 };
typedef char _alignment_check_for_MEM_POOL_BLOCK_SIZE[((MemPoolBlockSize & (MemPoolAlignment - 1)) == 0) ? 1 : -1];
template <typename T>
struct IsDynamicallyAllocatable
struct UAVCAN_EXPORT IsDynamicallyAllocatable
{
static void check() { StaticAssert<sizeof(T) <= MemPoolBlockSize>::check(); }
static void check()
{
char dummy[(sizeof(T) <= MemPoolBlockSize) ? 1 : -1];
(void)dummy;
}
};
}
+3 -2
View File
@@ -7,6 +7,7 @@
#include <cstdlib>
#include <cassert>
#include <uavcan/impl_constants.hpp>
namespace uavcan
{
@@ -14,7 +15,7 @@ namespace uavcan
* Classes that are supposed to be linked-listed should derive this.
*/
template <typename T>
class LinkedListNode
class UAVCAN_EXPORT LinkedListNode
{
T* next_;
@@ -36,7 +37,7 @@ public:
* Linked list root.
*/
template <typename T>
class LinkedListRoot
class UAVCAN_EXPORT LinkedListRoot
{
T* root_;
+1 -1
View File
@@ -22,7 +22,7 @@ namespace uavcan
* Size of Key + Value + padding must not exceed MemPoolBlockSize.
*/
template <typename Key, typename Value, unsigned NumStaticEntries>
class Map : Noncopyable
class UAVCAN_EXPORT Map : Noncopyable
{
UAVCAN_PACKED_BEGIN
struct KVPair
+9 -7
View File
@@ -28,7 +28,7 @@ enum ArrayMode { ArrayModeStatic, ArrayModeDynamic };
template <unsigned Size>
class StaticArrayBase
class UAVCAN_EXPORT StaticArrayBase
{
public:
enum { SizeBitLen = 0 };
@@ -57,7 +57,7 @@ protected:
template <unsigned MaxSize>
class DynamicArrayBase
class UAVCAN_EXPORT DynamicArrayBase
{
protected:
typedef IntegerSpec<IntegerBitLen<MaxSize>::Result, SignednessUnsigned, CastModeSaturate> RawSizeType;
@@ -123,8 +123,8 @@ public:
* Statically allocated array with optional dynamic-like behavior
*/
template <typename T, ArrayMode ArrayMode, unsigned MaxSize>
class ArrayImpl : public Select<ArrayMode == ArrayModeDynamic,
DynamicArrayBase<MaxSize>, StaticArrayBase<MaxSize> >::Result
class UAVCAN_EXPORT ArrayImpl : public Select<ArrayMode == ArrayModeDynamic,
DynamicArrayBase<MaxSize>, StaticArrayBase<MaxSize> >::Result
{
typedef ArrayImpl<T, ArrayMode, MaxSize> SelfType;
typedef typename Select<ArrayMode == ArrayModeDynamic,
@@ -198,7 +198,7 @@ public:
* Bit array specialization
*/
template <unsigned MaxSize, ArrayMode ArrayMode, CastMode CastMode>
class ArrayImpl<IntegerSpec<1, SignednessUnsigned, CastMode>, ArrayMode, MaxSize>
class UAVCAN_EXPORT ArrayImpl<IntegerSpec<1, SignednessUnsigned, CastMode>, ArrayMode, MaxSize>
: public std::bitset<MaxSize>
, public Select<ArrayMode == ArrayModeDynamic, DynamicArrayBase<MaxSize>, StaticArrayBase<MaxSize> >::Result
{
@@ -228,7 +228,7 @@ template <typename T, ArrayMode ArrayMode> class ArrayImpl<T, ArrayMode, 0>;
template <typename T, ArrayMode ArrayMode, unsigned MaxSize_>
class Array : public ArrayImpl<T, ArrayMode, MaxSize_>
class UAVCAN_EXPORT Array : public ArrayImpl<T, ArrayMode, MaxSize_>
{
typedef ArrayImpl<T, ArrayMode, MaxSize_> Base;
typedef Array<T, ArrayMode, MaxSize_> SelfType;
@@ -691,12 +691,14 @@ public:
};
template <typename R, typename T, ArrayMode ArrayMode, unsigned MaxSize>
UAVCAN_EXPORT
inline bool operator==(const R& rhs, const Array<T, ArrayMode, MaxSize>& lhs)
{
return lhs.operator==(rhs);
}
template <typename R, typename T, ArrayMode ArrayMode, unsigned MaxSize>
UAVCAN_EXPORT
inline bool operator!=(const R& rhs, const Array<T, ArrayMode, MaxSize>& lhs)
{
return lhs.operator!=(rhs);
@@ -704,7 +706,7 @@ inline bool operator!=(const R& rhs, const Array<T, ArrayMode, MaxSize>& lhs)
template <typename T, ArrayMode ArrayMode, unsigned MaxSize>
class YamlStreamer<Array<T, ArrayMode, MaxSize> >
class UAVCAN_EXPORT YamlStreamer<Array<T, ArrayMode, MaxSize> >
{
typedef Array<T, ArrayMode, MaxSize> ArrayType;
@@ -8,15 +8,16 @@
#include <string>
#include <uavcan/stdint.hpp>
#include <uavcan/util/compile_time.hpp>
#include <uavcan/impl_constants.hpp>
namespace uavcan
{
class ITransferBuffer;
class UAVCAN_EXPORT ITransferBuffer;
void bitarrayCopy(const unsigned char* src_org, int src_offset, int src_len, unsigned char* dst_org, int dst_offset);
class BitStream
class UAVCAN_EXPORT BitStream
{
enum { MaxBytesPerRW = 16 };
@@ -21,7 +21,7 @@ namespace uavcan
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
template <typename ArrayType_>
class CharArrayFormatter
class UAVCAN_EXPORT CharArrayFormatter
{
ArrayType_& array_;
@@ -99,7 +99,7 @@ public:
#else
template <typename ArrayType_>
class CharArrayFormatter
class UAVCAN_EXPORT CharArrayFormatter
{
ArrayType_& array_;
@@ -34,7 +34,7 @@ struct NativeFloatSelector
};
class IEEE754Converter
class UAVCAN_EXPORT IEEE754Converter
{
// TODO: Non-IEEE float support for float32 and float64
static uint16_t nativeNonIeeeToHalf(float value);
@@ -102,7 +102,7 @@ template <> struct IEEE754Limits<64>
template <unsigned BitLen_, CastMode CastMode>
class FloatSpec : public IEEE754Limits<BitLen_>
class UAVCAN_EXPORT FloatSpec : public IEEE754Limits<BitLen_>
{
FloatSpec();
@@ -184,7 +184,7 @@ private:
template <unsigned BitLen, CastMode CastMode>
struct YamlStreamer<FloatSpec<BitLen, CastMode> >
struct UAVCAN_EXPORT YamlStreamer<FloatSpec<BitLen, CastMode> >
{
typedef typename FloatSpec<BitLen, CastMode>::StorageType StorageType;
@@ -17,7 +17,7 @@ namespace uavcan
enum Signedness { SignednessUnsigned, SignednessSigned };
template <unsigned BitLen_, Signedness Signedness, CastMode CastMode>
class IntegerSpec
class UAVCAN_EXPORT IntegerSpec
{
struct ErrorNoSuchInteger;
@@ -132,7 +132,7 @@ struct IsIntegerSpec<IntegerSpec<BitLen, Signedness, CastMode> >
template <unsigned BitLen, Signedness Signedness, CastMode CastMode>
struct YamlStreamer<IntegerSpec<BitLen, Signedness, CastMode> >
struct UAVCAN_EXPORT YamlStreamer<IntegerSpec<BitLen, Signedness, CastMode> >
{
typedef IntegerSpec<BitLen, Signedness, CastMode> RawType;
typedef typename RawType::StorageType StorageType;
@@ -8,13 +8,14 @@
#include <limits>
#include <string>
#include <uavcan/stdint.hpp>
#include <uavcan/impl_constants.hpp>
#include <uavcan/util/compile_time.hpp>
#include <uavcan/marshal/bit_stream.hpp>
namespace uavcan
{
class ScalarCodec
class UAVCAN_EXPORT ScalarCodec
{
BitStream& stream_;
@@ -5,6 +5,7 @@
#pragma once
#include <uavcan/util/compile_time.hpp>
#include <uavcan/impl_constants.hpp>
namespace uavcan
{
@@ -64,6 +65,6 @@ public:
template <typename T>
struct YamlStreamer;
struct UAVCAN_EXPORT YamlStreamer;
}
@@ -4,13 +4,14 @@
#pragma once
#include <uavcan/impl_constants.hpp>
#include <uavcan/node/scheduler.hpp>
#include <uavcan/node/marshal_buffer.hpp>
namespace uavcan
{
class INode
class UAVCAN_EXPORT INode
{
public:
virtual ~INode() { }
@@ -23,7 +23,7 @@ namespace uavcan
* DataStruct - instantiable class
*/
template <typename DataSpec, typename DataStruct>
class GenericPublisher
class UAVCAN_EXPORT GenericPublisher
{
enum
{
@@ -19,7 +19,7 @@ namespace uavcan
{
template <typename DataType_>
class ReceivedDataStructure : public DataType_
class UAVCAN_EXPORT ReceivedDataStructure : public DataType_
{
const IncomingTransfer* transfer_;
@@ -69,7 +69,7 @@ static Stream& operator<<(Stream& s, const ReceivedDataStructure<DataType>& rds)
template <typename DataStruct_, unsigned NumStaticReceivers_, unsigned NumStaticBufs_>
class TransferListenerInstantiationHelper
class UAVCAN_EXPORT TransferListenerInstantiationHelper
{
enum { DataTypeMaxByteLen = BitLenToByteLen<DataStruct_::MaxBitLen>::Result };
enum { NeedsBuffer = int(DataTypeMaxByteLen) > int(MaxSingleFrameTransferPayloadLen) };
@@ -83,7 +83,7 @@ public:
template <typename DataSpec, typename DataStruct, typename TransferListenerType>
class GenericSubscriber : Noncopyable
class UAVCAN_EXPORT GenericSubscriber : Noncopyable
{
typedef GenericSubscriber<DataSpec, DataStruct, TransferListenerType> SelfType;
@@ -21,7 +21,7 @@ namespace uavcan
typedef std::bitset<DataTypeID::Max + 1> DataTypeIDMask;
class GlobalDataTypeRegistry : Noncopyable
class UAVCAN_EXPORT GlobalDataTypeRegistry : Noncopyable
{
struct Entry : public LinkedListNode<Entry>
{
@@ -133,7 +133,7 @@ public:
template <typename Type>
struct DefaultDataTypeRegistrator
struct UAVCAN_EXPORT DefaultDataTypeRegistrator
{
DefaultDataTypeRegistrator()
{
@@ -4,13 +4,14 @@
#pragma once
#include <uavcan/impl_constants.hpp>
#include <uavcan/transport/transfer.hpp>
#include <uavcan/transport/transfer_buffer.hpp>
namespace uavcan
{
class IMarshalBuffer : public ITransferBuffer
class UAVCAN_EXPORT IMarshalBuffer : public ITransferBuffer
{
public:
virtual const uint8_t* getDataPtr() const = 0;
@@ -18,7 +19,7 @@ public:
};
class IMarshalBufferProvider
class UAVCAN_EXPORT IMarshalBufferProvider
{
public:
virtual ~IMarshalBufferProvider() { }
@@ -27,7 +28,7 @@ public:
template <unsigned MaxSize_ = MaxTransferPayloadLen>
class MarshalBufferProvider : public IMarshalBufferProvider
class UAVCAN_EXPORT MarshalBufferProvider : public IMarshalBufferProvider
{
class Buffer : public IMarshalBuffer
{
+1 -1
View File
@@ -29,7 +29,7 @@ namespace uavcan
template <std::size_t MemPoolSize_,
unsigned OutgoingTransferRegistryStaticEntries = 10,
unsigned OutgoingTransferMaxPayloadLen = MaxTransferPayloadLen>
class Node : public INode
class UAVCAN_EXPORT Node : public INode
{
enum
{
+1 -1
View File
@@ -10,7 +10,7 @@ namespace uavcan
{
template <typename DataType_>
class Publisher : protected GenericPublisher<DataType_, DataType_>
class UAVCAN_EXPORT Publisher : protected GenericPublisher<DataType_, DataType_>
{
typedef GenericPublisher<DataType_, DataType_> BaseType;
+4 -4
View File
@@ -11,9 +11,9 @@
namespace uavcan
{
class Scheduler;
class UAVCAN_EXPORT Scheduler;
class DeadlineHandler : public LinkedListNode<DeadlineHandler>, Noncopyable
class UAVCAN_EXPORT DeadlineHandler : public LinkedListNode<DeadlineHandler>, Noncopyable
{
MonotonicTime deadline_;
@@ -41,7 +41,7 @@ public:
};
class DeadlineScheduler : Noncopyable
class UAVCAN_EXPORT DeadlineScheduler : Noncopyable
{
LinkedListRoot<DeadlineHandler> handlers_; // Ordered by deadline, lowest first
@@ -56,7 +56,7 @@ public:
};
class Scheduler : Noncopyable
class UAVCAN_EXPORT Scheduler : Noncopyable
{
enum { DefaultDeadlineResolutionMs = 5 };
enum { MinDeadlineResolutionMs = 1 };
@@ -20,7 +20,7 @@ namespace uavcan
{
template <typename ServiceDataType>
class ServiceResponseTransferListenerInstantiationHelper
class UAVCAN_EXPORT ServiceResponseTransferListenerInstantiationHelper
{
enum { DataTypeMaxByteLen = BitLenToByteLen<ServiceDataType::Response::MaxBitLen>::Result };
public:
@@ -29,7 +29,7 @@ public:
template <typename DataType>
struct ServiceCallResult
struct UAVCAN_EXPORT ServiceCallResult
{
typedef ReceivedDataStructure<typename DataType::Response> ResponseFieldType;
@@ -76,7 +76,7 @@ template <typename DataType_,
typename Callback_ = void (*)(const ServiceCallResult<DataType_>&)
#endif
>
class ServiceClient
class UAVCAN_EXPORT ServiceClient
: public GenericSubscriber<DataType_, typename DataType_::Response,
typename ServiceResponseTransferListenerInstantiationHelper<DataType_>::Type >
, protected DeadlineHandler
@@ -29,10 +29,10 @@ template <typename DataType_,
#endif
unsigned NumStaticReceivers = 2,
unsigned NumStaticBufs = 1>
class ServiceServer : public GenericSubscriber<DataType_, typename DataType_::Request,
typename TransferListenerInstantiationHelper<typename DataType_::Request,
NumStaticReceivers,
NumStaticBufs>::Type>
class UAVCAN_EXPORT ServiceServer
: public GenericSubscriber<DataType_, typename DataType_::Request,
typename TransferListenerInstantiationHelper<typename DataType_::Request,
NumStaticReceivers, NumStaticBufs>::Type>
{
public:
typedef DataType_ DataType;
+4 -4
View File
@@ -27,10 +27,10 @@ template <typename DataType_,
#endif
unsigned NumStaticReceivers = 2,
unsigned NumStaticBufs = 1>
class Subscriber : public GenericSubscriber<DataType_, DataType_,
typename TransferListenerInstantiationHelper<DataType_,
NumStaticReceivers,
NumStaticBufs>::Type>
class UAVCAN_EXPORT Subscriber
: public GenericSubscriber<DataType_, DataType_,
typename TransferListenerInstantiationHelper<DataType_, NumStaticReceivers,
NumStaticBufs>::Type>
{
public:
typedef Callback_ Callback;
+4 -4
View File
@@ -23,9 +23,9 @@
namespace uavcan
{
class TimerBase;
class UAVCAN_EXPORT TimerBase;
struct TimerEvent
struct UAVCAN_EXPORT TimerEvent
{
MonotonicTime scheduled_time;
MonotonicTime real_time;
@@ -37,7 +37,7 @@ struct TimerEvent
};
class TimerBase : private DeadlineHandler
class UAVCAN_EXPORT TimerBase : private DeadlineHandler
{
MonotonicDuration period_;
@@ -65,7 +65,7 @@ public:
template <typename Callback_>
class TimerEventForwarder : public TimerBase
class UAVCAN_EXPORT TimerEventForwarder : public TimerBase
{
public:
typedef Callback_ Callback;
@@ -13,7 +13,7 @@
namespace uavcan
{
class DataTypeInfoProvider : Noncopyable
class UAVCAN_EXPORT DataTypeInfoProvider : Noncopyable
{
typedef MethodBinder<DataTypeInfoProvider*,
void (DataTypeInfoProvider::*)(const protocol::ComputeAggregateTypeSignature::Request&,
@@ -16,7 +16,7 @@ namespace uavcan
* Ref. M. Gergeleit, H. Streich - "Implementing a Distributed High-Resolution Real-Time Clock using the CAN-Bus"
* TODO: Enforce max one master per node
*/
class GlobalTimeSyncMaster : protected LoopbackFrameListenerBase
class UAVCAN_EXPORT GlobalTimeSyncMaster : protected LoopbackFrameListenerBase
{
class IfaceMaster
{
@@ -14,7 +14,7 @@ namespace uavcan
* Ref. M. Gergeleit, H. Streich - "Implementing a Distributed High-Resolution Real-Time Clock using the CAN-Bus"
* http://modecs.cs.uni-salzburg.at/results/related_documents/CAN_clock.pdf
*/
class GlobalTimeSyncSlave : Noncopyable
class UAVCAN_EXPORT GlobalTimeSyncSlave : Noncopyable
{
typedef MethodBinder<GlobalTimeSyncSlave*,
void (GlobalTimeSyncSlave::*)(const ReceivedDataStructure<protocol::GlobalTimeSync>&)>
+2 -2
View File
@@ -16,7 +16,7 @@
namespace uavcan
{
class ILogSink
class UAVCAN_EXPORT ILogSink
{
public:
typedef typename StorageType<typename protocol::debug::LogLevel::FieldTypes::value>::Type LogLevel;
@@ -35,7 +35,7 @@ public:
};
class Logger
class UAVCAN_EXPORT Logger
{
public:
typedef ILogSink::LogLevel LogLevel;
@@ -14,7 +14,7 @@
namespace uavcan
{
struct NodeInitializationResult
struct UAVCAN_EXPORT NodeInitializationResult
{
NodeID conflicting_node;
bool isOk() const { return !conflicting_node.isValid(); }
@@ -24,7 +24,7 @@ struct NodeInitializationResult
* This class does not issue GlobalDiscoveryRequest, assuming that it was done already by the caller.
* Instantiated object can execute() only once. Objects of this class are intended for stack allocation.
*/
class NodeInitializer : Noncopyable
class UAVCAN_EXPORT NodeInitializer : Noncopyable
{
typedef std::bitset<NodeID::Max + 1> NodeIDMask;
typedef MethodBinder<NodeInitializer*,
@@ -12,7 +12,7 @@
namespace uavcan
{
class NodeStatusMonitor : protected TimerBase
class UAVCAN_EXPORT NodeStatusMonitor : protected TimerBase
{
public:
typedef typename StorageType<typename protocol::NodeStatus::FieldTypes::status_code>::Type NodeStatusCode;
@@ -17,7 +17,7 @@
namespace uavcan
{
class NodeStatusProvider : private TimerBase
class UAVCAN_EXPORT NodeStatusProvider : private TimerBase
{
typedef MethodBinder<NodeStatusProvider*, void (NodeStatusProvider::*)(const protocol::GlobalDiscoveryRequest&)>
GlobalDiscoveryRequestCallback;
@@ -11,7 +11,7 @@
namespace uavcan
{
class PanicBroadcaster : private TimerBase
class UAVCAN_EXPORT PanicBroadcaster : private TimerBase
{
Publisher<protocol::Panic> pub_;
protocol::Panic msg_;
@@ -35,7 +35,7 @@ template <
typename Callback = void (*)(const ReceivedDataStructure<protocol::Panic>&)
#endif
>
class PanicListener : Noncopyable
class UAVCAN_EXPORT PanicListener : Noncopyable
{
typedef MethodBinder<PanicListener*, void (PanicListener::*)(const ReceivedDataStructure<protocol::Panic>&)>
PanicMsgCallback;
@@ -12,7 +12,7 @@
namespace uavcan
{
class IParamManager
class UAVCAN_EXPORT IParamManager
{
public:
typedef typename StorageType<typename protocol::param::GetSet::Response::FieldTypes::name>::Type ParamName;
@@ -63,7 +63,7 @@ public:
};
class ParamServer
class UAVCAN_EXPORT ParamServer
{
typedef MethodBinder<ParamServer*, void (ParamServer::*)(const protocol::param::GetSet::Request&,
protocol::param::GetSet::Response&)> GetSetCallback;
@@ -11,7 +11,7 @@
namespace uavcan
{
class IRestartRequestHandler
class UAVCAN_EXPORT IRestartRequestHandler
{
public:
virtual ~IRestartRequestHandler() { }
@@ -19,7 +19,7 @@ public:
};
class RestartRequestServer : Noncopyable
class UAVCAN_EXPORT RestartRequestServer : Noncopyable
{
typedef MethodBinder<const RestartRequestServer*,
void (RestartRequestServer::*)(const ReceivedDataStructure<protocol::RestartNode::Request>&,
@@ -11,7 +11,7 @@
namespace uavcan
{
class TransportStatsProvider : Noncopyable
class UAVCAN_EXPORT TransportStatsProvider : Noncopyable
{
typedef MethodBinder<const TransportStatsProvider*,
void (TransportStatsProvider::*)(const protocol::GetTransportStats::Request&,
+7 -4
View File
@@ -9,6 +9,7 @@
#include <limits>
#include <sstream>
#include <cstdio>
#include <uavcan/impl_constants.hpp>
#include <uavcan/util/compile_time.hpp>
#include <uavcan/Timestamp.hpp>
@@ -166,16 +167,16 @@ public:
/*
* Monotonic
*/
class MonotonicDuration : public DurationBase<MonotonicDuration> { };
class UAVCAN_EXPORT MonotonicDuration : public DurationBase<MonotonicDuration> { };
class MonotonicTime : public TimeBase<MonotonicTime, MonotonicDuration> { };
class UAVCAN_EXPORT MonotonicTime : public TimeBase<MonotonicTime, MonotonicDuration> { };
/*
* UTC
*/
class UtcDuration : public DurationBase<UtcDuration> { };
class UAVCAN_EXPORT UtcDuration : public DurationBase<UtcDuration> { };
class UtcTime : public TimeBase<UtcTime, UtcDuration>
class UAVCAN_EXPORT UtcTime : public TimeBase<UtcTime, UtcDuration>
{
public:
UtcTime() { }
@@ -201,6 +202,7 @@ public:
template <typename Stream, typename D>
UAVCAN_EXPORT
inline Stream& operator<<(Stream& s, DurationBase<D> d)
{
char buf[8];
@@ -215,6 +217,7 @@ inline Stream& operator<<(Stream& s, DurationBase<D> d)
}
template <typename Stream, typename T, typename D>
UAVCAN_EXPORT
inline Stream& operator<<(Stream& s, TimeBase<T, D> t)
{
char buf[8];
@@ -21,7 +21,7 @@ namespace uavcan
enum { MaxCanIfaces = 3 };
struct CanRxFrame : public CanFrame
struct UAVCAN_EXPORT CanRxFrame : public CanFrame
{
MonotonicTime ts_mono;
UtcTime ts_utc;
@@ -35,7 +35,7 @@ struct CanRxFrame : public CanFrame
};
class CanTxQueue : Noncopyable
class UAVCAN_EXPORT CanTxQueue : Noncopyable
{
public:
enum Qos { Volatile, Persistent };
@@ -117,7 +117,7 @@ public:
};
struct CanIfacePerfCounters
struct UAVCAN_EXPORT CanIfacePerfCounters
{
uint64_t frames_tx;
uint64_t frames_rx;
@@ -131,7 +131,7 @@ struct CanIfacePerfCounters
};
class CanIOManager : Noncopyable
class UAVCAN_EXPORT CanIOManager : Noncopyable
{
struct IfaceFrameCounters
{
+2 -1
View File
@@ -6,6 +6,7 @@
#include <cassert>
#include <uavcan/stdint.hpp>
#include <uavcan/impl_constants.hpp>
namespace uavcan
{
@@ -23,7 +24,7 @@ namespace uavcan
* crc.hexdigest()
* '29B1'
*/
class TransferCRC
class UAVCAN_EXPORT TransferCRC
{
static const uint16_t Table[256];
uint16_t value_;
@@ -7,6 +7,7 @@
#include <cassert>
#include <uavcan/error.hpp>
#include <uavcan/stdint.hpp>
#include <uavcan/impl_constants.hpp>
#include <uavcan/transport/perf_counter.hpp>
#include <uavcan/transport/transfer_listener.hpp>
#include <uavcan/transport/outgoing_transfer_registry.hpp>
@@ -16,9 +17,9 @@
namespace uavcan
{
class Dispatcher;
class UAVCAN_EXPORT Dispatcher;
class LoopbackFrameListenerBase : public LinkedListNode<LoopbackFrameListenerBase>, Noncopyable
class UAVCAN_EXPORT LoopbackFrameListenerBase : public LinkedListNode<LoopbackFrameListenerBase>, Noncopyable
{
Dispatcher& dispatcher_;
@@ -40,7 +41,7 @@ public:
};
class LoopbackFrameListenerRegistry : Noncopyable
class UAVCAN_EXPORT LoopbackFrameListenerRegistry : Noncopyable
{
LinkedListRoot<LoopbackFrameListenerBase> listeners_;
@@ -54,7 +55,7 @@ public:
};
class Dispatcher : Noncopyable
class UAVCAN_EXPORT Dispatcher : Noncopyable
{
CanIOManager canio_;
ISystemClock& sysclock_;
+3 -4
View File
@@ -9,14 +9,13 @@
#include <string>
#include <uavcan/transport/transfer.hpp>
#include <uavcan/transport/can_io.hpp>
#include <uavcan/impl_constants.hpp>
#include <uavcan/data_type.hpp>
namespace uavcan
{
struct CanRxFrame;
class Frame
class UAVCAN_EXPORT Frame
{
uint8_t payload_[sizeof(CanFrame::data)];
TransferType transfer_type_;
@@ -87,7 +86,7 @@ public:
};
class RxFrame : public Frame
class UAVCAN_EXPORT RxFrame : public Frame
{
MonotonicTime ts_mono_;
UtcTime ts_utc_;
@@ -17,7 +17,7 @@ namespace uavcan
{
UAVCAN_PACKED_BEGIN
class OutgoingTransferRegistryKey
class UAVCAN_EXPORT OutgoingTransferRegistryKey
{
DataTypeID data_type_id_;
uint8_t transfer_type_;
@@ -64,7 +64,7 @@ public:
UAVCAN_PACKED_END
class IOutgoingTransferRegistry
class UAVCAN_EXPORT IOutgoingTransferRegistry
{
public:
virtual ~IOutgoingTransferRegistry() { }
@@ -75,7 +75,7 @@ public:
template <int NumStaticEntries>
class OutgoingTransferRegistry : public IOutgoingTransferRegistry, Noncopyable
class UAVCAN_EXPORT OutgoingTransferRegistry : public IOutgoingTransferRegistry, Noncopyable
{
UAVCAN_PACKED_BEGIN
struct Value
@@ -5,11 +5,12 @@
#pragma once
#include <uavcan/stdint.hpp>
#include <uavcan/impl_constants.hpp>
namespace uavcan
{
class TransferPerfCounter
class UAVCAN_EXPORT TransferPerfCounter
{
uint64_t transfers_tx_;
uint64_t transfers_rx_;
@@ -5,6 +5,7 @@
#pragma once
#include <cassert>
#include <uavcan/impl_constants.hpp>
#include <uavcan/stdint.hpp>
namespace uavcan
@@ -24,7 +25,7 @@ enum TransferType
};
class TransferID
class UAVCAN_EXPORT TransferID
{
uint8_t value_;
@@ -64,7 +65,7 @@ public:
};
class NodeID
class UAVCAN_EXPORT NodeID
{
enum
{
@@ -20,7 +20,7 @@ UAVCAN_PACKED_BEGIN
/**
* API for transfer buffer users.
*/
class ITransferBuffer
class UAVCAN_EXPORT ITransferBuffer
{
public:
virtual ~ITransferBuffer() { }
@@ -32,7 +32,7 @@ public:
/**
* Internal for TransferBufferManager
*/
class TransferBufferManagerKey
class UAVCAN_EXPORT TransferBufferManagerKey
{
NodeID node_id_;
uint8_t transfer_type_;
@@ -67,7 +67,7 @@ public:
/**
* Internal for TransferBufferManager
*/
class TransferBufferManagerEntry : public ITransferBuffer, Noncopyable
class UAVCAN_EXPORT TransferBufferManagerEntry : public ITransferBuffer, Noncopyable
{
TransferBufferManagerKey key_;
@@ -96,7 +96,7 @@ public:
* reset() call releases all memory blocks.
* Supports unordered write operations - from higher to lower offsets
*/
class DynamicTransferBufferManagerEntry
class UAVCAN_EXPORT DynamicTransferBufferManagerEntry
: public TransferBufferManagerEntry
, public LinkedListNode<DynamicTransferBufferManagerEntry>
{
@@ -149,7 +149,7 @@ UAVCAN_PACKED_END
* Standalone static buffer
*/
template <unsigned Size>
class StaticTransferBuffer : public ITransferBuffer
class UAVCAN_EXPORT StaticTransferBuffer : public ITransferBuffer
{
uint8_t data_[Size];
unsigned max_write_pos_;
@@ -222,7 +222,7 @@ public:
* Statically allocated storage for buffer manager
*/
template <unsigned Size>
class StaticTransferBufferManagerEntry : public TransferBufferManagerEntry
class UAVCAN_EXPORT StaticTransferBufferManagerEntry : public TransferBufferManagerEntry
{
StaticTransferBuffer<Size> buf_;
@@ -278,7 +278,7 @@ public:
/**
* Manages different storage types (static/dynamic) for transfer reception logic.
*/
class ITransferBufferManager
class UAVCAN_EXPORT ITransferBufferManager
{
public:
virtual ~ITransferBufferManager() { }
@@ -290,7 +290,7 @@ public:
/**
* Convinience class.
*/
class TransferBufferAccessor
class UAVCAN_EXPORT TransferBufferAccessor
{
ITransferBufferManager& bufmgr_;
const TransferBufferManagerKey key_;
@@ -311,7 +311,7 @@ public:
* Buffer manager implementation.
*/
template <unsigned MaxBufSize, unsigned NumStaticBufs>
class TransferBufferManager : public ITransferBufferManager, Noncopyable
class UAVCAN_EXPORT TransferBufferManager : public ITransferBufferManager, Noncopyable
{
typedef StaticTransferBufferManagerEntry<MaxBufSize> StaticBufferType;
@@ -493,7 +493,7 @@ public:
};
template <>
class TransferBufferManager<0, 0> : public ITransferBufferManager
class UAVCAN_EXPORT TransferBufferManager<0, 0> : public ITransferBufferManager
{
public:
TransferBufferManager() { }
@@ -21,7 +21,7 @@ namespace uavcan
/**
* Container for received transfer.
*/
class IncomingTransfer : public ITransferBuffer
class UAVCAN_EXPORT IncomingTransfer : public ITransferBuffer
{
MonotonicTime ts_mono_;
UtcTime ts_utc_;
@@ -61,7 +61,7 @@ public:
/**
* Internal.
*/
class SingleFrameIncomingTransfer : public IncomingTransfer
class UAVCAN_EXPORT SingleFrameIncomingTransfer : public IncomingTransfer
{
const uint8_t* const payload_;
const uint8_t payload_len_;
@@ -73,7 +73,7 @@ public:
/**
* Internal.
*/
class MultiFrameIncomingTransfer : public IncomingTransfer, Noncopyable
class UAVCAN_EXPORT MultiFrameIncomingTransfer : public IncomingTransfer, Noncopyable
{
TransferBufferAccessor& buf_acc_;
public:
@@ -86,7 +86,7 @@ public:
/**
* Internal, refer to transport dispatcher.
*/
class TransferListenerBase : public LinkedListNode<TransferListenerBase>, Noncopyable
class UAVCAN_EXPORT TransferListenerBase : public LinkedListNode<TransferListenerBase>, Noncopyable
{
const DataTypeDescriptor& data_type_;
const TransferCRC crc_base_; ///< Pre-initialized with data type hash, thus constant
@@ -118,7 +118,7 @@ public:
* This class should be derived by transfer receivers (subscribers, servers).
*/
template <unsigned MaxBufSize, unsigned NumStaticBufs, unsigned NumStaticReceivers>
class TransferListener : public TransferListenerBase
class UAVCAN_EXPORT TransferListener : public TransferListenerBase
{
typedef TransferBufferManager<MaxBufSize, NumStaticBufs> BufferManager;
BufferManager bufmgr_;
@@ -204,7 +204,7 @@ public:
* This class should be derived by callers.
*/
template <unsigned MaxBufSize>
class ServiceResponseTransferListener : public TransferListener<MaxBufSize, 1, 1>
class UAVCAN_EXPORT ServiceResponseTransferListener : public TransferListener<MaxBufSize, 1, 1>
{
public:
struct ExpectedResponseParams
@@ -5,6 +5,7 @@
#pragma once
#include <cstdlib>
#include <uavcan/impl_constants.hpp>
#include <uavcan/transport/frame.hpp>
#include <uavcan/transport/transfer_buffer.hpp>
@@ -12,7 +13,7 @@ namespace uavcan
{
UAVCAN_PACKED_BEGIN
class TransferReceiver
class UAVCAN_EXPORT TransferReceiver
{
public:
enum ResultCode { ResultNotComplete, ResultComplete, ResultSingleFrame };
@@ -6,6 +6,7 @@
#include <cstdlib>
#include <cassert>
#include <uavcan/impl_constants.hpp>
#include <uavcan/error.hpp>
#include <uavcan/data_type.hpp>
#include <uavcan/transport/crc.hpp>
@@ -15,7 +16,7 @@
namespace uavcan
{
class TransferSender
class UAVCAN_EXPORT TransferSender
{
const MonotonicDuration max_transfer_interval_;
const DataTypeDescriptor& data_type_;
+25 -21
View File
@@ -4,6 +4,8 @@
#pragma once
#include <uavcan/impl_constants.hpp>
namespace uavcan
{
/**
@@ -11,10 +13,10 @@ namespace uavcan
* StaticAssert<expression>::check();
*/
template <bool Value>
struct StaticAssert;
struct UAVCAN_EXPORT StaticAssert;
template <>
struct StaticAssert<true>
struct UAVCAN_EXPORT StaticAssert<true>
{
static void check() { }
};
@@ -28,7 +30,7 @@ template <long N> struct ShowIntegerAsError;
/**
* Prevents copying when inherited
*/
class Noncopyable
class UAVCAN_EXPORT Noncopyable
{
Noncopyable(const Noncopyable&);
Noncopyable& operator=(const Noncopyable&);
@@ -40,33 +42,33 @@ protected:
* Compile time conditions
*/
template <bool B, typename T = void>
struct EnableIf { };
struct UAVCAN_EXPORT EnableIf { };
template <typename T>
struct EnableIf<true, T>
struct UAVCAN_EXPORT EnableIf<true, T>
{
typedef T Type;
};
template <typename T, typename R = void>
struct EnableIfType
struct UAVCAN_EXPORT EnableIfType
{
typedef R Type;
};
template <bool Condition, typename TrueType, typename FalseType>
struct Select;
struct UAVCAN_EXPORT Select;
template <typename TrueType, typename FalseType>
struct Select<true, TrueType, FalseType>
struct UAVCAN_EXPORT Select<true, TrueType, FalseType>
{
typedef TrueType Result;
};
template <typename TrueType, typename FalseType>
struct Select<false, TrueType, FalseType>
struct UAVCAN_EXPORT Select<false, TrueType, FalseType>
{
typedef FalseType Result;
};
@@ -74,7 +76,7 @@ struct Select<false, TrueType, FalseType>
/**
* Value types
*/
template <bool> struct BooleanType { };
template <bool> struct UAVCAN_EXPORT BooleanType { };
typedef BooleanType<true> TrueType;
typedef BooleanType<false> FalseType;
@@ -82,7 +84,7 @@ typedef BooleanType<false> FalseType;
* Relations
*/
template <typename T1, typename T2>
class IsImplicitlyConvertibleFromTo
class UAVCAN_EXPORT IsImplicitlyConvertibleFromTo
{
template <typename U> static U returner();
@@ -98,13 +100,14 @@ public:
template <typename From, typename To>
struct TryImplicitCastImpl
struct UAVCAN_EXPORT TryImplicitCastImpl
{
static To impl(const From& from, const To&, TrueType) { return To(from); }
static To impl(const From&, const To& default_, FalseType) { return default_; }
};
template <typename To, typename From>
UAVCAN_EXPORT
To try_implicit_cast(const From& from, const To& default_)
{
return TryImplicitCastImpl<From, To>::impl(from, default_,
@@ -112,6 +115,7 @@ To try_implicit_cast(const From& from, const To& default_)
}
template <typename To, typename From>
UAVCAN_EXPORT
To try_implicit_cast(const From& from)
{
return TryImplicitCastImpl<From, To>::impl(from, To(),
@@ -121,14 +125,14 @@ To try_implicit_cast(const From& from)
/**
* Some arithmetics
*/
template <unsigned Value> struct CompileTimeIntSqrt;
template <> struct CompileTimeIntSqrt<4> { enum { Result = 2 }; };
template <> struct CompileTimeIntSqrt<9> { enum { Result = 3 }; };
template <> struct CompileTimeIntSqrt<16> { enum { Result = 4 }; };
template <> struct CompileTimeIntSqrt<25> { enum { Result = 5 }; };
template <> struct CompileTimeIntSqrt<36> { enum { Result = 6 }; };
template <> struct CompileTimeIntSqrt<49> { enum { Result = 7 }; };
template <> struct CompileTimeIntSqrt<64> { enum { Result = 8 }; };
template <> struct CompileTimeIntSqrt<81> { enum { Result = 9 }; };
template <unsigned Value> struct UAVCAN_EXPORT CompileTimeIntSqrt;
template <> struct UAVCAN_EXPORT CompileTimeIntSqrt<4> { enum { Result = 2 }; };
template <> struct UAVCAN_EXPORT CompileTimeIntSqrt<9> { enum { Result = 3 }; };
template <> struct UAVCAN_EXPORT CompileTimeIntSqrt<16> { enum { Result = 4 }; };
template <> struct UAVCAN_EXPORT CompileTimeIntSqrt<25> { enum { Result = 5 }; };
template <> struct UAVCAN_EXPORT CompileTimeIntSqrt<36> { enum { Result = 6 }; };
template <> struct UAVCAN_EXPORT CompileTimeIntSqrt<49> { enum { Result = 7 }; };
template <> struct UAVCAN_EXPORT CompileTimeIntSqrt<64> { enum { Result = 8 }; };
template <> struct UAVCAN_EXPORT CompileTimeIntSqrt<81> { enum { Result = 9 }; };
}
@@ -16,7 +16,7 @@ namespace uavcan
{
template <typename T>
class LazyConstructor
class UAVCAN_EXPORT LazyConstructor
{
union
{
@@ -12,7 +12,7 @@ namespace uavcan
{
template <typename ObjectPtr, typename MemFunPtr>
class MethodBinder
class UAVCAN_EXPORT MethodBinder
{
ObjectPtr obj_;
MemFunPtr fun_;