00001 /*---------------------------------------------------------------------------- 00002 Name: XmlBlasterManaged.h 00003 Project: xmlBlaster.org 00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file 00005 Author: "Marcel Ruff" <xmlBlaster@marcelruff.info> 00006 Note: A managed wrapper around the xmlBlaster client C library 00007 Used for .net applications like C# or VB.net 00008 See: This strange C++-CLI programming language is described in 00009 http://download.microsoft.com/download/9/9/c/99c65bcd-ac66-482e-8dc1-0e14cd1670cd/C++-CLI%20Standard.pdf 00010 -----------------------------------------------------------------------------*/ 00011 #ifndef XMLBLASTER_XmlBlasterManaged_H 00012 #define XMLBLASTER_XmlBlasterManaged_H 00013 #ifdef _MANAGED // If /clr flag is set 00014 00015 struct XmlBlasterAccessUnparsed; 00016 00017 namespace org { namespace xmlBlaster { namespace client { 00018 00019 public ref class XmlBlasterExceptionM : System::Exception 00020 { 00021 private: 00022 const System::String ^errorCodeStr_; 00023 const System::String ^embeddedMessage_; 00024 00025 public: 00026 XmlBlasterExceptionM(const System::String^ errorCode, 00027 const System::String^ embeddedMessage) { 00028 this->errorCodeStr_ = errorCode; 00029 this->embeddedMessage_ = embeddedMessage; 00030 } 00031 00032 virtual ~XmlBlasterExceptionM(){}; 00033 00034 const System::String ^getErrorCodeStr() { return this->errorCodeStr_; } 00035 const System::String ^getMessage() { return this->errorCodeStr_ + this->embeddedMessage_; } 00036 }; 00037 00038 00039 public ref class XmlBlasterAccessM 00040 { 00041 public: 00042 XmlBlasterAccessM(System::Collections::Hashtable ^properties); 00043 ~XmlBlasterAccessM(); 00044 System::String^ connect(System::String ^connectQos); 00045 /* 00046 org::xmlBlaster::client::qos::SubscribeReturnQos subscribe(const org::xmlBlaster::client::key::SubscribeKey& key, const org::xmlBlaster::client::qos::SubscribeQos& qos, I_Callback *callback=0); 00047 std::vector<org::xmlBlaster::util::MessageUnit> get(const org::xmlBlaster::client::key::GetKey& key, const org::xmlBlaster::client::qos::GetQos& qos); 00048 std::vector<org::xmlBlaster::client::qos::UnSubscribeReturnQos> unSubscribe(const org::xmlBlaster::client::key::UnSubscribeKey& key, const org::xmlBlaster::client::qos::UnSubscribeQos& qos); 00049 org::xmlBlaster::client::qos::PublishReturnQos publish(const org::xmlBlaster::util::MessageUnit& msgUnit); 00050 void publishOneway(const std::vector<org::xmlBlaster::util::MessageUnit>& msgUnitArr); 00051 std::vector<org::xmlBlaster::client::qos::PublishReturnQos> publishArr(const std::vector<org::xmlBlaster::util::MessageUnit> &msgUnitArr); 00052 std::vector<org::xmlBlaster::client::qos::EraseReturnQos> erase(const org::xmlBlaster::client::key::EraseKey& key, const org::xmlBlaster::client::qos::EraseQos& qos); 00053 */ 00054 System::Boolean disconnect(System::String ^qos); 00055 System::String^ getVersion(); 00056 System::String^ getUsage(); 00057 private: 00058 void check(); 00059 void shutdown(); 00060 XmlBlasterAccessUnparsed *connection_; 00061 }; 00062 }}} 00063 00064 00065 #endif // _MANAGED 00066 #endif /* XMLBLASTER_XmlBlasterManaged_H */