activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1050636 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/examples: ./ advisories/ cmstemplate/ consumers/ producers/ topics/chat/
Date Sat, 18 Dec 2010 13:29:40 GMT
Author: tabish
Date: Sat Dec 18 13:29:40 2010
New Revision: 1050636

URL: http://svn.apache.org/viewvc?rev=1050636&view=rev
Log:
Clean up the examples a bit.
Fix a bunch of warnings that get shown with various versions of GCC especially if you turn
on -Weffc++

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryConsumer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryConsumer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/TempDestinationAdvisoryConsumer.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate/CMSTemplateReceiver.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/consumers/SimpleAsyncConsumer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/main.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryConsumer.cpp?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryConsumer.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryConsumer.cpp
Sat Dec 18 13:29:40 2010
@@ -36,7 +36,9 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-AdvisoryConsumer::AdvisoryConsumer( cms::Session* session ) {
+AdvisoryConsumer::AdvisoryConsumer( cms::Session* session ) : session(session),
+                                                              consumer(),
+                                                              advisoryConsumer() {
 
     if( session == NULL ) {
         throw NullPointerException(
@@ -48,7 +50,6 @@ AdvisoryConsumer::AdvisoryConsumer( cms:
     std::auto_ptr<cms::Topic> advisories( session->createTopic(
         "ActiveMQ.Advisory.Producer.Topic.HEART-BEAT-CHANNEL" ) );
 
-    this->session = session;
     this->consumer.reset( session->createConsumer( destination.get() ) );
     this->advisoryConsumer.reset( session->createConsumer( advisories.get() ) );
     this->consumer->setMessageListener( this );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryConsumer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryConsumer.h?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryConsumer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryConsumer.h Sat
Dec 18 13:29:40 2010
@@ -47,6 +47,11 @@ namespace advisories {
          std::auto_ptr<cms::MessageConsumer> consumer;
          std::auto_ptr<cms::MessageConsumer> advisoryConsumer;
 
+     private:
+
+         AdvisoryConsumer( const AdvisoryConsumer& );
+         AdvisoryConsumer& operator= ( const AdvisoryConsumer& );
+
     public:
 
         AdvisoryConsumer( cms::Session* session );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducer.cpp?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducer.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducer.cpp
Sat Dec 18 13:29:40 2010
@@ -32,7 +32,12 @@ using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
 
 ////////////////////////////////////////////////////////////////////////////////
-AdvisoryProducer::AdvisoryProducer( cms::Session* session ) : shutdownLatch(1) {
+AdvisoryProducer::AdvisoryProducer( cms::Session* session ) : consumerOnline(false),
+                                                              shutdown(false),
+                                                              shutdownLatch(1),
+                                                              session(session),
+                                                              consumer(),
+                                                              producer() {
 
     if( session == NULL ) {
         throw NullPointerException(
@@ -44,10 +49,6 @@ AdvisoryProducer::AdvisoryProducer( cms:
     std::auto_ptr<cms::Topic> advisories( session->createTopic(
         "ActiveMQ.Advisory.Consumer.Topic.HEART-BEAT-CHANNEL" ) );
 
-    this->shutdown = false;
-    this->consumerOnline = false;
-
-    this->session = session;
     this->producer.reset( session->createProducer( destination.get() ) );
     this->consumer.reset( session->createConsumer( advisories.get() ) );
     this->consumer->setMessageListener( this );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducer.h?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducer.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/AdvisoryProducer.h Sat
Dec 18 13:29:40 2010
@@ -53,6 +53,11 @@ namespace advisories {
         std::auto_ptr<cms::MessageConsumer> consumer;
         std::auto_ptr<cms::MessageProducer> producer;
 
+    private:
+
+        AdvisoryProducer( const AdvisoryProducer& );
+        AdvisoryProducer& operator= ( const AdvisoryProducer& );
+
     public:
 
         AdvisoryProducer( cms::Session* session );

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/TempDestinationAdvisoryConsumer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/TempDestinationAdvisoryConsumer.h?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/TempDestinationAdvisoryConsumer.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/advisories/TempDestinationAdvisoryConsumer.h
Sat Dec 18 13:29:40 2010
@@ -43,10 +43,10 @@ namespace advisories {
         cms::Session* session;
         std::auto_ptr<cms::MessageConsumer> consumer;
 
-    protected:
+    private:
 
         TempDestinationAdvisoryConsumer( const TempDestinationAdvisoryConsumer& );
-        TempDestinationAdvisoryConsumer operator= ( const TempDestinationAdvisoryConsumer&
);
+        TempDestinationAdvisoryConsumer& operator= ( const TempDestinationAdvisoryConsumer&
);
 
     public:
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate/CMSTemplateReceiver.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate/CMSTemplateReceiver.cpp?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate/CMSTemplateReceiver.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/cmstemplate/CMSTemplateReceiver.cpp
Sat Dec 18 13:29:40 2010
@@ -58,10 +58,15 @@ namespace {
         CmsTemplate* cmsTemplate;
         Thread* asyncReceiverThread;
 
+    private:
+
+        Receiver( const Receiver& );
+        Receiver& operator= ( const Receiver& );
+
     public:
 
         Receiver( string name, CmsTemplate* cmsTemplate ) :
-            name(name), ready( 1 ), isClosing( false ), cmsTemplate( cmsTemplate ) {
+            name(name), ready(1), isClosing(false), cmsTemplate(cmsTemplate), asyncReceiverThread(NULL)
{
 
             asyncReceiverThread = new Thread( this, "AsyncReceiver" );
             asyncReceiverThread->start();

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/consumers/SimpleAsyncConsumer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/consumers/SimpleAsyncConsumer.cpp?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/consumers/SimpleAsyncConsumer.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/consumers/SimpleAsyncConsumer.cpp
Sat Dec 18 13:29:40 2010
@@ -56,25 +56,29 @@ private:
     Destination* destination;
     MessageConsumer* consumer;
     bool useTopic;
-    bool clientAck;
     std::string brokerURI;
     std::string destURI;
+    bool clientAck;
+
+private:
+
+    SimpleAsyncConsumer( const SimpleAsyncConsumer& );
+    SimpleAsyncConsumer& operator= ( const SimpleAsyncConsumer& );
 
 public:
 
     SimpleAsyncConsumer( const std::string& brokerURI,
                          const std::string& destURI,
                          bool useTopic = false,
-                         bool clientAck = false ) {
-
-        this->connection = NULL;
-        this->session = NULL;
-        this->destination = NULL;
-        this->consumer = NULL;
-        this->useTopic = useTopic;
-        this->brokerURI = brokerURI;
-        this->destURI = destURI;
-        this->clientAck = clientAck;
+                         bool clientAck = false ) :
+        connection(NULL),
+        session(NULL),
+        destination(NULL),
+        consumer(NULL),
+        useTopic(useTopic),
+        brokerURI(brokerURI),
+        destURI(destURI),
+        clientAck(clientAck) {
     }
 
     virtual ~SimpleAsyncConsumer() throw() {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/main.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/main.cpp?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/main.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/main.cpp Sat Dec 18 13:29:40 2010
@@ -57,20 +57,25 @@ private:
     bool sessionTransacted;
     std::string brokerURI;
 
+private:
+
+    HelloWorldProducer( const HelloWorldProducer& );
+    HelloWorldProducer& operator= ( const HelloWorldProducer& );
+
 public:
 
     HelloWorldProducer( const std::string& brokerURI,
                         int numMessages,
                         bool useTopic = false,
-                        bool sessionTransacted = false ){
-        this->connection = NULL;
-        this->session = NULL;
-        this->destination = NULL;
-        this->producer = NULL;
-        this->numMessages = numMessages;
-        this->useTopic = useTopic;
-        this->sessionTransacted = sessionTransacted;
-        this->brokerURI = brokerURI;
+                        bool sessionTransacted = false ) :
+        connection(NULL),
+        session(NULL),
+        destination(NULL),
+        producer(NULL),
+        numMessages(numMessages),
+        useTopic(useTopic),
+        sessionTransacted(sessionTransacted),
+        brokerURI(brokerURI) {
     }
 
     virtual ~HelloWorldProducer(){
@@ -183,23 +188,30 @@ private:
     bool sessionTransacted;
     std::string brokerURI;
 
+private:
+
+    HelloWorldConsumer( const HelloWorldConsumer& );
+    HelloWorldConsumer& operator= ( const HelloWorldConsumer& );
+
 public:
 
     HelloWorldConsumer( const std::string& brokerURI,
                         int numMessages,
                         bool useTopic = false,
                         bool sessionTransacted = false,
-                        int waitMillis = 30000 )
-                         : latch(1), doneLatch(numMessages){
-        this->connection = NULL;
-        this->session = NULL;
-        this->destination = NULL;
-        this->consumer = NULL;
-        this->waitMillis = waitMillis;
-        this->useTopic = useTopic;
-        this->sessionTransacted = sessionTransacted;
-        this->brokerURI = brokerURI;
+                        int waitMillis = 30000 ) :
+        latch(1),
+        doneLatch(numMessages),
+        connection(NULL),
+        session(NULL),
+        destination(NULL),
+        consumer(NULL),
+        waitMillis(waitMillis),
+        useTopic(useTopic),
+        sessionTransacted(sessionTransacted),
+        brokerURI(brokerURI) {
     }
+
     virtual ~HelloWorldConsumer() throw() {
         cleanup();
     }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/producers/SimpleProducer.cpp Sat
Dec 18 13:29:40 2010
@@ -58,23 +58,24 @@ private:
     std::string brokerURI;
     std::string destURI;
 
+private:
+
+    SimpleProducer( const SimpleProducer& );
+    SimpleProducer& operator= ( const SimpleProducer& );
+
 public:
 
-    SimpleProducer( const std::string& brokerURI,
-                    unsigned int numMessages,
-                    const std::string& destURI,
-                    bool useTopic = false,
-                    bool clientAck = false ){
-
-        this->connection = NULL;
-        this->session = NULL;
-        this->destination = NULL;
-        this->producer = NULL;
-        this->numMessages = numMessages;
-        this->useTopic = useTopic;
-        this->brokerURI = brokerURI;
-        this->destURI = destURI;
-        this->clientAck = clientAck;
+    SimpleProducer( const std::string& brokerURI, unsigned int numMessages,
+                    const std::string& destURI, bool useTopic = false, bool clientAck
= false ) :
+        connection(NULL),
+        session(NULL),
+        destination(NULL),
+        producer(NULL),
+        useTopic(useTopic),
+        clientAck(clientAck),
+        numMessages(numMessages),
+        brokerURI(brokerURI),
+        destURI(destURI) {
     }
 
     virtual ~SimpleProducer(){

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.cpp?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.cpp Sat Dec 18
13:29:40 2010
@@ -40,7 +40,8 @@ const char* Chat::DEFAULT_BROKER_URI = "
 const char* Chat::DEFAULT_TOPIC_NAME = "cms.sample.chat";
 
 ////////////////////////////////////////////////////////////////////////////////
-Chat::Chat() {
+Chat::Chat() : connection(), session(),  consumer(), producer(), topic(),
+               brokerURI(), username(), password(), topicName() {
 
     this->setBrokerURI( DEFAULT_BROKER_URI );
     this->setTopicName( DEFAULT_TOPIC_NAME );
@@ -139,6 +140,9 @@ void Chat::run() {
 
                 class finalizer {
                 private:
+                    finalizer( const finalizer& );
+                    finalizer& operator= ( const finalizer& );
+                private:
                     char* text;
                 public:
                     finalizer( char* p ) : text( p ) {}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.h?rev=1050636&r1=1050635&r2=1050636&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/examples/topics/chat/Chat.h Sat Dec 18 13:29:40
2010
@@ -49,6 +49,11 @@ namespace chat{
         std::string password;
         std::string topicName;
 
+    private:
+
+        Chat( const Chat& );
+        Chat& operator= ( const Chat& );
+
     public:
 
         static const char* DEFAULT_BROKER_URI;



Mime
View raw message