You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2006/07/21 13:36:16 UTC
svn commit: r424272 [7/10] - in /incubator/activemq/trunk/activemq-cpp: ./
src/examples/ src/main/activemq/concurrent/ src/main/activemq/connector/
src/main/activemq/connector/stomp/
src/main/activemq/connector/stomp/commands/ src/main/activemq/connect...
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketInputStream.h Fri Jul 21 04:36:09 2006
@@ -57,57 +57,57 @@
/**
* Locks the object.
*/
- virtual void lock() throw(exceptions::ActiveMQException){
+ virtual void lock() throw( exceptions::ActiveMQException ){
mutex.lock();
}
- /**
- * Unlocks the object.
- */
- virtual void unlock() throw(exceptions::ActiveMQException){
- mutex.unlock();
- }
+ /**
+ * Unlocks the object.
+ */
+ virtual void unlock() throw( exceptions::ActiveMQException ){
+ mutex.unlock();
+ }
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- */
- virtual void wait() throw(exceptions::ActiveMQException){
- mutex.wait();
- }
+ /**
+ * Waits on a signal from this object, which is generated
+ * by a call to Notify. Must have this object locked before
+ * calling.
+ */
+ virtual void wait() throw( exceptions::ActiveMQException ){
+ mutex.wait();
+ }
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws ActiveMQException
- */
- virtual void wait(unsigned long millisecs)
- throw(exceptions::ActiveMQException) {
+ /**
+ * Waits on a signal from this object, which is generated
+ * by a call to Notify. Must have this object locked before
+ * calling. This wait will timeout after the specified time
+ * interval.
+ * @param time in millisecsonds to wait, or WAIT_INIFINITE
+ * @throws ActiveMQException
+ */
+ virtual void wait( unsigned long millisecs )
+ throw( exceptions::ActiveMQException ) {
- mutex.wait(millisecs);
- }
+ mutex.wait( millisecs );
+ }
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notify() throw(exceptions::ActiveMQException){
- mutex.notify();
- }
+ /**
+ * Signals a waiter on this object that it can now wake
+ * up and continue. Must have this object locked before
+ * calling.
+ */
+ virtual void notify() throw( exceptions::ActiveMQException ){
+ mutex.notify();
+ }
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notifyAll() throw(exceptions::ActiveMQException){
- mutex.notifyAll();
- }
+ /**
+ * Signals the waiters on this object that it can now wake
+ * up and continue. Must have this object locked before
+ * calling.
+ */
+ virtual void notifyAll() throw( exceptions::ActiveMQException ){
+ mutex.notifyAll();
+ }
/**
* Polls instantaneously to see if data is available on
@@ -121,7 +121,7 @@
* @return The next byte.
* @throws IOException thrown if an error occurs.
*/
- virtual unsigned char read() throw (io::IOException);
+ virtual unsigned char read() throw ( io::IOException );
/**
* Reads an array of bytes from the buffer.
@@ -136,7 +136,8 @@
* Close - does nothing. It is the responsibility of the owner
* of the socket object to close it.
*/
- virtual void close() throw(cms::CMSException){}
+ virtual void close() throw( cms::CMSException ){}
+
};
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/SocketOutputStream.h Fri Jul 21 04:36:09 2006
@@ -25,117 +25,125 @@
namespace activemq{
namespace network{
- /**
- * Output stream for performing write operations
- * on a socket.
- */
- class SocketOutputStream : public io::OutputStream
- {
- private:
+ /**
+ * Output stream for performing write operations
+ * on a socket.
+ */
+ class SocketOutputStream : public io::OutputStream
+ {
+ private:
- // The socket.
- Socket::SocketHandle socket;
- concurrent::Mutex mutex;
- bool debug;
+ // The socket.
+ Socket::SocketHandle socket;
+ concurrent::Mutex mutex;
+ bool debug;
- public:
+ public:
- /**
- * Constructor.
- * @param socket the socket handle.
- */
- SocketOutputStream( Socket::SocketHandle socket );
-
- /**
- * Destructor.
- */
- virtual ~SocketOutputStream();
-
- virtual void setDebug( const bool debug ){
- this->debug = debug;
- }
-
- /**
- * Locks the object.
- */
- virtual void lock() throw(exceptions::ActiveMQException){
- mutex.lock();
- }
+ /**
+ * Constructor.
+ * @param socket the socket handle.
+ */
+ SocketOutputStream( Socket::SocketHandle socket );
+
+ virtual ~SocketOutputStream();
+
+ /**
+ * Enables Debugging of Socket Data
+ * @param true to enable
+ */
+ virtual void setDebug( const bool debug ){
+ this->debug = debug;
+ }
+
+ /**
+ * Locks the object.
+ * @throws ActiveMQException
+ */
+ virtual void lock() throw( exceptions::ActiveMQException ){
+ mutex.lock();
+ }
- /**
- * Unlocks the object.
- */
- virtual void unlock() throw(exceptions::ActiveMQException){
- mutex.unlock();
- }
+ /**
+ * Unlocks the object.
+ * @throws ActiveMQException
+ */
+ virtual void unlock() throw( exceptions::ActiveMQException ){
+ mutex.unlock();
+ }
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling.
- */
- virtual void wait() throw(exceptions::ActiveMQException){
- mutex.wait();
- }
+ /**
+ * Waits on a signal from this object, which is generated
+ * by a call to Notify. Must have this object locked before
+ * calling.
+ * @throws ActiveMQException
+ */
+ virtual void wait() throw( exceptions::ActiveMQException ){
+ mutex.wait();
+ }
- /**
- * Waits on a signal from this object, which is generated
- * by a call to Notify. Must have this object locked before
- * calling. This wait will timeout after the specified time
- * interval.
- * @param time in millisecsonds to wait, or WAIT_INIFINITE
- * @throws ActiveMQException
- */
- virtual void wait(unsigned long millisecs)
- throw(exceptions::ActiveMQException) {
+ /**
+ * Waits on a signal from this object, which is generated
+ * by a call to Notify. Must have this object locked before
+ * calling. This wait will timeout after the specified time
+ * interval.
+ * @param time in millisecsonds to wait, or WAIT_INIFINITE
+ * @throws ActiveMQException
+ */
+ virtual void wait( unsigned long millisecs )
+ throw( exceptions::ActiveMQException ) {
- mutex.wait(millisecs);
- }
+ mutex.wait( millisecs );
+ }
- /**
- * Signals a waiter on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notify() throw(exceptions::ActiveMQException){
- mutex.notify();
- }
+ /**
+ * Signals a waiter on this object that it can now wake
+ * up and continue. Must have this object locked before
+ * calling.
+ * @throws ActiveMQException
+ */
+ virtual void notify() throw( exceptions::ActiveMQException ){
+ mutex.notify();
+ }
- /**
- * Signals the waiters on this object that it can now wake
- * up and continue. Must have this object locked before
- * calling.
- */
- virtual void notifyAll() throw(exceptions::ActiveMQException){
- mutex.notifyAll();
- }
+ /**
+ * Signals the waiters on this object that it can now wake
+ * up and continue. Must have this object locked before
+ * calling.
+ */
+ virtual void notifyAll() throw( exceptions::ActiveMQException ){
+ mutex.notifyAll();
+ }
- /**
- * Writes a single byte to the output stream.
- * @param c the byte.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char c ) throw (io::IOException);
-
- /**
- * Writes an array of bytes to the output stream.
- * @param buffer The array of bytes to write.
- * @param len The number of bytes from the buffer to be written.
- * @throws IOException thrown if an error occurs.
- */
- virtual void write( const unsigned char* buffer, const int len ) throw (io::IOException);
-
- /**
- * Flush - does nothing.
- */
- virtual void flush() throw (io::IOException){};
-
- /**
- * Close - does nothing. It is the responsibility of the owner
- * of the socket object to close it.
- */
- virtual void close() throw(cms::CMSException){}
- };
+ /**
+ * Writes a single byte to the output stream.
+ * @param c the byte.
+ * @throws IOException thrown if an error occurs.
+ */
+ virtual void write( const unsigned char c ) throw ( io::IOException );
+
+ /**
+ * Writes an array of bytes to the output stream.
+ * @param buffer The array of bytes to write.
+ * @param len The number of bytes from the buffer to be written.
+ * @throws IOException thrown if an error occurs.
+ */
+ virtual void write( const unsigned char* buffer, const int len ) throw ( io::IOException );
+
+ /**
+ * Flush - does nothing.
+ * @throws IOException
+ */
+ virtual void flush() throw ( io::IOException ){};
+
+ /**
+ * Close - does nothing. It is the responsibility of the owner
+ * of the socket object to close it.
+ * @throws CMSException
+ */
+ virtual void close() throw( cms::CMSException ){}
+
+ };
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp Fri Jul 21 04:36:09 2006
@@ -16,19 +16,19 @@
*/
#if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
- #include <unistd.h>
- #include <netdb.h>
- #include <fcntl.h>
- #include <sys/file.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- extern int errno;
+ #include <unistd.h>
+ #include <netdb.h>
+ #include <fcntl.h>
+ #include <sys/file.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ extern int errno;
#else
- #include <Winsock2.h>
- #include <Ws2tcpip.h>
- #include <sys/stat.h>
- #define stat _stat
+ #include <Winsock2.h>
+ #include <Ws2tcpip.h>
+ #include <sys/stat.h>
+ #define stat _stat
#endif
#include <stdio.h>
@@ -45,278 +45,276 @@
using namespace activemq::network;
using namespace activemq::io;
+#if !defined( unix ) || defined( __CYGWIN__ )
-#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
+ // Static socket initializer needed for winsock
- // Static socket initializer needed for winsock
-
- TcpSocket::StaticSocketInitializer::StaticSocketInitializer () {
- socketInitError = NULL;
- const WORD version_needed = MAKEWORD(2,2); // lo-order byte: major version
- WSAData temp;
- if (WSAStartup(version_needed, &temp)){
- clear();
+ TcpSocket::StaticSocketInitializer::StaticSocketInitializer() {
+ socketInitError = NULL;
+ const WORD version_needed = MAKEWORD(2,2); // lo-order byte: major version
+ WSAData temp;
+ if( WSAStartup( version_needed, &temp ) ){
+ clear();
socketInitError = new SocketException ( __FILE__, __LINE__,
- "winsock.dll was not found");
- }
- }
- TcpSocket::StaticSocketInitializer::~StaticSocketInitializer () {
- clear();
- WSACleanup();
- }
+ "winsock.dll was not found");
+ }
+ }
+ TcpSocket::StaticSocketInitializer::~StaticSocketInitializer() {
+ clear();
+ WSACleanup();
+ }
- // Create static instance of the socket initializer.
- TcpSocket::StaticSocketInitializer TcpSocket::staticSocketInitializer;
+ // Create static instance of the socket initializer.
+ TcpSocket::StaticSocketInitializer TcpSocket::staticSocketInitializer;
#endif
////////////////////////////////////////////////////////////////////////////////
TcpSocket::TcpSocket() {
- socketHandle = INVALID_SOCKET_HANDLE;
- inputStream = NULL;
- outputStream = NULL;
-
-#if !(defined( unix ) || defined(__APPLE__)) || defined( __CYGWIN__ )
- if (staticSocketInitializer.getSocketInitError() != NULL) {
- throw *staticSocketInitializer.getSocketInitError();
- }
-#endif
+ socketHandle = INVALID_SOCKET_HANDLE;
+ inputStream = NULL;
+ outputStream = NULL;
+
+ #if !defined( unix ) || defined( __CYGWIN__ )
+ if( staticSocketInitializer.getSocketInitError() != NULL ) {
+ throw *staticSocketInitializer.getSocketInitError();
+ }
+ #endif
}
////////////////////////////////////////////////////////////////////////////////
-TcpSocket::TcpSocket(Socket::SocketHandle socketHandle){
- this->socketHandle = socketHandle;
+TcpSocket::TcpSocket( Socket::SocketHandle socketHandle ){
+ this->socketHandle = socketHandle;
- inputStream = new SocketInputStream( socketHandle );
- outputStream = new SocketOutputStream( socketHandle );
+ inputStream = new SocketInputStream( socketHandle );
+ outputStream = new SocketOutputStream( socketHandle );
}
////////////////////////////////////////////////////////////////////////////////
TcpSocket::~TcpSocket()
{
- // No shutdown, just close - dont want blocking destructor.
- close();
+ // No shutdown, just close - dont want blocking destructor.
+ close();
}
////////////////////////////////////////////////////////////////////////////////
InputStream* TcpSocket::getInputStream(){
- return inputStream;
+ return inputStream;
}
////////////////////////////////////////////////////////////////////////////////
OutputStream* TcpSocket::getOutputStream(){
- return outputStream;
+ return outputStream;
}
////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::connect(const char* host, int port) throw (SocketException)
+void TcpSocket::connect(const char* host, int port) throw ( SocketException )
{
- if( isConnected() ) {
- throw SocketException( __FILE__, __LINE__,
- "Socket::connect - Socket already connected. host: %s, port: %d", host, port );
- }
+ if( isConnected() ) {
+ throw SocketException( __FILE__, __LINE__,
+ "Socket::connect - Socket already connected. host: %s, port: %d", host, port );
+ }
- // Create the socket.
- socketHandle = ::socket(AF_INET, SOCK_STREAM, 0);
- if( socketHandle < 0 ) {
- socketHandle = INVALID_SOCKET_HANDLE;
- throw SocketException( __FILE__, __LINE__, ::strerror( errno ) );
- }
-
- // Check port value.
- if (port <= 0 || port > 65535) {
- close();
- throw SocketException ( __FILE__, __LINE__,
- "Socket::connect- Port out of range: %d", port );
- }
+ // Create the socket.
+ socketHandle = ::socket(AF_INET, SOCK_STREAM, 0);
+ if( socketHandle < 0 ) {
+ socketHandle = INVALID_SOCKET_HANDLE;
+ throw SocketException( __FILE__, __LINE__, ::strerror( errno ) );
+ }
+
+ // Check port value.
+ if (port <= 0 || port > 65535) {
+ close();
+ throw SocketException ( __FILE__, __LINE__,
+ "Socket::connect- Port out of range: %d", port );
+ }
- sockaddr_in target_addr;
- target_addr.sin_family = AF_INET;
- target_addr.sin_port = htons((short)port);
- target_addr.sin_addr.s_addr = 0; // To be set later down...
- memset(&target_addr.sin_zero, 0, sizeof(target_addr.sin_zero));
-
- // Resolve name
- addrinfo hints;
- memset(&hints, 0, sizeof(addrinfo));
- hints.ai_family = PF_INET;
- struct addrinfo *res_ptr = NULL;
+ sockaddr_in target_addr;
+ target_addr.sin_family = AF_INET;
+ target_addr.sin_port = htons( ( short ) port );
+ target_addr.sin_addr.s_addr = 0; // To be set later down...
+ memset( &target_addr.sin_zero, 0, sizeof( target_addr.sin_zero ) );
+
+ // Resolve name
+ addrinfo hints;
+ memset(&hints, 0, sizeof(addrinfo));
+ hints.ai_family = PF_INET;
+ struct addrinfo *res_ptr = NULL;
- int status = ::getaddrinfo(host, NULL, &hints, &res_ptr);
- if( status != 0 || res_ptr == NULL){
- throw SocketException( __FILE__, __LINE__,
- "Socket::connect - %s", ::strerror( errno ) );
- }
+ int status = ::getaddrinfo( host, NULL, &hints, &res_ptr );
+ if( status != 0 || res_ptr == NULL){
+ throw SocketException( __FILE__, __LINE__,
+ "Socket::connect - %s", ::strerror( errno ) );
+ }
- assert(res_ptr->ai_addr->sa_family == AF_INET);
- // Porting: On both 32bit and 64 bit systems that we compile to soo far, sin_addr
- // is a 32 bit value, not an unsigned long.
- assert(sizeof(((sockaddr_in*)res_ptr->ai_addr)->sin_addr.s_addr) == 4);
- target_addr.sin_addr.s_addr = ((sockaddr_in*)res_ptr->ai_addr)->sin_addr.s_addr;
- freeaddrinfo(res_ptr);
-
- // Attempt the connection to the server.
- status = ::connect(socketHandle,
- (const sockaddr *)&target_addr,
- sizeof(target_addr));
+ assert(res_ptr->ai_addr->sa_family == AF_INET);
+ // Porting: On both 32bit and 64 bit systems that we compile to soo far, sin_addr
+ // is a 32 bit value, not an unsigned long.
+ assert( sizeof( ( ( sockaddr_in* )res_ptr->ai_addr )->sin_addr.s_addr ) == 4 );
+ target_addr.sin_addr.s_addr = ( ( sockaddr_in* )res_ptr->ai_addr )->sin_addr.s_addr;
+ freeaddrinfo( res_ptr );
+
+ // Attempt the connection to the server.
+ status = ::connect( socketHandle,
+ ( const sockaddr * )&target_addr,
+ sizeof( target_addr ) );
- if( status < 0 ){
- close();
- throw SocketException( __FILE__, __LINE__,
- "Socket::connect - %s", ::strerror( errno ) );
- }
-
- // Create an input/output stream for this socket.
- inputStream = new SocketInputStream( socketHandle );
- outputStream = new SocketOutputStream( socketHandle );
+ if( status < 0 ){
+ close();
+ throw SocketException( __FILE__, __LINE__,
+ "Socket::connect - %s", ::strerror( errno ) );
+ }
+
+ // Create an input/output stream for this socket.
+ inputStream = new SocketInputStream( socketHandle );
+ outputStream = new SocketOutputStream( socketHandle );
}
////////////////////////////////////////////////////////////////////////////////
void TcpSocket::close() throw( cms::CMSException )
{
- // Destroy the input stream.
- if( inputStream != NULL ){
- delete inputStream;
- inputStream = NULL;
- }
-
- // Destroy the output stream.
- if( outputStream != NULL ){
- delete outputStream;
- outputStream = NULL;
- }
+ // Destroy the input stream.
+ if( inputStream != NULL ){
+ delete inputStream;
+ inputStream = NULL;
+ }
- if( isConnected() )
- {
-
- ::shutdown(socketHandle, 2);
+ // Destroy the output stream.
+ if( outputStream != NULL ){
+ delete outputStream;
+ outputStream = NULL;
+ }
+
+ if( isConnected() )
+ {
+ ::shutdown( socketHandle, 2 );
- #if (defined(unix) || defined(__APPLE__)) && !defined(__CYGWIN__)
- ::close(socketHandle);
- #else
- ::closesocket(socketHandle);
- #endif
+ #if defined(unix) && !defined(__CYGWIN__)
+ ::close( socketHandle );
+ #else
+ ::closesocket( socketHandle );
+ #endif
- socketHandle = INVALID_SOCKET_HANDLE;
- }
+ socketHandle = INVALID_SOCKET_HANDLE;
+ }
}
////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getSoLinger() const throw(SocketException){
+int TcpSocket::getSoLinger() const throw( SocketException ){
- linger value;
- socklen_t length = sizeof(value);
- ::getsockopt(socketHandle, SOL_SOCKET, SO_LINGER, (char*)&value, &length );
+ linger value;
+ socklen_t length = sizeof( value );
+ ::getsockopt( socketHandle, SOL_SOCKET, SO_LINGER, (char*)&value, &length );
- return value.l_onoff? value.l_linger : 0;
+ return value.l_onoff? value.l_linger : 0;
}
////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setSoLinger( const int dolinger ) throw(SocketException){
+void TcpSocket::setSoLinger( const int dolinger ) throw( SocketException ){
- linger value;
- value.l_onoff = dolinger != 0;
- value.l_linger = dolinger;
- ::setsockopt(socketHandle, SOL_SOCKET, SO_LINGER, (char*)&value, sizeof(value) );
+ linger value;
+ value.l_onoff = dolinger != 0;
+ value.l_linger = dolinger;
+ ::setsockopt( socketHandle, SOL_SOCKET, SO_LINGER, (char*)&value, sizeof(value) );
}
////////////////////////////////////////////////////////////////////////////////
-bool TcpSocket::getKeepAlive() const throw(SocketException){
+bool TcpSocket::getKeepAlive() const throw( SocketException ){
- int value;
- socklen_t length = sizeof(int);
- ::getsockopt(socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char*)&value, &length );
- return value != 0;
+ int value;
+ socklen_t length = sizeof( int );
+ ::getsockopt( socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char*)&value, &length );
+ return value != 0;
}
////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setKeepAlive( const bool keepAlive ) throw(SocketException){
+void TcpSocket::setKeepAlive( const bool keepAlive ) throw( SocketException ){
- int value = keepAlive? 1 : 0;
- ::setsockopt(socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char*)&value, sizeof(int) );
+ int value = keepAlive? 1 : 0;
+ ::setsockopt(socketHandle, SOL_SOCKET, SO_KEEPALIVE, (char*)&value, sizeof(int) );
}
////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getReceiveBufferSize() const throw(SocketException){
+int TcpSocket::getReceiveBufferSize() const throw( SocketException ){
- int value;
- socklen_t length = sizeof(int);
- ::getsockopt(socketHandle, SOL_SOCKET, SO_RCVBUF, (char*)&value, &length );
- return value;
+ int value;
+ socklen_t length = sizeof( int );
+ ::getsockopt( socketHandle, SOL_SOCKET, SO_RCVBUF, (char*)&value, &length );
+ return value;
}
////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setReceiveBufferSize( const int size ) throw(SocketException){
+void TcpSocket::setReceiveBufferSize( const int size ) throw( SocketException ){
- ::setsockopt(socketHandle, SOL_SOCKET, SO_RCVBUF, (char*)&size, sizeof(int) );
+ ::setsockopt( socketHandle, SOL_SOCKET, SO_RCVBUF, (char*)&size, sizeof(int) );
}
////////////////////////////////////////////////////////////////////////////////
-bool TcpSocket::getReuseAddress() const throw(SocketException){
+bool TcpSocket::getReuseAddress() const throw( SocketException ){
- int value;
- socklen_t length = sizeof(int);
- ::getsockopt(socketHandle, SOL_SOCKET, SO_REUSEADDR, (char*)&value, &length );
- return value != 0;
+ int value;
+ socklen_t length = sizeof( int );
+ ::getsockopt( socketHandle, SOL_SOCKET, SO_REUSEADDR, (char*)&value, &length );
+ return value != 0;
}
////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setReuseAddress( const bool reuse ) throw(SocketException){
+void TcpSocket::setReuseAddress( const bool reuse ) throw( SocketException ){
- int value = reuse? 1 : 0;
- ::setsockopt(socketHandle, SOL_SOCKET, SO_REUSEADDR, (char*)&value, sizeof(int) );
+ int value = reuse? 1 : 0;
+ ::setsockopt( socketHandle, SOL_SOCKET, SO_REUSEADDR, (char*)&value, sizeof(int) );
}
////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getSendBufferSize() const throw(SocketException){
+int TcpSocket::getSendBufferSize() const throw( SocketException ){
- int value;
- socklen_t length = sizeof(int);
- ::getsockopt(socketHandle, SOL_SOCKET, SO_SNDBUF, (char*)&value, &length );
- return value;
+ int value;
+ socklen_t length = sizeof( int );
+ ::getsockopt( socketHandle, SOL_SOCKET, SO_SNDBUF, (char*)&value, &length );
+ return value;
}
////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setSendBufferSize( const int size ) throw(SocketException){
+void TcpSocket::setSendBufferSize( const int size ) throw( SocketException ){
- ::setsockopt(socketHandle, SOL_SOCKET, SO_SNDBUF, (char*)&size, sizeof(int) );
+ ::setsockopt( socketHandle, SOL_SOCKET, SO_SNDBUF, ( char* )&size, sizeof( int ) );
}
////////////////////////////////////////////////////////////////////////////////
-void TcpSocket::setSoTimeout ( const int millisecs ) throw (SocketException)
+void TcpSocket::setSoTimeout ( const int millisecs ) throw ( SocketException )
{
-#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- timeval timot;
- timot.tv_sec = millisecs / 1000;
- timot.tv_usec = (millisecs % 1000) * 1000;
-#else
- int timot = millisecs;
-#endif
+ #if defined( unix ) && !defined( __CYGWIN__ )
+ timeval timot;
+ timot.tv_sec = millisecs / 1000;
+ timot.tv_usec = (millisecs % 1000) * 1000;
+ #else
+ int timot = millisecs;
+ #endif
- ::setsockopt(socketHandle, SOL_SOCKET, SO_RCVTIMEO, (const char*) &timot, sizeof (timot));
- ::setsockopt(socketHandle, SOL_SOCKET, SO_SNDTIMEO, (const char*) &timot, sizeof (timot));
+ ::setsockopt( socketHandle, SOL_SOCKET, SO_RCVTIMEO, (const char*) &timot, sizeof (timot) );
+ ::setsockopt( socketHandle, SOL_SOCKET, SO_SNDTIMEO, (const char*) &timot, sizeof (timot) );
}
////////////////////////////////////////////////////////////////////////////////
-int TcpSocket::getSoTimeout() const throw(SocketException)
+int TcpSocket::getSoTimeout() const throw( SocketException )
{
-#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- timeval timot;
- timot.tv_sec = 0;
- timot.tv_usec = 0;
- socklen_t size = sizeof(timot);
-#else
- int timot = 0;
- int size = sizeof(timot);
-#endif
+ #if defined( unix ) && !defined( __CYGWIN__ )
+ timeval timot;
+ timot.tv_sec = 0;
+ timot.tv_usec = 0;
+ socklen_t size = sizeof(timot);
+ #else
+ int timot = 0;
+ int size = sizeof(timot);
+ #endif
- ::getsockopt(socketHandle, SOL_SOCKET, SO_RCVTIMEO, (char*) &timot, &size);
+ ::getsockopt(socketHandle, SOL_SOCKET, SO_RCVTIMEO, (char*) &timot, &size);
-#if (defined( unix ) || defined(__APPLE__)) && !defined( __CYGWIN__ )
- return (timot.tv_sec * 1000) + (timot.tv_usec / 1000);
-#else
- return timot;
-#endif
-}
+ #if defined( unix ) && !defined( __CYGWIN__ )
+ return (timot.tv_sec * 1000) + (timot.tv_usec / 1000);
+ #else
+ return timot;
+ #endif
+}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.h Fri Jul 21 04:36:09 2006
@@ -25,209 +25,211 @@
namespace activemq{
namespace network{
- // Forward declarations
- class SocketInputStream;
- class SocketOutputStream;
-
- /**
- * Platform-independent implementation of the socket interface.
- */
- class TcpSocket : public Socket
- {
- private:
-
- /**
- * The handle for this socket.
- */
- SocketHandle socketHandle;
-
- /**
- * The input stream for reading this socket.
- */
- SocketInputStream* inputStream;
-
- /**
- * The output stream for writing to this socket.
- */
- SocketOutputStream* outputStream;
-
- public:
-
- /**
- * Construct a non-connected socket.
- */
- TcpSocket();
-
- /**
- * Construct a connected or bound socket based on given
- * socket handle.
- */
- TcpSocket(SocketHandle socketHandle);
-
- /**
- * Destruct.
- * Releases the socket handle but not
- * gracefully shut down the connection.
- */
- virtual ~TcpSocket();
-
- /**
- * Gets the handle for the socket.
- */
- SocketHandle getSocketHandle () {
- return socketHandle;
- }
-
- /**
- * Connects to the specified destination. Closes this socket if
- * connected to another destination.
- * @param host The host of the server to connect to.
- * @param port The port of the server to connect to.
- * @throws IOException Thrown if a failure occurred in the connect.
- */
- virtual void connect( const char* host, const int port ) throw(SocketException);
-
- /**
- * Indicates whether or not this socket is connected to a destination.
- */
- virtual bool isConnected() const{
- return socketHandle != INVALID_SOCKET_HANDLE;
- }
-
- /**
- * Gets the InputStream for this socket.
- * @return The InputStream for this socket. NULL if not connected.
- */
- virtual io::InputStream* getInputStream();
-
- /**
- * Gets the OutputStream for this socket.
- * @return the OutputStream for this socket. NULL if not connected.
- */
- virtual io::OutputStream* getOutputStream();
-
- /**
- * Gets the linger time.
- * @return The linger time in seconds.
- * @throws SocketException if the operation fails.
- */
- virtual int getSoLinger() const throw(SocketException);
-
- /**
- * Sets the linger time.
- * @param linger The linger time in seconds. If 0, linger is off.
- * @throws SocketException if the operation fails.
- */
- virtual void setSoLinger( const int linger ) throw(SocketException);
-
- /**
- * Gets the keep alive flag.
- * @return True if keep alive is enabled.
- * @throws SocketException if the operation fails.
- */
- virtual bool getKeepAlive() const throw(SocketException);
-
- /**
- * Enables/disables the keep alive flag.
- * @param keepAlive If true, enables the flag.
- * @throws SocketException if the operation fails.
- */
- virtual void setKeepAlive( const bool keepAlive ) throw(SocketException);
-
- /**
- * Gets the receive buffer size.
- * @return the receive buffer size in bytes.
- * @throws SocketException if the operation fails.
- */
- virtual int getReceiveBufferSize() const throw(SocketException);
-
- /**
- * Sets the recieve buffer size.
- * @param size Number of bytes to set the receive buffer to.
- * @throws SocketException if the operation fails.
- */
- virtual void setReceiveBufferSize( const int size ) throw(SocketException);
-
- /**
- * Gets the reuse address flag.
- * @return True if the address can be reused.
- * @throws SocketException if the operation fails.
- */
- virtual bool getReuseAddress() const throw(SocketException);
-
- /**
- * Sets the reuse address flag.
- * @param reuse If true, sets the flag.
- * @throws SocketException if the operation fails.
- */
- virtual void setReuseAddress( const bool reuse ) throw(SocketException);
-
- /**
- * Gets the send buffer size.
- * @return the size in bytes of the send buffer.
- * @throws SocketException if the operation fails.
- */
- virtual int getSendBufferSize() const throw(SocketException);
-
- /**
- * Sets the send buffer size.
- * @param size The number of bytes to set the send buffer to.
- * @throws SocketException if the operation fails.
- */
- virtual void setSendBufferSize( const int size ) throw(SocketException);
-
- /**
- * Gets the timeout for socket operations.
- * @return The timeout in milliseconds for socket operations.
- * @throws SocketException Thrown if unable to retrieve the information.
- */
- virtual int getSoTimeout() const throw(SocketException);
-
- /**
- * Sets the timeout for socket operations.
- * @param timeout The timeout in milliseconds for socket operations.<p>
- * @throws SocketException Thrown if unable to set the information.
- */
- virtual void setSoTimeout( const int timeout ) throw(SocketException);
+ // Forward declarations
+ class SocketInputStream;
+ class SocketOutputStream;
+
+ /**
+ * Platform-independent implementation of the socket interface.
+ */
+ class TcpSocket : public Socket
+ {
+ private:
+
+ /**
+ * The handle for this socket.
+ */
+ SocketHandle socketHandle;
+
+ /**
+ * The input stream for reading this socket.
+ */
+ SocketInputStream* inputStream;
+
+ /**
+ * The output stream for writing to this socket.
+ */
+ SocketOutputStream* outputStream;
+
+ public:
+
+ /**
+ * Construct a non-connected socket.
+ */
+ TcpSocket();
+
+ /**
+ * Construct a connected or bound socket based on given
+ * socket handle.
+ */
+ TcpSocket( SocketHandle socketHandle );
+
+ /**
+ * Destruct.
+ * Releases the socket handle but not
+ * gracefully shut down the connection.
+ */
+ virtual ~TcpSocket();
+
+ /**
+ * Gets the handle for the socket.
+ * @return SocketHabler for this Socket, can be NULL
+ */
+ SocketHandle getSocketHandle () {
+ return socketHandle;
+ }
+
+ /**
+ * Connects to the specified destination. Closes this socket if
+ * connected to another destination.
+ * @param host The host of the server to connect to.
+ * @param port The port of the server to connect to.
+ * @throws IOException Thrown if a failure occurred in the connect.
+ */
+ virtual void connect( const char* host, const int port ) throw( SocketException );
+
+ /**
+ * Indicates whether or not this socket is connected to a destination.
+ * @return true if connected
+ */
+ virtual bool isConnected() const{
+ return socketHandle != INVALID_SOCKET_HANDLE;
+ }
+
+ /**
+ * Gets the InputStream for this socket.
+ * @return The InputStream for this socket. NULL if not connected.
+ */
+ virtual io::InputStream* getInputStream();
+
+ /**
+ * Gets the OutputStream for this socket.
+ * @return the OutputStream for this socket. NULL if not connected.
+ */
+ virtual io::OutputStream* getOutputStream();
+
+ /**
+ * Gets the linger time.
+ * @return The linger time in seconds.
+ * @throws SocketException if the operation fails.
+ */
+ virtual int getSoLinger() const throw( SocketException );
+
+ /**
+ * Sets the linger time.
+ * @param linger The linger time in seconds. If 0, linger is off.
+ * @throws SocketException if the operation fails.
+ */
+ virtual void setSoLinger( const int linger ) throw( SocketException );
+
+ /**
+ * Gets the keep alive flag.
+ * @return True if keep alive is enabled.
+ * @throws SocketException if the operation fails.
+ */
+ virtual bool getKeepAlive() const throw( SocketException );
+
+ /**
+ * Enables/disables the keep alive flag.
+ * @param keepAlive If true, enables the flag.
+ * @throws SocketException if the operation fails.
+ */
+ virtual void setKeepAlive( const bool keepAlive ) throw( SocketException );
+
+ /**
+ * Gets the receive buffer size.
+ * @return the receive buffer size in bytes.
+ * @throws SocketException if the operation fails.
+ */
+ virtual int getReceiveBufferSize() const throw( SocketException );
+
+ /**
+ * Sets the recieve buffer size.
+ * @param size Number of bytes to set the receive buffer to.
+ * @throws SocketException if the operation fails.
+ */
+ virtual void setReceiveBufferSize( const int size ) throw( SocketException );
+
+ /**
+ * Gets the reuse address flag.
+ * @return True if the address can be reused.
+ * @throws SocketException if the operation fails.
+ */
+ virtual bool getReuseAddress() const throw( SocketException );
+
+ /**
+ * Sets the reuse address flag.
+ * @param reuse If true, sets the flag.
+ * @throws SocketException if the operation fails.
+ */
+ virtual void setReuseAddress( const bool reuse ) throw( SocketException );
+
+ /**
+ * Gets the send buffer size.
+ * @return the size in bytes of the send buffer.
+ * @throws SocketException if the operation fails.
+ */
+ virtual int getSendBufferSize() const throw( SocketException );
+
+ /**
+ * Sets the send buffer size.
+ * @param size The number of bytes to set the send buffer to.
+ * @throws SocketException if the operation fails.
+ */
+ virtual void setSendBufferSize( const int size ) throw( SocketException );
+
+ /**
+ * Gets the timeout for socket operations.
+ * @return The timeout in milliseconds for socket operations.
+ * @throws SocketException Thrown if unable to retrieve the information.
+ */
+ virtual int getSoTimeout() const throw( SocketException );
+
+ /**
+ * Sets the timeout for socket operations.
+ * @param timeout The timeout in milliseconds for socket operations.<p>
+ * @throws SocketException Thrown if unable to set the information.
+ */
+ virtual void setSoTimeout( const int timeout ) throw(SocketException);
- /**
- * Closes this object and deallocates the appropriate resources.
- * @throws CMSException
- */
- virtual void close() throw( cms::CMSException );
-
- protected:
-
- #if !defined( unix ) || defined( __CYGWIN__ )
-
- // WINDOWS needs initialization of winsock
- class StaticSocketInitializer {
- private:
+ /**
+ * Closes this object and deallocates the appropriate resources.
+ * @throws CMSException
+ */
+ virtual void close() throw( cms::CMSException );
+
+ protected:
+
+ #if !defined( unix ) || defined( __CYGWIN__ )
+
+ // WINDOWS needs initialization of winsock
+ class StaticSocketInitializer {
+ private:
- SocketException* socketInitError;
+ SocketException* socketInitError;
- void clear(){
- if( socketInitError != NULL ){
- delete socketInitError;
- }
- socketInitError = NULL;
- }
+ void clear(){
+ if( socketInitError != NULL ){
+ delete socketInitError;
+ }
+ socketInitError = NULL;
+ }
- public:
+ public:
- SocketException* getSocketInitError () {
- return socketInitError;
- }
+ SocketException* getSocketInitError() {
+ return socketInitError;
+ }
- StaticSocketInitializer();
- virtual ~StaticSocketInitializer ();
+ StaticSocketInitializer();
+ virtual ~StaticSocketInitializer();
- };
+ };
- static StaticSocketInitializer staticSocketInitializer;
- #endif
+ static StaticSocketInitializer staticSocketInitializer;
+ #endif
- };
+ };
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/BrokerError.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/BrokerError.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/BrokerError.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/BrokerError.h Fri Jul 21 04:36:09 2006
@@ -24,12 +24,12 @@
namespace activemq{
namespace transport{
- /**
- * A distributed exception that implies that an error occurred at
- * the broker.
- */
- class BrokerError : public exceptions::ActiveMQException{
- public:
+ /**
+ * A distributed exception that implies that an error occurred at
+ * the broker.
+ */
+ class BrokerError : public exceptions::ActiveMQException{
+ public:
BrokerError(){};
BrokerError( const exceptions::ActiveMQException& ex ){
@@ -60,7 +60,7 @@
virtual ~BrokerError(){}
- };
+ };
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Command.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Command.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Command.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Command.h Fri Jul 21 04:36:09 2006
@@ -21,8 +21,8 @@
namespace activemq{
namespace transport{
- class Command{
- public:
+ class Command{
+ public:
virtual ~Command(void){}
@@ -50,7 +50,7 @@
*/
virtual bool isResponseRequired() const = 0;
- };
+ };
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandIOException.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandIOException.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandIOException.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/CommandIOException.h Fri Jul 21 04:36:09 2006
@@ -24,8 +24,8 @@
namespace activemq{
namespace transport{
- class CommandIOException : public io::IOException{
- public:
+ class CommandIOException : public io::IOException{
+ public:
CommandIOException(){};
CommandIOException( const exceptions::ActiveMQException& ex ){
@@ -34,12 +34,12 @@
CommandIOException( const CommandIOException& ex ){
*(exceptions::ActiveMQException*)this = ex;
}
- CommandIOException(const char* file, const int lineNumber,
- const char* msg, ...)
+ CommandIOException( const char* file, const int lineNumber,
+ const char* msg, ... )
{
- va_list vargs ;
- va_start(vargs, msg) ;
- buildMessage(msg, vargs) ;
+ va_list vargs;
+ va_start( vargs, msg );
+ buildMessage( msg, vargs );
// Set the first mark for this exception.
setMark( file, lineNumber );
@@ -55,7 +55,7 @@
}
virtual ~CommandIOException(){}
- };
+ };
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ExceptionResponse.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ExceptionResponse.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ExceptionResponse.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ExceptionResponse.h Fri Jul 21 04:36:09 2006
@@ -24,12 +24,12 @@
namespace activemq{
namespace transport{
- /**
- * A response object that indicates an error occurred at the
- * broker.
- */
- class ExceptionResponse : public Response{
- public:
+ /**
+ * A response object that indicates an error occurred at the
+ * broker.
+ */
+ class ExceptionResponse : public Response{
+ public:
virtual ~ExceptionResponse(){}
@@ -38,7 +38,7 @@
*/
virtual const BrokerError* getException() const = 0;
- };
+ };
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/FutureResponse.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/FutureResponse.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/FutureResponse.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/FutureResponse.h Fri Jul 21 04:36:09 2006
@@ -50,14 +50,14 @@
/**
* Locks the object.
*/
- virtual void lock() throw(exceptions::ActiveMQException){
+ virtual void lock() throw( exceptions::ActiveMQException ){
mutex.lock();
}
/**
* Unlocks the object.
*/
- virtual void unlock() throw(exceptions::ActiveMQException){
+ virtual void unlock() throw( exceptions::ActiveMQException ){
mutex.unlock();
}
@@ -66,7 +66,7 @@
* by a call to Notify. Must have this object locked before
* calling.
*/
- virtual void wait() throw(exceptions::ActiveMQException){
+ virtual void wait() throw( exceptions::ActiveMQException ){
mutex.wait();
}
@@ -78,8 +78,8 @@
* @param time in millisecsonds to wait, or WAIT_INIFINITE
* @throws ActiveMQException
*/
- virtual void wait(unsigned long millisecs)
- throw(exceptions::ActiveMQException)
+ virtual void wait( unsigned long millisecs )
+ throw( exceptions::ActiveMQException )
{
mutex.wait( millisecs );
}
@@ -89,7 +89,7 @@
* up and continue. Must have this object locked before
* calling.
*/
- virtual void notify() throw(exceptions::ActiveMQException){
+ virtual void notify() throw( exceptions::ActiveMQException ){
mutex.notify();
}
@@ -98,7 +98,7 @@
* up and continue. Must have this object locked before
* calling.
*/
- virtual void notifyAll() throw(exceptions::ActiveMQException){
+ virtual void notifyAll() throw( exceptions::ActiveMQException ){
mutex.notifyAll();
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.h Fri Jul 21 04:36:09 2006
@@ -136,13 +136,13 @@
* @throws UnsupportedOperationException if this method is not implemented
* by this transport.
*/
- virtual void oneway( Command* command ) throw(CommandIOException, exceptions::UnsupportedOperationException);
+ virtual void oneway( Command* command ) throw( CommandIOException, exceptions::UnsupportedOperationException );
/**
* Not supported by this class - throws an exception.
* @throws UnsupportedOperationException.
*/
- virtual Response* request( Command* command ) throw(CommandIOException, exceptions::UnsupportedOperationException){
+ virtual Response* request( Command* command ) throw( CommandIOException, exceptions::UnsupportedOperationException ){
throw exceptions::UnsupportedOperationException( __FILE__, __LINE__, "IOTransport::request() - unsupported operation" );
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Response.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Response.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Response.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Response.h Fri Jul 21 04:36:09 2006
@@ -23,8 +23,8 @@
namespace activemq{
namespace transport{
- class Response : public Command{
- public:
+ class Response : public Command{
+ public:
virtual ~Response(void) {}
@@ -40,7 +40,7 @@
*/
virtual void setCorrelationId( const unsigned int corrId ) = 0;
- };
+ };
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ResponseCorrelator.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ResponseCorrelator.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ResponseCorrelator.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/ResponseCorrelator.h Fri Jul 21 04:36:09 2006
@@ -74,7 +74,7 @@
/**
* Returns the next available command id.
*/
- unsigned int getNextCommandId() throw (exceptions::ActiveMQException){
+ unsigned int getNextCommandId() throw ( exceptions::ActiveMQException ){
try{
synchronized( &commandIdMutex ){
@@ -143,7 +143,7 @@
* by this transport.
*/
virtual void oneway( Command* command )
- throw(CommandIOException, exceptions::UnsupportedOperationException)
+ throw( CommandIOException, exceptions::UnsupportedOperationException )
{
try{
@@ -171,7 +171,7 @@
* @throws CommandIOException if an error occurs with the request.
*/
virtual Response* request( Command* command )
- throw(CommandIOException, exceptions::UnsupportedOperationException)
+ throw( CommandIOException, exceptions::UnsupportedOperationException )
{
try{
@@ -243,7 +243,7 @@
// Let's see if the incoming command is a response.
Response* response =
- dynamic_cast<Response*>(command);
+ dynamic_cast<Response*>( command );
if( response == NULL ){
@@ -271,7 +271,7 @@
// If it's an exception response, notify the exception listener.
ExceptionResponse* exResp =
- dynamic_cast<ExceptionResponse*>(response);
+ dynamic_cast<ExceptionResponse*>( response );
if( exResp != NULL ){
const BrokerError* error = exResp->getException();
fire( *error );
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransport.cpp Fri Jul 21 04:36:09 2006
@@ -39,7 +39,7 @@
// Create the IO device we will be communicating over the
// wire with. This may need to change if we add more types
// of sockets, such as SSL.
- socket = SocketFactory::createSocket(properties);
+ socket = SocketFactory::createSocket( properties );
// Cast it to an IO transport so we can wire up the socket
// input and output streams.
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TcpTransportFactory.cpp Fri Jul 21 04:36:09 2006
@@ -29,7 +29,7 @@
{
// Create the one and only instance of the registrar
static TransportFactoryMapRegistrar registrar(
- "tcp", new TcpTransportFactory());
+ "tcp", new TcpTransportFactory() );
return registrar.getFactory();
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Transport.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Transport.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Transport.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/Transport.h Fri Jul 21 04:36:09 2006
@@ -30,78 +30,78 @@
namespace activemq{
namespace transport{
- // Forward declarations.
- class CommandListener;
- class CommandReader;
- class CommandWriter;
- class TransportExceptionListener;
+ // Forward declarations.
+ class CommandListener;
+ class CommandReader;
+ class CommandWriter;
+ class TransportExceptionListener;
- /**
- * Interface for a transport layer for command objects. Callers can
- * send oneway messages or make synchronous requests. Non-response
- * messages will be delivered to the specified listener object upon
- * receipt.
- */
- class Transport
- :
- public cms::Startable,
- public cms::Closeable
- {
- public:
+ /**
+ * Interface for a transport layer for command objects. Callers can
+ * send oneway messages or make synchronous requests. Non-response
+ * messages will be delivered to the specified listener object upon
+ * receipt.
+ */
+ class Transport
+ :
+ public cms::Startable,
+ public cms::Closeable
+ {
+ public:
- virtual ~Transport(){}
+ virtual ~Transport(){}
- /**
- * Sends a one-way command. Does not wait for any response from the
- * broker.
- * @param command the command to be sent.
- * @throws CommandIOException if an exception occurs during writing of
- * the command.
- * @throws UnsupportedOperationException if this method is not implemented
- * by this transport.
- */
- virtual void oneway( Command* command )
- throw(CommandIOException,
- exceptions::UnsupportedOperationException) = 0;
+ /**
+ * Sends a one-way command. Does not wait for any response from the
+ * broker.
+ * @param command the command to be sent.
+ * @throws CommandIOException if an exception occurs during writing of
+ * the command.
+ * @throws UnsupportedOperationException if this method is not implemented
+ * by this transport.
+ */
+ virtual void oneway( Command* command )
+ throw( CommandIOException,
+ exceptions::UnsupportedOperationException ) = 0;
- /**
- * Sends the given command to the broker and then waits for the response.
- * @param command the command to be sent.
- * @return the response from the broker.
- * @throws CommandIOException if an exception occurs during the read of the
- * command.
- * @throws UnsupportedOperationException if this method is not implemented
- * by this transport.
- */
- virtual Response* request( Command* command )
- throw(CommandIOException,
- exceptions::UnsupportedOperationException) = 0;
+ /**
+ * Sends the given command to the broker and then waits for the response.
+ * @param command the command to be sent.
+ * @return the response from the broker.
+ * @throws CommandIOException if an exception occurs during the read of the
+ * command.
+ * @throws UnsupportedOperationException if this method is not implemented
+ * by this transport.
+ */
+ virtual Response* request( Command* command )
+ throw( CommandIOException,
+ exceptions::UnsupportedOperationException ) = 0;
- /**
- * Assigns the command listener for non-response commands.
- * @param listener the listener.
- */
- virtual void setCommandListener( CommandListener* listener ) = 0;
+ /**
+ * Assigns the command listener for non-response commands.
+ * @param listener the listener.
+ */
+ virtual void setCommandListener( CommandListener* listener ) = 0;
- /**
- * Sets the command reader.
- * @param reader the object that will be used for reading command objects.
- */
- virtual void setCommandReader( CommandReader* reader ) = 0;
+ /**
+ * Sets the command reader.
+ * @param reader the object that will be used for reading command objects.
+ */
+ virtual void setCommandReader( CommandReader* reader ) = 0;
- /**
- * Sets the command writer.
- * @param writer the object that will be used for writing command objects.
- */
- virtual void setCommandWriter( CommandWriter* writer ) = 0;
+ /**
+ * Sets the command writer.
+ * @param writer the object that will be used for writing command objects.
+ */
+ virtual void setCommandWriter( CommandWriter* writer ) = 0;
- /**
- * Sets the observer of asynchronous exceptions from this transport.
- * @param listener the listener of transport exceptions.
- */
- virtual void setTransportExceptionListener(
- TransportExceptionListener* listener ) = 0;
- };
+ /**
+ * Sets the observer of asynchronous exceptions from this transport.
+ * @param listener the listener of transport exceptions.
+ */
+ virtual void setTransportExceptionListener(
+ TransportExceptionListener* listener ) = 0;
+ };
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportExceptionListener.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportExceptionListener.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportExceptionListener.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportExceptionListener.h Fri Jul 21 04:36:09 2006
@@ -23,26 +23,27 @@
namespace activemq{
namespace transport{
- // Forward declarations.
- class Transport;
+ // Forward declarations.
+ class Transport;
- /**
- * A listener of asynchronous exceptions from a command transport object.
- */
- class TransportExceptionListener{
- public:
+ /**
+ * A listener of asynchronous exceptions from a command transport object.
+ */
+ class TransportExceptionListener{
+ public:
- virtual ~TransportExceptionListener(){}
+ virtual ~TransportExceptionListener(){}
- /**
- * Event handler for an exception from a command transport.
- * @param source The source of the exception
- * @param ex The exception.
- */
- virtual void onTransportException(
- Transport* source,
- const exceptions::ActiveMQException& ex ) = 0;
- };
+ /**
+ * Event handler for an exception from a command transport.
+ * @param source The source of the exception
+ * @param ex The exception.
+ */
+ virtual void onTransportException(
+ Transport* source,
+ const exceptions::ActiveMQException& ex ) = 0;
+
+ };
}}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMap.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMap.cpp?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMap.cpp (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMap.cpp Fri Jul 21 04:36:09 2006
@@ -39,7 +39,7 @@
////////////////////////////////////////////////////////////////////////////////
void TransportFactoryMap::unregisterTransportFactory( const string& name ){
- factoryMap.erase(name);
+ factoryMap.erase( name );
}
////////////////////////////////////////////////////////////////////////////////
@@ -48,7 +48,7 @@
map<string, TransportFactory*>::const_iterator itr =
factoryMap.find(name);
- if(itr != factoryMap.end())
+ if( itr != factoryMap.end() )
{
return itr->second;
}
@@ -58,13 +58,13 @@
}
////////////////////////////////////////////////////////////////////////////////
-size_t TransportFactoryMap::getFactoryNames(vector<string>& factoryList){
+size_t TransportFactoryMap::getFactoryNames( vector< string >& factoryList ){
map<string, TransportFactory*>::const_iterator itr =
factoryMap.begin();
for(; itr != factoryMap.end(); ++itr)
{
- factoryList.insert(factoryList.end(), itr->first);
+ factoryList.insert( factoryList.end(), itr->first );
}
return factoryMap.size();
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMap.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMap.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMap.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMap.h Fri Jul 21 04:36:09 2006
@@ -46,10 +46,10 @@
virtual ~TransportFactoryMap() {};
// Hidden Copy Constructore
- TransportFactoryMap(const TransportFactoryMap& factoryMap){};
+ TransportFactoryMap( const TransportFactoryMap& factoryMap ){};
// Hidden Assignment operator
- TransportFactoryMap& operator=(const TransportFactoryMap& factoryMap){
+ TransportFactoryMap& operator=( const TransportFactoryMap& factoryMap ){
return *this;
}
@@ -66,7 +66,7 @@
* @param factory to store.
*/
void registerTransportFactory( const std::string& name,
- TransportFactory* factory );
+ TransportFactory* factory );
/**
* Unregisters a Transport Factory with this map
@@ -86,7 +86,7 @@
* @param vector object to receive the list
* @returns count of factories.
*/
- std::size_t getFactoryNames(std::vector<std::string>& factoryList);
+ std::size_t getFactoryNames( std::vector<std::string>& factoryList );
};
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMapRegistrar.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMapRegistrar.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMapRegistrar.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/transport/TransportFactoryMapRegistrar.h Fri Jul 21 04:36:09 2006
@@ -38,7 +38,7 @@
* @param boolean indicating if this object manages the lifetime of
* the factory that is being registered.
*/
- TransportFactoryMapRegistrar(const std::string& name,
+ TransportFactoryMapRegistrar( const std::string& name,
TransportFactory* factory,
bool manageLifetime = true)
{
@@ -58,9 +58,9 @@
{
// UnRegister it in the map.
TransportFactoryMap::getInstance().
- unregisterTransportFactory(name);
+ unregisterTransportFactory( name );
- if(manageLifetime)
+ if( manageLifetime )
{
delete factory;
}
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Boolean.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Boolean.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Boolean.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Boolean.h Fri Jul 21 04:36:09 2006
@@ -27,15 +27,15 @@
{
public:
- Boolean(void) {}
- virtual ~Boolean(void) {}
+ Boolean(void) {}
+ virtual ~Boolean(void) {}
/**
* Parses the String passed and extracts an bool.
* @param String to parse
* @return bool value
*/
- static int parseBoolean(const std::string& value){
+ static int parseBoolean( const std::string& value ){
bool ret = 0;
std::istringstream istream(value);
istream.clear();
@@ -48,7 +48,7 @@
* @param bool to convert
* @return string representation
*/
- static std::string toString(bool value){
+ static std::string toString( bool value ){
std::ostringstream ostream;
ostream << std::boolalpha << value;
return ostream.str();
Modified: incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Endian.h
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Endian.h?rev=424272&r1=424271&r2=424272&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Endian.h (original)
+++ incubator/activemq/trunk/activemq-cpp/src/main/activemq/util/Endian.h Fri Jul 21 04:36:09 2006
@@ -103,7 +103,7 @@
// Macros and helpers for endian conversion
namespace activemq{
namespace util{
-
+
/*#ifdef IFR_IS_BIGENDIAN
inline unsigned int htoni (unsigned int i) { return i; }
inline unsigned long long htonll (unsigned long long ll) { return ll; }
@@ -117,18 +117,18 @@
inline unsigned int htoni (unsigned int i) {
return ( i << 8 ) & 0xFF00 |
- ( i >> 8 ) & 0x00FF;
+ ( i >> 8 ) & 0x00FF;
}
inline unsigned long long htonll (unsigned long long ll) {
return
( ll << 56 ) & 0xFF00000000000000ULL |
- ( ll << 40 ) & 0x00FF000000000000ULL |
- ( ll << 24 ) & 0x0000FF0000000000ULL |
- ( ll << 8 ) & 0x000000FF00000000ULL |
+ ( ll << 40 ) & 0x00FF000000000000ULL |
+ ( ll << 24 ) & 0x0000FF0000000000ULL |
+ ( ll << 8 ) & 0x000000FF00000000ULL |
( ll >> 8 ) & 0x00000000FF000000ULL |
- ( ll >> 24 ) & 0x0000000000FF0000ULL |
- ( ll >> 40 ) & 0x000000000000FF00ULL |
- ( ll >> 56 ) & 0x00000000000000FFULL;
+ ( ll >> 24 ) & 0x0000000000FF0000ULL |
+ ( ll >> 40 ) & 0x000000000000FF00ULL |
+ ( ll >> 56 ) & 0x00000000000000FFULL;
}
@@ -145,53 +145,53 @@
inline float ntohf (float f) { return htonf (f); }
inline double ntohd (double d) { return htond (d); }
*/
- class Endian{
- public:
-
- static void byteSwap(unsigned char* data, int dataLength) {
-
- #ifdef IFR_IS_BIGENDIAN
- return;
- #endif
-
- for (int i = 0; i<dataLength/2; i++) {
- unsigned char temp = data[i];
- data[i] = data[dataLength-1-i];
- data[dataLength-1-i] = temp;
- }
- }
-
- static uint8_t byteSwap( uint8_t value ){
- byteSwap( (unsigned char*)&value, sizeof( value ) );
- return value;
- }
-
- static uint16_t byteSwap( uint16_t value ){
- byteSwap( (unsigned char*)&value, sizeof( value ) );
- return value;
- }
-
- static uint32_t byteSwap( uint32_t value ){
- byteSwap( (unsigned char*)&value, sizeof( value ) );
- return value;
- }
-
- static uint64_t byteSwap( uint64_t value ){
- byteSwap( (unsigned char*)&value, sizeof( value ) );
- return value;
- }
-
- static float byteSwap( float value ){
- byteSwap( (unsigned char*)&value, sizeof( value ) );
- return value;
- }
-
- static double byteSwap( double value ){
- byteSwap( (unsigned char*)&value, sizeof( value ) );
- return value;
- }
- };
-
+ class Endian{
+ public:
+
+ static void byteSwap(unsigned char* data, int dataLength) {
+
+ #ifdef IFR_IS_BIGENDIAN
+ return;
+ #endif
+
+ for (int i = 0; i<dataLength/2; i++) {
+ unsigned char temp = data[i];
+ data[i] = data[dataLength-1-i];
+ data[dataLength-1-i] = temp;
+ }
+ }
+
+ static uint8_t byteSwap( uint8_t value ){
+ byteSwap( (unsigned char*)&value, sizeof( value ) );
+ return value;
+ }
+
+ static uint16_t byteSwap( uint16_t value ){
+ byteSwap( (unsigned char*)&value, sizeof( value ) );
+ return value;
+ }
+
+ static uint32_t byteSwap( uint32_t value ){
+ byteSwap( (unsigned char*)&value, sizeof( value ) );
+ return value;
+ }
+
+ static uint64_t byteSwap( uint64_t value ){
+ byteSwap( (unsigned char*)&value, sizeof( value ) );
+ return value;
+ }
+
+ static float byteSwap( float value ){
+ byteSwap( (unsigned char*)&value, sizeof( value ) );
+ return value;
+ }
+
+ static double byteSwap( double value ){
+ byteSwap( (unsigned char*)&value, sizeof( value ) );
+ return value;
+ }
+ };
+
//#endif // IFR_IS_BIGENDIAN
}}