From e8fa4a236985a118b2b782065cea0ea8c110bb3b Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Tue, 8 Apr 2014 15:40:51 +0400 Subject: [PATCH] UAVCAN_EXPORT --- .../data_type_template.tmpl | 5 +- libuavcan/include/uavcan/data_type.hpp | 11 +++-- libuavcan/include/uavcan/driver/can.hpp | 10 ++-- .../include/uavcan/driver/system_clock.hpp | 2 +- libuavcan/include/uavcan/dynamic_memory.hpp | 8 ++-- libuavcan/include/uavcan/error.hpp | 3 ++ libuavcan/include/uavcan/impl_constants.hpp | 17 +++++-- libuavcan/include/uavcan/linked_list.hpp | 5 +- libuavcan/include/uavcan/map.hpp | 2 +- libuavcan/include/uavcan/marshal/array.hpp | 16 ++++--- .../include/uavcan/marshal/bit_stream.hpp | 5 +- .../uavcan/marshal/char_array_formatter.hpp | 4 +- .../include/uavcan/marshal/float_spec.hpp | 6 +-- .../include/uavcan/marshal/integer_spec.hpp | 4 +- .../include/uavcan/marshal/scalar_codec.hpp | 3 +- .../include/uavcan/marshal/type_util.hpp | 3 +- .../include/uavcan/node/abstract_node.hpp | 3 +- .../include/uavcan/node/generic_publisher.hpp | 2 +- .../uavcan/node/generic_subscriber.hpp | 6 +-- .../uavcan/node/global_data_type_registry.hpp | 4 +- .../include/uavcan/node/marshal_buffer.hpp | 7 +-- libuavcan/include/uavcan/node/node.hpp | 2 +- libuavcan/include/uavcan/node/publisher.hpp | 2 +- libuavcan/include/uavcan/node/scheduler.hpp | 8 ++-- .../include/uavcan/node/service_client.hpp | 6 +-- .../include/uavcan/node/service_server.hpp | 8 ++-- libuavcan/include/uavcan/node/subscriber.hpp | 8 ++-- libuavcan/include/uavcan/node/timer.hpp | 8 ++-- .../protocol/data_type_info_provider.hpp | 2 +- .../protocol/global_time_sync_master.hpp | 2 +- .../protocol/global_time_sync_slave.hpp | 2 +- libuavcan/include/uavcan/protocol/logger.hpp | 4 +- .../uavcan/protocol/node_initializer.hpp | 4 +- .../uavcan/protocol/node_status_monitor.hpp | 2 +- .../uavcan/protocol/node_status_provider.hpp | 2 +- .../uavcan/protocol/panic_broadcaster.hpp | 2 +- .../uavcan/protocol/panic_listener.hpp | 2 +- .../include/uavcan/protocol/param_server.hpp | 4 +- .../protocol/restart_request_server.hpp | 4 +- .../protocol/transport_stats_provider.hpp | 2 +- libuavcan/include/uavcan/time.hpp | 11 +++-- libuavcan/include/uavcan/transport/can_io.hpp | 8 ++-- libuavcan/include/uavcan/transport/crc.hpp | 3 +- .../include/uavcan/transport/dispatcher.hpp | 9 ++-- libuavcan/include/uavcan/transport/frame.hpp | 7 ++- .../transport/outgoing_transfer_registry.hpp | 6 +-- .../include/uavcan/transport/perf_counter.hpp | 3 +- .../include/uavcan/transport/transfer.hpp | 5 +- .../uavcan/transport/transfer_buffer.hpp | 20 ++++---- .../uavcan/transport/transfer_listener.hpp | 12 ++--- .../uavcan/transport/transfer_receiver.hpp | 3 +- .../uavcan/transport/transfer_sender.hpp | 3 +- .../include/uavcan/util/compile_time.hpp | 46 ++++++++++--------- .../include/uavcan/util/lazy_constructor.hpp | 2 +- .../include/uavcan/util/method_binder.hpp | 2 +- 55 files changed, 187 insertions(+), 153 deletions(-) diff --git a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl index 86d5e60040..7c41235370 100644 --- a/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl +++ b/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/data_type_template.tmpl @@ -8,6 +8,7 @@ #pragma once +#include #include #include @@ -47,7 +48,7 @@ UAVCAN_PACKED_BEGIN % if t.kind != t.KIND_SERVICE: template % 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 static void stream(Stream& s, ${type_name}::ParameterType obj, const int level) diff --git a/libuavcan/include/uavcan/data_type.hpp b/libuavcan/include/uavcan/data_type.hpp index d02debde2b..f1f9520c12 100644 --- a/libuavcan/include/uavcan/data_type.hpp +++ b/libuavcan/include/uavcan/data_type.hpp @@ -9,12 +9,13 @@ #include #include #include +#include #include 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_; diff --git a/libuavcan/include/uavcan/driver/can.hpp b/libuavcan/include/uavcan/driver/can.hpp index cecc56afc2..f705da2fc6 100644 --- a/libuavcan/include/uavcan/driver/can.hpp +++ b/libuavcan/include/uavcan/driver/can.hpp @@ -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() { } diff --git a/libuavcan/include/uavcan/driver/system_clock.hpp b/libuavcan/include/uavcan/driver/system_clock.hpp index e442159142..82a6804587 100644 --- a/libuavcan/include/uavcan/driver/system_clock.hpp +++ b/libuavcan/include/uavcan/driver/system_clock.hpp @@ -15,7 +15,7 @@ namespace uavcan /** * System clock interface - monotonic and UTC. */ -class ISystemClock +class UAVCAN_EXPORT ISystemClock { public: virtual ~ISystemClock() { } diff --git a/libuavcan/include/uavcan/dynamic_memory.hpp b/libuavcan/include/uavcan/dynamic_memory.hpp index d2d6b9e0e9..a09a601549 100644 --- a/libuavcan/include/uavcan/dynamic_memory.hpp +++ b/libuavcan/include/uavcan/dynamic_memory.hpp @@ -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 -class PoolManager : public IAllocator, Noncopyable +class UAVCAN_EXPORT PoolManager : public IAllocator, Noncopyable { IPoolAllocator* pools_[MaxPools]; @@ -108,7 +108,7 @@ public: template -class PoolAllocator : public IPoolAllocator, Noncopyable +class UAVCAN_EXPORT PoolAllocator : public IPoolAllocator, Noncopyable { union Node { diff --git a/libuavcan/include/uavcan/error.hpp b/libuavcan/include/uavcan/error.hpp index 9ae596166e..8411b32efc 100644 --- a/libuavcan/include/uavcan/error.hpp +++ b/libuavcan/include/uavcan/error.hpp @@ -4,6 +4,8 @@ #pragma once +#include + namespace uavcan { /** @@ -33,6 +35,7 @@ enum #if __GNUC__ __attribute__ ((noreturn)) #endif +UAVCAN_EXPORT void handleFatalError(const char* msg); } diff --git a/libuavcan/include/uavcan/impl_constants.hpp b/libuavcan/include/uavcan/impl_constants.hpp index b74b23c7a1..330b5327b1 100644 --- a/libuavcan/include/uavcan/impl_constants.hpp +++ b/libuavcan/include/uavcan/impl_constants.hpp @@ -4,8 +4,6 @@ #pragma once -#include - /** * 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 -struct IsDynamicallyAllocatable +struct UAVCAN_EXPORT IsDynamicallyAllocatable { - static void check() { StaticAssert::check(); } + static void check() + { + char dummy[(sizeof(T) <= MemPoolBlockSize) ? 1 : -1]; + (void)dummy; + } }; } diff --git a/libuavcan/include/uavcan/linked_list.hpp b/libuavcan/include/uavcan/linked_list.hpp index d79a64d85e..7d5a1460e3 100644 --- a/libuavcan/include/uavcan/linked_list.hpp +++ b/libuavcan/include/uavcan/linked_list.hpp @@ -7,6 +7,7 @@ #include #include +#include namespace uavcan { @@ -14,7 +15,7 @@ namespace uavcan * Classes that are supposed to be linked-listed should derive this. */ template -class LinkedListNode +class UAVCAN_EXPORT LinkedListNode { T* next_; @@ -36,7 +37,7 @@ public: * Linked list root. */ template -class LinkedListRoot +class UAVCAN_EXPORT LinkedListRoot { T* root_; diff --git a/libuavcan/include/uavcan/map.hpp b/libuavcan/include/uavcan/map.hpp index d227d63a0c..4c4d4777c9 100644 --- a/libuavcan/include/uavcan/map.hpp +++ b/libuavcan/include/uavcan/map.hpp @@ -22,7 +22,7 @@ namespace uavcan * Size of Key + Value + padding must not exceed MemPoolBlockSize. */ template -class Map : Noncopyable +class UAVCAN_EXPORT Map : Noncopyable { UAVCAN_PACKED_BEGIN struct KVPair diff --git a/libuavcan/include/uavcan/marshal/array.hpp b/libuavcan/include/uavcan/marshal/array.hpp index 1dd3ee5b3d..70ec5d02a7 100644 --- a/libuavcan/include/uavcan/marshal/array.hpp +++ b/libuavcan/include/uavcan/marshal/array.hpp @@ -28,7 +28,7 @@ enum ArrayMode { ArrayModeStatic, ArrayModeDynamic }; template -class StaticArrayBase +class UAVCAN_EXPORT StaticArrayBase { public: enum { SizeBitLen = 0 }; @@ -57,7 +57,7 @@ protected: template -class DynamicArrayBase +class UAVCAN_EXPORT DynamicArrayBase { protected: typedef IntegerSpec::Result, SignednessUnsigned, CastModeSaturate> RawSizeType; @@ -123,8 +123,8 @@ public: * Statically allocated array with optional dynamic-like behavior */ template -class ArrayImpl : public Select, StaticArrayBase >::Result +class UAVCAN_EXPORT ArrayImpl : public Select, StaticArrayBase >::Result { typedef ArrayImpl SelfType; typedef typename Select -class ArrayImpl, ArrayMode, MaxSize> +class UAVCAN_EXPORT ArrayImpl, ArrayMode, MaxSize> : public std::bitset , public Select, StaticArrayBase >::Result { @@ -228,7 +228,7 @@ template class ArrayImpl; template -class Array : public ArrayImpl +class UAVCAN_EXPORT Array : public ArrayImpl { typedef ArrayImpl Base; typedef Array SelfType; @@ -691,12 +691,14 @@ public: }; template +UAVCAN_EXPORT inline bool operator==(const R& rhs, const Array& lhs) { return lhs.operator==(rhs); } template +UAVCAN_EXPORT inline bool operator!=(const R& rhs, const Array& lhs) { return lhs.operator!=(rhs); @@ -704,7 +706,7 @@ inline bool operator!=(const R& rhs, const Array& lhs) template -class YamlStreamer > +class UAVCAN_EXPORT YamlStreamer > { typedef Array ArrayType; diff --git a/libuavcan/include/uavcan/marshal/bit_stream.hpp b/libuavcan/include/uavcan/marshal/bit_stream.hpp index 0033e9a910..fbe17a490a 100644 --- a/libuavcan/include/uavcan/marshal/bit_stream.hpp +++ b/libuavcan/include/uavcan/marshal/bit_stream.hpp @@ -8,15 +8,16 @@ #include #include #include +#include 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 }; diff --git a/libuavcan/include/uavcan/marshal/char_array_formatter.hpp b/libuavcan/include/uavcan/marshal/char_array_formatter.hpp index f5c61810e2..da00c33d8d 100644 --- a/libuavcan/include/uavcan/marshal/char_array_formatter.hpp +++ b/libuavcan/include/uavcan/marshal/char_array_formatter.hpp @@ -21,7 +21,7 @@ namespace uavcan #if UAVCAN_CPP_VERSION >= UAVCAN_CPP11 template -class CharArrayFormatter +class UAVCAN_EXPORT CharArrayFormatter { ArrayType_& array_; @@ -99,7 +99,7 @@ public: #else template -class CharArrayFormatter +class UAVCAN_EXPORT CharArrayFormatter { ArrayType_& array_; diff --git a/libuavcan/include/uavcan/marshal/float_spec.hpp b/libuavcan/include/uavcan/marshal/float_spec.hpp index 60b14403fd..7c550d3be2 100644 --- a/libuavcan/include/uavcan/marshal/float_spec.hpp +++ b/libuavcan/include/uavcan/marshal/float_spec.hpp @@ -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 -class FloatSpec : public IEEE754Limits +class UAVCAN_EXPORT FloatSpec : public IEEE754Limits { FloatSpec(); @@ -184,7 +184,7 @@ private: template -struct YamlStreamer > +struct UAVCAN_EXPORT YamlStreamer > { typedef typename FloatSpec::StorageType StorageType; diff --git a/libuavcan/include/uavcan/marshal/integer_spec.hpp b/libuavcan/include/uavcan/marshal/integer_spec.hpp index ae971d98bb..172f51e542 100644 --- a/libuavcan/include/uavcan/marshal/integer_spec.hpp +++ b/libuavcan/include/uavcan/marshal/integer_spec.hpp @@ -17,7 +17,7 @@ namespace uavcan enum Signedness { SignednessUnsigned, SignednessSigned }; template -class IntegerSpec +class UAVCAN_EXPORT IntegerSpec { struct ErrorNoSuchInteger; @@ -132,7 +132,7 @@ struct IsIntegerSpec > template -struct YamlStreamer > +struct UAVCAN_EXPORT YamlStreamer > { typedef IntegerSpec RawType; typedef typename RawType::StorageType StorageType; diff --git a/libuavcan/include/uavcan/marshal/scalar_codec.hpp b/libuavcan/include/uavcan/marshal/scalar_codec.hpp index 95970fa8b8..cc3fde2a24 100644 --- a/libuavcan/include/uavcan/marshal/scalar_codec.hpp +++ b/libuavcan/include/uavcan/marshal/scalar_codec.hpp @@ -8,13 +8,14 @@ #include #include #include +#include #include #include namespace uavcan { -class ScalarCodec +class UAVCAN_EXPORT ScalarCodec { BitStream& stream_; diff --git a/libuavcan/include/uavcan/marshal/type_util.hpp b/libuavcan/include/uavcan/marshal/type_util.hpp index d037f7c219..7b2e8bafec 100644 --- a/libuavcan/include/uavcan/marshal/type_util.hpp +++ b/libuavcan/include/uavcan/marshal/type_util.hpp @@ -5,6 +5,7 @@ #pragma once #include +#include namespace uavcan { @@ -64,6 +65,6 @@ public: template -struct YamlStreamer; +struct UAVCAN_EXPORT YamlStreamer; } diff --git a/libuavcan/include/uavcan/node/abstract_node.hpp b/libuavcan/include/uavcan/node/abstract_node.hpp index 1357bf7e73..20129c62a8 100644 --- a/libuavcan/include/uavcan/node/abstract_node.hpp +++ b/libuavcan/include/uavcan/node/abstract_node.hpp @@ -4,13 +4,14 @@ #pragma once +#include #include #include namespace uavcan { -class INode +class UAVCAN_EXPORT INode { public: virtual ~INode() { } diff --git a/libuavcan/include/uavcan/node/generic_publisher.hpp b/libuavcan/include/uavcan/node/generic_publisher.hpp index 2c06ad883f..d91123a75e 100644 --- a/libuavcan/include/uavcan/node/generic_publisher.hpp +++ b/libuavcan/include/uavcan/node/generic_publisher.hpp @@ -23,7 +23,7 @@ namespace uavcan * DataStruct - instantiable class */ template -class GenericPublisher +class UAVCAN_EXPORT GenericPublisher { enum { diff --git a/libuavcan/include/uavcan/node/generic_subscriber.hpp b/libuavcan/include/uavcan/node/generic_subscriber.hpp index 59ca7881bf..b086965f64 100644 --- a/libuavcan/include/uavcan/node/generic_subscriber.hpp +++ b/libuavcan/include/uavcan/node/generic_subscriber.hpp @@ -19,7 +19,7 @@ namespace uavcan { template -class ReceivedDataStructure : public DataType_ +class UAVCAN_EXPORT ReceivedDataStructure : public DataType_ { const IncomingTransfer* transfer_; @@ -69,7 +69,7 @@ static Stream& operator<<(Stream& s, const ReceivedDataStructure& rds) template -class TransferListenerInstantiationHelper +class UAVCAN_EXPORT TransferListenerInstantiationHelper { enum { DataTypeMaxByteLen = BitLenToByteLen::Result }; enum { NeedsBuffer = int(DataTypeMaxByteLen) > int(MaxSingleFrameTransferPayloadLen) }; @@ -83,7 +83,7 @@ public: template -class GenericSubscriber : Noncopyable +class UAVCAN_EXPORT GenericSubscriber : Noncopyable { typedef GenericSubscriber SelfType; diff --git a/libuavcan/include/uavcan/node/global_data_type_registry.hpp b/libuavcan/include/uavcan/node/global_data_type_registry.hpp index 6b0560e788..f208e5e1d4 100644 --- a/libuavcan/include/uavcan/node/global_data_type_registry.hpp +++ b/libuavcan/include/uavcan/node/global_data_type_registry.hpp @@ -21,7 +21,7 @@ namespace uavcan typedef std::bitset DataTypeIDMask; -class GlobalDataTypeRegistry : Noncopyable +class UAVCAN_EXPORT GlobalDataTypeRegistry : Noncopyable { struct Entry : public LinkedListNode { @@ -133,7 +133,7 @@ public: template -struct DefaultDataTypeRegistrator +struct UAVCAN_EXPORT DefaultDataTypeRegistrator { DefaultDataTypeRegistrator() { diff --git a/libuavcan/include/uavcan/node/marshal_buffer.hpp b/libuavcan/include/uavcan/node/marshal_buffer.hpp index 517316f2d1..e5e83c50e7 100644 --- a/libuavcan/include/uavcan/node/marshal_buffer.hpp +++ b/libuavcan/include/uavcan/node/marshal_buffer.hpp @@ -4,13 +4,14 @@ #pragma once +#include #include #include 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 -class MarshalBufferProvider : public IMarshalBufferProvider +class UAVCAN_EXPORT MarshalBufferProvider : public IMarshalBufferProvider { class Buffer : public IMarshalBuffer { diff --git a/libuavcan/include/uavcan/node/node.hpp b/libuavcan/include/uavcan/node/node.hpp index 19b0dc26ed..725d5363b9 100644 --- a/libuavcan/include/uavcan/node/node.hpp +++ b/libuavcan/include/uavcan/node/node.hpp @@ -29,7 +29,7 @@ namespace uavcan template -class Node : public INode +class UAVCAN_EXPORT Node : public INode { enum { diff --git a/libuavcan/include/uavcan/node/publisher.hpp b/libuavcan/include/uavcan/node/publisher.hpp index f1f67b61c6..964a1c8532 100644 --- a/libuavcan/include/uavcan/node/publisher.hpp +++ b/libuavcan/include/uavcan/node/publisher.hpp @@ -10,7 +10,7 @@ namespace uavcan { template -class Publisher : protected GenericPublisher +class UAVCAN_EXPORT Publisher : protected GenericPublisher { typedef GenericPublisher BaseType; diff --git a/libuavcan/include/uavcan/node/scheduler.hpp b/libuavcan/include/uavcan/node/scheduler.hpp index 1284207842..fd7c05bf0f 100644 --- a/libuavcan/include/uavcan/node/scheduler.hpp +++ b/libuavcan/include/uavcan/node/scheduler.hpp @@ -11,9 +11,9 @@ namespace uavcan { -class Scheduler; +class UAVCAN_EXPORT Scheduler; -class DeadlineHandler : public LinkedListNode, Noncopyable +class UAVCAN_EXPORT DeadlineHandler : public LinkedListNode, Noncopyable { MonotonicTime deadline_; @@ -41,7 +41,7 @@ public: }; -class DeadlineScheduler : Noncopyable +class UAVCAN_EXPORT DeadlineScheduler : Noncopyable { LinkedListRoot 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 }; diff --git a/libuavcan/include/uavcan/node/service_client.hpp b/libuavcan/include/uavcan/node/service_client.hpp index 419459e6ac..5c689167a4 100644 --- a/libuavcan/include/uavcan/node/service_client.hpp +++ b/libuavcan/include/uavcan/node/service_client.hpp @@ -20,7 +20,7 @@ namespace uavcan { template -class ServiceResponseTransferListenerInstantiationHelper +class UAVCAN_EXPORT ServiceResponseTransferListenerInstantiationHelper { enum { DataTypeMaxByteLen = BitLenToByteLen::Result }; public: @@ -29,7 +29,7 @@ public: template -struct ServiceCallResult +struct UAVCAN_EXPORT ServiceCallResult { typedef ReceivedDataStructure ResponseFieldType; @@ -76,7 +76,7 @@ template &) #endif > -class ServiceClient +class UAVCAN_EXPORT ServiceClient : public GenericSubscriber::Type > , protected DeadlineHandler diff --git a/libuavcan/include/uavcan/node/service_server.hpp b/libuavcan/include/uavcan/node/service_server.hpp index 345c13dc1b..62269e4c0c 100644 --- a/libuavcan/include/uavcan/node/service_server.hpp +++ b/libuavcan/include/uavcan/node/service_server.hpp @@ -29,10 +29,10 @@ template -class ServiceServer : public GenericSubscriber::Type> +class UAVCAN_EXPORT ServiceServer + : public GenericSubscriber::Type> { public: typedef DataType_ DataType; diff --git a/libuavcan/include/uavcan/node/subscriber.hpp b/libuavcan/include/uavcan/node/subscriber.hpp index d374ebb9b7..ff53651fe6 100644 --- a/libuavcan/include/uavcan/node/subscriber.hpp +++ b/libuavcan/include/uavcan/node/subscriber.hpp @@ -27,10 +27,10 @@ template -class Subscriber : public GenericSubscriber::Type> +class UAVCAN_EXPORT Subscriber + : public GenericSubscriber::Type> { public: typedef Callback_ Callback; diff --git a/libuavcan/include/uavcan/node/timer.hpp b/libuavcan/include/uavcan/node/timer.hpp index 4020f65933..5231da3730 100644 --- a/libuavcan/include/uavcan/node/timer.hpp +++ b/libuavcan/include/uavcan/node/timer.hpp @@ -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 -class TimerEventForwarder : public TimerBase +class UAVCAN_EXPORT TimerEventForwarder : public TimerBase { public: typedef Callback_ Callback; diff --git a/libuavcan/include/uavcan/protocol/data_type_info_provider.hpp b/libuavcan/include/uavcan/protocol/data_type_info_provider.hpp index ba4edc98bc..e633818b63 100644 --- a/libuavcan/include/uavcan/protocol/data_type_info_provider.hpp +++ b/libuavcan/include/uavcan/protocol/data_type_info_provider.hpp @@ -13,7 +13,7 @@ namespace uavcan { -class DataTypeInfoProvider : Noncopyable +class UAVCAN_EXPORT DataTypeInfoProvider : Noncopyable { typedef MethodBinder&)> diff --git a/libuavcan/include/uavcan/protocol/logger.hpp b/libuavcan/include/uavcan/protocol/logger.hpp index 7aacfc8e41..41ffa7a891 100644 --- a/libuavcan/include/uavcan/protocol/logger.hpp +++ b/libuavcan/include/uavcan/protocol/logger.hpp @@ -16,7 +16,7 @@ namespace uavcan { -class ILogSink +class UAVCAN_EXPORT ILogSink { public: typedef typename StorageType::Type LogLevel; @@ -35,7 +35,7 @@ public: }; -class Logger +class UAVCAN_EXPORT Logger { public: typedef ILogSink::LogLevel LogLevel; diff --git a/libuavcan/include/uavcan/protocol/node_initializer.hpp b/libuavcan/include/uavcan/protocol/node_initializer.hpp index e191a16189..82ad1e0f96 100644 --- a/libuavcan/include/uavcan/protocol/node_initializer.hpp +++ b/libuavcan/include/uavcan/protocol/node_initializer.hpp @@ -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 NodeIDMask; typedef MethodBinder::Type NodeStatusCode; diff --git a/libuavcan/include/uavcan/protocol/node_status_provider.hpp b/libuavcan/include/uavcan/protocol/node_status_provider.hpp index dc8bc9ccda..d6d6043e7e 100644 --- a/libuavcan/include/uavcan/protocol/node_status_provider.hpp +++ b/libuavcan/include/uavcan/protocol/node_status_provider.hpp @@ -17,7 +17,7 @@ namespace uavcan { -class NodeStatusProvider : private TimerBase +class UAVCAN_EXPORT NodeStatusProvider : private TimerBase { typedef MethodBinder GlobalDiscoveryRequestCallback; diff --git a/libuavcan/include/uavcan/protocol/panic_broadcaster.hpp b/libuavcan/include/uavcan/protocol/panic_broadcaster.hpp index f53175b1c8..8f08e4cb98 100644 --- a/libuavcan/include/uavcan/protocol/panic_broadcaster.hpp +++ b/libuavcan/include/uavcan/protocol/panic_broadcaster.hpp @@ -11,7 +11,7 @@ namespace uavcan { -class PanicBroadcaster : private TimerBase +class UAVCAN_EXPORT PanicBroadcaster : private TimerBase { Publisher pub_; protocol::Panic msg_; diff --git a/libuavcan/include/uavcan/protocol/panic_listener.hpp b/libuavcan/include/uavcan/protocol/panic_listener.hpp index 1fc6bc56c4..f222fd7cf6 100644 --- a/libuavcan/include/uavcan/protocol/panic_listener.hpp +++ b/libuavcan/include/uavcan/protocol/panic_listener.hpp @@ -35,7 +35,7 @@ template < typename Callback = void (*)(const ReceivedDataStructure&) #endif > -class PanicListener : Noncopyable +class UAVCAN_EXPORT PanicListener : Noncopyable { typedef MethodBinder&)> PanicMsgCallback; diff --git a/libuavcan/include/uavcan/protocol/param_server.hpp b/libuavcan/include/uavcan/protocol/param_server.hpp index aa1c216e85..03b91b1df0 100644 --- a/libuavcan/include/uavcan/protocol/param_server.hpp +++ b/libuavcan/include/uavcan/protocol/param_server.hpp @@ -12,7 +12,7 @@ namespace uavcan { -class IParamManager +class UAVCAN_EXPORT IParamManager { public: typedef typename StorageType::Type ParamName; @@ -63,7 +63,7 @@ public: }; -class ParamServer +class UAVCAN_EXPORT ParamServer { typedef MethodBinder GetSetCallback; diff --git a/libuavcan/include/uavcan/protocol/restart_request_server.hpp b/libuavcan/include/uavcan/protocol/restart_request_server.hpp index 3faf497dbd..718a0e2f3c 100644 --- a/libuavcan/include/uavcan/protocol/restart_request_server.hpp +++ b/libuavcan/include/uavcan/protocol/restart_request_server.hpp @@ -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&, diff --git a/libuavcan/include/uavcan/protocol/transport_stats_provider.hpp b/libuavcan/include/uavcan/protocol/transport_stats_provider.hpp index 7723bd3c3e..8bfaa69ef2 100644 --- a/libuavcan/include/uavcan/protocol/transport_stats_provider.hpp +++ b/libuavcan/include/uavcan/protocol/transport_stats_provider.hpp @@ -11,7 +11,7 @@ namespace uavcan { -class TransportStatsProvider : Noncopyable +class UAVCAN_EXPORT TransportStatsProvider : Noncopyable { typedef MethodBinder #include #include +#include #include #include @@ -166,16 +167,16 @@ public: /* * Monotonic */ -class MonotonicDuration : public DurationBase { }; +class UAVCAN_EXPORT MonotonicDuration : public DurationBase { }; -class MonotonicTime : public TimeBase { }; +class UAVCAN_EXPORT MonotonicTime : public TimeBase { }; /* * UTC */ -class UtcDuration : public DurationBase { }; +class UAVCAN_EXPORT UtcDuration : public DurationBase { }; -class UtcTime : public TimeBase +class UAVCAN_EXPORT UtcTime : public TimeBase { public: UtcTime() { } @@ -201,6 +202,7 @@ public: template +UAVCAN_EXPORT inline Stream& operator<<(Stream& s, DurationBase d) { char buf[8]; @@ -215,6 +217,7 @@ inline Stream& operator<<(Stream& s, DurationBase d) } template +UAVCAN_EXPORT inline Stream& operator<<(Stream& s, TimeBase t) { char buf[8]; diff --git a/libuavcan/include/uavcan/transport/can_io.hpp b/libuavcan/include/uavcan/transport/can_io.hpp index f294df53f6..0da4352417 100644 --- a/libuavcan/include/uavcan/transport/can_io.hpp +++ b/libuavcan/include/uavcan/transport/can_io.hpp @@ -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 { diff --git a/libuavcan/include/uavcan/transport/crc.hpp b/libuavcan/include/uavcan/transport/crc.hpp index 2d40d3ee8f..91c6be0423 100644 --- a/libuavcan/include/uavcan/transport/crc.hpp +++ b/libuavcan/include/uavcan/transport/crc.hpp @@ -6,6 +6,7 @@ #include #include +#include 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_; diff --git a/libuavcan/include/uavcan/transport/dispatcher.hpp b/libuavcan/include/uavcan/transport/dispatcher.hpp index 80bb1a25a0..d30eb72011 100644 --- a/libuavcan/include/uavcan/transport/dispatcher.hpp +++ b/libuavcan/include/uavcan/transport/dispatcher.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -16,9 +17,9 @@ namespace uavcan { -class Dispatcher; +class UAVCAN_EXPORT Dispatcher; -class LoopbackFrameListenerBase : public LinkedListNode, Noncopyable +class UAVCAN_EXPORT LoopbackFrameListenerBase : public LinkedListNode, Noncopyable { Dispatcher& dispatcher_; @@ -40,7 +41,7 @@ public: }; -class LoopbackFrameListenerRegistry : Noncopyable +class UAVCAN_EXPORT LoopbackFrameListenerRegistry : Noncopyable { LinkedListRoot listeners_; @@ -54,7 +55,7 @@ public: }; -class Dispatcher : Noncopyable +class UAVCAN_EXPORT Dispatcher : Noncopyable { CanIOManager canio_; ISystemClock& sysclock_; diff --git a/libuavcan/include/uavcan/transport/frame.hpp b/libuavcan/include/uavcan/transport/frame.hpp index db1d8182bd..7c044e4954 100644 --- a/libuavcan/include/uavcan/transport/frame.hpp +++ b/libuavcan/include/uavcan/transport/frame.hpp @@ -9,14 +9,13 @@ #include #include #include +#include #include 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_; diff --git a/libuavcan/include/uavcan/transport/outgoing_transfer_registry.hpp b/libuavcan/include/uavcan/transport/outgoing_transfer_registry.hpp index 481116b2f8..0187855e4d 100644 --- a/libuavcan/include/uavcan/transport/outgoing_transfer_registry.hpp +++ b/libuavcan/include/uavcan/transport/outgoing_transfer_registry.hpp @@ -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 -class OutgoingTransferRegistry : public IOutgoingTransferRegistry, Noncopyable +class UAVCAN_EXPORT OutgoingTransferRegistry : public IOutgoingTransferRegistry, Noncopyable { UAVCAN_PACKED_BEGIN struct Value diff --git a/libuavcan/include/uavcan/transport/perf_counter.hpp b/libuavcan/include/uavcan/transport/perf_counter.hpp index 2baa7358ba..85b2cc56f4 100644 --- a/libuavcan/include/uavcan/transport/perf_counter.hpp +++ b/libuavcan/include/uavcan/transport/perf_counter.hpp @@ -5,11 +5,12 @@ #pragma once #include +#include namespace uavcan { -class TransferPerfCounter +class UAVCAN_EXPORT TransferPerfCounter { uint64_t transfers_tx_; uint64_t transfers_rx_; diff --git a/libuavcan/include/uavcan/transport/transfer.hpp b/libuavcan/include/uavcan/transport/transfer.hpp index d73ee19011..fba31ceb88 100644 --- a/libuavcan/include/uavcan/transport/transfer.hpp +++ b/libuavcan/include/uavcan/transport/transfer.hpp @@ -5,6 +5,7 @@ #pragma once #include +#include #include 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 { diff --git a/libuavcan/include/uavcan/transport/transfer_buffer.hpp b/libuavcan/include/uavcan/transport/transfer_buffer.hpp index b887c89f07..d7c5436ef9 100644 --- a/libuavcan/include/uavcan/transport/transfer_buffer.hpp +++ b/libuavcan/include/uavcan/transport/transfer_buffer.hpp @@ -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 { @@ -149,7 +149,7 @@ UAVCAN_PACKED_END * Standalone static buffer */ template -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 -class StaticTransferBufferManagerEntry : public TransferBufferManagerEntry +class UAVCAN_EXPORT StaticTransferBufferManagerEntry : public TransferBufferManagerEntry { StaticTransferBuffer 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 -class TransferBufferManager : public ITransferBufferManager, Noncopyable +class UAVCAN_EXPORT TransferBufferManager : public ITransferBufferManager, Noncopyable { typedef StaticTransferBufferManagerEntry StaticBufferType; @@ -493,7 +493,7 @@ public: }; template <> -class TransferBufferManager<0, 0> : public ITransferBufferManager +class UAVCAN_EXPORT TransferBufferManager<0, 0> : public ITransferBufferManager { public: TransferBufferManager() { } diff --git a/libuavcan/include/uavcan/transport/transfer_listener.hpp b/libuavcan/include/uavcan/transport/transfer_listener.hpp index 8df5fbb90f..d5dbda115a 100644 --- a/libuavcan/include/uavcan/transport/transfer_listener.hpp +++ b/libuavcan/include/uavcan/transport/transfer_listener.hpp @@ -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, Noncopyable +class UAVCAN_EXPORT TransferListenerBase : public LinkedListNode, 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 -class TransferListener : public TransferListenerBase +class UAVCAN_EXPORT TransferListener : public TransferListenerBase { typedef TransferBufferManager BufferManager; BufferManager bufmgr_; @@ -204,7 +204,7 @@ public: * This class should be derived by callers. */ template -class ServiceResponseTransferListener : public TransferListener +class UAVCAN_EXPORT ServiceResponseTransferListener : public TransferListener { public: struct ExpectedResponseParams diff --git a/libuavcan/include/uavcan/transport/transfer_receiver.hpp b/libuavcan/include/uavcan/transport/transfer_receiver.hpp index e84069f77e..da0bef9047 100644 --- a/libuavcan/include/uavcan/transport/transfer_receiver.hpp +++ b/libuavcan/include/uavcan/transport/transfer_receiver.hpp @@ -5,6 +5,7 @@ #pragma once #include +#include #include #include @@ -12,7 +13,7 @@ namespace uavcan { UAVCAN_PACKED_BEGIN -class TransferReceiver +class UAVCAN_EXPORT TransferReceiver { public: enum ResultCode { ResultNotComplete, ResultComplete, ResultSingleFrame }; diff --git a/libuavcan/include/uavcan/transport/transfer_sender.hpp b/libuavcan/include/uavcan/transport/transfer_sender.hpp index 2e529ef074..648d608c13 100644 --- a/libuavcan/include/uavcan/transport/transfer_sender.hpp +++ b/libuavcan/include/uavcan/transport/transfer_sender.hpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -15,7 +16,7 @@ namespace uavcan { -class TransferSender +class UAVCAN_EXPORT TransferSender { const MonotonicDuration max_transfer_interval_; const DataTypeDescriptor& data_type_; diff --git a/libuavcan/include/uavcan/util/compile_time.hpp b/libuavcan/include/uavcan/util/compile_time.hpp index 52c4a429b4..d4ad3d0a2e 100644 --- a/libuavcan/include/uavcan/util/compile_time.hpp +++ b/libuavcan/include/uavcan/util/compile_time.hpp @@ -4,6 +4,8 @@ #pragma once +#include + namespace uavcan { /** @@ -11,10 +13,10 @@ namespace uavcan * StaticAssert::check(); */ template -struct StaticAssert; +struct UAVCAN_EXPORT StaticAssert; template <> -struct StaticAssert +struct UAVCAN_EXPORT StaticAssert { static void check() { } }; @@ -28,7 +30,7 @@ template 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 -struct EnableIf { }; +struct UAVCAN_EXPORT EnableIf { }; template -struct EnableIf +struct UAVCAN_EXPORT EnableIf { typedef T Type; }; template -struct EnableIfType +struct UAVCAN_EXPORT EnableIfType { typedef R Type; }; template -struct Select; +struct UAVCAN_EXPORT Select; template -struct Select +struct UAVCAN_EXPORT Select { typedef TrueType Result; }; template -struct Select +struct UAVCAN_EXPORT Select { typedef FalseType Result; }; @@ -74,7 +76,7 @@ struct Select /** * Value types */ -template struct BooleanType { }; +template struct UAVCAN_EXPORT BooleanType { }; typedef BooleanType TrueType; typedef BooleanType FalseType; @@ -82,7 +84,7 @@ typedef BooleanType FalseType; * Relations */ template -class IsImplicitlyConvertibleFromTo +class UAVCAN_EXPORT IsImplicitlyConvertibleFromTo { template static U returner(); @@ -98,13 +100,14 @@ public: template -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 +UAVCAN_EXPORT To try_implicit_cast(const From& from, const To& default_) { return TryImplicitCastImpl::impl(from, default_, @@ -112,6 +115,7 @@ To try_implicit_cast(const From& from, const To& default_) } template +UAVCAN_EXPORT To try_implicit_cast(const From& from) { return TryImplicitCastImpl::impl(from, To(), @@ -121,14 +125,14 @@ To try_implicit_cast(const From& from) /** * Some arithmetics */ -template 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 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 }; }; } diff --git a/libuavcan/include/uavcan/util/lazy_constructor.hpp b/libuavcan/include/uavcan/util/lazy_constructor.hpp index 5d6255b0f8..a00f014e90 100644 --- a/libuavcan/include/uavcan/util/lazy_constructor.hpp +++ b/libuavcan/include/uavcan/util/lazy_constructor.hpp @@ -16,7 +16,7 @@ namespace uavcan { template -class LazyConstructor +class UAVCAN_EXPORT LazyConstructor { union { diff --git a/libuavcan/include/uavcan/util/method_binder.hpp b/libuavcan/include/uavcan/util/method_binder.hpp index 778b92e600..92d28b8495 100644 --- a/libuavcan/include/uavcan/util/method_binder.hpp +++ b/libuavcan/include/uavcan/util/method_binder.hpp @@ -12,7 +12,7 @@ namespace uavcan { template -class MethodBinder +class UAVCAN_EXPORT MethodBinder { ObjectPtr obj_; MemFunPtr fun_;