applied patch from Matz of AMQ-592 for improvements to the C++ client

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@381363 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-02-27 15:35:54 +00:00
parent 75af5faa5a
commit 2a088309a6
19 changed files with 1937 additions and 0 deletions

6
openwire-cpp/.classpath Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path=""/>
</classpath>

17
openwire-cpp/.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>openwire-cpp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,73 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef IBytesMessage_hpp_
#define IBytesMessage_hpp_
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
#include <string>
#include "IMessage.hpp"
#include "MessageEOFException.hpp"
#include "MessageNotReadableException.hpp"
#include "MessageNotWritableException.hpp"
#include "util/ifr/p"
namespace apache
{
namespace activemq
{
namespace client
{
using namespace std;
using namespace ifr;
/*
*
*/
struct IBytesMessage //: IMessage
{
virtual int getBodyLength() = 0;
virtual void reset() = 0 ;
virtual char readByte() throw (MessageNotReadableException, MessageEOFException) = 0 ;
virtual int readBytes(char* buffer, int length) throw (MessageNotReadableException) = 0 ;
virtual bool readBoolean() throw (MessageNotReadableException, MessageEOFException) = 0 ;
virtual double readDouble() throw (MessageNotReadableException, MessageEOFException) = 0 ;
virtual float readFloat() throw (MessageNotReadableException, MessageEOFException) = 0 ;
virtual int readInt() throw (MessageNotReadableException, MessageEOFException) = 0 ;
virtual long long readLong() throw (MessageNotReadableException, MessageEOFException) = 0 ;
virtual short readShort() throw (MessageNotReadableException, MessageEOFException) = 0 ;
virtual p<string> readUTF() throw (MessageNotReadableException, MessageEOFException) = 0 ;
virtual void writeBoolean(bool value) throw (MessageNotWritableException) = 0 ;
virtual void writeByte(char value) throw (MessageNotWritableException) = 0 ;
virtual void writeBytes(char* value, int length) throw (MessageNotWritableException) = 0 ;
virtual void writeDouble(double value) throw (MessageNotWritableException) = 0 ;
virtual void writeFloat(float value) throw (MessageNotWritableException) = 0 ;
virtual void writeInt(int value) throw (MessageNotWritableException) = 0 ;
virtual void writeLong(long long value) throw (MessageNotWritableException) = 0 ;
virtual void writeShort(short value) throw (MessageNotWritableException) = 0 ;
virtual void writeUTF(p<string> value) throw (MessageNotWritableException) = 0 ;
} ;
/* namespace */
}
}
}
#endif /*IBytesMessage_hpp_*/

View File

@ -0,0 +1,49 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef IllegalArgumentException_hpp_
#define IllegalArgumentException_hpp_
#include "TraceException.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
using namespace std ;
/*
* Signals that a method has been passed an illegal or inappropriate argument.
*/
class IllegalArgumentException : public TraceException
{
public:
IllegalArgumentException() : TraceException()
{ /* no-op */ } ;
IllegalArgumentException(const char *const& msg) : TraceException(msg)
{ /* no-op */ } ;
IllegalArgumentException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
{ /* no-op */ } ;
} ;
/* namespace */
}
}
}
#endif /*IllegalArgumentException_hpp_*/

View File

@ -0,0 +1,50 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MessageEOFException_hpp_
#define MessageEOFException_hpp_
#include "TraceException.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
using namespace std ;
/*
* Signals that an unexpected end of stream has been reached when reading
* a message.
*/
class MessageEOFException : public TraceException
{
public:
MessageEOFException() : TraceException()
{ /* no-op */ } ;
MessageEOFException(const char *const& msg) : TraceException(msg)
{ /* no-op */ } ;
MessageEOFException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
{ /* no-op */ } ;
} ;
/* namespace */
}
}
}
#endif /*MessageEOFException_hpp_*/

View File

@ -0,0 +1,50 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MessageFormatException_hpp_
#define MessageFormatException_hpp_
#include "TraceException.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
using namespace std ;
/*
* Signals that a client attempts to use a data type not supported by a
* message or attempts to read data in a message as the wrong type.
*/
class MessageFormatException : public TraceException
{
public:
MessageFormatException() : TraceException()
{ /* no-op */ } ;
MessageFormatException(const char *const& msg) : TraceException(msg)
{ /* no-op */ } ;
MessageFormatException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
{ /* no-op */ } ;
} ;
/* namespace */
}
}
}
#endif /*MessageFormatException_hpp_*/

