You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/10/18 20:58:04 UTC
svn commit: r1399781 [2/3] - in
/activemq/activemq-cpp/trunk/activemq-cpp/src/main: ./ activemq/library/
activemq/state/ activemq/threads/ activemq/transport/mock/ activemq/util/
activemq/wireformat/ activemq/wireformat/openwire/marshal/
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/TaskRunner.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/TaskRunner.h?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/TaskRunner.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/threads/TaskRunner.h Thu Oct 18 18:58:02 2012
@@ -27,7 +27,7 @@ namespace threads {
class AMQCPP_API TaskRunner {
public:
- virtual ~TaskRunner() {}
+ virtual ~TaskRunner();
/**
* Shutdown after a timeout, does not guarantee that the task's iterate
@@ -35,7 +35,7 @@ namespace threads {
*
* @param timeout - Time in Milliseconds to wait for the task to stop.
*/
- virtual void shutdown( unsigned int timeout ) = 0;
+ virtual void shutdown(unsigned int timeout) = 0;
/**
* Shutdown once the task has finished and the TaskRunner's thread has exited.
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/InternalCommandListener.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/InternalCommandListener.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/InternalCommandListener.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/InternalCommandListener.cpp Thu Oct 18 18:58:02 2012
@@ -38,18 +38,21 @@ InternalCommandListener::InternalCommand
////////////////////////////////////////////////////////////////////////////////
InternalCommandListener::~InternalCommandListener() {
- done = true;
- synchronized( &inboundQueue ) {
- inboundQueue.notifyAll();
- }
- this->join();
+ try {
+ done = true;
+ synchronized(&inboundQueue) {
+ inboundQueue.notifyAll();
+ }
+ this->join();
- inboundQueue.clear();
+ inboundQueue.clear();
+ }
+ AMQ_CATCHALL_NOTHROW()
}
////////////////////////////////////////////////////////////////////////////////
void InternalCommandListener::onCommand(const Pointer<Command> command) {
- synchronized( &inboundQueue ) {
+ synchronized(&inboundQueue) {
// Create a response now before the caller has a
// chance to destroy the command.
responseBuilder->buildIncomingCommands(command, inboundQueue);
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/mock/MockTransport.cpp Thu Oct 18 18:58:02 2012
@@ -90,11 +90,11 @@ void MockTransport::oneway(const Pointer
return;
}
}
- AMQ_CATCH_RETHROW( IOException)
- AMQ_CATCH_RETHROW( UnsupportedOperationException)
- AMQ_CATCH_EXCEPTION_CONVERT( ActiveMQException, IOException)
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, IOException)
- AMQ_CATCHALL_THROW( IOException)
+ AMQ_CATCH_RETHROW(IOException)
+ AMQ_CATCH_RETHROW(UnsupportedOperationException)
+ AMQ_CATCH_EXCEPTION_CONVERT(ActiveMQException, IOException)
+ AMQ_CATCH_EXCEPTION_CONVERT(Exception, IOException)
+ AMQ_CATCHALL_THROW(IOException)
}
////////////////////////////////////////////////////////////////////////////////
@@ -187,7 +187,6 @@ Pointer<Response> MockTransport::request
////////////////////////////////////////////////////////////////////////////////
void MockTransport::start() {
-
if (this->failOnStart) {
throw IOException(__FILE__, __LINE__, "Failed to Start MockTransport.");
}
@@ -195,7 +194,6 @@ void MockTransport::start() {
////////////////////////////////////////////////////////////////////////////////
void MockTransport::stop() {
-
if (this->failOnStop) {
throw IOException(__FILE__, __LINE__, "Failed to Stop MockTransport.");
}
@@ -203,7 +201,6 @@ void MockTransport::stop() {
////////////////////////////////////////////////////////////////////////////////
void MockTransport::close() {
-
if (this->failOnClose) {
throw IOException(__FILE__, __LINE__, "Failed to Close MockTransport.");
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/ActiveMQProperties.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/ActiveMQProperties.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/ActiveMQProperties.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/ActiveMQProperties.cpp Thu Oct 18 18:58:02 2012
@@ -31,26 +31,24 @@ ActiveMQProperties::~ActiveMQProperties(
}
////////////////////////////////////////////////////////////////////////////////
-void ActiveMQProperties::copy( const CMSProperties* source ){
+void ActiveMQProperties::copy(const CMSProperties* source) {
- if( source == NULL ) {
+ if (source == NULL) {
return;
}
properties.clear();
- std::vector< std::pair< std::string, std::string > > vec =
- source->toArray();
+ std::vector<std::pair<std::string, std::string> > vec = source->toArray();
- for( unsigned int ix=0; ix<vec.size(); ++ix ){
- properties.setProperty(vec[ix].first, vec[ix].second );
+ for (unsigned int ix = 0; ix < vec.size(); ++ix) {
+ properties.setProperty(vec[ix].first, vec[ix].second);
}
}
////////////////////////////////////////////////////////////////////////////////
-cms::CMSProperties* ActiveMQProperties::clone() const{
-
+cms::CMSProperties* ActiveMQProperties::clone() const {
ActiveMQProperties* props = new ActiveMQProperties();
- props->copy( this );
+ props->copy(this);
return props;
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/ActiveMQProperties.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/ActiveMQProperties.h?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/ActiveMQProperties.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/ActiveMQProperties.h Thu Oct 18 18:58:02 2012
@@ -25,8 +25,8 @@
#include <cms/CMSProperties.h>
#include <decaf/util/Properties.h>
-namespace activemq{
-namespace util{
+namespace activemq {
+namespace util {
/**
* Implementation of the CMSProperties interface that
@@ -34,7 +34,7 @@ namespace util{
*
* @since 2.0
*/
- class AMQCPP_API ActiveMQProperties : public cms::CMSProperties {
+ class AMQCPP_API ActiveMQProperties: public cms::CMSProperties {
private:
decaf::util::Properties properties;
@@ -53,7 +53,7 @@ namespace util{
return this->properties;
}
- virtual void setProperties( decaf::util::Properties& props ) {
+ virtual void setProperties(decaf::util::Properties& props) {
this->properties = props;
}
@@ -65,41 +65,39 @@ namespace util{
return properties.isEmpty();
}
- virtual const char* getProperty( const std::string& name ) const{
+ virtual const char* getProperty(const std::string& name) const {
return properties.getProperty(name);
}
- virtual std::string getProperty( const std::string& name,
- const std::string& defaultValue ) const {
- return properties.getProperty( name,defaultValue );
+ virtual std::string getProperty(const std::string& name, const std::string& defaultValue) const {
+ return properties.getProperty(name, defaultValue);
}
- virtual void setProperty( const std::string& name,
- const std::string& value ){
- properties.setProperty( name,value );
+ virtual void setProperty(const std::string& name, const std::string& value) {
+ properties.setProperty(name, value);
}
- virtual bool hasProperty( const std::string& name ) const {
+ virtual bool hasProperty(const std::string& name) const {
return properties.hasProperty(name);
}
- virtual std::string remove( const std::string& name ){
- return properties.remove( name );
+ virtual std::string remove(const std::string& name) {
+ return properties.remove(name);
}
virtual std::vector<std::string> propertyNames() const {
return properties.propertyNames();
}
- virtual std::vector< std::pair< std::string, std::string > > toArray() const{
+ virtual std::vector<std::pair<std::string, std::string> > toArray() const {
return properties.toArray();
}
- virtual void copy( const CMSProperties* source );
+ virtual void copy(const CMSProperties* source);
virtual CMSProperties* clone() const;
- virtual void clear(){
+ virtual void clear() {
properties.clear();
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.cpp Thu Oct 18 18:58:02 2012
@@ -35,50 +35,50 @@ CMSExceptionSupport::~CMSExceptionSuppor
}
////////////////////////////////////////////////////////////////////////////////
-CMSException CMSExceptionSupport::create( const std::string& msg, const Exception& cause ) {
+CMSException CMSExceptionSupport::create(const std::string& msg, const Exception& cause) {
- CMSException exception( msg, cause.clone() );
+ CMSException exception(msg, cause.clone());
return exception;
}
////////////////////////////////////////////////////////////////////////////////
-CMSException CMSExceptionSupport::create( const Exception& cause ) {
+CMSException CMSExceptionSupport::create(const Exception& cause) {
std::string msg = cause.getMessage();
- if( msg.length() == 0 ) {
+ if (msg.length() == 0) {
msg = typeid( &cause ).name();
}
- CMSException exception( msg, cause.clone() );
+ CMSException exception(msg, cause.clone());
return exception;
}
////////////////////////////////////////////////////////////////////////////////
-MessageEOFException CMSExceptionSupport::createMessageEOFException( const Exception& cause ) {
+MessageEOFException CMSExceptionSupport::createMessageEOFException(const Exception& cause) {
std::string msg = cause.getMessage();
- if( msg.length() == 0 ) {
+ if (msg.length() == 0) {
msg = typeid( &cause ).name();
}
- MessageEOFException exception( msg, cause.clone() );
+ MessageEOFException exception(msg, cause.clone());
return exception;
}
////////////////////////////////////////////////////////////////////////////////
-MessageFormatException CMSExceptionSupport::createMessageFormatException( const Exception& cause ) {
+MessageFormatException CMSExceptionSupport::createMessageFormatException(const Exception& cause) {
std::string msg = cause.getMessage();
- if( msg.length() == 0 ) {
+ if (msg.length() == 0) {
msg = typeid( &cause ).name();
}
- MessageFormatException exception( msg, cause.clone() );
+ MessageFormatException exception(msg, cause.clone());
return exception;
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CMSExceptionSupport.h Thu Oct 18 18:58:02 2012
@@ -51,13 +51,13 @@ namespace util {
virtual ~CMSExceptionSupport();
- static cms::CMSException create( const std::string& msg, const decaf::lang::Exception& cause );
+ static cms::CMSException create(const std::string& msg, const decaf::lang::Exception& cause);
- static cms::CMSException create( const decaf::lang::Exception& cause );
+ static cms::CMSException create(const decaf::lang::Exception& cause);
- static cms::MessageEOFException createMessageEOFException( const decaf::lang::Exception& cause );
+ static cms::MessageEOFException createMessageEOFException(const decaf::lang::Exception& cause);
- static cms::MessageFormatException createMessageFormatException( const decaf::lang::Exception& cause );
+ static cms::MessageFormatException createMessageFormatException(const decaf::lang::Exception& cause);
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CompositeData.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CompositeData.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CompositeData.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CompositeData.cpp Thu Oct 18 18:58:02 2012
@@ -41,20 +41,20 @@ URI CompositeData::toURI() const {
ostringstream sb;
- if( scheme != "" ) {
+ if (scheme != "") {
sb << scheme << ":";
}
- if( host.size() != 0) {
+ if (host.size() != 0) {
sb << host;
} else {
sb << "(";
bool firstTime = true;
- std::auto_ptr< Iterator<URI> > iter( components.iterator() );
+ std::auto_ptr<Iterator<URI> > iter(components.iterator());
- while( iter->hasNext() ) {
- if( firstTime == true ) {
+ while (iter->hasNext()) {
+ if (firstTime == true) {
sb << ",";
firstTime = false;
}
@@ -64,17 +64,17 @@ URI CompositeData::toURI() const {
sb << ")";
}
- if( path != "") {
+ if (path != "") {
sb << "/" << path;
}
- if( !parameters.isEmpty() ) {
- sb << "?" << URISupport::createQueryString( parameters );
+ if (!parameters.isEmpty()) {
+ sb << "?" << URISupport::createQueryString(parameters);
}
- if( fragment != "" ) {
+ if (fragment != "") {
sb << "#" << fragment;
}
- return URI( sb.str() );
+ return URI(sb.str());
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CompositeData.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CompositeData.h?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CompositeData.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/CompositeData.h Thu Oct 18 18:58:02 2012
@@ -58,7 +58,7 @@ namespace util {
return components;
}
- void setComponents( const LinkedList<URI>& components ) {
+ void setComponents(const LinkedList<URI>& components) {
this->components = components;
}
@@ -66,7 +66,7 @@ namespace util {
return fragment;
}
- void setFragment( const std::string& fragment ) {
+ void setFragment(const std::string& fragment) {
this->fragment = fragment;
}
@@ -74,7 +74,7 @@ namespace util {
return parameters;
}
- void setParameters( const Properties& parameters ) {
+ void setParameters(const Properties& parameters) {
this->parameters = parameters;
}
@@ -82,7 +82,7 @@ namespace util {
return scheme;
}
- void setScheme( const std::string& scheme ) {
+ void setScheme(const std::string& scheme) {
this->scheme = scheme;
}
@@ -90,7 +90,7 @@ namespace util {
return path;
}
- void setPath( const std::string& path ) {
+ void setPath(const std::string& path) {
this->path = path;
}
@@ -98,7 +98,7 @@ namespace util {
return host;
}
- void setHost( const std::string& host ) {
+ void setHost(const std::string& host) {
this->host = host;
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/IdGenerator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/IdGenerator.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/IdGenerator.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/IdGenerator.cpp Thu Oct 18 18:58:02 2012
@@ -58,14 +58,14 @@ namespace util {
try {
hostname = InetAddress::getLocalHost().getHostName();
- ServerSocket ss( 0 );
- stub = "-" + Long::toString( ss.getLocalPort() ) + "-" +
- Long::toString( System::currentTimeMillis() ) + "-";
- Thread::sleep( 100 );
+ ServerSocket ss(0);
+ stub = "-" + Long::toString(ss.getLocalPort()) +
+ "-" + Long::toString(System::currentTimeMillis()) + "-";
+ Thread::sleep(100);
ss.close();
- } catch( Exception& ioe ) {
+ } catch (Exception& ioe) {
hostname = "localhost";
- stub = "-1-" + Long::toString( System::currentTimeMillis() ) + "-";
+ stub = "-1-" + Long::toString(System::currentTimeMillis()) + "-";
}
UNIQUE_STUB = stub;
@@ -78,7 +78,7 @@ IdGenerator::IdGenerator() : prefix(), s
}
////////////////////////////////////////////////////////////////////////////////
-IdGenerator::IdGenerator( const std::string& prefix ) : prefix(prefix), seed(), sequence(0) {
+IdGenerator::IdGenerator(const std::string& prefix) : prefix(prefix), seed(), sequence(0) {
}
////////////////////////////////////////////////////////////////////////////////
@@ -90,39 +90,37 @@ std::string IdGenerator::generateId() co
std::string result;
- if( IdGenerator::kernel == NULL ) {
- throw RuntimeException( __FILE__, __LINE__, "Library is not initialized." );
+ if (IdGenerator::kernel == NULL) {
+ throw RuntimeException(__FILE__, __LINE__, "Library is not initialized.");
}
synchronized( &( IdGenerator::kernel->mutex ) ) {
- if( seed.empty() ) {
+ if (seed.empty()) {
- if( prefix.empty() ) {
- this->seed = std::string( "ID:" ) + IdGenerator::kernel->hostname +
- IdGenerator::kernel->UNIQUE_STUB +
- Long::toString( IdGenerator::kernel->instanceCount++ ) + ":";
+ if (prefix.empty()) {
+ this->seed = std::string("ID:") + IdGenerator::kernel->hostname + IdGenerator::kernel->UNIQUE_STUB
+ + Long::toString(IdGenerator::kernel->instanceCount++) + ":";
} else {
- this->seed = prefix + IdGenerator::kernel->UNIQUE_STUB +
- Long::toString( IdGenerator::kernel->instanceCount++ ) + ":";
+ this->seed = prefix + IdGenerator::kernel->UNIQUE_STUB + Long::toString(IdGenerator::kernel->instanceCount++) + ":";
}
}
- result = this->seed + Long::toString( this->sequence++ );
+ result = this->seed + Long::toString(this->sequence++);
}
return result;
}
////////////////////////////////////////////////////////////////////////////////
-std::string IdGenerator::getSeedFromId( const std::string& id ) {
+std::string IdGenerator::getSeedFromId(const std::string& id) {
std::string result = id;
- if( !id.empty() ) {
- std::size_t index = id.find_last_of( ':' );
- if( index != std::string::npos && ( index + 1 ) < id.length() ) {
- result = id.substr( 0, index + 1 );
+ if (!id.empty()) {
+ std::size_t index = id.find_last_of(':');
+ if (index != std::string::npos && (index + 1) < id.length()) {
+ result = id.substr(0, index + 1);
}
}
@@ -130,15 +128,15 @@ std::string IdGenerator::getSeedFromId(
}
////////////////////////////////////////////////////////////////////////////////
-long long IdGenerator::getSequenceFromId( const std::string& id ) {
+long long IdGenerator::getSequenceFromId(const std::string& id) {
long long result = -1;
- if( !id.empty() ) {
- std::size_t index = id.find_last_of( ':' );
- if( index != std::string::npos && ( index + 1 ) < id.length() ) {
- std::string numStr = id.substr( index + 1, id.length() );
- result = Long::parseLong( numStr );
+ if (!id.empty()) {
+ std::size_t index = id.find_last_of(':');
+ if (index != std::string::npos && (index + 1) < id.length()) {
+ std::string numStr = id.substr(index + 1, id.length());
+ result = Long::parseLong(numStr);
}
}
@@ -146,20 +144,20 @@ long long IdGenerator::getSequenceFromId
}
////////////////////////////////////////////////////////////////////////////////
-int IdGenerator::compare( const std::string& id1, const std::string& id2 ) {
+int IdGenerator::compare(const std::string& id1, const std::string& id2) {
int result = -1;
- std::string seed1 = IdGenerator::getSeedFromId( id1 );
- std::string seed2 = IdGenerator::getSeedFromId( id2 );
+ std::string seed1 = IdGenerator::getSeedFromId(id1);
+ std::string seed2 = IdGenerator::getSeedFromId(id2);
- if( !seed1.empty() && !seed2.empty() ) {
+ if (!seed1.empty() && !seed2.empty()) {
- result = apr_strnatcmp( seed1.c_str(), seed2.c_str() );
+ result = apr_strnatcmp(seed1.c_str(), seed2.c_str());
- if( result == 0 ) {
- long long count1 = IdGenerator::getSequenceFromId( id1 );
- long long count2 = IdGenerator::getSequenceFromId( id2 );
- result = (int)( count1 - count2 );
+ if (result == 0) {
+ long long count1 = IdGenerator::getSequenceFromId(id1);
+ long long count2 = IdGenerator::getSequenceFromId(id2);
+ result = (int) (count1 - count2);
}
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/IdGenerator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/IdGenerator.h?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/IdGenerator.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/IdGenerator.h Thu Oct 18 18:58:02 2012
@@ -41,14 +41,14 @@ namespace util {
private:
- IdGenerator( const IdGenerator& );
- IdGenerator& operator= ( const IdGenerator& );
+ IdGenerator(const IdGenerator&);
+ IdGenerator& operator=(const IdGenerator&);
public:
IdGenerator();
- IdGenerator( const std::string& prefix );
+ IdGenerator(const std::string& prefix);
virtual ~IdGenerator();
@@ -74,14 +74,14 @@ namespace util {
*
* @returns the seed portion of the Id, minus the count value.
*/
- static std::string getSeedFromId( const std::string& id );
+ static std::string getSeedFromId(const std::string& id);
/**
* Gets the count value from a Generated Id, the seed portion is removed.
*
* @returns the sequence count portion of the id, minus the seed value.
*/
- static long long getSequenceFromId( const std::string& id );
+ static long long getSequenceFromId(const std::string& id);
/**
* Compares two generated id values.
@@ -93,7 +93,7 @@ namespace util {
*
* @returns zero if ids are equal or positove if id1 > id2...
*/
- static int compare( const std::string& id1, const std::string& id2 );
+ static int compare(const std::string& id1, const std::string& id2);
private:
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/LongSequenceGenerator.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/LongSequenceGenerator.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/LongSequenceGenerator.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/LongSequenceGenerator.cpp Thu Oct 18 18:58:02 2012
@@ -27,9 +27,13 @@ LongSequenceGenerator::LongSequenceGener
}
////////////////////////////////////////////////////////////////////////////////
+LongSequenceGenerator::~LongSequenceGenerator() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
long long LongSequenceGenerator::getNextSequenceId() {
- synchronized( &mutex ) {
+ synchronized(&mutex) {
return this->lastSequenceId++;
}
@@ -39,7 +43,7 @@ long long LongSequenceGenerator::getNext
////////////////////////////////////////////////////////////////////////////////
long long LongSequenceGenerator::getLastSequenceId() {
- synchronized( &mutex ) {
+ synchronized(&mutex) {
return this->lastSequenceId;
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/LongSequenceGenerator.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/LongSequenceGenerator.h?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/LongSequenceGenerator.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/LongSequenceGenerator.h Thu Oct 18 18:58:02 2012
@@ -21,8 +21,8 @@
#include <activemq/util/Config.h>
#include <decaf/util/concurrent/Mutex.h>
-namespace activemq{
-namespace util{
+namespace activemq {
+namespace util {
/**
* This class is used to generate a sequence of long long values that
@@ -38,7 +38,7 @@ namespace util{
public:
LongSequenceGenerator();
- virtual ~LongSequenceGenerator() {}
+ virtual ~LongSequenceGenerator();
/**
* @returns the next id in the sequence.
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.cpp Thu Oct 18 18:58:02 2012
@@ -38,158 +38,153 @@ MarshallingSupport::~MarshallingSupport(
}
////////////////////////////////////////////////////////////////////////////////
-void MarshallingSupport::writeString( decaf::io::DataOutputStream& dataOut, const std::string& value ) {
+void MarshallingSupport::writeString(decaf::io::DataOutputStream& dataOut, const std::string& value) {
- try{
+ try {
- if( value.length() <= Short::MAX_VALUE / 4 ) {
- dataOut.write( PrimitiveValueNode::STRING_TYPE );
- MarshallingSupport::writeString16( dataOut, value );
+ if (value.length() <= Short::MAX_VALUE / 4) {
+ dataOut.write(PrimitiveValueNode::STRING_TYPE);
+ MarshallingSupport::writeString16(dataOut, value);
} else {
- dataOut.write( PrimitiveValueNode::BIG_STRING_TYPE );
- MarshallingSupport::writeString32( dataOut, value );
+ dataOut.write(PrimitiveValueNode::BIG_STRING_TYPE);
+ MarshallingSupport::writeString32(dataOut, value);
}
}
- AMQ_CATCH_RETHROW( decaf::io::IOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, decaf::io::IOException )
- AMQ_CATCHALL_THROW( decaf::io::IOException )
+ AMQ_CATCH_RETHROW(decaf::io::IOException)
+ AMQ_CATCH_EXCEPTION_CONVERT(Exception, decaf::io::IOException)
+ AMQ_CATCHALL_THROW(decaf::io::IOException)
}
////////////////////////////////////////////////////////////////////////////////
-void MarshallingSupport::writeString16( decaf::io::DataOutputStream& dataOut, const std::string& value ) {
+void MarshallingSupport::writeString16(decaf::io::DataOutputStream& dataOut, const std::string& value) {
- try{
+ try {
- int strSize = (int)value.length();
+ int strSize = (int) value.length();
- if( strSize > Short::MAX_VALUE ) {
- throw IOException(
- __FILE__, __LINE__,
- "String size exceeds Short::MAX_VALUE and cannot be sent via Openwire." );
+ if (strSize > Short::MAX_VALUE) {
+ throw IOException(__FILE__, __LINE__, "String size exceeds Short::MAX_VALUE and cannot be sent via Openwire.");
}
- dataOut.writeShort( (short)strSize );
- if( strSize > 0 ) {
- dataOut.write( (unsigned char*)value.c_str(), strSize, 0, strSize );
+ dataOut.writeShort((short) strSize);
+ if (strSize > 0) {
+ dataOut.write((unsigned char*) value.c_str(), strSize, 0, strSize);
}
}
- AMQ_CATCH_RETHROW( decaf::io::IOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, decaf::io::IOException )
- AMQ_CATCHALL_THROW( decaf::io::IOException )
+ AMQ_CATCH_RETHROW(decaf::io::IOException)
+ AMQ_CATCH_EXCEPTION_CONVERT(Exception, decaf::io::IOException)
+ AMQ_CATCHALL_THROW(decaf::io::IOException)
}
////////////////////////////////////////////////////////////////////////////////
-void MarshallingSupport::writeString32( decaf::io::DataOutputStream& dataOut, const std::string& value ) {
+void MarshallingSupport::writeString32(decaf::io::DataOutputStream& dataOut, const std::string& value) {
- try{
+ try {
- int strSize = (int)value.length();
+ int strSize = (int) value.length();
- if( strSize > Integer::MAX_VALUE ) {
- throw IOException(
- __FILE__, __LINE__,
- "String size exceeds Integer::MAX_VALUE and cannot be sent via Openwire." );
+ if (strSize > Integer::MAX_VALUE) {
+ throw IOException(__FILE__, __LINE__, "String size exceeds Integer::MAX_VALUE and cannot be sent via Openwire.");
}
- dataOut.writeInt( strSize );
- if( strSize > 0 ) {
- dataOut.write( (unsigned char*)value.c_str(), strSize, 0, strSize );
+ dataOut.writeInt(strSize);
+ if (strSize > 0) {
+ dataOut.write((unsigned char*) value.c_str(), strSize, 0, strSize);
}
}
- AMQ_CATCH_RETHROW( decaf::io::IOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, decaf::io::IOException )
- AMQ_CATCHALL_THROW( decaf::io::IOException )
+ AMQ_CATCH_RETHROW(decaf::io::IOException)
+ AMQ_CATCH_EXCEPTION_CONVERT(Exception, decaf::io::IOException)
+ AMQ_CATCHALL_THROW(decaf::io::IOException)
}
////////////////////////////////////////////////////////////////////////////////
-std::string MarshallingSupport::readString16( decaf::io::DataInputStream& dataIn ) {
+std::string MarshallingSupport::readString16(decaf::io::DataInputStream& dataIn) {
- try{
+ try {
int utfLength = dataIn.readShort();
- if( utfLength > 0 ) {
+ if (utfLength > 0) {
- std::vector<unsigned char> buffer( utfLength );
- dataIn.readFully( &buffer[0], utfLength );
- return std::string( (char*)( &buffer[0] ), utfLength );
+ std::vector<unsigned char> buffer(utfLength);
+ dataIn.readFully(&buffer[0], utfLength);
+ return std::string((char*) (&buffer[0]), utfLength);
}
return "";
}
- AMQ_CATCH_RETHROW( decaf::io::IOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, decaf::io::IOException )
- AMQ_CATCHALL_THROW( decaf::io::IOException )
+ AMQ_CATCH_RETHROW(decaf::io::IOException)
+ AMQ_CATCH_EXCEPTION_CONVERT(Exception, decaf::io::IOException)
+ AMQ_CATCHALL_THROW(decaf::io::IOException)
}
////////////////////////////////////////////////////////////////////////////////
-std::string MarshallingSupport::readString32( decaf::io::DataInputStream& dataIn ) {
+std::string MarshallingSupport::readString32(decaf::io::DataInputStream& dataIn) {
- try{
+ try {
int utfLength = dataIn.readInt();
- if( utfLength > 0 ) {
+ if (utfLength > 0) {
- std::vector<unsigned char> buffer( utfLength );
- dataIn.readFully( &buffer[0], utfLength );
- return std::string( (char*)( &buffer[0] ), utfLength );
+ std::vector<unsigned char> buffer(utfLength);
+ dataIn.readFully(&buffer[0], utfLength);
+ return std::string((char*) (&buffer[0]), utfLength);
}
return "";
}
- AMQ_CATCH_RETHROW( decaf::io::IOException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, decaf::io::IOException )
- AMQ_CATCHALL_THROW( decaf::io::IOException )
+ AMQ_CATCH_RETHROW(decaf::io::IOException)
+ AMQ_CATCH_EXCEPTION_CONVERT(Exception, decaf::io::IOException)
+ AMQ_CATCHALL_THROW(decaf::io::IOException)
}
////////////////////////////////////////////////////////////////////////////////
-std::string MarshallingSupport::asciiToModifiedUtf8( const std::string& asciiString ) {
+std::string MarshallingSupport::asciiToModifiedUtf8(const std::string& asciiString) {
try {
- if( asciiString.length() > 0 ) {
+ if (asciiString.length() > 0) {
int utfLength = 0;
std::size_t length = asciiString.length();
- for( std::size_t i = 0; i < length; ++i ) {
+ for (std::size_t i = 0; i < length; ++i) {
- unsigned int charValue = (unsigned char)asciiString.at( i );
+ unsigned int charValue = (unsigned char) asciiString.at(i);
// Written to allow for expansion to wide character strings at some
// point, as it stands now the value can never be > 255 since the
// string class returns a single byte char.
- if( charValue > 0 && charValue <= 127 ) {
+ if (charValue > 0 && charValue <= 127) {
utfLength++;
- } else if( charValue <= 2047 ) {
+ } else if (charValue <= 2047) {
utfLength += 2;
} else {
utfLength += 3;
}
}
- if( utfLength > Integer::MAX_VALUE ) {
- throw UTFDataFormatException(
- __FILE__, __LINE__,
- ( std::string( "MarshallingSupport::asciiToModifiedUtf8 - Cannot marshall " ) +
- "string utf8 encoding longer than: 2^31 bytes, supplied string utf8 encoding was: " +
- Integer::toString( (int)utfLength ) + " bytes long." ).c_str() );
+ if (utfLength > Integer::MAX_VALUE) {
+ throw UTFDataFormatException(__FILE__, __LINE__,
+ (std::string("MarshallingSupport::asciiToModifiedUtf8 - Cannot marshall ")
+ + "string utf8 encoding longer than: 2^31 bytes, supplied string utf8 encoding was: " + Integer::toString((int) utfLength)
+ + " bytes long.").c_str());
}
- std::string utfBytes( (std::size_t)utfLength, '\0' );
+ std::string utfBytes((std::size_t) utfLength, '\0');
unsigned int utfIndex = 0;
- for( std::size_t i = 0; i < length; i++ ) {
+ for (std::size_t i = 0; i < length; i++) {
- unsigned int charValue = (unsigned char)asciiString.at( i );
+ unsigned int charValue = (unsigned char) asciiString.at(i);
// Written to allow for expansion to wide character strings at some
// point, as it stands now the value can never be > 255 since the
// string class returns a single byte char.
- if( charValue > 0 && charValue <= 127 ) {
- utfBytes[utfIndex++] = (char)charValue;
- } else if( charValue <= 2047 ) {
- utfBytes[utfIndex++] = (char)(0xc0 | (0x1f & (charValue >> 6)));
- utfBytes[utfIndex++] = (char)(0x80 | (0x3f & charValue));
+ if (charValue > 0 && charValue <= 127) {
+ utfBytes[utfIndex++] = (char) charValue;
+ } else if (charValue <= 2047) {
+ utfBytes[utfIndex++] = (char) (0xc0 | (0x1f & (charValue >> 6)));
+ utfBytes[utfIndex++] = (char) (0x80 | (0x3f & charValue));
} else {
- utfBytes[utfIndex++] = (char)(0xe0 | (0x0f & (charValue >> 12)));
- utfBytes[utfIndex++] = (char)(0x80 | (0x3f & (charValue >> 6)));
- utfBytes[utfIndex++] = (char)(0x80 | (0x3f & charValue));
+ utfBytes[utfIndex++] = (char) (0xe0 | (0x0f & (charValue >> 12)));
+ utfBytes[utfIndex++] = (char) (0x80 | (0x3f & (charValue >> 6)));
+ utfBytes[utfIndex++] = (char) (0x80 | (0x3f & charValue));
}
}
@@ -198,68 +193,58 @@ std::string MarshallingSupport::asciiToM
return "";
}
}
- AMQ_CATCH_RETHROW( decaf::io::UTFDataFormatException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, decaf::io::UTFDataFormatException )
- AMQ_CATCHALL_THROW( decaf::io::UTFDataFormatException )
+ AMQ_CATCH_RETHROW(decaf::io::UTFDataFormatException)
+ AMQ_CATCH_EXCEPTION_CONVERT(Exception, decaf::io::UTFDataFormatException)
+ AMQ_CATCHALL_THROW(decaf::io::UTFDataFormatException)
}
////////////////////////////////////////////////////////////////////////////////
-std::string MarshallingSupport::modifiedUtf8ToAscii( const std::string modifiedUtf8String ) {
+std::string MarshallingSupport::modifiedUtf8ToAscii(const std::string modifiedUtf8String) {
try {
std::size_t utfLength = modifiedUtf8String.length();
- if( utfLength == 0 ) {
+ if (utfLength == 0) {
return "";
}
- std::vector<unsigned char> result( utfLength );
+ std::vector<unsigned char> result(utfLength);
std::size_t count = 0;
std::size_t index = 0;
unsigned char a = 0;
- while( count < utfLength ) {
- if( ( result[index] = modifiedUtf8String[count++] ) < 0x80 ) {
+ while (count < utfLength) {
+ if ((result[index] = modifiedUtf8String[count++]) < 0x80) {
index++;
- } else if( ( ( a = result[index] ) & 0xE0 ) == 0xC0 ) {
- if( count >= utfLength ) {
- throw UTFDataFormatException(
- __FILE__, __LINE__,
- "Invalid UTF-8 encoding found, start of two byte char found at end.");
+ } else if (((a = result[index]) & 0xE0) == 0xC0) {
+ if (count >= utfLength) {
+ throw UTFDataFormatException(__FILE__, __LINE__, "Invalid UTF-8 encoding found, start of two byte char found at end.");
}
unsigned char b = modifiedUtf8String[count++];
- if( ( b & 0xC0 ) != 0x80 ) {
- throw UTFDataFormatException(
- __FILE__, __LINE__,
- "Invalid UTF-8 encoding found, byte two does not start with 0x80." );
+ if ((b & 0xC0) != 0x80) {
+ throw UTFDataFormatException(__FILE__, __LINE__, "Invalid UTF-8 encoding found, byte two does not start with 0x80.");
}
// 2-byte UTF8 encoding: 110X XXxx 10xx xxxx
// Bits set at 'X' means we have encountered a UTF8 encoded value
// greater than 255, which is not supported.
- if( a & 0x1C ) {
- throw UTFDataFormatException(
- __FILE__, __LINE__,
- "Invalid 2 byte UTF-8 encoding found, "
- "This method only supports encoded ASCII values of (0-255)." );
+ if (a & 0x1C) {
+ throw UTFDataFormatException(__FILE__, __LINE__, "Invalid 2 byte UTF-8 encoding found, "
+ "This method only supports encoded ASCII values of (0-255).");
}
- result[index++] = (unsigned char)( ( ( a & 0x1F ) << 6 ) | ( b & 0x3F ) );
+ result[index++] = (unsigned char) (((a & 0x1F) << 6) | (b & 0x3F));
- } else if( ( a & 0xF0 ) == 0xE0 ) {
+ } else if ((a & 0xF0) == 0xE0) {
- if( count + 1 >= utfLength ) {
- throw UTFDataFormatException(
- __FILE__, __LINE__,
- "Invalid UTF-8 encoding found, start of three byte char found at end.");
+ if (count + 1 >= utfLength) {
+ throw UTFDataFormatException(__FILE__, __LINE__, "Invalid UTF-8 encoding found, start of three byte char found at end.");
} else {
- throw UTFDataFormatException(
- __FILE__, __LINE__,
- "Invalid 3 byte UTF-8 encoding found, "
- "This method only supports encoded ASCII values of (0-255)." );
+ throw UTFDataFormatException(__FILE__, __LINE__, "Invalid 3 byte UTF-8 encoding found, "
+ "This method only supports encoded ASCII values of (0-255).");
}
// If we were to support multibyte strings in the future this would be
@@ -277,14 +262,13 @@ std::string MarshallingSupport::modified
// ( ( b & 0x3F ) << 6 ) | ( c & 0x3F );
} else {
- throw UTFDataFormatException(
- __FILE__, __LINE__, "Invalid UTF-8 encoding found, aborting.");
+ throw UTFDataFormatException(__FILE__, __LINE__, "Invalid UTF-8 encoding found, aborting.");
}
}
- return std::string( (char*)( &result[0] ), index );
+ return std::string((char*) (&result[0]), index);
}
- AMQ_CATCH_RETHROW( decaf::io::UTFDataFormatException )
- AMQ_CATCH_EXCEPTION_CONVERT( Exception, decaf::io::UTFDataFormatException )
- AMQ_CATCHALL_THROW( decaf::io::UTFDataFormatException )
+ AMQ_CATCH_RETHROW(decaf::io::UTFDataFormatException)
+ AMQ_CATCH_EXCEPTION_CONVERT(Exception, decaf::io::UTFDataFormatException)
+ AMQ_CATCHALL_THROW(decaf::io::UTFDataFormatException)
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.h?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MarshallingSupport.h Thu Oct 18 18:58:02 2012
@@ -51,7 +51,7 @@ namespace util {
*
* @throws IOException if an I/O error occurs while writing the string.
*/
- static void writeString( decaf::io::DataOutputStream& dataOut, const std::string& value );
+ static void writeString(decaf::io::DataOutputStream& dataOut, const std::string& value);
/**
* Write the string object to the given DataOutputStream as Raw bytes, no string
@@ -66,7 +66,7 @@ namespace util {
*
* @throws IOException if an I/O error occurs while writing the string.
*/
- static void writeString16( decaf::io::DataOutputStream& dataOut, const std::string& value );
+ static void writeString16(decaf::io::DataOutputStream& dataOut, const std::string& value);
/**
* Write the string object to the given DataOutputStream as Raw bytes, no string
@@ -81,7 +81,7 @@ namespace util {
*
* @throws IOException if an I/O error occurs while writing the string.
*/
- static void writeString32( decaf::io::DataOutputStream& dataOut, const std::string& value );
+ static void writeString32(decaf::io::DataOutputStream& dataOut, const std::string& value);
/**
* Reads an Openwire encoded string from the provided DataInputStream. No string
@@ -98,7 +98,7 @@ namespace util {
*
* @throws IOException if an I/O error occurs while writing the string.
*/
- static std::string readString16( decaf::io::DataInputStream& dataIn );
+ static std::string readString16(decaf::io::DataInputStream& dataIn);
/**
* Reads an Openwire encoded string from the provided DataInputStream. No string
@@ -115,9 +115,10 @@ namespace util {
*
* @throws IOException if an I/O error occurs while writing the string.
*/
- static std::string readString32( decaf::io::DataInputStream& dataIn );
+ static std::string readString32(decaf::io::DataInputStream& dataIn);
- public: // Static Utility Methods.
+ public:
+ // Static Utility Methods.
/**
* Given an ASCII String with byte values [0..255] convert the string to a
@@ -133,7 +134,7 @@ namespace util {
* @throws UTFDataFormatException if the length of the encoded string would exceed the
* size of an signed integer.
*/
- static std::string asciiToModifiedUtf8( const std::string& asciiString );
+ static std::string asciiToModifiedUtf8(const std::string& asciiString);
/**
* Given a string that contains bytes in the Java Modified UTF-8 format convert
@@ -150,7 +151,7 @@ namespace util {
* @throws UTFDataFormatException if the provided string contains invalid data or the
* character values encoded in the string exceed ASCII value 255.
*/
- static std::string modifiedUtf8ToAscii( const std::string modifiedUtf8String );
+ static std::string modifiedUtf8ToAscii(const std::string modifiedUtf8String);
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MemoryUsage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MemoryUsage.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MemoryUsage.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MemoryUsage.cpp Thu Oct 18 18:58:02 2012
@@ -29,7 +29,7 @@ MemoryUsage::MemoryUsage() : limit(0), u
}
////////////////////////////////////////////////////////////////////////////////
-MemoryUsage::MemoryUsage( unsigned long long limit ) : limit(limit), usage(), mutex() {
+MemoryUsage::MemoryUsage(unsigned long long limit) : limit(limit), usage(), mutex() {
}
////////////////////////////////////////////////////////////////////////////////
@@ -39,43 +39,43 @@ MemoryUsage::~MemoryUsage() {
////////////////////////////////////////////////////////////////////////////////
void MemoryUsage::waitForSpace() {
- synchronized( &mutex ) {
- while( this->isFull() ) {
+ synchronized(&mutex) {
+ while (this->isFull()) {
mutex.wait();
}
}
}
////////////////////////////////////////////////////////////////////////////////
-void MemoryUsage::waitForSpace( unsigned int timeout ) {
+void MemoryUsage::waitForSpace(unsigned int timeout) {
- if( this->isFull() ) {
- synchronized( &mutex ) {
- mutex.wait( timeout );
+ if (this->isFull()) {
+ synchronized(&mutex) {
+ mutex.wait(timeout);
}
}
}
////////////////////////////////////////////////////////////////////////////////
-void MemoryUsage::increaseUsage( unsigned long long value ) {
+void MemoryUsage::increaseUsage(unsigned long long value) {
- if( value == 0 ) {
+ if (value == 0) {
return;
}
- synchronized( &mutex ) {
+ synchronized(&mutex) {
this->usage += value;
}
}
////////////////////////////////////////////////////////////////////////////////
-void MemoryUsage::decreaseUsage( unsigned long long value ) {
+void MemoryUsage::decreaseUsage(unsigned long long value) {
- if( value == 0 ) {
+ if (value == 0) {
return;
}
- synchronized( &mutex ) {
+ synchronized(&mutex) {
value > this->usage ? this->usage = 0 : this->usage -= value;
mutex.notifyAll();
}
@@ -85,7 +85,7 @@ void MemoryUsage::decreaseUsage( unsigne
bool MemoryUsage::isFull() const {
bool result = false;
- synchronized( &mutex ) {
+ synchronized(&mutex) {
result = this->usage >= this->limit;
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MemoryUsage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MemoryUsage.h?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MemoryUsage.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/MemoryUsage.h Thu Oct 18 18:58:02 2012
@@ -48,7 +48,7 @@ namespace util {
* Creates an instance of an Usage monitor with a set limit.
* @param limit - amount of memory this manager allows.
*/
- MemoryUsage( unsigned long long limit );
+ MemoryUsage(unsigned long long limit);
virtual ~MemoryUsage();
@@ -62,14 +62,14 @@ namespace util {
* when the given time span in milliseconds elapses.
* @param timeout The time to wait for more space.
*/
- virtual void waitForSpace( unsigned int timeout );
+ virtual void waitForSpace(unsigned int timeout);
/**
* Tries to increase the usage by value amount but blocks if this object is
* currently full.
* @param value Amount of usage in bytes to add.
*/
- virtual void enqueueUsage( unsigned long long value ) {
+ virtual void enqueueUsage(unsigned long long value) {
waitForSpace();
increaseUsage(value);
}
@@ -78,13 +78,13 @@ namespace util {
* Increases the usage by the value amount
* @param value Amount of usage to add.
*/
- virtual void increaseUsage( unsigned long long value );
+ virtual void increaseUsage(unsigned long long value);
/**
* Decreases the usage by the value amount.
* @param value Amount of space to return to the pool
*/
- virtual void decreaseUsage( unsigned long long value );
+ virtual void decreaseUsage(unsigned long long value);
/**
* Returns true if this Usage instance is full, i.e. Usage >= 100%
@@ -103,7 +103,7 @@ namespace util {
* Sets the current usage amount
* @param usage - The amount to tag as used.
*/
- void setUsage( unsigned long long usage ) {
+ void setUsage(unsigned long long usage) {
this->usage = usage;
}
@@ -119,7 +119,7 @@ namespace util {
* Sets the current limit amount
* @param limit - The amount that can be used before full.
*/
- void setLimit( unsigned long long limit ) {
+ void setLimit(unsigned long long limit) {
this->limit = limit;
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveList.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveList.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveList.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveList.cpp Thu Oct 18 18:58:02 2012
@@ -52,9 +52,8 @@ std::string PrimitiveList::toString() co
stream << "Begin Class PrimitiveList:" << std::endl;
- for( int i = 0; i < this->size(); ++i ) {
- stream << "list[" << i << "] = "
- << this->get( i ).toString() << std::endl;
+ for (int i = 0; i < this->size(); ++i) {
+ stream << "list[" << i << "] = " << this->get(i).toString() << std::endl;
}
stream << "End Class PrimitiveList:" << std::endl;
@@ -63,161 +62,161 @@ std::string PrimitiveList::toString() co
}
////////////////////////////////////////////////////////////////////////////////
-bool PrimitiveList::getBool( int index ) const {
+bool PrimitiveList::getBool(int index) const {
- PrimitiveValueNode node = this->get( index );
- return converter.convert<bool>( node );
+ PrimitiveValueNode node = this->get(index);
+ return converter.convert<bool>(node);
}
////////////////////////////////////////////////////////////////////////////////
-void PrimitiveList::setBool( int index, bool value ) {
+void PrimitiveList::setBool(int index, bool value) {
PrimitiveValueNode node;
- node.setBool( value );
+ node.setBool(value);
- this->set( index, node );
+ this->set(index, node);
}
////////////////////////////////////////////////////////////////////////////////
-unsigned char PrimitiveList::getByte( int index ) const {
+unsigned char PrimitiveList::getByte(int index) const {
- PrimitiveValueNode node = this->get( index );
- return converter.convert<unsigned char>( node );
+ PrimitiveValueNode node = this->get(index);
+ return converter.convert<unsigned char>(node);
}
////////////////////////////////////////////////////////////////////////////////
-void PrimitiveList::setByte( int index, unsigned char value ) {
+void PrimitiveList::setByte(int index, unsigned char value) {
PrimitiveValueNode node;
- node.setByte( value );
+ node.setByte(value);
- this->set( index, node );
+ this->set(index, node);
}
////////////////////////////////////////////////////////////////////////////////
-char PrimitiveList::getChar( int index ) const {
+char PrimitiveList::getChar(int index) const {
- PrimitiveValueNode node = this->get( index );
- return converter.convert<char>( node );
+ PrimitiveValueNode node = this->get(index);
+ return converter.convert<char>(node);
}
////////////////////////////////////////////////////////////////////////////////
-void PrimitiveList::setChar( int index, char value ) {
+void PrimitiveList::setChar(int index, char value) {
PrimitiveValueNode node;
- node.setChar( value );
+ node.setChar(value);
- this->set( index, node );
+ this->set(index, node);
}
////////////////////////////////////////////////////////////////////////////////
-short PrimitiveList::getShort( int index ) const {
+short PrimitiveList::getShort(int index) const {
- PrimitiveValueNode node = this->get( index );
- return converter.convert<short>( node );
+ PrimitiveValueNode node = this->get(index);
+ return converter.convert<short>(node);
}
////////////////////////////////////////////////////////////////////////////////
-void PrimitiveList::setShort( int index, short value ) {
+void PrimitiveList::setShort(int index, short value) {
PrimitiveValueNode node;
- node.setShort( value );
+ node.setShort(value);
- this->set( index, node );
+ this->set(index, node);
}
////////////////////////////////////////////////////////////////////////////////
-int PrimitiveList::getInt( int index ) const {
+int PrimitiveList::getInt(int index) const {
- PrimitiveValueNode node = this->get( index );
- return converter.convert<int>( node );
+ PrimitiveValueNode node = this->get(index);
+ return converter.convert<int>(node);
}
////////////////////////////////////////////////////////////////////////////////
-void PrimitiveList::setInt( int index, int value ) {
+void PrimitiveList::setInt(int index, int value) {
PrimitiveValueNode node;
- node.setInt( value );
+ node.setInt(value);
- this->set( index, node );
+ this->set(index, node);
}
////////////////////////////////////////////////////////////////////////////////
-long long PrimitiveList::getLong( int index ) const {
+long long PrimitiveList::getLong(int index) const {
- PrimitiveValueNode node = this->get( index );
- return converter.convert<long long>( node );
+ PrimitiveValueNode node = this->get(index);
+ return converter.convert<long long>(node);
}
////////////////////////////////////////////////////////////////////////////////
-void PrimitiveList::setLong( int index, long long value ) {
+void PrimitiveList::setLong(int index, long long value) {
PrimitiveValueNode node;
- node.setLong( value );
+ node.setLong(value);
- this->set( index, node );
+ this->set(index, node);
}
////////////////////////////////////////////////////////////////////////////////
-double PrimitiveList::getDouble( int index ) const {
+double PrimitiveList::getDouble(int index) const {
- PrimitiveValueNode node = this->get( index );
- return converter.convert<double>( node );
+ PrimitiveValueNode node = this->get(index);
+ return converter.convert<double>(node);
}
////////////////////////////////////////////////////////////////////////////////
-void PrimitiveList::setDouble( int index, double value ) {
+void PrimitiveList::setDouble(int index, double value) {
PrimitiveValueNode node;
- node.setDouble( value );
+ node.setDouble(value);
- this->set( index, node );
+ this->set(index, node);
}
////////////////////////////////////////////////////////////////////////////////
-float PrimitiveList::getFloat( int index ) const {
+float PrimitiveList::getFloat(int index) const {
- PrimitiveValueNode node = this->get( index );
- return converter.convert<float>( node );
+ PrimitiveValueNode node = this->get(index);
+ return converter.convert<float>(node);
}
////////////////////////////////////////////////////////////////////////////////
-void PrimitiveList::setFloat( int index, float value ) {
+void PrimitiveList::setFloat(int index, float value) {
PrimitiveValueNode node;
- node.setFloat( value );
+ node.setFloat(value);
- this->set( index, node );
+ this->set(index, node);
}
////////////////////////////////////////////////////////////////////////////////
-string PrimitiveList::getString( int index ) const {
+string PrimitiveList::getString(int index) const {
- PrimitiveValueNode node = this->get( index );
- return converter.convert<std::string>( node );
+ PrimitiveValueNode node = this->get(index);
+ return converter.convert<std::string>(node);
}
////////////////////////////////////////////////////////////////////////////////
-void PrimitiveList::setString( int index, const string& value ) {
+void PrimitiveList::setString(int index, const string& value) {
PrimitiveValueNode node;
- node.setString( value );
+ node.setString(value);
- this->set( index, node );
+ this->set(index, node);
}
////////////////////////////////////////////////////////////////////////////////
-std::vector<unsigned char> PrimitiveList::getByteArray( int index ) const {
+std::vector<unsigned char> PrimitiveList::getByteArray(int index) const {
- PrimitiveValueNode node = this->get( index );
- return converter.convert< std::vector<unsigned char> >( node );
+ PrimitiveValueNode node = this->get(index);
+ return converter.convert<std::vector<unsigned char> >(node);
}
////////////////////////////////////////////////////////////////////////////////
-void PrimitiveList::setByteArray( int index, const std::vector<unsigned char>& value ) {
+void PrimitiveList::setByteArray(int index, const std::vector<unsigned char>& value) {
PrimitiveValueNode node;
- node.setByteArray( value );
+ node.setByteArray(value);
- this->set( index, node );
+ this->set(index, node);
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveList.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveList.h?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveList.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveList.h Thu Oct 18 18:58:02 2012
@@ -51,13 +51,13 @@ namespace util{
* Copy Constructor
* @param src - the Decaf List of PrimtiveNodeValues to copy
*/
- PrimitiveList( const decaf::util::List<PrimitiveValueNode>& src );
+ PrimitiveList(const decaf::util::List<PrimitiveValueNode>& src);
/**
* Copy Constructor
* @param src - the PrimitiveList to copy
*/
- PrimitiveList( const PrimitiveList& src );
+ PrimitiveList(const PrimitiveList& src);
/**
* Converts the contents into a formatted string that can be output
@@ -74,7 +74,7 @@ namespace util{
* @throw UnsupportedOperationException if the type at index is not of the
* type that this method is to return or can convert to.
*/
- virtual bool getBool( int index ) const;
+ virtual bool getBool(int index) const;
/**
* Sets the value at the given index to the new value specified,
@@ -85,7 +85,7 @@ namespace util{
* @param value - the new value to assign to the element at index
* @throw IndexOutOfBoundsException if index > size().
*/
- virtual void setBool( int index, bool value );
+ virtual void setBool(int index, bool value);
/**
* Gets the Byte value at the specified index.
@@ -95,7 +95,7 @@ namespace util{
* @throw UnsupportedOperationException if the type at index is not of the
* type that this method is to return or can convert to.
*/
- virtual unsigned char getByte( int index ) const;
+ virtual unsigned char getByte(int index) const;
/**
* Sets the value at the given index to the new value specified,
@@ -106,7 +106,7 @@ namespace util{
* @param value - the new value to assign to the element at index
* @throw IndexOutOfBoundsException if index > size().
*/
- virtual void setByte( int index, unsigned char value );
+ virtual void setByte(int index, unsigned char value);
/**
* Gets the Character value at the specified index.
@@ -116,7 +116,7 @@ namespace util{
* @throw UnsupportedOperationException if the type at index is not of the
* type that this method is to return or can convert to.
*/
- virtual char getChar( int index ) const;
+ virtual char getChar(int index) const;
/**
* Sets the value at the given index to the new value specified,
@@ -127,7 +127,7 @@ namespace util{
* @param value - the new value to assign to the element at index
* @throw IndexOutOfBoundsException if index > size().
*/
- virtual void setChar( int index, char value );
+ virtual void setChar(int index, char value);
/**
* Gets the Short value at the specified index.
@@ -137,7 +137,7 @@ namespace util{
* @throw UnsupportedOperationException if the type at index is not of the
* type that this method is to return or can convert to.
*/
- virtual short getShort( int index ) const;
+ virtual short getShort(int index) const;
/**
* Sets the value at the given index to the new value specified,
@@ -148,7 +148,7 @@ namespace util{
* @param value - the new value to assign to the element at index
* @throw IndexOutOfBoundsException if index > size().
*/
- virtual void setShort( int index, short value );
+ virtual void setShort(int index, short value);
/**
* Gets the Integer value at the specified index.
@@ -158,7 +158,7 @@ namespace util{
* @throw UnsupportedOperationException if the type at index is not of the
* type that this method is to return or can convert to.
*/
- virtual int getInt( int index ) const;
+ virtual int getInt(int index) const;
/**
* Sets the value at the given index to the new value specified,
@@ -169,7 +169,7 @@ namespace util{
* @param value - the new value to assign to the element at index
* @throw IndexOutOfBoundsException if index > size().
*/
- virtual void setInt( int index, int value );
+ virtual void setInt(int index, int value);
/**
* Gets the Long value at the specified index.
@@ -179,7 +179,7 @@ namespace util{
* @throw UnsupportedOperationException if the type at index is not of the
* type that this method is to return or can convert to.
*/
- virtual long long getLong( int index ) const;
+ virtual long long getLong(int index) const;
/**
* Sets the value at the given index to the new value specified,
@@ -190,7 +190,7 @@ namespace util{
* @param value - the new value to assign to the element at index
* @throw IndexOutOfBoundsException if index > size().
*/
- virtual void setLong( int index, long long value );
+ virtual void setLong(int index, long long value);
/**
* Gets the Float value at the specified index.
@@ -200,7 +200,7 @@ namespace util{
* @throw UnsupportedOperationException if the type at index is not of the
* type that this method is to return or can convert to.
*/
- virtual float getFloat( int index ) const;
+ virtual float getFloat(int index) const;
/**
* Sets the value at the given index to the new value specified,
@@ -211,7 +211,7 @@ namespace util{
* @param value - the new value to assign to the element at index
* @throw IndexOutOfBoundsException if index > size().
*/
- virtual void setFloat( int index, float value );
+ virtual void setFloat(int index, float value);
/**
* Gets the Double value at the specified index.
@@ -221,7 +221,7 @@ namespace util{
* @throw UnsupportedOperationException if the type at index is not of the
* type that this method is to return or can convert to.
*/
- virtual double getDouble( int index ) const;
+ virtual double getDouble(int index) const;
/**
* Sets the value at the given index to the new value specified,
@@ -232,7 +232,7 @@ namespace util{
* @param value - the new value to assign to the element at index
* @throw IndexOutOfBoundsException if index > size().
*/
- virtual void setDouble( int index, double value );
+ virtual void setDouble(int index, double value);
/**
* Gets the String value at the specified index.
@@ -242,7 +242,7 @@ namespace util{
* @throw UnsupportedOperationException if the type at index is not of the
* type that this method is to return or can convert to.
*/
- virtual std::string getString( int index ) const;
+ virtual std::string getString(int index) const;
/**
* Sets the value at the given index to the new value specified,
@@ -253,7 +253,7 @@ namespace util{
* @param value - the new value to assign to the element at index
* @throw IndexOutOfBoundsException if index > size().
*/
- virtual void setString( int index, const std::string& value );
+ virtual void setString(int index, const std::string& value);
/**
* Gets the Byte Array value at the specified index.
@@ -263,7 +263,7 @@ namespace util{
* @throw UnsupportedOperationException if the type at index is not of the
* type that this method is to return or can convert to.
*/
- virtual std::vector<unsigned char> getByteArray( int index ) const;
+ virtual std::vector<unsigned char> getByteArray(int index) const;
/**
* Sets the value at the given index to the new value specified,
@@ -274,7 +274,7 @@ namespace util{
* @param value - the new value to assign to the element at index
* @throw IndexOutOfBoundsException if index > size().
*/
- virtual void setByteArray( int index, const std::vector<unsigned char>& value );
+ virtual void setByteArray(int index, const std::vector<unsigned char>& value);
};
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.h?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.h Thu Oct 18 18:58:02 2012
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-#ifndef ACTIVEMQ_UTIL_PRIMITIVEMAP_H_
-#define ACTIVEMQ_UTIL_PRIMITIVEMAP_H_
+#ifndef _ACTIVEMQ_UTIL_PRIMITIVEMAP_H_
+#define _ACTIVEMQ_UTIL_PRIMITIVEMAP_H_
#include <string>
#include <vector>
@@ -291,4 +291,4 @@ namespace util {
}}
-#endif /*ACTIVEMQ_UTIL_PRIMITIVEMAP_H_*/
+#endif /*_ACTIVEMQ_UTIL_PRIMITIVEMAP_H_*/
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveValueConverter.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveValueConverter.cpp?rev=1399781&r1=1399780&r2=1399781&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveValueConverter.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveValueConverter.cpp Thu Oct 18 18:58:02 2012
@@ -26,12 +26,12 @@
#include <decaf/lang/Float.h>
#include <decaf/lang/Double.h>
-namespace activemq{
-namespace util{
+using namespace activemq;
+using namespace activemq::util;
////////////////////////////////////////////////////////////////////////////////
template<>
-bool PrimitiveValueConverter::convert( const PrimitiveValueNode& value ) const {
+bool PrimitiveValueConverter::convert(const PrimitiveValueNode& value) const {
switch( value.getType() ) {
case PrimitiveValueNode::BOOLEAN_TYPE:
@@ -51,7 +51,7 @@ bool PrimitiveValueConverter::convert( c
////////////////////////////////////////////////////////////////////////////////
template<>
-unsigned char PrimitiveValueConverter::convert( const PrimitiveValueNode& value ) const {
+unsigned char PrimitiveValueConverter::convert(const PrimitiveValueNode& value) const {
switch( value.getType() ) {
case PrimitiveValueNode::BYTE_TYPE:
@@ -71,7 +71,7 @@ unsigned char PrimitiveValueConverter::c
////////////////////////////////////////////////////////////////////////////////
template<>
-char PrimitiveValueConverter::convert( const PrimitiveValueNode& value ) const {
+char PrimitiveValueConverter::convert(const PrimitiveValueNode& value) const {
switch( value.getType() ) {
case PrimitiveValueNode::CHAR_TYPE:
@@ -91,7 +91,7 @@ char PrimitiveValueConverter::convert( c
////////////////////////////////////////////////////////////////////////////////
template<>
-short PrimitiveValueConverter::convert( const PrimitiveValueNode& value ) const {
+short PrimitiveValueConverter::convert(const PrimitiveValueNode& value) const {
switch( value.getType() ) {
case PrimitiveValueNode::BYTE_TYPE:
@@ -113,7 +113,7 @@ short PrimitiveValueConverter::convert(
////////////////////////////////////////////////////////////////////////////////
template<>
-int PrimitiveValueConverter::convert( const PrimitiveValueNode& value ) const {
+int PrimitiveValueConverter::convert(const PrimitiveValueNode& value) const {
switch( value.getType() ) {
case PrimitiveValueNode::BYTE_TYPE:
@@ -137,7 +137,7 @@ int PrimitiveValueConverter::convert( co
////////////////////////////////////////////////////////////////////////////////
template<>
-long long PrimitiveValueConverter::convert( const PrimitiveValueNode& value ) const {
+long long PrimitiveValueConverter::convert(const PrimitiveValueNode& value) const {
switch( value.getType() ) {
case PrimitiveValueNode::BYTE_TYPE:
@@ -163,7 +163,7 @@ long long PrimitiveValueConverter::conve
////////////////////////////////////////////////////////////////////////////////
template<>
-float PrimitiveValueConverter::convert( const PrimitiveValueNode& value ) const {
+float PrimitiveValueConverter::convert(const PrimitiveValueNode& value) const {
switch( value.getType() ) {
case PrimitiveValueNode::FLOAT_TYPE:
@@ -183,7 +183,7 @@ float PrimitiveValueConverter::convert(
////////////////////////////////////////////////////////////////////////////////
template<>
-double PrimitiveValueConverter::convert( const PrimitiveValueNode& value ) const {
+double PrimitiveValueConverter::convert(const PrimitiveValueNode& value) const {
switch( value.getType() ) {
case PrimitiveValueNode::FLOAT_TYPE:
@@ -205,7 +205,7 @@ double PrimitiveValueConverter::convert(
////////////////////////////////////////////////////////////////////////////////
template<>
-std::string PrimitiveValueConverter::convert( const PrimitiveValueNode& value ) const {
+std::string PrimitiveValueConverter::convert(const PrimitiveValueNode& value) const {
switch( value.getType() ) {
case PrimitiveValueNode::NULL_TYPE:
@@ -248,4 +248,3 @@ std::vector<unsigned char> PrimitiveValu
}
}
-}}