activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r419422 [9/11] - in /incubator/activemq/trunk/openwire-cpp/src/main/cpp: activemq/ activemq/command/ activemq/protocol/openwire/ activemq/transport/ activemq/transport/tcp/ cms/ ppr/ ppr/io/ ppr/io/encoding/ ppr/net/ ppr/thread/ ppr/util/
Date Thu, 06 Jul 2006 03:18:03 GMT
Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp Wed Jul  5 20:17:58 2006
@@ -1,97 +1,97 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "activemq/transport/TransportFactory.hpp"
-#include <cctype>
-#include <algorithm>
-
-using namespace apache::activemq::transport;
-
-
-// --- Constructors -------------------------------------------------
-
-/*
- *
- */
-TransportFactory::TransportFactory()
-{
-    socketFactory = new SocketFactory() ;
-}
-
-
-// --- Operation methods --------------------------------------------
-
-/*
- *
- */
-p<ITransport> TransportFactory::createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException)
-{
-    p<ISocket>    socket ;
-    p<ITransport> transport ;
-    p<IProtocol>  protocol ;
-    string        uriString ;
-
-    // Make an URI all lower case string
-    uriString = location->toString() ;
-    std::transform(uriString.begin(), uriString.end(), uriString.begin(), (int(*)(int))tolower) ;  // The explicit cast is needed to compile on Linux
-
-    // Create and open socket
-    cout << "Opening socket to: " << location->host() << " on port " << location->port() << endl ;
-    socket = connect(location->host().c_str(), location->port()) ;
-
-    // Create wire protocol depending on specified query parameter
-    if( uriString.find("protocol=stomp") != string::npos )
-        throw IllegalArgumentException("The STOMP protocol is not yet implemented") ;
-    else
-        protocol = new OpenWireProtocol() ;
-
-    // Configure character encoding depending on specified query parameter
-    if( uriString.find("encoding=none") != string::npos )
-        CharsetEncoderRegistry::DEFAULT = NULL ;
-    else
-        CharsetEncoderRegistry::DEFAULT = AsciiToUTF8Encoder::NAME ;
-
-    // Create transport depending on specified URI scheme
-    if( uriString.find("tcp://") != string::npos )
-	    transport = new TcpTransport(socket, protocol) ;
-    else
-        throw IllegalArgumentException("Cannot create transport for unknown URI scheme") ;
-
-    // Chain logging filter is requested in URI query
-    if( uriString.find("trace=true") != string::npos )
-        transport = new LoggingFilter(transport) ;
-
-    // Chain correlator and mutext filters
-	transport = new CorrelatorFilter(transport) ;
-	transport = new MutexFilter(transport) ;
-
-	return transport ;
-}
-
-
-// --- Implementation methods ---------------------------------------
-
-/*
- *
- */
-p<ISocket> TransportFactory::connect(const char* host, int port) throw (SocketException)
-{
-    p<ISocket> socket = socketFactory->createSocket() ;
-
- 	// Try to connect socket to given address and port
-    socket->connect(host, port) ;
-    return socket ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "activemq/transport/TransportFactory.hpp"
+#include <cctype>
+#include <algorithm>
+
+using namespace apache::activemq::transport;
+
+
+// --- Constructors -------------------------------------------------
+
+/*
+ *
+ */
+TransportFactory::TransportFactory()
+{
+    socketFactory = new SocketFactory() ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ *
+ */
+p<ITransport> TransportFactory::createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException)
+{
+    p<ISocket>    socket ;
+    p<ITransport> transport ;
+    p<IProtocol>  protocol ;
+    string        uriString ;
+
+    // Make an URI all lower case string
+    uriString = location->toString() ;
+    std::transform(uriString.begin(), uriString.end(), uriString.begin(), (int(*)(int))tolower) ;  // The explicit cast is needed to compile on Linux
+
+    // Create and open socket
+    cout << "Opening socket to: " << location->host() << " on port " << location->port() << endl ;
+    socket = connect(location->host().c_str(), location->port()) ;
+
+    // Create wire protocol depending on specified query parameter
+    if( uriString.find("protocol=stomp") != string::npos )
+        throw IllegalArgumentException("The STOMP protocol is not yet implemented") ;
+    else
+        protocol = new OpenWireProtocol() ;
+
+    // Configure character encoding depending on specified query parameter
+    if( uriString.find("encoding=none") != string::npos )
+        CharsetEncoderRegistry::DEFAULT = NULL ;
+    else
+        CharsetEncoderRegistry::DEFAULT = AsciiToUTF8Encoder::NAME ;
+
+    // Create transport depending on specified URI scheme
+    if( uriString.find("tcp://") != string::npos )
+	    transport = new TcpTransport(socket, protocol) ;
+    else
+        throw IllegalArgumentException("Cannot create transport for unknown URI scheme") ;
+
+    // Chain logging filter is requested in URI query
+    if( uriString.find("trace=true") != string::npos )
+        transport = new LoggingFilter(transport) ;
+
+    // Chain correlator and mutext filters
+	transport = new CorrelatorFilter(transport) ;
+	transport = new MutexFilter(transport) ;
+
+	return transport ;
+}
+
+
+// --- Implementation methods ---------------------------------------
+
+/*
+ *
+ */
+p<ISocket> TransportFactory::connect(const char* host, int port) throw (SocketException)
+{
+    p<ISocket> socket = socketFactory->createSocket() ;
+
+ 	// Try to connect socket to given address and port
+    socket->connect(host, port) ;
+    return socket ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFactory.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp Wed Jul  5 20:17:58 2006
@@ -1,112 +1,112 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "activemq/transport/TransportFilter.hpp"
-
-using namespace apache::activemq::transport;
-
-
-// --- Constructors -------------------------------------------------
-
-/*
- * 
- */
-TransportFilter::TransportFilter(p<ITransport> next)
-{
-    this->next     = next ;
-    this->listener = NULL ;
-
-    // Set us up as the command listener for next link in chain
-    next->setCommandListener( smartify(this) ) ;
-}
-
-
-// --- Attribute methods --------------------------------------------
-
-/*
- *
- */
-void TransportFilter::setCommandListener(p<ICommandListener> listener)
-{
-    this->listener = listener ;
-}
-
-/*
- *
- */
-p<ICommandListener> TransportFilter::getCommandListener()
-{
-    return this->listener ;
-}
-
-
-// --- Operation methods --------------------------------------------
-
-/*
- * 
- */
-void TransportFilter::start()
-{
-    if( listener == NULL )
-	    throw InvalidOperationException ("Command listener cannot be null when Start is called.") ;
-
-    // Start next link in chain
-    this->next->start() ;
-}
-
-/*
- * 
- */
-void TransportFilter::oneway(p<BaseCommand> command)
-{
-    this->next->oneway(command) ;
-}
-
-/*
- * 
- */
-p<FutureResponse> TransportFilter::asyncRequest(p<BaseCommand> command)
-{
-    return this->next->asyncRequest(command) ;
-}
-
-/*
- * 
- */
-p<Response> TransportFilter::request(p<BaseCommand> command)
-{
-    return this->next->request(command) ;
-}
-
-// --- Event methods ------------------------------------------------
-
-/*
- * 
- */
-void TransportFilter::onCommand(p<ITransport> transport, p<BaseCommand> command)
-{
-    // Forward incoming command to "real" listener
-    this->listener->onCommand(transport, command) ;
-}
-
-/*
- * 
- */
-void TransportFilter::onError(p<ITransport> transport, exception& error)
-{
-    // Forward incoming exception to "real" listener
-    this->listener->onError(transport, error) ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "activemq/transport/TransportFilter.hpp"
+
+using namespace apache::activemq::transport;
+
+
+// --- Constructors -------------------------------------------------
+
+/*
+ * 
+ */
+TransportFilter::TransportFilter(p<ITransport> next)
+{
+    this->next     = next ;
+    this->listener = NULL ;
+
+    // Set us up as the command listener for next link in chain
+    next->setCommandListener( smartify(this) ) ;
+}
+
+
+// --- Attribute methods --------------------------------------------
+
+/*
+ *
+ */
+void TransportFilter::setCommandListener(p<ICommandListener> listener)
+{
+    this->listener = listener ;
+}
+
+/*
+ *
+ */
+p<ICommandListener> TransportFilter::getCommandListener()
+{
+    return this->listener ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ * 
+ */
+void TransportFilter::start()
+{
+    if( listener == NULL )
+	    throw InvalidOperationException ("Command listener cannot be null when Start is called.") ;
+
+    // Start next link in chain
+    this->next->start() ;
+}
+
+/*
+ * 
+ */
+void TransportFilter::oneway(p<BaseCommand> command)
+{
+    this->next->oneway(command) ;
+}
+
+/*
+ * 
+ */
+p<FutureResponse> TransportFilter::asyncRequest(p<BaseCommand> command)
+{
+    return this->next->asyncRequest(command) ;
+}
+
+/*
+ * 
+ */
+p<Response> TransportFilter::request(p<BaseCommand> command)
+{
+    return this->next->request(command) ;
+}
+
+// --- Event methods ------------------------------------------------
+
+/*
+ * 
+ */
+void TransportFilter::onCommand(p<ITransport> transport, p<BaseCommand> command)
+{
+    // Forward incoming command to "real" listener
+    this->listener->onCommand(transport, command) ;
+}
+
+/*
+ * 
+ */
+void TransportFilter::onError(p<ITransport> transport, exception& error)
+{
+    // Forward incoming exception to "real" listener
+    this->listener->onError(transport, error) ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/TransportFilter.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp Wed Jul  5 20:17:58 2006
@@ -1,157 +1,157 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "activemq/transport/tcp/TcpTransport.hpp"
-
-using namespace std;
-using namespace apache::activemq::transport::tcp;
-
-
-// --- Constructors -------------------------------------------------
-
-/*
- *
- */
-TcpTransport::TcpTransport(p<ISocket> socket, p<IProtocol> wireProtocol)
-{
-    // Initialize members
-    this->socket     = socket ;
-    this->protocol   = wireProtocol ;
-    this->istream    = NULL ;
-    this->ostream    = NULL ;
-    this->listener   = NULL ;
-    this->readThread = NULL ;
-    this->started    = false ;
-    this->closed     = false ;
-}
-
-/*
- *
- */
-TcpTransport::~TcpTransport()
-{
-    closed = true ;
-    readThread->join() ;
-    istream->close() ;
-    ostream->close() ;
-}
-
-
-// --- Attribute methods --------------------------------------------
-
-/*
- *
- */
-void TcpTransport::setCommandListener(p<ICommandListener> listener)
-{
-    this->listener = listener ;
-}
-
-/*
- *
- */
-p<ICommandListener> TcpTransport::getCommandListener()
-{
-    return this->listener ;
-}
-
-
-// --- Operation methods --------------------------------------------
-
-/*
- *
- */
-void TcpTransport::start()
-{
-    if( !started )
-    {
-        // Must have a command listener
-        if( listener == NULL )
-			throw InvalidOperationException("Command listener cannot be null when TCP transport start is called.") ;
-
-        started = true ;
-
-        // Create the I/O streams
-        ostream = new DataOutputStream( new BufferedOutputStream( new SocketOutputStream(socket) ) ) ;
-        istream = new DataInputStream( new BufferedInputStream( new SocketInputStream(socket) ) ) ;
-        
-        // Create and start the background read thread
-        readThread = new ReadThread(this) ;
-        readThread->start() ;
-
-        // Ask protocol handler to handshake
-        protocol->handshake( smartify(this) ) ;
-    }
-}
-
-/*
- *
- */
-void TcpTransport::oneway(p<BaseCommand> command)
-{
-    protocol->marshal(command, ostream) ;
-    ostream->flush() ;
-}
-
-/*
- *
- */
-p<FutureResponse> TcpTransport::asyncRequest(p<BaseCommand> command)
-{
-    throw InvalidOperationException("Use a CorrelatorFilter if you want to issue asynchrounous request calls.") ;
-}
-
-/*
- *
- */
-p<Response> TcpTransport::request(p<BaseCommand> command)
-{
-    throw InvalidOperationException("Use a CorrelatorFilter if you want to issue request calls.") ;
-}
-
-
-// --- Implementation methods ---------------------------------------
-
-/*
- *
- */
-void TcpTransport::readLoop()
-{
-    // Continue loop until closed or aborted
-    while( !closed )
-    {
-        p<BaseCommand> command = NULL ;
-
-        try
-        {
-            // Read next command
-            command = p_cast<BaseCommand> (protocol->unmarshal(istream)) ;
-
-            // Forward to command listener
-
-            listener->onCommand(smartify(this), command) ;
-        }
-        catch( exception& e )
-        {
-            // Socket closed or error
-            if( !closed )
-                listener->onError(smartify(this), e) ;
-
-            cout << "Exiting read loop due to exception: " << e.what() << endl ;
-            break ;
-        }
-    }
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "activemq/transport/tcp/TcpTransport.hpp"
+
+using namespace std;
+using namespace apache::activemq::transport::tcp;
+
+
+// --- Constructors -------------------------------------------------
+
+/*
+ *
+ */
+TcpTransport::TcpTransport(p<ISocket> socket, p<IProtocol> wireProtocol)
+{
+    // Initialize members
+    this->socket     = socket ;
+    this->protocol   = wireProtocol ;
+    this->istream    = NULL ;
+    this->ostream    = NULL ;
+    this->listener   = NULL ;
+    this->readThread = NULL ;
+    this->started    = false ;
+    this->closed     = false ;
+}
+
+/*
+ *
+ */
+TcpTransport::~TcpTransport()
+{
+    closed = true ;
+    readThread->join() ;
+    istream->close() ;
+    ostream->close() ;
+}
+
+
+// --- Attribute methods --------------------------------------------
+
+/*
+ *
+ */
+void TcpTransport::setCommandListener(p<ICommandListener> listener)
+{
+    this->listener = listener ;
+}
+
+/*
+ *
+ */
+p<ICommandListener> TcpTransport::getCommandListener()
+{
+    return this->listener ;
+}
+
+
+// --- Operation methods --------------------------------------------
+
+/*
+ *
+ */
+void TcpTransport::start()
+{
+    if( !started )
+    {
+        // Must have a command listener
+        if( listener == NULL )
+			throw InvalidOperationException("Command listener cannot be null when TCP transport start is called.") ;
+
+        started = true ;
+
+        // Create the I/O streams
+        ostream = new DataOutputStream( new BufferedOutputStream( new SocketOutputStream(socket) ) ) ;
+        istream = new DataInputStream( new BufferedInputStream( new SocketInputStream(socket) ) ) ;
+        
+        // Create and start the background read thread
+        readThread = new ReadThread(this) ;
+        readThread->start() ;
+
+        // Ask protocol handler to handshake
+        protocol->handshake( smartify(this) ) ;
+    }
+}
+
+/*
+ *
+ */
+void TcpTransport::oneway(p<BaseCommand> command)
+{
+    protocol->marshal(command, ostream) ;
+    ostream->flush() ;
+}
+
+/*
+ *
+ */
+p<FutureResponse> TcpTransport::asyncRequest(p<BaseCommand> command)
+{
+    throw InvalidOperationException("Use a CorrelatorFilter if you want to issue asynchrounous request calls.") ;
+}
+
+/*
+ *
+ */
+p<Response> TcpTransport::request(p<BaseCommand> command)
+{
+    throw InvalidOperationException("Use a CorrelatorFilter if you want to issue request calls.") ;
+}
+
+
+// --- Implementation methods ---------------------------------------
+
+/*
+ *
+ */
+void TcpTransport::readLoop()
+{
+    // Continue loop until closed or aborted
+    while( !closed )
+    {
+        p<BaseCommand> command = NULL ;
+
+        try
+        {
+            // Read next command
+            command = p_cast<BaseCommand> (protocol->unmarshal(istream)) ;
+
+            // Forward to command listener
+
+            listener->onCommand(smartify(this), command) ;
+        }
+        catch( exception& e )
+        {
+            // Socket closed or error
+            if( !closed )
+                listener->onError(smartify(this), e) ;
+
+            cout << "Exiting read loop due to exception: " << e.what() << endl ;
+            break ;
+        }
+    }
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/activemq/transport/tcp/TcpTransport.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.cpp Wed Jul  5 20:17:58 2006
@@ -1,46 +1,46 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "cms/CmsException.hpp"
-
-using namespace apache::cms;
-
-
-/*
- *
- */
-CmsException::CmsException()
-     : msg("")
-{
-    // no-op
-}
-
-/*
- *
- */
-CmsException::CmsException(const char* message)
-     : msg(message)
-{
-    // no-op
-}
-
-/*
- *
- */
-CmsException::~CmsException () throw ()
-{
-    // no-op
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "cms/CmsException.hpp"
+
+using namespace apache::cms;
+
+
+/*
+ *
+ */
+CmsException::CmsException()
+     : msg("")
+{
+    // no-op
+}
+
+/*
+ *
+ */
+CmsException::CmsException(const char* message)
+     : msg(message)
+{
+    // no-op
+}
+
+/*
+ *
+ */
+CmsException::~CmsException () throw ()
+{
+    // no-op
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/cms/CmsException.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/TraceException.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/TraceException.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/TraceException.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/TraceException.cpp Wed Jul  5 20:17:58 2006
@@ -1,72 +1,72 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ppr/TraceException.hpp"
-
-using namespace apache::ppr;
-
-/*
- * 
- */
-TraceException::TraceException()
-   : exception()
-{
-    // no-op
-} ;
-
-/*
- * 
- */
-TraceException::TraceException(const char* msg, ...)
-{
-    va_list vargs ;
-
-    va_start(vargs, msg) ;
-    buildMessage(msg, vargs) ;
-}
-
-void TraceException::buildMessage(const char* format, va_list& vargs)
-{
-    // Allocate buffer with a guess of it's size
-    array<char> buffer (128);
-
-    // Format string
-    for (;;) {
-        int size = vsnprintf(buffer.c_array(), buffer.size(), format, vargs);
-        if (size > -1 && size < (int) buffer.size()) {
-            // Guessed size was enough. Assign the string.
-            message.assign (buffer.c_array(), size);
-            break;
-        }
-        // Guessed size was not enough.
-        if (size > -1) {
-            // Reallocate a new buffer that will fit.
-            buffer = array<char> (size + 1);
-        } else {
-            // Implementation of vsnprintf() did not return a valid required size.
-            // Reallocate a new buffer. Double the guess of size.
-            buffer = array<char> (buffer.size() * 2);
-        }
-    }
-}
-
-const char* TraceException::what() const throw()
-{
-    if( message.empty() )
-        return exception::what() ;
-    else
-        return message.c_str() ;
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ppr/TraceException.hpp"
+
+using namespace apache::ppr;
+
+/*
+ * 
+ */
+TraceException::TraceException()
+   : exception()
+{
+    // no-op
+} ;
+
+/*
+ * 
+ */
+TraceException::TraceException(const char* msg, ...)
+{
+    va_list vargs ;
+
+    va_start(vargs, msg) ;
+    buildMessage(msg, vargs) ;
+}
+
+void TraceException::buildMessage(const char* format, va_list& vargs)
+{
+    // Allocate buffer with a guess of it's size
+    array<char> buffer (128);
+
+    // Format string
+    for (;;) {
+        int size = vsnprintf(buffer.c_array(), buffer.size(), format, vargs);
+        if (size > -1 && size < (int) buffer.size()) {
+            // Guessed size was enough. Assign the string.
+            message.assign (buffer.c_array(), size);
+            break;
+        }
+        // Guessed size was not enough.
+        if (size > -1) {
+            // Reallocate a new buffer that will fit.
+            buffer = array<char> (size + 1);
+        } else {
+            // Implementation of vsnprintf() did not return a valid required size.
+            // Reallocate a new buffer. Double the guess of size.
+            buffer = array<char> (buffer.size() * 2);
+        }
+    }
+}
+
+const char* TraceException::what() const throw()
+{
+    if( message.empty() )
+        return exception::what() ;
+    else
+        return message.c_str() ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/TraceException.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/BufferedInputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/BufferedInputStream.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/BufferedInputStream.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/BufferedInputStream.cpp Wed Jul  5 20:17:58 2006
@@ -1,132 +1,132 @@
-/* 
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ppr/io/BufferedInputStream.hpp"
-
-using namespace apache::ppr::io;
-
-/*
- * 
- */
-BufferedInputStream::BufferedInputStream(p<IInputStream> istream)
-{
-    this->istream = istream ;
-    this->size    = DEFAULT_SIZE ;
-	buffer        = new char[size] ;
-	position      = 0 ;
-    treshold      = 0 ;
-}
-
-/*
- * 
- */
-BufferedInputStream::BufferedInputStream(p<IInputStream> istream, int size)
-{
-    this->istream = istream ;
-    this->size    = size ;
-	buffer        = new char[size] ;
-	position      = 0 ;
-    treshold      = 0 ;
-}
-
-/*
- * Close stream.
- */
-void BufferedInputStream::close() throw(IOException)
-{
-    // Cascade close request to underlying stream
-    if( istream != NULL )
-    {
-        istream->close() ;
-        istream = NULL ;
-        buffer  = NULL ;
-    }
-}
-
-/*
- *
- */
-int BufferedInputStream::read(char* buf, int offset, int length) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Assert parameters
-    if( buf == NULL || offset < 0 || offset > length || length < 0 )
-        throw IllegalArgumentException() ;
-    
-    // Skip read if length is invalid
-    if( length == 0 )
-        return 0 ;
-
-    // Have we reached end-of-buffer?
-	if( isEOB() )
-    {
-        // Skip buffering should request be larger than internal buffer
-	    if( length >= size )
-		    return istream->read(buf, offset, length) ;
-
-        // Load internal buffer with new data
-	    loadBuffer() ;
-	}
-    // Any data available?
-	if( isEOB() )
-        return -1 ;
-
-    // Copy requested bytes up to max buffer size
-	int bytesRead = min(length, treshold - position) ;
-
-    // Copy read bytes into supplied buffer
-	memcpy(&buf[offset], &buffer[position], bytesRead) ;
-
-    // Adjust array position
-	position += bytesRead ;
-
-	return bytesRead ;
-}
-
-/*
- * Load the input buffer with new data.
- */
-void BufferedInputStream::loadBuffer() throw(IOException)
-{
-    // Try to load the whole buffer
-    int bytesRead = istream->read(buffer, 0, size) ;
-
-    // Reset counters if any data was loaded
-    if( bytesRead > 0 )
-    {
-        treshold = bytesRead ;
-        position = 0 ;
-    }
-}
-
-/*
- * Check if stream has been closed.
- */
-void BufferedInputStream::checkClosed() throw(IOException)
-{
-    if( istream == NULL )
-        throw IOException("Input stream closed") ;
-}
-
-/*
- * Check is end-of-buffer has been reached.
- */
-bool BufferedInputStream::isEOB()
-{
-    return ( position >= treshold ) ? true : false ;
-}
+/* 
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ppr/io/BufferedInputStream.hpp"
+
+using namespace apache::ppr::io;
+
+/*
+ * 
+ */
+BufferedInputStream::BufferedInputStream(p<IInputStream> istream)
+{
+    this->istream = istream ;
+    this->size    = DEFAULT_SIZE ;
+	buffer        = new char[size] ;
+	position      = 0 ;
+    treshold      = 0 ;
+}
+
+/*
+ * 
+ */
+BufferedInputStream::BufferedInputStream(p<IInputStream> istream, int size)
+{
+    this->istream = istream ;
+    this->size    = size ;
+	buffer        = new char[size] ;
+	position      = 0 ;
+    treshold      = 0 ;
+}
+
+/*
+ * Close stream.
+ */
+void BufferedInputStream::close() throw(IOException)
+{
+    // Cascade close request to underlying stream
+    if( istream != NULL )
+    {
+        istream->close() ;
+        istream = NULL ;
+        buffer  = NULL ;
+    }
+}
+
+/*
+ *
+ */
+int BufferedInputStream::read(char* buf, int offset, int length) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Assert parameters
+    if( buf == NULL || offset < 0 || offset > length || length < 0 )
+        throw IllegalArgumentException() ;
+    
+    // Skip read if length is invalid
+    if( length == 0 )
+        return 0 ;
+
+    // Have we reached end-of-buffer?
+	if( isEOB() )
+    {
+        // Skip buffering should request be larger than internal buffer
+	    if( length >= size )
+		    return istream->read(buf, offset, length) ;
+
+        // Load internal buffer with new data
+	    loadBuffer() ;
+	}
+    // Any data available?
+	if( isEOB() )
+        return -1 ;
+
+    // Copy requested bytes up to max buffer size
+	int bytesRead = min(length, treshold - position) ;
+
+    // Copy read bytes into supplied buffer
+	memcpy(&buf[offset], &buffer[position], bytesRead) ;
+
+    // Adjust array position
+	position += bytesRead ;
+
+	return bytesRead ;
+}
+
+/*
+ * Load the input buffer with new data.
+ */
+void BufferedInputStream::loadBuffer() throw(IOException)
+{
+    // Try to load the whole buffer
+    int bytesRead = istream->read(buffer, 0, size) ;
+
+    // Reset counters if any data was loaded
+    if( bytesRead > 0 )
+    {
+        treshold = bytesRead ;
+        position = 0 ;
+    }
+}
+
+/*
+ * Check if stream has been closed.
+ */
+void BufferedInputStream::checkClosed() throw(IOException)
+{
+    if( istream == NULL )
+        throw IOException("Input stream closed") ;
+}
+
+/*
+ * Check is end-of-buffer has been reached.
+ */
+bool BufferedInputStream::isEOB()
+{
+    return ( position >= treshold ) ? true : false ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/BufferedInputStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/BufferedOutputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/BufferedOutputStream.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/BufferedOutputStream.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/BufferedOutputStream.cpp Wed Jul  5 20:17:58 2006
@@ -1,142 +1,142 @@
-/* 
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ppr/io/BufferedOutputStream.hpp"
-
-using namespace apache::ppr::io;
-
-/*
- * 
- */
-BufferedOutputStream::BufferedOutputStream(p<IOutputStream> ostream)
-{
-    this->ostream = ostream ;
-    this->size    = DEFAULT_SIZE ;
-	buffer        = new char[size] ;
-	position      = 0 ;
-    treshold      = size ;
-}
-
-/*
- * 
- */
-BufferedOutputStream::BufferedOutputStream(p<IOutputStream> ostream, int size)
-{
-    this->ostream = ostream ;
-    this->size    = size ;
-	buffer        = new char[size] ;
-	position      = 0 ;
-    treshold      = size ;
-}
-
-/*
- * Close stream.
- */
-void BufferedOutputStream::close() throw(IOException)
-{
-    // Cascade close request to internal stream
-    if( ostream != NULL )
-    {
-        // Flush any remaining bytes
-        flush0() ;
-
-        // Shut down
-        ostream->close() ;
-        ostream = NULL ;
-        buffer  = NULL ;
-    }
-}
-
-/*
- *
- */
-int BufferedOutputStream::write(const char* buf, int offset, int length) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Assert parameters
-    if( buf == NULL || offset < 0 || offset > length || length < 0 )
-        throw IllegalArgumentException() ;
-
-    // Skip write if length is invalid
-    if( length == 0 )
-        return 0 ;
-
-    // Skip buffering should request be larger than internal buffer
-    if( length >= size )
-    {
-        flush0() ;
-	    return ostream->write(buf, offset, length) ;
-    }
-    int start = offset, end = offset + length ;
-
-    while( start < end )
-    {
-        int delta = min(treshold - position, end - start) ;
-        memcpy(&buffer[position], &buf[start], delta) ;
-        start    += delta ;
-        position += delta ;
-
-        // Have we reached end-of-buffer?
-	    if( isEOB() )
-            flush0() ;
-    }
-    return length ;
-}
-
-/*
- * Flush stream, i.e. buffer.
- */
-void BufferedOutputStream::flush() throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    flush0() ;
-}
-
-/*
- * Flush buffer.
- */
-void BufferedOutputStream::flush0() throw(IOException)
-{
-    // Check if there is anything to flush
-    if( position > 0 )
-    {
-        ostream->write(buffer, 0, position) ;
-	    position = 0 ;
-	}
-    // Flush underlying stream
-    ostream->flush() ;
-}
-
-/*
- * Check if stream has been closed.
- */
-void BufferedOutputStream::checkClosed() throw(IOException)
-{
-    if( ostream == NULL )
-        throw IOException("Output stream closed") ;
-}
-
-/*
- * Check is end-of-buffer has been reached.
- */
-bool BufferedOutputStream::isEOB()
-{
-    return ( position >= treshold ) ? true : false ;
-}
+/* 
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ppr/io/BufferedOutputStream.hpp"
+
+using namespace apache::ppr::io;
+
+/*
+ * 
+ */
+BufferedOutputStream::BufferedOutputStream(p<IOutputStream> ostream)
+{
+    this->ostream = ostream ;
+    this->size    = DEFAULT_SIZE ;
+	buffer        = new char[size] ;
+	position      = 0 ;
+    treshold      = size ;
+}
+
+/*
+ * 
+ */
+BufferedOutputStream::BufferedOutputStream(p<IOutputStream> ostream, int size)
+{
+    this->ostream = ostream ;
+    this->size    = size ;
+	buffer        = new char[size] ;
+	position      = 0 ;
+    treshold      = size ;
+}
+
+/*
+ * Close stream.
+ */
+void BufferedOutputStream::close() throw(IOException)
+{
+    // Cascade close request to internal stream
+    if( ostream != NULL )
+    {
+        // Flush any remaining bytes
+        flush0() ;
+
+        // Shut down
+        ostream->close() ;
+        ostream = NULL ;
+        buffer  = NULL ;
+    }
+}
+
+/*
+ *
+ */
+int BufferedOutputStream::write(const char* buf, int offset, int length) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Assert parameters
+    if( buf == NULL || offset < 0 || offset > length || length < 0 )
+        throw IllegalArgumentException() ;
+
+    // Skip write if length is invalid
+    if( length == 0 )
+        return 0 ;
+
+    // Skip buffering should request be larger than internal buffer
+    if( length >= size )
+    {
+        flush0() ;
+	    return ostream->write(buf, offset, length) ;
+    }
+    int start = offset, end = offset + length ;
+
+    while( start < end )
+    {
+        int delta = min(treshold - position, end - start) ;
+        memcpy(&buffer[position], &buf[start], delta) ;
+        start    += delta ;
+        position += delta ;
+
+        // Have we reached end-of-buffer?
+	    if( isEOB() )
+            flush0() ;
+    }
+    return length ;
+}
+
+/*
+ * Flush stream, i.e. buffer.
+ */
+void BufferedOutputStream::flush() throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    flush0() ;
+}
+
+/*
+ * Flush buffer.
+ */
+void BufferedOutputStream::flush0() throw(IOException)
+{
+    // Check if there is anything to flush
+    if( position > 0 )
+    {
+        ostream->write(buffer, 0, position) ;
+	    position = 0 ;
+	}
+    // Flush underlying stream
+    ostream->flush() ;
+}
+
+/*
+ * Check if stream has been closed.
+ */
+void BufferedOutputStream::checkClosed() throw(IOException)
+{
+    if( ostream == NULL )
+        throw IOException("Output stream closed") ;
+}
+
+/*
+ * Check is end-of-buffer has been reached.
+ */
+bool BufferedOutputStream::isEOB()
+{
+    return ( position >= treshold ) ? true : false ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/BufferedOutputStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/ByteArrayInputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/ByteArrayInputStream.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/ByteArrayInputStream.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/ByteArrayInputStream.cpp Wed Jul  5 20:17:58 2006
@@ -1,77 +1,77 @@
-/* 
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ppr/io/ByteArrayInputStream.hpp"
-
-using namespace apache::ppr::io;
-
-/*
- *
- */
-ByteArrayInputStream::ByteArrayInputStream(array<char> buffer)
-{
-    this->body     = (buffer != NULL) ? buffer : NULL ;
-    this->bodySize = (buffer != NULL) ? (int)body.size() : 0 ;
-    this->offset   = 0 ;
-}
-
-/*
- *
- */
-ByteArrayInputStream::~ByteArrayInputStream()
-{
-    // no-op
-}
-
-void ByteArrayInputStream::close() throw(IOException)
-{
-    // no-op
-}
-
-/*
- *
- */
-array<char> ByteArrayInputStream::toArray()
-{
-    array<char> retBody ;
-
-    // Create return body and copy current contents
-    retBody = array<char> (bodySize) ;
-    memcpy(retBody.c_array(), body.c_array(), bodySize) ;
-
-    return retBody ;
-}
-
-/*
- *
- */
-int ByteArrayInputStream::read(char* buf, int index, int length) throw(IOException)
-{
-    // Check for EOF offset
-    if( offset > bodySize )
-        throw EOFException() ;
-
-    // Copy bytes from supplied buffer
-    for( int i = index ; i < length ; i++, offset++ )
-    {
-        // Check for body EOF
-        if( offset > bodySize )
-            return length - i ;
-
-        buf[i] = body[offset] ;
-    }
-    return length ;
-}
+/* 
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ppr/io/ByteArrayInputStream.hpp"
+
+using namespace apache::ppr::io;
+
+/*
+ *
+ */
+ByteArrayInputStream::ByteArrayInputStream(array<char> buffer)
+{
+    this->body     = (buffer != NULL) ? buffer : NULL ;
+    this->bodySize = (buffer != NULL) ? (int)body.size() : 0 ;
+    this->offset   = 0 ;
+}
+
+/*
+ *
+ */
+ByteArrayInputStream::~ByteArrayInputStream()
+{
+    // no-op
+}
+
+void ByteArrayInputStream::close() throw(IOException)
+{
+    // no-op
+}
+
+/*
+ *
+ */
+array<char> ByteArrayInputStream::toArray()
+{
+    array<char> retBody ;
+
+    // Create return body and copy current contents
+    retBody = array<char> (bodySize) ;
+    memcpy(retBody.c_array(), body.c_array(), bodySize) ;
+
+    return retBody ;
+}
+
+/*
+ *
+ */
+int ByteArrayInputStream::read(char* buf, int index, int length) throw(IOException)
+{
+    // Check for EOF offset
+    if( offset > bodySize )
+        throw EOFException() ;
+
+    // Copy bytes from supplied buffer
+    for( int i = index ; i < length ; i++, offset++ )
+    {
+        // Check for body EOF
+        if( offset > bodySize )
+            return length - i ;
+
+        buf[i] = body[offset] ;
+    }
+    return length ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/ByteArrayInputStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/ByteArrayOutputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/ByteArrayOutputStream.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/ByteArrayOutputStream.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/ByteArrayOutputStream.cpp Wed Jul  5 20:17:58 2006
@@ -1,122 +1,122 @@
-/* 
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ppr/io/ByteArrayOutputStream.hpp"
-
-using namespace apache::ppr::io;
-
-/*
- *
- */
-ByteArrayOutputStream::ByteArrayOutputStream()
-{
-    this->body       = array<char> (INITIAL_SIZE) ;
-    this->bodySize   = INITIAL_SIZE ;
-    this->bodyLength = 0 ;
-    this->offset     = 0 ;
-}
-
-/*
- *
- */
-ByteArrayOutputStream::ByteArrayOutputStream(array<char> buffer)
-{
-    this->body       = (buffer != NULL ) ? buffer : array<char> (INITIAL_SIZE) ;
-    this->bodySize   = (int)body.size() ;
-    this->bodyLength = 0 ;
-    this->offset     = 0 ;
-}
-
-/*
- *
- */
-ByteArrayOutputStream::~ByteArrayOutputStream()
-{
-    // no-op
-}
-
-/*
- *
- */
-array<char> ByteArrayOutputStream::toArray()
-{
-    // Return NULL if no array content
-    if( bodyLength == 0 ) 
-        return NULL ;
-
-    // Create return body and copy current contents
-    array<char> retBody = array<char> (bodyLength) ;
-    memcpy(retBody.c_array(), body.c_array(), bodyLength) ;
-
-    return retBody ;
-}
-
-/*
- *
- */
-void ByteArrayOutputStream::close() throw(IOException)
-{
-    // no-op
-}
-
-/*
- *
- */
-void ByteArrayOutputStream::flush() throw(IOException)
-{
-    // no-op
-}
-
-/*
- *
- */
-int ByteArrayOutputStream::write(const char* buf, int index, int length) throw(IOException)
-{
-    // Assert buffer parameter
-    if( buf == NULL )
-        return 0 ;
-
-    // Copy bytes from supplied buffer
-    for( int i = index ; i < length ; i++, offset++ )
-    {
-        // Check for EOF offset
-        if( offset > bodySize )
-            expandBody() ;
-
-        body[offset] = buf[i] ;
-    }
-    // Update content length
-    bodyLength = offset ;
-
-    return length ;
-}
-
-/*
- *
- */
-void ByteArrayOutputStream::expandBody()
-{
-    array<char> newBody ;
-    int         newSize = bodySize + ByteArrayOutputStream::EXPAND_SIZE ;
-
-    // Create new body and copy current contents
-    newBody = array<char> (newSize) ;
-    memcpy(newBody.c_array(), body.c_array(), bodySize) ;
-
-    // Clean up and use new content body
-    body     = newBody ;
-    bodySize = newSize ;
-}
+/* 
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ppr/io/ByteArrayOutputStream.hpp"
+
+using namespace apache::ppr::io;
+
+/*
+ *
+ */
+ByteArrayOutputStream::ByteArrayOutputStream()
+{
+    this->body       = array<char> (INITIAL_SIZE) ;
+    this->bodySize   = INITIAL_SIZE ;
+    this->bodyLength = 0 ;
+    this->offset     = 0 ;
+}
+
+/*
+ *
+ */
+ByteArrayOutputStream::ByteArrayOutputStream(array<char> buffer)
+{
+    this->body       = (buffer != NULL ) ? buffer : array<char> (INITIAL_SIZE) ;
+    this->bodySize   = (int)body.size() ;
+    this->bodyLength = 0 ;
+    this->offset     = 0 ;
+}
+
+/*
+ *
+ */
+ByteArrayOutputStream::~ByteArrayOutputStream()
+{
+    // no-op
+}
+
+/*
+ *
+ */
+array<char> ByteArrayOutputStream::toArray()
+{
+    // Return NULL if no array content
+    if( bodyLength == 0 ) 
+        return NULL ;
+
+    // Create return body and copy current contents
+    array<char> retBody = array<char> (bodyLength) ;
+    memcpy(retBody.c_array(), body.c_array(), bodyLength) ;
+
+    return retBody ;
+}
+
+/*
+ *
+ */
+void ByteArrayOutputStream::close() throw(IOException)
+{
+    // no-op
+}
+
+/*
+ *
+ */
+void ByteArrayOutputStream::flush() throw(IOException)
+{
+    // no-op
+}
+
+/*
+ *
+ */
+int ByteArrayOutputStream::write(const char* buf, int index, int length) throw(IOException)
+{
+    // Assert buffer parameter
+    if( buf == NULL )
+        return 0 ;
+
+    // Copy bytes from supplied buffer
+    for( int i = index ; i < length ; i++, offset++ )
+    {
+        // Check for EOF offset
+        if( offset > bodySize )
+            expandBody() ;
+
+        body[offset] = buf[i] ;
+    }
+    // Update content length
+    bodyLength = offset ;
+
+    return length ;
+}
+
+/*
+ *
+ */
+void ByteArrayOutputStream::expandBody()
+{
+    array<char> newBody ;
+    int         newSize = bodySize + ByteArrayOutputStream::EXPAND_SIZE ;
+
+    // Create new body and copy current contents
+    newBody = array<char> (newSize) ;
+    memcpy(newBody.c_array(), body.c_array(), bodySize) ;
+
+    // Clean up and use new content body
+    body     = newBody ;
+    bodySize = newSize ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/ByteArrayOutputStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.cpp Wed Jul  5 20:17:58 2006
@@ -1,222 +1,222 @@
-/* 
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ppr/io/DataInputStream.hpp"
-
-using namespace apache::ppr::io;
-
-/*
- *
- */
-DataInputStream::DataInputStream(p<IInputStream> istream)
-{
-    this->istream = istream ;
-    this->encoder = CharsetEncoderRegistry::getEncoder() ;
-}
-
-/*
- *
- */
-DataInputStream::DataInputStream(p<IInputStream> istream, const char* encname)
-{
-    this->istream = istream ;
-    this->encoder = CharsetEncoderRegistry::getEncoder(encname) ;
-}
-
-/*
- *
- */
-DataInputStream::~DataInputStream()
-{
-    // no-op
-}
-
-/*
- *
- */
-void DataInputStream::close() throw(IOException)
-{
-    // Cascade close request to underlying stream
-    if( istream != NULL )
-    {
-        istream->close() ;
-        istream = NULL ;
-    }
-}
-
-/*
- *
- */
-int DataInputStream::read(char* buffer, int offset, int length) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Read buffer
-    return istream->read(buffer, offset, length) ;
-}
-
-/*
- *
- */
-char DataInputStream::readByte() throw(IOException)
-{
-    char value ;
-
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Read a single byte
-    istream->read(&value, 0, sizeof(char)) ;
-    return value ;
-}
-
-/*
- *
- */
-bool DataInputStream::readBoolean() throw(IOException)
-{
-    // Read a boolean
-    return ( readByte() ) ? true : false ;
-}
-
-/*
- *
- */
-double DataInputStream::readDouble() throw(IOException)
-{
-    double value ;
-
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Read a double and convert from big endian to little endian if necessary
-    istream->read((char*)&value, 0, sizeof(double) ) ;
-    return ntohd(value) ;
-}
-
-/*
- *
- */
-float DataInputStream::readFloat() throw(IOException)
-{
-    float value ;
-
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Read a float and convert from big endian to little endian if necessary
-    istream->read((char*)&value, 0, sizeof(float)) ;
-    return ntohf(value) ;
-}
-
-/*
- *
- */
-short DataInputStream::readShort() throw(IOException)
-{
-    short value ;
-
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Read a short and convert from big endian to little endian if necessary
-    istream->read((char*)&value, 0, sizeof(short)) ;
-    return ntohs(value) ;
-}
-
-/*
- *
- */
-int DataInputStream::readInt() throw(IOException)
-{
-    int value ;
-
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Read an int and convert from big endian to little endian if necessary
-    istream->read((char*)&value, 0, sizeof(int)) ;
-    return ntohi(value) ;
-}
-
-/*
- *
- */
-long long DataInputStream::readLong() throw(IOException)
-{
-    long long value ;
-
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Read a long long and convert from big endian to little endian if necessary
-    istream->read((char*)&value, 0, sizeof(long long)) ;
-    return ntohll(value) ;
-}
-
-/*
- *
- */
-p<string> DataInputStream::readString() throw(IOException)
-{
-    p<string> value ;
-    short     length ;
-
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Read length of string
-    length = readShort() ;
-    if (length < 0)
-        throw IOException ("Negative length of string") ;
-    else if (length > 0)
-    {
-        array<char> buffer = array<char> (length+1) ;
-
-        // Read string bytes
-        istream->read(&buffer[0], 0, length) ;
-        buffer[length] = '\0' ;
-
-        // Create string
-        value = new string() ;
-        value->assign( buffer.c_array() ) ;
-
-        // Decode string if charset encoder has been configured
-        if( encoder != NULL )
-        {
-            try {
-                value = encoder->decode(value) ;
-            }
-            catch( CharsetEncodingException &cee ) {
-                throw new IOException( cee.what() ) ;
-            }
-        }
-    }
-    else   // ...empty string
-        value = new string("") ;
-
-    return value ;
-}
-
-/*
- * Check if stream has been closed.
- */
-void DataInputStream::checkClosed() throw(IOException)
-{
-    if( istream == NULL )
-        throw IOException("Input stream closed") ;
-}
+/* 
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ppr/io/DataInputStream.hpp"
+
+using namespace apache::ppr::io;
+
+/*
+ *
+ */
+DataInputStream::DataInputStream(p<IInputStream> istream)
+{
+    this->istream = istream ;
+    this->encoder = CharsetEncoderRegistry::getEncoder() ;
+}
+
+/*
+ *
+ */
+DataInputStream::DataInputStream(p<IInputStream> istream, const char* encname)
+{
+    this->istream = istream ;
+    this->encoder = CharsetEncoderRegistry::getEncoder(encname) ;
+}
+
+/*
+ *
+ */
+DataInputStream::~DataInputStream()
+{
+    // no-op
+}
+
+/*
+ *
+ */
+void DataInputStream::close() throw(IOException)
+{
+    // Cascade close request to underlying stream
+    if( istream != NULL )
+    {
+        istream->close() ;
+        istream = NULL ;
+    }
+}
+
+/*
+ *
+ */
+int DataInputStream::read(char* buffer, int offset, int length) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Read buffer
+    return istream->read(buffer, offset, length) ;
+}
+
+/*
+ *
+ */
+char DataInputStream::readByte() throw(IOException)
+{
+    char value ;
+
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Read a single byte
+    istream->read(&value, 0, sizeof(char)) ;
+    return value ;
+}
+
+/*
+ *
+ */
+bool DataInputStream::readBoolean() throw(IOException)
+{
+    // Read a boolean
+    return ( readByte() ) ? true : false ;
+}
+
+/*
+ *
+ */
+double DataInputStream::readDouble() throw(IOException)
+{
+    double value ;
+
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Read a double and convert from big endian to little endian if necessary
+    istream->read((char*)&value, 0, sizeof(double) ) ;
+    return ntohd(value) ;
+}
+
+/*
+ *
+ */
+float DataInputStream::readFloat() throw(IOException)
+{
+    float value ;
+
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Read a float and convert from big endian to little endian if necessary
+    istream->read((char*)&value, 0, sizeof(float)) ;
+    return ntohf(value) ;
+}
+
+/*
+ *
+ */
+short DataInputStream::readShort() throw(IOException)
+{
+    short value ;
+
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Read a short and convert from big endian to little endian if necessary
+    istream->read((char*)&value, 0, sizeof(short)) ;
+    return ntohs(value) ;
+}
+
+/*
+ *
+ */
+int DataInputStream::readInt() throw(IOException)
+{
+    int value ;
+
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Read an int and convert from big endian to little endian if necessary
+    istream->read((char*)&value, 0, sizeof(int)) ;
+    return ntohi(value) ;
+}
+
+/*
+ *
+ */
+long long DataInputStream::readLong() throw(IOException)
+{
+    long long value ;
+
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Read a long long and convert from big endian to little endian if necessary
+    istream->read((char*)&value, 0, sizeof(long long)) ;
+    return ntohll(value) ;
+}
+
+/*
+ *
+ */
+p<string> DataInputStream::readString() throw(IOException)
+{
+    p<string> value ;
+    short     length ;
+
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Read length of string
+    length = readShort() ;
+    if (length < 0)
+        throw IOException ("Negative length of string") ;
+    else if (length > 0)
+    {
+        array<char> buffer = array<char> (length+1) ;
+
+        // Read string bytes
+        istream->read(&buffer[0], 0, length) ;
+        buffer[length] = '\0' ;
+
+        // Create string
+        value = new string() ;
+        value->assign( buffer.c_array() ) ;
+
+        // Decode string if charset encoder has been configured
+        if( encoder != NULL )
+        {
+            try {
+                value = encoder->decode(value) ;
+            }
+            catch( CharsetEncodingException &cee ) {
+                throw new IOException( cee.what() ) ;
+            }
+        }
+    }
+    else   // ...empty string
+        value = new string("") ;
+
+    return value ;
+}
+
+/*
+ * Check if stream has been closed.
+ */
+void DataInputStream::checkClosed() throw(IOException)
+{
+    if( istream == NULL )
+        throw IOException("Input stream closed") ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataInputStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.cpp Wed Jul  5 20:17:58 2006
@@ -1,218 +1,218 @@
-/* 
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ppr/io/DataOutputStream.hpp"
-
-using namespace apache::ppr::io;
-
-/*
- *
- */
-DataOutputStream::DataOutputStream(p<IOutputStream> ostream)
-{
-    this->ostream = ostream ;
-    this->encoder = CharsetEncoderRegistry::getEncoder() ;
-}
-
-/*
- *
- */
-DataOutputStream::DataOutputStream(p<IOutputStream> ostream, const char* encname)
-{
-    this->ostream = ostream ;
-    this->encoder = CharsetEncoderRegistry::getEncoder(encname) ;
-}
-
-/*
- *
- */
-DataOutputStream::~DataOutputStream()
-{
-    // no-op
-}
-
-/*
- *
- */
-void DataOutputStream::close() throw(IOException)
-{
-    // Cascade close request to underlying stream
-    if( ostream != NULL )
-    {
-        ostream->close() ;
-        ostream = NULL ;
-    }
-}
-
-/*
- *
- */
-void DataOutputStream::flush() throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Flush stream
-    ostream->flush() ;
-}
-
-/*
- *
- */
-int DataOutputStream::write(const char* buffer, int offset, int length) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Write buffer
-    return ostream->write(buffer, offset, length) ;
-}
-
-/*
- *
- */
-void DataOutputStream::writeByte(char value) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Write a single byte
-    ostream->write((char*)&value, 0, sizeof(char)) ;
-}
-
-/*
- *
- */
-void DataOutputStream::writeBoolean(bool value) throw(IOException)
-{
-    // Write a boolean
-    ( value ) ? writeByte(0x01) : writeByte(0x00) ;
-}
-
-/*
- *
- */
-void DataOutputStream::writeDouble(double v) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Write a double, convert from little endian to big endian if necessary
-    double value = htond(v) ;
-    ostream->write((char*)&value, 0, sizeof(double)) ;
-}
-
-/*
- *
- */
-void DataOutputStream::writeFloat(float v) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Write a float, convert from little endian to big endian if necessary
-    float value = htonf(v) ;
-    ostream->write((char*)&value, 0, sizeof(float)) ;
-}
-
-/*
- *
- */
-void DataOutputStream::writeShort(short v) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Write a short, convert from little endian to big endian if necessary
-    short value = htons(v) ;
-    ostream->write((char*)&value, 0, sizeof(short)) ;
-}
-
-/*
- *
- */
-void DataOutputStream::writeInt(int v) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Write an int, convert from little endian to big endian if necessary
-    int value = htoni(v) ;
-    ostream->write((char*)&value, 0, sizeof(int)) ;
-}
-
-/*
- *
- */
-void DataOutputStream::writeLong(long long v) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Write a long long, convert from little endian to big endian if necessary
-    long long value = htonll(v) ;
-    ostream->write((char*)&value, 0, sizeof(long long)) ;
-}
-
-/*
- *
- */
-int DataOutputStream::writeString(p<string> value) throw(IOException)
-{
-    // Check if underlying stream has been closed
-    checkClosed() ;
-
-    // Assert argument
-    if( value == NULL )
-        return 0 ;
-
-    p<string> data ;
-    int       length = (int)value->length() ;
-
-    // Encode string if an charset encoder has been configured
-    if( encoder != NULL )
-    {
-        try {
-            data = encoder->encode(value, &length) ;
-        }
-        catch( CharsetEncodingException &cee ) {
-            throw IOException( cee.what() ) ;
-        }
-    }
-    else
-        data = value ;
-
-    // Assert string length
-    if( length > USHRT_MAX )
-        throw IOException("String length exceeds maximum length") ;
-
-    // Write length of string
-    writeShort( (short)length ) ;
-
-    // Write string contents
-    ostream->write((char*)data->c_str(), 0, length) ;
-
-    return length ;
-}
-
-/*
- * Check if stream has been closed.
- */
-void DataOutputStream::checkClosed() throw(IOException)
-{
-    if( ostream == NULL )
-        throw IOException("Output stream closed") ;
-}
+/* 
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ppr/io/DataOutputStream.hpp"
+
+using namespace apache::ppr::io;
+
+/*
+ *
+ */
+DataOutputStream::DataOutputStream(p<IOutputStream> ostream)
+{
+    this->ostream = ostream ;
+    this->encoder = CharsetEncoderRegistry::getEncoder() ;
+}
+
+/*
+ *
+ */
+DataOutputStream::DataOutputStream(p<IOutputStream> ostream, const char* encname)
+{
+    this->ostream = ostream ;
+    this->encoder = CharsetEncoderRegistry::getEncoder(encname) ;
+}
+
+/*
+ *
+ */
+DataOutputStream::~DataOutputStream()
+{
+    // no-op
+}
+
+/*
+ *
+ */
+void DataOutputStream::close() throw(IOException)
+{
+    // Cascade close request to underlying stream
+    if( ostream != NULL )
+    {
+        ostream->close() ;
+        ostream = NULL ;
+    }
+}
+
+/*
+ *
+ */
+void DataOutputStream::flush() throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Flush stream
+    ostream->flush() ;
+}
+
+/*
+ *
+ */
+int DataOutputStream::write(const char* buffer, int offset, int length) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Write buffer
+    return ostream->write(buffer, offset, length) ;
+}
+
+/*
+ *
+ */
+void DataOutputStream::writeByte(char value) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Write a single byte
+    ostream->write((char*)&value, 0, sizeof(char)) ;
+}
+
+/*
+ *
+ */
+void DataOutputStream::writeBoolean(bool value) throw(IOException)
+{
+    // Write a boolean
+    ( value ) ? writeByte(0x01) : writeByte(0x00) ;
+}
+
+/*
+ *
+ */
+void DataOutputStream::writeDouble(double v) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Write a double, convert from little endian to big endian if necessary
+    double value = htond(v) ;
+    ostream->write((char*)&value, 0, sizeof(double)) ;
+}
+
+/*
+ *
+ */
+void DataOutputStream::writeFloat(float v) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Write a float, convert from little endian to big endian if necessary
+    float value = htonf(v) ;
+    ostream->write((char*)&value, 0, sizeof(float)) ;
+}
+
+/*
+ *
+ */
+void DataOutputStream::writeShort(short v) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Write a short, convert from little endian to big endian if necessary
+    short value = htons(v) ;
+    ostream->write((char*)&value, 0, sizeof(short)) ;
+}
+
+/*
+ *
+ */
+void DataOutputStream::writeInt(int v) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Write an int, convert from little endian to big endian if necessary
+    int value = htoni(v) ;
+    ostream->write((char*)&value, 0, sizeof(int)) ;
+}
+
+/*
+ *
+ */
+void DataOutputStream::writeLong(long long v) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Write a long long, convert from little endian to big endian if necessary
+    long long value = htonll(v) ;
+    ostream->write((char*)&value, 0, sizeof(long long)) ;
+}
+
+/*
+ *
+ */
+int DataOutputStream::writeString(p<string> value) throw(IOException)
+{
+    // Check if underlying stream has been closed
+    checkClosed() ;
+
+    // Assert argument
+    if( value == NULL )
+        return 0 ;
+
+    p<string> data ;
+    int       length = (int)value->length() ;
+
+    // Encode string if an charset encoder has been configured
+    if( encoder != NULL )
+    {
+        try {
+            data = encoder->encode(value, &length) ;
+        }
+        catch( CharsetEncodingException &cee ) {
+            throw IOException( cee.what() ) ;
+        }
+    }
+    else
+        data = value ;
+
+    // Assert string length
+    if( length > USHRT_MAX )
+        throw IOException("String length exceeds maximum length") ;
+
+    // Write length of string
+    writeShort( (short)length ) ;
+
+    // Write string contents
+    ostream->write((char*)data->c_str(), 0, length) ;
+
+    return length ;
+}
+
+/*
+ * Check if stream has been closed.
+ */
+void DataOutputStream::checkClosed() throw(IOException)
+{
+    if( ostream == NULL )
+        throw IOException("Output stream closed") ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/DataOutputStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/SocketInputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/SocketInputStream.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/SocketInputStream.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/SocketInputStream.cpp Wed Jul  5 20:17:58 2006
@@ -1,84 +1,84 @@
-/* 
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ppr/io/SocketInputStream.hpp"
-
-using namespace apache::ppr::io;
-
-/*
- *
- */
-SocketInputStream::SocketInputStream(p<ISocket> socket)
-{
-    this->socket = socket ;
-}
-
-/*
- *
- */
-SocketInputStream::~SocketInputStream()
-{
-    // no-op
-}
-
-/*
- *
- */
-void SocketInputStream::close() throw(IOException)
-{
-    // Cascade close request to underlying socket
-    if( socket != NULL )
-    {
-        socket->close() ;
-        socket = NULL ;
-    }
-}
-
-/*
- *
- */
-int SocketInputStream::read(char* buf, int offset, int length) throw(IOException)
-{
-    char* buffer = buf + offset ;
-    //char* buffer = buf + index ;
-    //int   length, remaining = size ;
-    int bytesRead ;
-
-    // Loop until requested number of bytes are read
-    //while( remaining > 0 )
-    //{
-        // Try to read remaining bytes
-      //  length = remaining ;
-
-        try
-        {
-            // Read some bytes from socket
-            //length = socket->receive(buffer, length) ;
-            bytesRead = socket->receive(buffer, length) ;
-        }
-        catch( SocketException se )
-        {
-            // Exit on any error
-            throw IOException("Failed to read from socket; error message = %s, at %s line %d", se.what(), __FILE__, __LINE__) ;
-        }
-
-        // Adjust buffer pointer and remaining number of bytes
-        //buffer    += length ;
-        //remaining -= length ;
-	//}
-	//return size ;
-    return bytesRead ;
-}
+/* 
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ppr/io/SocketInputStream.hpp"
+
+using namespace apache::ppr::io;
+
+/*
+ *
+ */
+SocketInputStream::SocketInputStream(p<ISocket> socket)
+{
+    this->socket = socket ;
+}
+
+/*
+ *
+ */
+SocketInputStream::~SocketInputStream()
+{
+    // no-op
+}
+
+/*
+ *
+ */
+void SocketInputStream::close() throw(IOException)
+{
+    // Cascade close request to underlying socket
+    if( socket != NULL )
+    {
+        socket->close() ;
+        socket = NULL ;
+    }
+}
+
+/*
+ *
+ */
+int SocketInputStream::read(char* buf, int offset, int length) throw(IOException)
+{
+    char* buffer = buf + offset ;
+    //char* buffer = buf + index ;
+    //int   length, remaining = size ;
+    int bytesRead ;
+
+    // Loop until requested number of bytes are read
+    //while( remaining > 0 )
+    //{
+        // Try to read remaining bytes
+      //  length = remaining ;
+
+        try
+        {
+            // Read some bytes from socket
+            //length = socket->receive(buffer, length) ;
+            bytesRead = socket->receive(buffer, length) ;
+        }
+        catch( SocketException se )
+        {
+            // Exit on any error
+            throw IOException("Failed to read from socket; error message = %s, at %s line %d", se.what(), __FILE__, __LINE__) ;
+        }
+
+        // Adjust buffer pointer and remaining number of bytes
+        //buffer    += length ;
+        //remaining -= length ;
+	//}
+	//return size ;
+    return bytesRead ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/SocketInputStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/SocketOutputStream.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/SocketOutputStream.cpp?rev=419422&r1=419421&r2=419422&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/SocketOutputStream.cpp (original)
+++ incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/SocketOutputStream.cpp Wed Jul  5 20:17:58 2006
@@ -1,92 +1,92 @@
-/* 
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "ppr/io/SocketOutputStream.hpp"
-
-using namespace apache::ppr::io;
-
-/*
- *
- */
-SocketOutputStream::SocketOutputStream(p<ISocket> socket)
-{
-    this->socket = socket ;
-}
-
-/*
- *
- */
-SocketOutputStream::~SocketOutputStream()
-{
-    // no-op
-}
-
-/*
- *
- */
-void SocketOutputStream::close() throw(IOException)
-{
-    // Cascade close request to underlying socket
-    if( socket != NULL )
-    {
-        socket->close() ;
-        socket = NULL ;
-    }
-}
-
-/*
- *
- */
-void SocketOutputStream::flush() throw(IOException)
-{
-    // no-op
-}
-
-/*
- *
- */
-int SocketOutputStream::write(const char* buf, int offset, int length) throw(IOException)
-{
-    const char*  buffer = buf + offset ;
-    //const char*  buffer = buf + index ;
-    //int          length, remaining = size ;
-    int bytesWritten ;
-
-    // Loop until requested number of bytes are read
-    //while( remaining > 0 )
-    //{
-        // Try to write remaining bytes
-        //length = remaining ;
-
-        try
-        {
-            // Write some bytes to socket
-            //length = socket->send(buffer, length) ;
-            bytesWritten = socket->send(buffer, length) ;
-        }
-        catch( SocketException se )
-        {
-            // Exit on any error
-            throw IOException("Failed to write to socket; error message = %s, at %s line %d", se.what(), __FILE__, __LINE__) ;
-        }
-
-        // Adjust buffer pointer and remaining number of bytes
-        //buffer    += length ;
-        //remaining -= length ;
-	//}
-	//return size ;
-    return bytesWritten ;
-}
+/* 
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "ppr/io/SocketOutputStream.hpp"
+
+using namespace apache::ppr::io;
+
+/*
+ *
+ */
+SocketOutputStream::SocketOutputStream(p<ISocket> socket)
+{
+    this->socket = socket ;
+}
+
+/*
+ *
+ */
+SocketOutputStream::~SocketOutputStream()
+{
+    // no-op
+}
+
+/*
+ *
+ */
+void SocketOutputStream::close() throw(IOException)
+{
+    // Cascade close request to underlying socket
+    if( socket != NULL )
+    {
+        socket->close() ;
+        socket = NULL ;
+    }
+}
+
+/*
+ *
+ */
+void SocketOutputStream::flush() throw(IOException)
+{
+    // no-op
+}
+
+/*
+ *
+ */
+int SocketOutputStream::write(const char* buf, int offset, int length) throw(IOException)
+{
+    const char*  buffer = buf + offset ;
+    //const char*  buffer = buf + index ;
+    //int          length, remaining = size ;
+    int bytesWritten ;
+
+    // Loop until requested number of bytes are read
+    //while( remaining > 0 )
+    //{
+        // Try to write remaining bytes
+        //length = remaining ;
+
+        try
+        {
+            // Write some bytes to socket
+            //length = socket->send(buffer, length) ;
+            bytesWritten = socket->send(buffer, length) ;
+        }
+        catch( SocketException se )
+        {
+            // Exit on any error
+            throw IOException("Failed to write to socket; error message = %s, at %s line %d", se.what(), __FILE__, __LINE__) ;
+        }
+
+        // Adjust buffer pointer and remaining number of bytes
+        //buffer    += length ;
+        //remaining -= length ;
+	//}
+	//return size ;
+    return bytesWritten ;
+}

Propchange: incubator/activemq/trunk/openwire-cpp/src/main/cpp/ppr/io/SocketOutputStream.cpp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message