View File

@ -0,0 +1,49 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MessageNotReadableException_hpp_
#define MessageNotReadableException_hpp_
#include "TraceException.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
using namespace std ;
/*
* Signals that a message is in read-only mode.
*/
class MessageNotReadableException : public TraceException
{
public:
MessageNotReadableException() : TraceException()
{ /* no-op */ } ;
MessageNotReadableException(const char *const& msg) : TraceException(msg)
{ /* no-op */ } ;
MessageNotReadableException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
{ /* no-op */ } ;
} ;
/* namespace */
}
}
}
#endif /*MessageNotReadableException_hpp_*/

View File

@ -0,0 +1,49 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MessageNotWritableException_hpp_
#define MessageNotWritableException_hpp_
#include "TraceException.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
using namespace std ;
/*
* Signals that a message is in read-only mode.
*/
class MessageNotWritableException : public TraceException
{
public:
MessageNotWritableException() : TraceException()
{ /* no-op */ } ;
MessageNotWritableException(const char *const& msg) : TraceException(msg)
{ /* no-op */ } ;
MessageNotWritableException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
{ /* no-op */ } ;
} ;
/* namespace */
}
}
}
#endif /*MessageNotWritableException_hpp_*/

View File

@ -0,0 +1,402 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/ActiveMQBytesMessage.hpp"
using namespace apache::activemq::client::command;
/*
*
*/
ActiveMQBytesMessage::ActiveMQBytesMessage()
{
this->body = new char[INITIAL_SIZE] ;
this->bodySize = INITIAL_SIZE ;
this->bodyLength = 0 ;
this->offset = 0 ;
this->readMode = false ;
}
/*
*
*/
ActiveMQBytesMessage::~ActiveMQBytesMessage()
{
}
/*
*
*/
int ActiveMQBytesMessage::getCommandType()
{
return ActiveMQBytesMessage::TYPE ;
}
/*
*
*/
int ActiveMQBytesMessage::getBodyLength()
{
return bodyLength ;
}
/*
*
*/
void ActiveMQBytesMessage::reset()
{
readMode = true ;
offset = 0 ;
}
/*
*
*/
char ActiveMQBytesMessage::readByte() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
// Check for EOF offset
if( offset > bodySize )
throw MessageEOFException() ;
// Read a single byte
return body[offset++] ;
}
/*
*
*/
int ActiveMQBytesMessage::readBytes(char* buffer, int length) throw (MessageNotReadableException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
// Check for EOF offset
if( offset > bodySize )
return -1 ;
// Copy bytes to supplied buffer
for( int i = 0 ; i < length ; i++, offset++ )
{
// Check for body EOF
if( offset > bodySize )
return i ;
buffer[i] = body[offset] ;
}
return length ;
}
/*
*
*/
bool ActiveMQBytesMessage::readBoolean() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
bool value ;
int result ;
// Read a boolean
result = readBytes((char*)&value, sizeof(bool)) ;
// Check for EOF offset
if( result == -1 || result < sizeof(bool) )
throw MessageEOFException() ;
return value ;
}
/*
*
*/
double ActiveMQBytesMessage::readDouble() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
double value ;
int result ;
// Read a double
result = readBytes((char*)&value, sizeof(double)) ;
// Check for EOF offset
if( result == -1 || result < sizeof(double) )
throw MessageEOFException() ;
// Convert from big endian to little endian if necessary
return ntohd(value) ;
}
/*
*
*/
float ActiveMQBytesMessage::readFloat() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
float value ;
int result ;
// Read a float
result = readBytes((char*)&value, sizeof(float)) ;
// Check for EOF offset
if( result == -1 || result < sizeof(float) )
throw MessageEOFException() ;
// Convert from big endian to little endian if necessary
return ntohf(value) ;
}
/*
*
*/
short ActiveMQBytesMessage::readShort() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
short value ;
int result ;
// Read a short
result = readBytes((char*)&value, sizeof(short)) ;
// Check for EOF offset
if( result == -1 || result < sizeof(short) )
throw MessageEOFException() ;
// Convert from big endian to little endian if necessary
return ntohs(value) ;
}
/*
*
*/
int ActiveMQBytesMessage::readInt() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
int value ;
int result ;
// Read an integer
result = readBytes((char*)&value, sizeof(int)) ;
// Check for EOF offset
if( result == -1 || result < sizeof(int) )
throw MessageEOFException() ;
// Convert from big endian to little endian if necessary
return ntohi(value) ;
}
/*
*
*/
long long ActiveMQBytesMessage::readLong() throw(MessageNotReadableException, MessageEOFException)
{
// Assert read mode
if( !readMode )
throw MessageNotReadableException() ;
long long value ;
int result ;
// Read a long long
result = readBytes((char*)&value, sizeof(long long)) ;
// Check for EOF offset
if( result == -1 || result < sizeof(long long) )
throw MessageEOFException() ;
// Convert from big endian to little endian if necessary
return ntohl(value) ;
}
/*
*
*/
p<string> ActiveMQBytesMessage::readUTF() throw(MessageNotReadableException, MessageEOFException)
{
// TODO
return NULL ;
}
/*
*
*/
void ActiveMQBytesMessage::writeByte(char value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Check for EOF offset
if( offset > bodySize )
expandBody() ;
// Write a single byte
body[offset++] = value ;
// Update content length
bodyLength = offset ;
}
/*
*
*/
void ActiveMQBytesMessage::writeBytes(char* value, int length) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Copy bytes from supplied buffer
for( int i = 0 ; i < length ; i++, offset++ )
{
// Check for EOF offset
if( offset > bodySize )
expandBody() ;
body[offset] = value[i] ;
}
// Update content length
bodyLength = offset ;
}
/*
*
*/
void ActiveMQBytesMessage::writeBoolean(bool value) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write boolean
writeBytes((char*)&value, sizeof(bool)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeDouble(double v) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write double, convert from little endian to big endian if necessary
double value = htond(v) ;
writeBytes((char*)&value, sizeof(double)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeFloat(float v) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write float, convert from little endian to big endian if necessary
float value = htonf(v) ;
writeBytes((char*)&value, sizeof(float)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeInt(int v) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write integer, convert from little endian to big endian if necessary
int value = htoni(v) ;
writeBytes((char*)&value, sizeof(int)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeLong(long long v) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write long, convert from little endian to big endian if necessary
long long value = htonl(v) ;
writeBytes((char*)&value, sizeof(long long)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeShort(short v) throw (MessageNotWritableException)
{
// Assert write mode
if( readMode )
throw MessageNotWritableException() ;
// Write short, convert from little endian to big endian if necessary
short value = htons(v) ;
writeBytes((char*)&value, sizeof(short)) ;
}
/*
*
*/
void ActiveMQBytesMessage::writeUTF(p<string> value) throw (MessageNotWritableException)
{
// TODO
}
/*
*
*/
void ActiveMQBytesMessage::expandBody()
{
char* newBody ;
int newSize = bodySize + ActiveMQBytesMessage::EXPAND_SIZE ;
// Create new body and copy current contents
newBody = new char[ newSize ] ;
memcpy(newBody, body, bodySize) ;
// Clean up and use new content body
delete [] body ;
body = newBody ;
bodySize = newSize ;
}

View File

@ -0,0 +1,102 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQBytesMessage_hpp_
#define ActiveMQBytesMessage_hpp_
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
#include <map>
#include <string>
#include "IBytesMessage.hpp"
#include "ActiveMQMessage.hpp"
#include "MessageEOFException.hpp"
#include "MessageNotWritableException.hpp"
#include "util/Endian.hpp"
#include "util/ifr/ap"
#include "util/ifr/p"
#include "util/MapItemHolder.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
using namespace ifr;
using namespace apache::activemq::client::util;
/*
*
*/
class ActiveMQBytesMessage : public ActiveMQMessage, IBytesMessage
{
private:
char* body ;
int bodySize,
bodyLength,
offset ;
bool readMode ;
const static int INITIAL_SIZE = 512 ;
const static int EXPAND_SIZE = 128 ;
public:
const static int TYPE = 24 ;
public:
ActiveMQBytesMessage() ;
virtual ~ActiveMQBytesMessage() ;
virtual int getCommandType() ;
virtual int getBodyLength() ;
virtual void reset() ;
virtual char readByte() throw (MessageNotReadableException, MessageEOFException) ;
virtual int readBytes(char* buffer, int length) throw (MessageNotReadableException) ;
virtual bool readBoolean() throw (MessageNotReadableException, MessageEOFException) ;
virtual double readDouble() throw (MessageNotReadableException, MessageEOFException) ;
virtual float readFloat() throw (MessageNotReadableException, MessageEOFException) ;
virtual int readInt() throw (MessageNotReadableException, MessageEOFException) ;
virtual long long readLong() throw (MessageNotReadableException, MessageEOFException) ;
virtual short readShort() throw (MessageNotReadableException, MessageEOFException) ;
virtual p<string> readUTF() throw (MessageNotReadableException, MessageEOFException) ;
virtual void writeBoolean(bool value) throw (MessageNotWritableException) ;
virtual void writeByte(char value) throw (MessageNotWritableException) ;
virtual void writeBytes(char* value, int length) throw (MessageNotWritableException) ;
virtual void writeDouble(double value) throw (MessageNotWritableException) ;
virtual void writeFloat(float value) throw (MessageNotWritableException) ;
virtual void writeInt(int value) throw (MessageNotWritableException) ;
virtual void writeLong(long long value) throw (MessageNotWritableException) ;
virtual void writeShort(short value) throw (MessageNotWritableException) ;
virtual void writeUTF(p<string> value) throw (MessageNotWritableException) ;
private:
void expandBody() ;
} ;
/* namespace */
}
}
}
}
#endif /*ActiveMQBytesMessage_hpp_*/

View File

@ -0,0 +1,441 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/ActiveMQMapMessage.hpp"
using namespace apache::activemq::client::command;
/*
*
*/
ActiveMQMapMessage::ActiveMQMapMessage()
{
}
/*
*
*/
ActiveMQMapMessage::~ActiveMQMapMessage()
{
}
/*
*
*/
int ActiveMQMapMessage::getCommandType()
{
return ActiveMQMapMessage::TYPE ;
}
/*
*
*/
bool ActiveMQMapMessage::getBoolean(const char* name) throw (MessageFormatException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
p<string> key = new string(name) ;
// Check if key exists in map
tempIter = contentMap.find(key) ;
if( tempIter == contentMap.end() )
throw MessageFormatException("No boolean value available for given key") ;
try
{
// Try to get value as a boolean
return tempIter->second->getBoolean() ;
}
catch( ConversionException ce )
{
throw MessageFormatException( ce.what() ) ;
}
}
/*
*
*/
void ActiveMQMapMessage::setBoolean(const char* name, bool value) throw (IllegalArgumentException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
p<string> key = new string(name) ;
contentMap[key] = new MapItemHolder(value) ;
}
/*
*
*/
char ActiveMQMapMessage::getByte(const char* name) throw (MessageFormatException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
p<string> key = new string(name) ;
// Check if key exists in map
tempIter = contentMap.find(key) ;
if( tempIter == contentMap.end() )
throw MessageFormatException("No byte value available for given key") ;
try
{
// Try to get value as a byte
return tempIter->second->getByte() ;
}
catch( ConversionException ce )
{
throw MessageFormatException( ce.what() ) ;
}
}
/*
*
*/
void ActiveMQMapMessage::setByte(const char* name, char value) throw (IllegalArgumentException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
p<string> key = new string(name) ;
contentMap[key] = new MapItemHolder(value) ;
}
/*
*
*/
ap<char> ActiveMQMapMessage::getBytes(const char* name) throw (MessageFormatException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
p<string> key = new string(name) ;
// Check if key exists in map
tempIter = contentMap.find(key) ;
if( tempIter == contentMap.end() )
throw MessageFormatException("No byte array value available for given key") ;
try
{
// Try to get value as a byte array
return tempIter->second->getBytes() ;
}
catch( ConversionException ce )
{
throw MessageFormatException( ce.what() ) ;
}
}
/*
*
*/
void ActiveMQMapMessage::setBytes(const char* name, ap<char> value) throw (IllegalArgumentException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
p<string> key = new string(name) ;
contentMap[key] = new MapItemHolder(value) ;
}
/*
*
*/
double ActiveMQMapMessage::getDouble(const char* name) throw (MessageFormatException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
p<string> key = new string(name) ;
// Check if key exists in map
tempIter = contentMap.find(key) ;
if( tempIter == contentMap.end() )
throw MessageFormatException("No double value available for given key") ;
try
{
// Try to get value as a double
return tempIter->second->getDouble() ;
}
catch( ConversionException ce )
{
throw MessageFormatException( ce.what() ) ;
}
}
/*
*
*/
void ActiveMQMapMessage::setDouble(const char* name, double value) throw (IllegalArgumentException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
p<string> key = new string(name) ;
contentMap[key] = new MapItemHolder(value) ;
}
/*
*
*/
float ActiveMQMapMessage::getFloat(const char* name) throw (MessageFormatException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
p<string> key = new string(name) ;
// Check if key exists in map
tempIter = contentMap.find(key) ;
if( tempIter == contentMap.end() )
throw MessageFormatException("No float value available for given key") ;
try
{
// Try to get value as a float
return tempIter->second->getFloat() ;
}
catch( ConversionException ce )
{
throw MessageFormatException( ce.what() ) ;
}
}
/*
*
*/
void ActiveMQMapMessage::setFloat(const char* name, float value) throw (IllegalArgumentException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
p<string> key = new string(name) ;
contentMap[key] = new MapItemHolder(value) ;
}
/*
*
*/
int ActiveMQMapMessage::getInt(const char* name) throw (MessageFormatException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
p<string> key = new string(name) ;
// Check if key exists in map
tempIter = contentMap.find(key) ;
if( tempIter == contentMap.end() )
throw MessageFormatException("No integer value available for given key") ;
try
{
// Try to get value as an integer
return tempIter->second->getInt() ;
}
catch( ConversionException ce )
{
throw MessageFormatException( ce.what() ) ;
}
}
/*
*
*/
void ActiveMQMapMessage::setInt(const char* name, int value) throw (IllegalArgumentException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
p<string> key = new string(name) ;
contentMap[key] = new MapItemHolder(value) ;
}
/*
*
*/
long long ActiveMQMapMessage::getLong(const char* name) throw (MessageFormatException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
p<string> key = new string(name) ;
// Check if key exists in map
tempIter = contentMap.find(key) ;
if( tempIter == contentMap.end() )
throw MessageFormatException("No long value available for given key") ;
try
{
// Try to get value as a long
return tempIter->second->getLong() ;
}
catch( ConversionException ce )
{
throw MessageFormatException( ce.what() ) ;
}
}
/*
*
*/
void ActiveMQMapMessage::setLong(const char* name, long long value) throw (IllegalArgumentException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
p<string> key = new string(name) ;
contentMap[key] = new MapItemHolder(value) ;
}
/*
*
*/
short ActiveMQMapMessage::getShort(const char* name) throw (MessageFormatException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
p<string> key = new string(name) ;
// Check if key exists in map
tempIter = contentMap.find(key) ;
if( tempIter == contentMap.end() )
throw MessageFormatException("No short value available for given key") ;
try
{
// Try to get value as a short
return tempIter->second->getShort() ;
}
catch( ConversionException ce )
{
throw MessageFormatException( ce.what() ) ;
}
}
/*
*
*/
void ActiveMQMapMessage::setShort(const char* name, short value) throw (IllegalArgumentException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
p<string> key = new string(name) ;
contentMap[key] = new MapItemHolder(value) ;
}
/*
*
*/
p<string> ActiveMQMapMessage::getString(const char* name) throw (MessageFormatException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
p<string> key = new string(name) ;
// Check if key exists in map
tempIter = contentMap.find(key) ;
if( tempIter == contentMap.end() )
throw MessageFormatException("No short value available for given key") ;
try
{
// Try to get value as a string
return tempIter->second->getString() ;
}
catch( ConversionException ce )
{
throw MessageFormatException( ce.what() ) ;
}
}
/*
*
*/
void ActiveMQMapMessage::setString(const char* name, p<string> value) throw (IllegalArgumentException)
{
// Assert arguments
if( name == NULL || strcmp(name, "") == 0 )
throw IllegalArgumentException("Invalid key name") ;
p<string> key = new string(name) ;
contentMap[key] = new MapItemHolder(value) ;
}
/*
*
*/
ap<string> ActiveMQMapMessage::getMapNames()
{
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
ap<string> keyNames (contentMap.size()) ;
int index = 0 ;
for( tempIter = contentMap.begin() ;
tempIter != contentMap.end() ;
tempIter++ )
{
keyNames[index++] = tempIter->first ;
}
return keyNames ;
}
/*
*
*/
bool ActiveMQMapMessage::itemExists(const char* name)
{
map< p<string>, p<MapItemHolder> >::const_iterator tempIter ;
p<string> key = new string(name) ;
// Check if key exists in map
tempIter = contentMap.find(key) ;
return ( tempIter != contentMap.end() ) ? true : false ;
}

View File

@ -0,0 +1,91 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQMapMessage_hpp_
#define ActiveMQMapMessage_hpp_
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
#include <map>
#include <string>
#include "ActiveMQMessage.hpp"
#include "IllegalArgumentException.hpp"
#include "MessageFormatException.hpp"
#include "util/ifr/ap"
#include "util/ifr/p"
#include "util/MapItemHolder.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
using namespace ifr;
using namespace apache::activemq::client::util;
/*
*
*/
class ActiveMQMapMessage : public ActiveMQMessage
{
private:
p<string> text ;
map< p<string>, p<MapItemHolder> > contentMap ;
public:
const static int TYPE = 25 ;
public:
ActiveMQMapMessage() ;
virtual ~ActiveMQMapMessage() ;
virtual int getCommandType() ;
virtual bool getBoolean(const char* name) throw (MessageFormatException) ;
virtual void setBoolean(const char* name, bool value) throw (IllegalArgumentException) ;
virtual char getByte(const char* name) throw (MessageFormatException) ;
virtual void setByte(const char* name, char value) throw (IllegalArgumentException) ;
virtual ap<char> getBytes(const char* name) throw (MessageFormatException) ;
virtual void setBytes(const char* name, ap<char> value) throw (IllegalArgumentException) ;
virtual double getDouble(const char* name) throw (MessageFormatException) ;
virtual void setDouble(const char* name, double value) throw (IllegalArgumentException) ;
virtual float getFloat(const char* name) throw (MessageFormatException) ;
virtual void setFloat(const char* name, float value) throw (IllegalArgumentException) ;
virtual int getInt(const char* name) throw (MessageFormatException) ;
virtual void setInt(const char* name, int value) throw (IllegalArgumentException) ;
virtual long long getLong(const char* name) throw (MessageFormatException) ;
virtual void setLong(const char* name, long long value) throw (IllegalArgumentException) ;
virtual short getShort(const char* name) throw (MessageFormatException) ;
virtual void setShort(const char* name, short value) throw (IllegalArgumentException) ;
virtual p<string> getString(const char* name) throw (MessageFormatException) ;
virtual void setString(const char* name, p<string> value) throw (IllegalArgumentException) ;
virtual ap<string> getMapNames() ;
virtual bool itemExists(const char* name) ;
} ;
/* namespace */
}
}
}
}
#endif /*ActiveMQMapMessage_hpp_*/

