activemq-cpp-3.9.5
OpenWireFormat.h
Go to the documentation of this file.
1
17
18#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_OPENWIREFORMAT_H_
19#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_OPENWIREFORMAT_H_
20
26#include <decaf/lang/Pointer.h>
31#include <memory>
32
33namespace activemq {
34namespace wireformat {
35namespace openwire {
36
37namespace marshal {
39}
40
41 using decaf::lang::Pointer;
42
44 public:
45
46 // Declared here to make life easier.
47 static const unsigned char NULL_TYPE;
48
49 // V1 if the default version we start at.
50 static const int DEFAULT_VERSION;
51
52 // Defines the maximum supported openwire version
53 static const int MAX_SUPPORTED_VERSION;
54
55 private:
56
57 // Configuration parameters
58 decaf::util::Properties properties;
59
60 // Preferred WireFormatInfo
61 Pointer<commands::WireFormatInfo> preferedWireFormatInfo;
62
63 // Marshalers
64 std::vector< marshal::DataStreamMarshaller* > dataMarshallers;
65
66 // Uniquely Generated ID, initialize in the Ctor
67 std::string id;
68
69 // Indicates when we are in the doUnmarshal call
71
72 // WireFormat Data
73 int version;
74 bool stackTraceEnabled;
75 bool tcpNoDelayEnabled;
76 bool cacheEnabled;
77 int cacheSize;
78 bool tightEncodingEnabled;
79 bool sizePrefixDisabled;
80 long long maxInactivityDuration;
81 long long maxInactivityDurationInitialDelay;
82
83 public:
84
90
91 virtual ~OpenWireFormat();
92
96 virtual bool hasNegotiator() const {
97 return true;
98 }
99
104
111
116
121
122 public:
123
132
143
154
165
175
186
196
202 return this->preferedWireFormatInfo;
203 }
204
209 bool isStackTraceEnabled() const {
210 return stackTraceEnabled;
211 }
212
217 void setStackTraceEnabled(bool stackTraceEnabled) {
218 this->stackTraceEnabled = stackTraceEnabled;
219 }
220
225 bool isTcpNoDelayEnabled() const {
226 return tcpNoDelayEnabled;
227 }
228
233 void setTcpNoDelayEnabled(bool tcpNoDelayEnabled) {
234 this->tcpNoDelayEnabled = tcpNoDelayEnabled;
235 }
236
241 int getVersion() const {
242 return version;
243 }
244
253 void setVersion(int version);
254
260 virtual bool inReceive() const {
261 return this->receiving.get();
262 }
263
268 bool isCacheEnabled() const {
269 return cacheEnabled;
270 }
271
276 void setCacheEnabled(bool cacheEnabled) {
277 this->cacheEnabled = cacheEnabled;
278 }
279
284 int getCacheSize() const {
285 return cacheSize;
286 }
287
292 void setCacheSize(int value) {
293 this->cacheSize = value;
294 }
295
301 return tightEncodingEnabled;
302 }
303
308 void setTightEncodingEnabled(bool tightEncodingEnabled) {
309 this->tightEncodingEnabled = tightEncodingEnabled;
310 }
311
316 bool isSizePrefixDisabled() const {
317 return sizePrefixDisabled;
318 }
319
324 void setSizePrefixDisabled(bool sizePrefixDisabled) {
325 this->sizePrefixDisabled = sizePrefixDisabled;
326 }
327
332 long long getMaxInactivityDuration() const {
333 return this->maxInactivityDuration;
334 }
335
340 void setMaxInactivityDuration(long long value) {
341 this->maxInactivityDuration = value;
342 }
343
349 return this->maxInactivityDurationInitialDelay;
350 }
351
357 this->maxInactivityDurationInitialDelay = value;
358 }
359
360 protected:
361
376
383
384 };
385
386}}}
387
388#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_OPENWIREFORMAT_H_*/
#define AMQCPP_API
Definition Config.h:30
Definition DataStructure.h:27
Definition WireFormatInfo.h:31
Interface for a transport layer for command objects.
Definition Transport.h:60
Provides a mechanism to marshal commands into and out of packets or into and out of streams,...
Definition WireFormat.h:43
commands::DataStructure * looseUnmarshalNestedObject(decaf::io::DataInputStream *dis)
Utility method to unmarshal an DataStructure object from an DataInputStream using the Loose Unmarshal...
void destroyMarshalers()
Cleans up all registered Marshallers and empties the dataMarshallers vector.
void addMarshaller(marshal::DataStreamMarshaller *marshaler)
Allows an external source to add marshalers to this object for types that may be marshaled or unmarsh...
void setSizePrefixDisabled(bool sizePrefixDisabled)
Sets if the sizePrefixDisabled flag is on.
Definition OpenWireFormat.h:324
long long getMaxInactivityDuration() const
Gets the MaxInactivityDuration setting.
Definition OpenWireFormat.h:332
void setVersion(int version)
Set the current Wireformat Version.
long long getMaxInactivityDurationInitialDelay() const
Gets the MaxInactivityDurationInitialDelay setting.
Definition OpenWireFormat.h:348
void setTcpNoDelayEnabled(bool tcpNoDelayEnabled)
Sets if the tcpNoDelayEnabled flag is on.
Definition OpenWireFormat.h:233
int getVersion() const
Get the current Wireformat Version.
Definition OpenWireFormat.h:241
void setPreferedWireFormatInfo(const Pointer< commands::WireFormatInfo > info)
Configures this object using the provided WireformatInfo object.
void renegotiateWireFormat(const commands::WireFormatInfo &info)
Called to re-negotiate the settings for the WireFormatInfo, these determine how the client and broker...
static const int MAX_SUPPORTED_VERSION
Definition OpenWireFormat.h:53
static const int DEFAULT_VERSION
Definition OpenWireFormat.h:50
void setCacheEnabled(bool cacheEnabled)
Sets if the cacheEnabled flag is on.
Definition OpenWireFormat.h:276
void setCacheSize(int value)
Sets the current Cache size.
Definition OpenWireFormat.h:292
commands::DataStructure * doUnmarshal(decaf::io::DataInputStream *dis)
Perform the actual unmarshal of data from the given DataInputStream return the unmarshalled DataStruc...
void setMaxInactivityDurationInitialDelay(long long value)
Sets the MaxInactivityDurationInitialDelay setting.
Definition OpenWireFormat.h:356
virtual int tightMarshalNestedObject1(commands::DataStructure *object, utils::BooleanStream *bs)
Utility method for Tight Marshaling the given object to the boolean stream passed.
bool isStackTraceEnabled() const
Checks if the stackTraceEnabled flag is on.
Definition OpenWireFormat.h:209
void setTightEncodingEnabled(bool tightEncodingEnabled)
Sets if the tightEncodingEnabled flag is on.
Definition OpenWireFormat.h:308
virtual Pointer< transport::Transport > createNegotiator(const Pointer< transport::Transport > transport)
If the Transport Provides a Negotiator this method will create and return a new instance of the Negot...
static const unsigned char NULL_TYPE
Definition OpenWireFormat.h:47
virtual Pointer< commands::Command > unmarshal(const activemq::transport::Transport *transport, decaf::io::DataInputStream *in)
Stream based unmarshaling, blocks on reads on the input stream until a complete command has been read...
void tightMarshalNestedObject2(commands::DataStructure *o, decaf::io::DataOutputStream *ds, utils::BooleanStream *bs)
Utility method that will Tight marshal some internally nested object that implements the DataStructur...
void setMaxInactivityDuration(long long value)
Sets the MaxInactivityDuration setting.
Definition OpenWireFormat.h:340
bool isTightEncodingEnabled() const
Checks if the tightEncodingEnabled flag is on.
Definition OpenWireFormat.h:300
virtual bool hasNegotiator() const
Returns true if this WireFormat has a Negotiator that needs to wrap the Transport that uses it....
Definition OpenWireFormat.h:96
virtual bool inReceive() const
Is there a Message being unmarshaled?
Definition OpenWireFormat.h:260
void looseMarshalNestedObject(commands::DataStructure *o, decaf::io::DataOutputStream *dataOut)
Utility method to loosely Marshal an object that is derived from the DataStrucutre interface.
void setStackTraceEnabled(bool stackTraceEnabled)
Sets if the stackTraceEnabled flag is on.
Definition OpenWireFormat.h:217
const Pointer< commands::WireFormatInfo > & getPreferedWireFormatInfo() const
Gets the Preferred WireFormatInfo object that this class holds.
Definition OpenWireFormat.h:201
bool isTcpNoDelayEnabled() const
Checks if the tcpNoDelayEnabled flag is on.
Definition OpenWireFormat.h:225
OpenWireFormat(const decaf::util::Properties &properties)
Constructs a new OpenWireFormat object.
bool isSizePrefixDisabled() const
Checks if the sizePrefixDisabled flag is on.
Definition OpenWireFormat.h:316
virtual void marshal(const Pointer< commands::Command > command, const activemq::transport::Transport *transport, decaf::io::DataOutputStream *out)
Stream based marshaling of a Command, this method blocks until the entire Command has been written ou...
bool isCacheEnabled() const
Checks if the cacheEnabled flag is on.
Definition OpenWireFormat.h:268
int getCacheSize() const
Returns the currently set Cache size.
Definition OpenWireFormat.h:284
commands::DataStructure * tightUnmarshalNestedObject(decaf::io::DataInputStream *dis, utils::BooleanStream *bs)
Utility method used to Unmarshal a Nested DataStructure type object from the given DataInputStream.
Base class for all classes that marshal commands for Openwire.
Definition DataStreamMarshaller.h:37
Manages the writing and reading of boolean data streams to and from a data source such as a DataInput...
Definition BooleanStream.h:49
A data input stream lets an application read primitive Java data types from an underlying input strea...
Definition DataInputStream.h:46
A data output stream lets an application write primitive Java data types to an output stream in a por...
Definition DataOutputStream.h:34
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition Pointer.h:53
Java-like properties class for mapping string names to string values.
Definition Properties.h:53
A boolean value that may be updated atomically.
Definition AtomicBoolean.h:34
bool get() const
Gets the current value of this AtomicBoolean.
Definition AtomicBoolean.h:63
Definition AbstractTransportFactory.h:30
Definition BaseDataStreamMarshaller.h:31
Definition BaseDataStreamMarshaller.h:30
Definition BaseDataStructure.h:28
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24