Author: tabish Date: Tue Nov 14 16:57:09 2006 New Revision: 475091 URL: http://svn.apache.org/viewvc?view=rev&rev=475091 Log: Updates for planned Openwire Support
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp?view=diff&rev=475091&r1=475090&r2=475091 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.cpp Tue Nov 14 16:57:09 2006 @@ -16,9 +16,11 @@ */ #include <activemq/connector/openwire/commands/WireFormatInfo.h> +#include <activemq/exceptions/NullPointerException.h> using namespace std; using namespace activemq; +using namespace activemq::exceptions; using namespace activemq::connector; using namespace activemq::connector::openwire; using namespace activemq::connector::openwire::commands; @@ -31,4 +33,35 @@ //////////////////////////////////////////////////////////////////////////////// WireFormatInfo::~WireFormatInfo() { +} + +//////////////////////////////////////////////////////////////////////////////// +DataStructure* WireFormatInfo::cloneDataStructure() const { + WireFormatInfo* wireFormatInfo = new WireFormatInfo(); + + // Copy the data from the base class or classes + wireFormatInfo->copyDataStructure( this ); + + return wireFormatInfo; +} + +//////////////////////////////////////////////////////////////////////////////// +void WireFormatInfo::copyDataStructure( const DataStructure* src ) { + + // Copy the data of the base class or classes + BaseDataStructure::copyDataStructure( src ); + + const WireFormatInfo* srcPtr = dynamic_cast<const WireFormatInfo*>( src ); + + if( srcPtr == NULL || src == NULL ) { + + throw exceptions::NullPointerException( + __FILE__, __LINE__, + "WireFormatInfo::copyDataStructure - src is NULL or invalid" ); + } +} + +//////////////////////////////////////////////////////////////////////////////// +unsigned char WireFormatInfo::getDataStructureType() const { + return WireFormatInfo::ID_WIREFORMATINFO; } Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h?view=diff&rev=475091&r1=475090&r2=475091 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/WireFormatInfo.h Tue Nov 14 16:57:09 2006 @@ -20,6 +20,8 @@ #include <activemq/connector/openwire/commands/BaseDataStructure.h> +#include <vector> + namespace activemq{ namespace connector{ namespace openwire{ @@ -28,12 +30,37 @@ class WireFormatInfo : public BaseDataStructure { public: + + const static unsigned char ID_WIREFORMATINFO = 1; + + public: WireFormatInfo(); virtual ~WireFormatInfo(); /** + * Get the unique identifier that this object and its own + * Marshaller share. + * @returns new DataStructure type copy. + */ + virtual unsigned char getDataStructureType() const; + + /** + * Clone this obbject and return a new instance that the + * caller now owns, this will be an exact copy of this one + * @returns new copy of this object. + */ + virtual DataStructure* cloneDataStructure() const; + + /** + * Copy the contents of the passed object into this objects + * members, overwriting any existing data. + * @return src - Source Object + */ + virtual void copyDataStructure( const DataStructure* src ); + + /** * Checks if the stackTraceEnabled flag is on * @return true if the flag is on. */ @@ -146,6 +173,20 @@ } private: + + static std::vector<char> MAGIC; +// = new byte[] { +// 'A'&0xFF, +// 'c'&0xFF, +// 't'&0xFF, +// 'i'&0xFF, +// 'v'&0xFF, +// 'e'&0xFF, +// 'M'&0xFF, +// 'Q'&0xFF }; + + std::vector<char> magic; + std::vector<char> marshalledProperties; int version; bool stackTraceEnabled;