View File

@ -0,0 +1,52 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/ActiveMQTempQueue.hpp"
using namespace apache::activemq::client::command;
/*
*
*/
ActiveMQTempQueue::ActiveMQTempQueue()
: ActiveMQDestination()
{
}
ActiveMQTempQueue::ActiveMQTempQueue(const char* name)
: ActiveMQDestination(name)
{
}
ActiveMQTempQueue::~ActiveMQTempQueue()
{
}
p<string> ActiveMQTempQueue::getQueueName()
{
return this->getPhysicalName() ;
}
int ActiveMQTempQueue::getDestinationType()
{
return ActiveMQDestination::ACTIVEMQ_QUEUE ;
}
p<ActiveMQDestination> ActiveMQTempQueue::createDestination(const char* name)
{
p<ActiveMQTempQueue> tempQueue = new ActiveMQTempQueue(name) ;
return tempQueue ;
}

View File

@ -0,0 +1,56 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQTempQueue_hpp_
#define ActiveMQTempQueue_hpp_
#include "ITemporaryQueue.hpp"
#include "command/ActiveMQDestination.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
/*
*
*/
class ActiveMQTempQueue : public ActiveMQDestination, ITemporaryQueue
{
public:
const static char TYPE = 102 ;
public:
ActiveMQTempQueue() ;
ActiveMQTempQueue(const char* name) ;
virtual ~ActiveMQTempQueue() ;
virtual p<string> getQueueName() ;
virtual int getDestinationType() ;
virtual p<ActiveMQDestination> createDestination(const char* name) ;
} ;
/* namespace */
}
}
}
}
#endif /*ActiveMQTempQueue_hpp_*/

