activemq-cpp-3.6.0
ActiveMQTextMessage.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _ACTIVEMQ_COMMANDS_ACTIVEMQTEXTMESSAGE_H_
19 #define _ACTIVEMQ_COMMANDS_ACTIVEMQTEXTMESSAGE_H_
20 
21 // Turn off warning message for ignored exception specification
22 #ifdef _MSC_VER
23 #pragma warning( disable : 4290 )
24 #endif
25 
26 #include <activemq/util/Config.h>
28 #include <cms/TextMessage.h>
29 #include <vector>
30 #include <string>
31 #include <memory>
32 
33 namespace activemq{
34 namespace commands{
35 
37  public ActiveMQMessageTemplate<cms::TextMessage> {
38  public:
39 
40  const static unsigned char ID_ACTIVEMQTEXTMESSAGE = 28;
41 
42  mutable std::auto_ptr<std::string> text;
43 
44  private:
45 
47  ActiveMQTextMessage& operator= ( const ActiveMQTextMessage& );
48 
49  public:
50 
52  virtual ~ActiveMQTextMessage() throw();
53 
54  virtual unsigned char getDataStructureType() const;
55 
56  virtual ActiveMQTextMessage* cloneDataStructure() const;
57 
58  virtual void copyDataStructure( const DataStructure* src );
59 
60  virtual std::string toString() const;
61 
62  virtual bool equals( const DataStructure* value ) const;
63 
64  virtual void clearBody();
65 
66  virtual void beforeMarshal( wireformat::WireFormat* wireFormat );
67 
68  virtual unsigned int getSize() const;
69 
70  public: // CMS Message
71 
72  virtual cms::TextMessage* clone() const {
73  ActiveMQTextMessage* clone = this->cloneDataStructure();
74  clone->setReadOnlyBody(false);
75  clone->setReadOnlyProperties(false);
76  return dynamic_cast<cms::TextMessage*>(clone);
77  }
78 
79  public: // cms::TextMessage
80 
81  virtual std::string getText() const;
82 
83  virtual void setText( const char* msg );
84 
85  virtual void setText( const std::string& msg );
86 
87  };
88 
89 }}
90 
91 #endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQTEXTMESSAGE_H_*/