From b1bf726866fa0752ed37a30b3c110174793d42bd Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Tue, 1 Mar 2011 16:39:26 +0000 Subject: [PATCH] flesh out api for dlls on windows svn path=/tags/yarp-2.3.3/; revision=8499 --- src/libYARP_OS/include/yarp/os/BinPortable.h | 2 +- src/libYARP_OS/include/yarp/os/BufferedPort.h | 2 +- src/libYARP_OS/include/yarp/os/LocalReader.h | 2 +- src/libYARP_OS/include/yarp/os/ManagedBytes.h | 2 + .../include/yarp/os/PortReaderBuffer.h | 8 +-- .../include/yarp/os/PortWriterBuffer.h | 2 +- src/libYARP_OS/include/yarp/os/PortablePair.h | 72 ++++++++++--------- src/libYARP_OS/include/yarp/os/Run.h | 2 +- src/libYARP_OS/include/yarp/os/api.h | 4 ++ .../include/yarp/os/impl/AbstractCarrier.h | 2 +- src/libYARP_OS/include/yarp/os/impl/Address.h | 2 +- .../include/yarp/os/impl/BottleImpl.h | 2 +- .../yarp/os/impl/BufferedConnectionWriter.h | 2 +- src/libYARP_OS/include/yarp/os/impl/Carrier.h | 2 +- .../include/yarp/os/impl/Carriers.h | 2 +- .../include/yarp/os/impl/Companion.h | 2 +- .../include/yarp/os/impl/DgramTwoWayStream.h | 2 +- .../include/yarp/os/impl/Election.h | 2 +- .../include/yarp/os/impl/FallbackNameClient.h | 2 +- .../include/yarp/os/impl/FallbackNameServer.h | 2 +- .../include/yarp/os/impl/InputProtocol.h | 2 +- .../include/yarp/os/impl/InputStream.h | 2 +- src/libYARP_OS/include/yarp/os/impl/Logger.h | 2 +- src/libYARP_OS/include/yarp/os/impl/Name.h | 2 +- .../include/yarp/os/impl/NameClient.h | 2 +- .../include/yarp/os/impl/NameConfig.h | 2 +- .../include/yarp/os/impl/NameServer.h | 4 +- src/libYARP_OS/include/yarp/os/impl/NetType.h | 2 +- .../include/yarp/os/impl/OutputProtocol.h | 2 +- .../include/yarp/os/impl/OutputStream.h | 2 +- .../include/yarp/os/impl/PortCommand.h | 2 +- .../include/yarp/os/impl/PortCore.h | 2 +- .../include/yarp/os/impl/PortManager.h | 2 +- .../include/yarp/os/impl/Protocol.h | 2 +- src/libYARP_OS/include/yarp/os/impl/Route.h | 2 +- .../include/yarp/os/impl/SemaphoreImpl.h | 2 +- .../include/yarp/os/impl/ShiftStream.h | 2 +- .../include/yarp/os/impl/SizedWriter.h | 2 +- .../yarp/os/impl/StreamConnectionReader.h | 2 +- src/libYARP_OS/include/yarp/os/impl/String.h | 2 + .../include/yarp/os/impl/ThreadImpl.h | 2 +- .../include/yarp/os/impl/TwoWayStream.h | 2 +- .../include/yarp/os/impl/UnitTest.h | 2 +- src/libYARP_OS/src/ManagedBytes.cpp | 16 +++++ 44 files changed, 105 insertions(+), 77 deletions(-) diff --git a/src/libYARP_OS/include/yarp/os/BinPortable.h b/src/libYARP_OS/include/yarp/os/BinPortable.h index 554799c02b3..cabde8cd631 100644 --- a/src/libYARP_OS/include/yarp/os/BinPortable.h +++ b/src/libYARP_OS/include/yarp/os/BinPortable.h @@ -28,7 +28,7 @@ namespace yarp { * languages, operating systems, or processor architectures. */ template -class YARP_OS_API yarp::os::BinPortable : public Portable { +class yarp::os::BinPortable : public Portable { private: T t; diff --git a/src/libYARP_OS/include/yarp/os/BufferedPort.h b/src/libYARP_OS/include/yarp/os/BufferedPort.h index 50e8623c435..3086c328bd5 100644 --- a/src/libYARP_OS/include/yarp/os/BufferedPort.h +++ b/src/libYARP_OS/include/yarp/os/BufferedPort.h @@ -32,7 +32,7 @@ namespace yarp { * (see BufferedPort::read and BufferedPort::write). */ template -class YARP_OS_API yarp::os::BufferedPort : public Contactable, +class yarp::os::BufferedPort : public Contactable, public TypedReader, public TypedReaderCallback { public: diff --git a/src/libYARP_OS/include/yarp/os/LocalReader.h b/src/libYARP_OS/include/yarp/os/LocalReader.h index 8054016bd67..d73258ca3c8 100644 --- a/src/libYARP_OS/include/yarp/os/LocalReader.h +++ b/src/libYARP_OS/include/yarp/os/LocalReader.h @@ -23,7 +23,7 @@ namespace yarp { * */ template -class YARP_OS_API yarp::os::LocalReader { +class yarp::os::LocalReader { public: virtual ~LocalReader() {} diff --git a/src/libYARP_OS/include/yarp/os/ManagedBytes.h b/src/libYARP_OS/include/yarp/os/ManagedBytes.h index 59c04b5d7b9..57829017c5a 100644 --- a/src/libYARP_OS/include/yarp/os/ManagedBytes.h +++ b/src/libYARP_OS/include/yarp/os/ManagedBytes.h @@ -102,6 +102,8 @@ class YARP_OS_API yarp::os::ManagedBytes { use = -1; } + bool allocateOnNeed(int neededLen, int allocateLen); + /** * Makes sure data block is owned, making a copy if necessary. */ diff --git a/src/libYARP_OS/include/yarp/os/PortReaderBuffer.h b/src/libYARP_OS/include/yarp/os/PortReaderBuffer.h index da5cbcd11ad..6b171f548a5 100644 --- a/src/libYARP_OS/include/yarp/os/PortReaderBuffer.h +++ b/src/libYARP_OS/include/yarp/os/PortReaderBuffer.h @@ -47,7 +47,7 @@ YARP_OS_API void typedReaderMissingCallback(); * */ template -class YARP_OS_API yarp::os::TypedReaderCallback { +class yarp::os::TypedReaderCallback { public: /** * Destructor. @@ -79,7 +79,7 @@ class YARP_OS_API yarp::os::TypedReaderCallback { * BufferedPort or a PortReaderBuffer. */ template -class YARP_OS_API yarp::os::TypedReader { +class yarp::os::TypedReader { public: /** * Call this to strictly keep all messages, or allow old ones @@ -290,7 +290,7 @@ class YARP_OS_API yarp::os::impl::PortReaderBufferBase : public yarp::os::PortRe template -class YARP_OS_API yarp::os::TypedReaderThread : public Thread { +class yarp::os::TypedReaderThread : public Thread { public: TypedReader *reader; TypedReaderCallback *callback; @@ -335,7 +335,7 @@ class YARP_OS_API yarp::os::TypedReaderThread : public Thread { * class, such as Bottle. */ template -class YARP_OS_API yarp::os::PortReaderBuffer : +class yarp::os::PortReaderBuffer : public yarp::os::TypedReader, public yarp::os::LocalReader, public yarp::os::impl::PortReaderBufferBaseCreator { diff --git a/src/libYARP_OS/include/yarp/os/PortWriterBuffer.h b/src/libYARP_OS/include/yarp/os/PortWriterBuffer.h index 49572b55379..9e4ef14e23d 100644 --- a/src/libYARP_OS/include/yarp/os/PortWriterBuffer.h +++ b/src/libYARP_OS/include/yarp/os/PortWriterBuffer.h @@ -102,7 +102,7 @@ class YARP_OS_API yarp::os::PortWriterBufferBase { * attach(). "T" should be a PortWriter class, such as Bottle. */ template -class YARP_OS_API yarp::os::PortWriterBuffer : public PortWriterBufferBase { +class yarp::os::PortWriterBuffer : public PortWriterBufferBase { public: //typedef T Type; diff --git a/src/libYARP_OS/include/yarp/os/PortablePair.h b/src/libYARP_OS/include/yarp/os/PortablePair.h index 29e1945fd7c..850a467d7eb 100644 --- a/src/libYARP_OS/include/yarp/os/PortablePair.h +++ b/src/libYARP_OS/include/yarp/os/PortablePair.h @@ -14,36 +14,13 @@ namespace yarp { namespace os { + class PortablePairBase; template class PortablePair; } } -/** - * Group a pair of objects to be sent and received together. - * Handy for adding general-purpose headers, for example. - */ -template -class YARP_OS_API yarp::os::PortablePair : public Portable { +class YARP_OS_API yarp::os::PortablePairBase : public Portable { public: - /** - * An object of the first type (HEAD). - */ - HEAD head; - - /** - * An object of the second type (BODY). - */ - BODY body; - - /** - * Reads this object pair from a network connection. - * @param connection an interface to the network connection for reading - * @return true iff the object pair was successfully read - */ - virtual bool read(ConnectionReader& connection) { - return readPair(connection,head,body); - } - /** * Reads an object pair from a network connection. * @param connection an interface to the network connection for reading @@ -70,15 +47,6 @@ class YARP_OS_API yarp::os::PortablePair : public Portable { return ok; } - /** - * Writes this object pair to a network connection. - * @param connection an interface to the network connection for writing - * @return true iff the object pair was successfully written - */ - virtual bool write(ConnectionWriter& connection) { - return writePair(connection,head,body); - } - /** * Writes an object pair to a network connection. * @param connection an interface to the network connection for writing @@ -104,6 +72,42 @@ class YARP_OS_API yarp::os::PortablePair : public Portable { return ok; } +}; + +/** + * Group a pair of objects to be sent and received together. + * Handy for adding general-purpose headers, for example. + */ +template +class yarp::os::PortablePair : public PortablePairBase { +public: + /** + * An object of the first type (HEAD). + */ + HEAD head; + + /** + * An object of the second type (BODY). + */ + BODY body; + + /** + * Reads this object pair from a network connection. + * @param connection an interface to the network connection for reading + * @return true iff the object pair was successfully read + */ + virtual bool read(ConnectionReader& connection) { + return readPair(connection,head,body); + } + + /** + * Writes this object pair to a network connection. + * @param connection an interface to the network connection for writing + * @return true iff the object pair was successfully written + */ + virtual bool write(ConnectionWriter& connection) { + return writePair(connection,head,body); + } /** * This is called when the port has finished all writing operations. diff --git a/src/libYARP_OS/include/yarp/os/Run.h b/src/libYARP_OS/include/yarp/os/Run.h index f7bc47fa4f5..e205302c553 100644 --- a/src/libYARP_OS/include/yarp/os/Run.h +++ b/src/libYARP_OS/include/yarp/os/Run.h @@ -22,7 +22,7 @@ namespace yarp { #undef main #endif -class YarpRunInfoVector; +class YARP_OS_API YarpRunInfoVector; /* * Typical Yarp applications consist of several intercommunicating modules distributed on different machines. diff --git a/src/libYARP_OS/include/yarp/os/api.h b/src/libYARP_OS/include/yarp/os/api.h index 8c8e82539d5..78a44a5f3a2 100644 --- a/src/libYARP_OS/include/yarp/os/api.h +++ b/src/libYARP_OS/include/yarp/os/api.h @@ -26,4 +26,8 @@ # endif #endif +#ifndef YARP_OS_impl_API +#define YARP_OS_impl_API YARP_OS_API +#endif + #endif diff --git a/src/libYARP_OS/include/yarp/os/impl/AbstractCarrier.h b/src/libYARP_OS/include/yarp/os/impl/AbstractCarrier.h index d1513cb82bc..1eb2916711a 100644 --- a/src/libYARP_OS/include/yarp/os/impl/AbstractCarrier.h +++ b/src/libYARP_OS/include/yarp/os/impl/AbstractCarrier.h @@ -24,7 +24,7 @@ namespace yarp { * A starter class for implementing simple carriers. * It implements reasonable default behavior. */ -class yarp::os::impl::AbstractCarrier : public Carrier { +class YARP_OS_impl_API yarp::os::impl::AbstractCarrier : public Carrier { public: virtual Carrier *create() = 0; diff --git a/src/libYARP_OS/include/yarp/os/impl/Address.h b/src/libYARP_OS/include/yarp/os/impl/Address.h index 720992be2d6..393b7ebd310 100644 --- a/src/libYARP_OS/include/yarp/os/impl/Address.h +++ b/src/libYARP_OS/include/yarp/os/impl/Address.h @@ -30,7 +30,7 @@ namespace yarp { * This may need to be extended for other systems, e.g. QNX. * */ -class yarp::os::impl::Address { +class YARP_OS_impl_API yarp::os::impl::Address { private: String name, carrier, regName; int port; diff --git a/src/libYARP_OS/include/yarp/os/impl/BottleImpl.h b/src/libYARP_OS/include/yarp/os/impl/BottleImpl.h index b7326386d76..288cbf460ad 100644 --- a/src/libYARP_OS/include/yarp/os/impl/BottleImpl.h +++ b/src/libYARP_OS/include/yarp/os/impl/BottleImpl.h @@ -387,7 +387,7 @@ class yarp::os::impl::StoreList : public Storable { * Handy to use until you work out how to make your own more * efficient formats for transmission. */ -class yarp::os::impl::BottleImpl : public yarp::os::Portable { +class YARP_OS_impl_API yarp::os::impl::BottleImpl : public yarp::os::Portable { public: BottleImpl(); diff --git a/src/libYARP_OS/include/yarp/os/impl/BufferedConnectionWriter.h b/src/libYARP_OS/include/yarp/os/impl/BufferedConnectionWriter.h index e866ae56db6..4a270bc4fdc 100644 --- a/src/libYARP_OS/include/yarp/os/impl/BufferedConnectionWriter.h +++ b/src/libYARP_OS/include/yarp/os/impl/BufferedConnectionWriter.h @@ -39,7 +39,7 @@ namespace yarp { /** * A helper for creating cached object descriptions. */ -class yarp::os::impl::BufferedConnectionWriter : public ConnectionWriter, public SizedWriter { +class YARP_OS_impl_API yarp::os::impl::BufferedConnectionWriter : public ConnectionWriter, public SizedWriter { public: BufferedConnectionWriter(bool textMode = false) : textMode(textMode) { diff --git a/src/libYARP_OS/include/yarp/os/impl/Carrier.h b/src/libYARP_OS/include/yarp/os/impl/Carrier.h index a5a9990e490..ce22a1426f6 100644 --- a/src/libYARP_OS/include/yarp/os/impl/Carrier.h +++ b/src/libYARP_OS/include/yarp/os/impl/Carrier.h @@ -46,7 +46,7 @@ namespace yarp { * * */ -class yarp::os::impl::Carrier { +class YARP_OS_impl_API yarp::os::impl::Carrier { public: diff --git a/src/libYARP_OS/include/yarp/os/impl/Carriers.h b/src/libYARP_OS/include/yarp/os/impl/Carriers.h index 4f27a9d1656..6062fedc037 100644 --- a/src/libYARP_OS/include/yarp/os/impl/Carriers.h +++ b/src/libYARP_OS/include/yarp/os/impl/Carriers.h @@ -31,7 +31,7 @@ namespace yarp { * This is the starting point for creating connections * between ports. */ -class yarp::os::impl::Carriers { +class YARP_OS_impl_API yarp::os::impl::Carriers { public: /** diff --git a/src/libYARP_OS/include/yarp/os/impl/Companion.h b/src/libYARP_OS/include/yarp/os/impl/Companion.h index d558e2c89e9..a6cee4fb712 100644 --- a/src/libYARP_OS/include/yarp/os/impl/Companion.h +++ b/src/libYARP_OS/include/yarp/os/impl/Companion.h @@ -35,7 +35,7 @@ namespace yarp { /** * Implementation of a standard set of YARP utilities. */ -class yarp::os::impl::Companion { +class YARP_OS_impl_API yarp::os::impl::Companion { public: static String version(); diff --git a/src/libYARP_OS/include/yarp/os/impl/DgramTwoWayStream.h b/src/libYARP_OS/include/yarp/os/impl/DgramTwoWayStream.h index 930bd2d477d..9e494fb91c6 100644 --- a/src/libYARP_OS/include/yarp/os/impl/DgramTwoWayStream.h +++ b/src/libYARP_OS/include/yarp/os/impl/DgramTwoWayStream.h @@ -29,7 +29,7 @@ namespace yarp { * A stream abstraction for datagram communication. It supports UDP and * MCAST. This class is not concerned with making the stream reliable. */ -class yarp::os::impl::DgramTwoWayStream : public TwoWayStream, public InputStream, public OutputStream { +class YARP_OS_impl_API yarp::os::impl::DgramTwoWayStream : public TwoWayStream, public InputStream, public OutputStream { public: DgramTwoWayStream() : mutex(1) { diff --git a/src/libYARP_OS/include/yarp/os/impl/Election.h b/src/libYARP_OS/include/yarp/os/impl/Election.h index 67eb2a050ed..1ff689517c9 100644 --- a/src/libYARP_OS/include/yarp/os/impl/Election.h +++ b/src/libYARP_OS/include/yarp/os/impl/Election.h @@ -30,7 +30,7 @@ namespace yarp { * where a manager is required for some resource used by several * peers, but it doesn't matter which peer plays that role. */ -class yarp::os::impl::Election { +class YARP_OS_impl_API yarp::os::impl::Election { private: typedef void *voidPtr; diff --git a/src/libYARP_OS/include/yarp/os/impl/FallbackNameClient.h b/src/libYARP_OS/include/yarp/os/impl/FallbackNameClient.h index 49957e21b44..939c257b7db 100644 --- a/src/libYARP_OS/include/yarp/os/impl/FallbackNameClient.h +++ b/src/libYARP_OS/include/yarp/os/impl/FallbackNameClient.h @@ -25,7 +25,7 @@ namespace yarp { * A client for the FallbackNameServer class. Provides a last-resort * means of searching for the name server. */ -class yarp::os::impl::FallbackNameClient : public ThreadImpl { +class YARP_OS_impl_API yarp::os::impl::FallbackNameClient : public ThreadImpl { public: FallbackNameClient() { closed = false; diff --git a/src/libYARP_OS/include/yarp/os/impl/FallbackNameServer.h b/src/libYARP_OS/include/yarp/os/impl/FallbackNameServer.h index 94cc2706a0f..1d23f362e22 100644 --- a/src/libYARP_OS/include/yarp/os/impl/FallbackNameServer.h +++ b/src/libYARP_OS/include/yarp/os/impl/FallbackNameServer.h @@ -26,7 +26,7 @@ namespace yarp { * Multi-cast server, for last resort information sharing about * name information -- when config files are missing or wrong */ -class yarp::os::impl::FallbackNameServer : public ThreadImpl { +class YARP_OS_impl_API yarp::os::impl::FallbackNameServer : public ThreadImpl { public: FallbackNameServer(NameServerStub& owner) : owner(owner) { closed = false; diff --git a/src/libYARP_OS/include/yarp/os/impl/InputProtocol.h b/src/libYARP_OS/include/yarp/os/impl/InputProtocol.h index c7d8ca54bb5..311c7f69198 100644 --- a/src/libYARP_OS/include/yarp/os/impl/InputProtocol.h +++ b/src/libYARP_OS/include/yarp/os/impl/InputProtocol.h @@ -28,7 +28,7 @@ namespace yarp { /** * The input side of an active connection between two ports. */ -class yarp::os::impl::InputProtocol { +class YARP_OS_impl_API yarp::os::impl::InputProtocol { public: virtual ~InputProtocol() {} diff --git a/src/libYARP_OS/include/yarp/os/impl/InputStream.h b/src/libYARP_OS/include/yarp/os/impl/InputStream.h index 14e0b5c6610..90edd65c62c 100644 --- a/src/libYARP_OS/include/yarp/os/impl/InputStream.h +++ b/src/libYARP_OS/include/yarp/os/impl/InputStream.h @@ -23,7 +23,7 @@ namespace yarp { * Simple specification of the minimum functions needed from input streams. * The streams could be TCP, UDP, MCAST, ... */ -class yarp::os::impl::InputStream { +class YARP_OS_impl_API yarp::os::impl::InputStream { public: /** * diff --git a/src/libYARP_OS/include/yarp/os/impl/Logger.h b/src/libYARP_OS/include/yarp/os/impl/Logger.h index 255b4ba7046..00ee9eaa33a 100644 --- a/src/libYARP_OS/include/yarp/os/impl/Logger.h +++ b/src/libYARP_OS/include/yarp/os/impl/Logger.h @@ -32,7 +32,7 @@ namespace yarp { * and ACE. * */ -class yarp::os::impl::Logger : public ACE_Log_Msg_Callback { +class YARP_OS_impl_API yarp::os::impl::Logger : public ACE_Log_Msg_Callback { public: enum Level { DEBUG = LM_DEBUG, diff --git a/src/libYARP_OS/include/yarp/os/impl/Name.h b/src/libYARP_OS/include/yarp/os/impl/Name.h index 02957607543..816cda8f1e0 100644 --- a/src/libYARP_OS/include/yarp/os/impl/Name.h +++ b/src/libYARP_OS/include/yarp/os/impl/Name.h @@ -23,7 +23,7 @@ namespace yarp { /** * Simple abstraction for a YARP port name. */ -class yarp::os::impl::Name { +class YARP_OS_impl_API yarp::os::impl::Name { public: /** diff --git a/src/libYARP_OS/include/yarp/os/impl/NameClient.h b/src/libYARP_OS/include/yarp/os/impl/NameClient.h index 0445a70b490..b3c5b7112de 100644 --- a/src/libYARP_OS/include/yarp/os/impl/NameClient.h +++ b/src/libYARP_OS/include/yarp/os/impl/NameClient.h @@ -29,7 +29,7 @@ namespace yarp { * name server these days - it is now a regular port, that can read * and respond to messages in the bottle format. */ -class yarp::os::impl::NameClient { +class YARP_OS_impl_API yarp::os::impl::NameClient { public: /** diff --git a/src/libYARP_OS/include/yarp/os/impl/NameConfig.h b/src/libYARP_OS/include/yarp/os/impl/NameConfig.h index 4450acee1b0..f9bbd49c029 100644 --- a/src/libYARP_OS/include/yarp/os/impl/NameConfig.h +++ b/src/libYARP_OS/include/yarp/os/impl/NameConfig.h @@ -28,7 +28,7 @@ namespace yarp { * Small helper class to help deal with legacy YARP configuration files. * */ -class yarp::os::impl::NameConfig { +class YARP_OS_impl_API yarp::os::impl::NameConfig { public: String getConfigFileName(const char *stem = NULL); diff --git a/src/libYARP_OS/include/yarp/os/impl/NameServer.h b/src/libYARP_OS/include/yarp/os/impl/NameServer.h index 9e8f451b1c0..ba6662d34fd 100644 --- a/src/libYARP_OS/include/yarp/os/impl/NameServer.h +++ b/src/libYARP_OS/include/yarp/os/impl/NameServer.h @@ -42,7 +42,7 @@ namespace yarp { /** * Stub for a YARP2-conforming name server. */ -class yarp::os::impl::NameServerStub { +class YARP_OS_impl_API yarp::os::impl::NameServerStub { public: virtual ~NameServerStub() {} virtual String apply(const String& txt, const Address& remote) = 0; @@ -51,7 +51,7 @@ class yarp::os::impl::NameServerStub { /** * Implementation of a YARP2-conforming name server. */ -class yarp::os::impl::NameServer : public NameServerStub { +class YARP_OS_impl_API yarp::os::impl::NameServer : public NameServerStub { public: NameServer() : nameMap(17), hostMap(17), mutex(1) { diff --git a/src/libYARP_OS/include/yarp/os/impl/NetType.h b/src/libYARP_OS/include/yarp/os/impl/NetType.h index d7a543c4c28..28f2963778b 100644 --- a/src/libYARP_OS/include/yarp/os/impl/NetType.h +++ b/src/libYARP_OS/include/yarp/os/impl/NetType.h @@ -31,7 +31,7 @@ namespace yarp { /** * Various utilities related to types and formats. */ -class yarp::os::impl::NetType { +class YARP_OS_impl_API yarp::os::impl::NetType { public: static int netInt(const yarp::os::Bytes& code) { diff --git a/src/libYARP_OS/include/yarp/os/impl/OutputProtocol.h b/src/libYARP_OS/include/yarp/os/impl/OutputProtocol.h index b2017715980..e8b8a096f9c 100644 --- a/src/libYARP_OS/include/yarp/os/impl/OutputProtocol.h +++ b/src/libYARP_OS/include/yarp/os/impl/OutputProtocol.h @@ -25,7 +25,7 @@ namespace yarp { /** * The output side of an active connection between two ports. */ -class yarp::os::impl::OutputProtocol { +class YARP_OS_impl_API yarp::os::impl::OutputProtocol { public: // all can throw IOException diff --git a/src/libYARP_OS/include/yarp/os/impl/OutputStream.h b/src/libYARP_OS/include/yarp/os/impl/OutputStream.h index 9d1003348db..bb1f4534b44 100644 --- a/src/libYARP_OS/include/yarp/os/impl/OutputStream.h +++ b/src/libYARP_OS/include/yarp/os/impl/OutputStream.h @@ -24,7 +24,7 @@ namespace yarp { * Simple specification of the minimum functions needed from output streams. * The streams could be TCP, UDP, MCAST, ... */ -class yarp::os::impl::OutputStream { +class YARP_OS_impl_API yarp::os::impl::OutputStream { public: /** diff --git a/src/libYARP_OS/include/yarp/os/impl/PortCommand.h b/src/libYARP_OS/include/yarp/os/impl/PortCommand.h index 37f821f82de..27bff86038d 100644 --- a/src/libYARP_OS/include/yarp/os/impl/PortCommand.h +++ b/src/libYARP_OS/include/yarp/os/impl/PortCommand.h @@ -26,7 +26,7 @@ namespace yarp { /** * Simple Readable and Writable object representing a command to a YARP port. */ -class yarp::os::impl::PortCommand : public yarp::os::Portable { +class YARP_OS_impl_API yarp::os::impl::PortCommand : public yarp::os::Portable { public: PortCommand() : header(8) { diff --git a/src/libYARP_OS/include/yarp/os/impl/PortCore.h b/src/libYARP_OS/include/yarp/os/impl/PortCore.h index 1ad20a0714f..f5ddd421b52 100644 --- a/src/libYARP_OS/include/yarp/os/impl/PortCore.h +++ b/src/libYARP_OS/include/yarp/os/impl/PortCore.h @@ -59,7 +59,7 @@ namespace yarp { * result in data being sent to all the outgoing connections. * This class is used to construct yarp::os::Port and yarp::os::BufferedPort. */ -class yarp::os::impl::PortCore : public ThreadImpl, public PortManager, public yarp::os::PortReader { +class YARP_OS_impl_API yarp::os::impl::PortCore : public ThreadImpl, public PortManager, public yarp::os::PortReader { public: /** diff --git a/src/libYARP_OS/include/yarp/os/impl/PortManager.h b/src/libYARP_OS/include/yarp/os/impl/PortManager.h index fdd685cf8d0..5a8c1b470fb 100644 --- a/src/libYARP_OS/include/yarp/os/impl/PortManager.h +++ b/src/libYARP_OS/include/yarp/os/impl/PortManager.h @@ -29,7 +29,7 @@ namespace yarp { /** * Specification of minimal operations a port must support. */ -class yarp::os::impl::PortManager { +class YARP_OS_impl_API yarp::os::impl::PortManager { public: PortManager() { os = NULL; diff --git a/src/libYARP_OS/include/yarp/os/impl/Protocol.h b/src/libYARP_OS/include/yarp/os/impl/Protocol.h index a6fca15e183..894094d9a8b 100644 --- a/src/libYARP_OS/include/yarp/os/impl/Protocol.h +++ b/src/libYARP_OS/include/yarp/os/impl/Protocol.h @@ -35,7 +35,7 @@ namespace yarp { * Connection Communication choreographer. Handles a single YARP connection, * and insulates ports from the details of the particular Carrier in use. */ -class yarp::os::impl::Protocol : public OutputProtocol, public InputProtocol { +class YARP_OS_impl_API yarp::os::impl::Protocol : public OutputProtocol, public InputProtocol { public: // everything could throw IOException diff --git a/src/libYARP_OS/include/yarp/os/impl/Route.h b/src/libYARP_OS/include/yarp/os/impl/Route.h index 267493b9665..8ee73fe61b4 100644 --- a/src/libYARP_OS/include/yarp/os/impl/Route.h +++ b/src/libYARP_OS/include/yarp/os/impl/Route.h @@ -24,7 +24,7 @@ namespace yarp { * Contains the names of the endpoints, and the name of * the carrier in use between them. */ -class yarp::os::impl::Route { +class YARP_OS_impl_API yarp::os::impl::Route { public: /** * diff --git a/src/libYARP_OS/include/yarp/os/impl/SemaphoreImpl.h b/src/libYARP_OS/include/yarp/os/impl/SemaphoreImpl.h index 90a4937951d..0e73b8803d6 100644 --- a/src/libYARP_OS/include/yarp/os/impl/SemaphoreImpl.h +++ b/src/libYARP_OS/include/yarp/os/impl/SemaphoreImpl.h @@ -37,7 +37,7 @@ namespace yarp { /** * A semaphore abstraction for mutual exclusion and resource management. */ -class yarp::os::impl::SemaphoreImpl { +class YARP_OS_impl_API yarp::os::impl::SemaphoreImpl { public: SemaphoreImpl(int initialCount = 1) #ifndef YARP_USE_NATIVE_POSIX_SEMA diff --git a/src/libYARP_OS/include/yarp/os/impl/ShiftStream.h b/src/libYARP_OS/include/yarp/os/impl/ShiftStream.h index f812814b71b..b6ebd7a09f7 100644 --- a/src/libYARP_OS/include/yarp/os/impl/ShiftStream.h +++ b/src/libYARP_OS/include/yarp/os/impl/ShiftStream.h @@ -27,7 +27,7 @@ namespace yarp { * an optimized stream type with user-preferred properties and * trade-offs. */ -class yarp::os::impl::ShiftStream : public TwoWayStream { +class YARP_OS_impl_API yarp::os::impl::ShiftStream : public TwoWayStream { public: /** * Constructor. diff --git a/src/libYARP_OS/include/yarp/os/impl/SizedWriter.h b/src/libYARP_OS/include/yarp/os/impl/SizedWriter.h index c8219ab3671..1b5b38b75e1 100644 --- a/src/libYARP_OS/include/yarp/os/impl/SizedWriter.h +++ b/src/libYARP_OS/include/yarp/os/impl/SizedWriter.h @@ -30,7 +30,7 @@ namespace yarp { * SizedWriter class is referenced by the library instead of * BufferedConnectionWriter specifically to leave that possibility open. */ -class yarp::os::impl::SizedWriter { +class YARP_OS_impl_API yarp::os::impl::SizedWriter { public: virtual ~SizedWriter() {} diff --git a/src/libYARP_OS/include/yarp/os/impl/StreamConnectionReader.h b/src/libYARP_OS/include/yarp/os/impl/StreamConnectionReader.h index 43e85706e03..71566d23167 100644 --- a/src/libYARP_OS/include/yarp/os/impl/StreamConnectionReader.h +++ b/src/libYARP_OS/include/yarp/os/impl/StreamConnectionReader.h @@ -35,7 +35,7 @@ namespace yarp { * Lets Readable objects read from the underlying InputStream * associated with the connection between two ports. */ -class yarp::os::impl::StreamConnectionReader : public ConnectionReader { +class YARP_OS_impl_API yarp::os::impl::StreamConnectionReader : public ConnectionReader { public: StreamConnectionReader() { in = NULL; diff --git a/src/libYARP_OS/include/yarp/os/impl/String.h b/src/libYARP_OS/include/yarp/os/impl/String.h index 93863cf0d1c..d2c11454bfd 100644 --- a/src/libYARP_OS/include/yarp/os/impl/String.h +++ b/src/libYARP_OS/include/yarp/os/impl/String.h @@ -9,6 +9,8 @@ #ifndef _YARP2_STRING_ #define _YARP2_STRING_ +#include + #if YARP_USE_STL_STRING #include diff --git a/src/libYARP_OS/include/yarp/os/impl/ThreadImpl.h b/src/libYARP_OS/include/yarp/os/impl/ThreadImpl.h index 53c8fa91bf5..e686ca73798 100644 --- a/src/libYARP_OS/include/yarp/os/impl/ThreadImpl.h +++ b/src/libYARP_OS/include/yarp/os/impl/ThreadImpl.h @@ -28,7 +28,7 @@ namespace yarp { /** * An abstraction for a thread of execution. */ -class yarp::os::impl::ThreadImpl : public Runnable { +class YARP_OS_impl_API yarp::os::impl::ThreadImpl : public Runnable { public: ThreadImpl(); ThreadImpl(Runnable *target); diff --git a/src/libYARP_OS/include/yarp/os/impl/TwoWayStream.h b/src/libYARP_OS/include/yarp/os/impl/TwoWayStream.h index 440cd9c488d..e9ef988ee4a 100644 --- a/src/libYARP_OS/include/yarp/os/impl/TwoWayStream.h +++ b/src/libYARP_OS/include/yarp/os/impl/TwoWayStream.h @@ -28,7 +28,7 @@ namespace yarp { * in which case it should fail if requested to communicate in an * unsupported direction. */ -class yarp::os::impl::TwoWayStream { +class YARP_OS_impl_API yarp::os::impl::TwoWayStream { public: /** * Destructor. diff --git a/src/libYARP_OS/include/yarp/os/impl/UnitTest.h b/src/libYARP_OS/include/yarp/os/impl/UnitTest.h index 9b6cf833ac9..4057d959198 100644 --- a/src/libYARP_OS/include/yarp/os/impl/UnitTest.h +++ b/src/libYARP_OS/include/yarp/os/impl/UnitTest.h @@ -25,7 +25,7 @@ namespace yarp { * Simple unit testing framework. There are libraries out there for * this, but we don't want to add another dependency to YARP. */ -class yarp::os::impl::UnitTest { +class YARP_OS_impl_API yarp::os::impl::UnitTest { public: UnitTest(); diff --git a/src/libYARP_OS/src/ManagedBytes.cpp b/src/libYARP_OS/src/ManagedBytes.cpp index 02160632765..44c103c7a95 100644 --- a/src/libYARP_OS/src/ManagedBytes.cpp +++ b/src/libYARP_OS/src/ManagedBytes.cpp @@ -23,3 +23,19 @@ void ManagedBytes::copy() { owned = true; } } + +bool ManagedBytes::allocateOnNeed(int neededLen, int allocateLen) { + if (length()=neededLen) { + char *buf = new char[allocateLen]; + yarp::os::NetworkBase::assertion(buf!=NULL); + ACE_OS::memcpy(buf,get(),length()); + if (owned) { + delete[] get(); + owned = false; + } + b = Bytes(buf,allocateLen); + owned = true; + return true; + } + return false; +}