View File

@ -0,0 +1,52 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "command/ActiveMQTempTopic.hpp"
using namespace apache::activemq::client::command;
/*
*
*/
ActiveMQTempTopic::ActiveMQTempTopic()
: ActiveMQDestination()
{
}
ActiveMQTempTopic::ActiveMQTempTopic(const char* name)
: ActiveMQDestination(name)
{
}
ActiveMQTempTopic::~ActiveMQTempTopic()
{
}
p<string> ActiveMQTempTopic::getTopicName()
{
return this->getPhysicalName() ;
}
int ActiveMQTempTopic::getDestinationType()
{
return ActiveMQDestination::ACTIVEMQ_QUEUE ;
}
p<ActiveMQDestination> ActiveMQTempTopic::createDestination(const char* name)
{
p<ActiveMQTempTopic> tempTopic = new ActiveMQTempTopic(name) ;
return tempTopic ;
}

View File

@ -0,0 +1,56 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ActiveMQTempTopic_hpp_
#define ActiveMQTempTopic_hpp_
#include "ITemporaryTopic.hpp"
#include "command/ActiveMQDestination.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace command
{
/*
*
*/
class ActiveMQTempTopic : public ActiveMQDestination, ITemporaryTopic
{
public:
const static char TYPE = 103 ;
public:
ActiveMQTempTopic() ;
ActiveMQTempTopic(const char* name) ;
virtual ~ActiveMQTempTopic() ;
virtual p<string> getTopicName() ;
virtual int getDestinationType() ;
virtual p<ActiveMQDestination> createDestination(const char* name) ;
} ;
/* namespace */
}
}
}
}
#endif /*ActiveMQTempTopic_hpp_*/

View File

@ -0,0 +1,52 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ConversionException_hpp_
#define ConversionException_hpp_
#include "TraceException.hpp"
namespace apache
{
namespace activemq
{
namespace client
{
namespace util
{
using namespace std ;
/*
* Signals that an illegal data conversion has occurred.
*/
class ConversionException : public TraceException
{
public:
ConversionException() : TraceException()
{ /* no-op */ } ;
ConversionException(const char *const& msg) : TraceException(msg)
{ /* no-op */ } ;
ConversionException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
{ /* no-op */ } ;
} ;
/* namespace */
}
}
}
}
#endif /*ConversionException_hpp_*/

View File

@ -0,0 +1,201 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "util/MapItemHolder.hpp"
using namespace apache::activemq::client::util;
/*
*
*/
MapItemHolder::MapItemHolder(bool value)
{
this->value = new bool(value) ;
this->type = MapItemHolder::BOOLEAN ;
}
MapItemHolder::MapItemHolder(char value)
{
this->value = new char(value) ;
this->type = MapItemHolder::BYTE ;
}
MapItemHolder::MapItemHolder(ap<char> value)
{
this->value = ap_help::get_obj (value);
addref(value) ;
this->type = MapItemHolder::BYTEARRAY ;
}
MapItemHolder::MapItemHolder(double value)
{
this->value = new double(value) ;
this->type = MapItemHolder::DOUBLE ;
}
MapItemHolder::MapItemHolder(float value)
{
this->value = new float(value) ;
this->type = MapItemHolder::FLOAT ;
}
MapItemHolder::MapItemHolder(int value)
{
this->value = new int(value) ;
this->type = MapItemHolder::INTEGER ;
}
MapItemHolder::MapItemHolder(long long value)
{
this->value = new long long(value) ;
this->type = MapItemHolder::LONG ;
}
MapItemHolder::MapItemHolder(short value)
{
this->value = new short(value) ;
this->type = MapItemHolder::SHORT ;
}
MapItemHolder::MapItemHolder(p<string> value)
{
this->value = p_help::get_obj (value);
addref(value) ;
this->type = MapItemHolder::STRING ;
}
MapItemHolder::~MapItemHolder()
{
if( type == BYTEARRAY )
release (reinterpret_cast<refcounted*> (value));
else if( type == STRING )
reinterpret_cast<PointerHolder<string>*> (value)->release();
else
delete value ;
}
bool MapItemHolder::getBoolean() throw (ConversionException)
{
if( type == BOOLEAN )
return *(reinterpret_cast<bool*> (value)) ;
else
throw ConversionException(__FILE__, __LINE__, "Cannot convert map item value to a boolean") ;
}
char MapItemHolder::getByte() throw (ConversionException)
{
if( type == BYTE )
return *(reinterpret_cast<char*> (value)) ;
else
throw ConversionException(__FILE__, __LINE__, "Cannot convert map item value to a byte") ;
}
ap<char> MapItemHolder::getBytes() throw (ConversionException)
{
if( type == BYTEARRAY ) {
ap<char> retval;
ap_help::set_obj (retval, value);
addref (retval);
return retval;
}
else
throw ConversionException(__FILE__, __LINE__, "Cannot convert map item value to a byte array") ;
}
double MapItemHolder::getDouble() throw (ConversionException)
{
if( type == DOUBLE || type == FLOAT )
return *(reinterpret_cast<double*> (value)) ;
else
throw ConversionException(__FILE__, __LINE__, "Cannot convert map item value to a double") ;
}
float MapItemHolder::getFloat() throw (ConversionException)
{
if( type == FLOAT )
return *(reinterpret_cast<float*> (value)) ;
else
throw ConversionException(__FILE__, __LINE__, "Cannot convert map item value to a float") ;
}
int MapItemHolder::getInt() throw (ConversionException)
{
if( type == INTEGER || type == SHORT || type == LONG )
return *(reinterpret_cast<int*> (value)) ;
else
throw ConversionException(__FILE__, __LINE__, "Cannot convert map item value to an integer") ;
}
long long MapItemHolder::getLong() throw (ConversionException)
{
if( type == INTEGER || type == SHORT || type == LONG )
return *(reinterpret_cast<long long*> (value)) ;
else
throw ConversionException(__FILE__, __LINE__, "Cannot convert map item value to a long") ;
}
short MapItemHolder::getShort() throw (ConversionException)
{
if( type == INTEGER || type == SHORT || type == LONG )
return *(reinterpret_cast<short*> (value)) ;
else
throw ConversionException(__FILE__, __LINE__, "Cannot convert map item value to a short") ;
}
p<string> MapItemHolder::getString() throw (ConversionException)
{
p<string> retval ;
char buffer[25] ;
switch( type )
{
case STRING:
p_help::set_obj (retval, value) ;
addref (retval) ;
return retval ;
case BOOLEAN:
sprintf(buffer, "%s", ( getBoolean() ? "true" : "false" ) ) ;
retval = new string(buffer) ;
return retval ;
case BYTE:
case SHORT:
case INTEGER:
sprintf(buffer, "%d", getInt() ) ;
retval = new string(buffer) ;
return retval ;
case LONG:
sprintf(buffer, "%I64d", getLong() ) ;
retval = new string(buffer) ;
return retval ;
case FLOAT:
sprintf(buffer, "%f", getFloat() ) ;
retval = new string(buffer) ;
return retval ;
case DOUBLE:
sprintf(buffer, "%lf", getDouble() ) ;
retval = new string(buffer) ;
return retval ;
default:
throw ConversionException(__FILE__, __LINE__, "Cannot convert map item value to a string") ;
}
}

View File

@ -0,0 +1,89 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MapItemHolder_hpp_
#define MapItemHolder_hpp_
#include <string>
#include "command/ActiveMQDestination.hpp"
#include "util/ConversionException.hpp"
#include "util/ifr/ap"
#include "util/ifr/p"
// Turn off warning message for ignored exception specification
#ifdef _MSC_VER
#pragma warning( disable : 4290 )
#endif
namespace apache
{
namespace activemq
{
namespace client
{
namespace util
{
using namespace ifr;
/*
*
*/
class MapItemHolder
{
private:
void* value ;
int type ;
const static int BOOLEAN = 0x00 ;
const static int BYTE = 0x01 ;
const static int BYTEARRAY = 0x02 ;
const static int DOUBLE = 0x03 ;
const static int FLOAT = 0x04 ;
const static int INTEGER = 0x05 ;
const static int LONG = 0x06 ;
const static int SHORT = 0x07 ;
const static int STRING = 0x08 ;
public:
MapItemHolder(bool value) ;
MapItemHolder(char value) ;
MapItemHolder(ap<char> value) ;
MapItemHolder(double value) ;
MapItemHolder(float value) ;
MapItemHolder(int value) ;
MapItemHolder(long long value) ;
MapItemHolder(short value) ;
MapItemHolder(p<string> value) ;
~MapItemHolder() ;
bool getBoolean() throw (ConversionException) ;
char getByte() throw (ConversionException) ;
ap<char> getBytes() throw (ConversionException) ;
double getDouble() throw (ConversionException) ;
float getFloat() throw (ConversionException) ;
int getInt() throw (ConversionException) ;
long long getLong() throw (ConversionException) ;
short getShort() throw (ConversionException) ;
p<string> getString() throw (ConversionException) ;
} ;
/* namespace */
}
}
}
}
#endif /*MapItemHolder_hpp_*/