|
Urbi SDK Remote for C++
2.7.5
|
00001 /* 00002 * Copyright (C) 2009, 2010, 2011, Gostai S.A.S. 00003 * 00004 * This software is provided "as is" without warranty of any kind, 00005 * either expressed or implied, including but not limited to the 00006 * implied warranties of fitness for a particular purpose. 00007 * 00008 * See the LICENSE file for more information. 00009 */ 00010 00012 00013 #ifndef URBI_UMESSAGE_HH 00014 # define URBI_UMESSAGE_HH 00015 00016 # include <iosfwd> 00017 # include <list> 00018 # include <string> 00019 00020 # include <urbi/export.hh> 00021 # include <urbi/fwd.hh> 00022 # include <urbi/ubinary.hh> 00023 00024 namespace urbi 00025 { 00026 00027 enum UMessageType 00028 { 00029 MESSAGE_SYSTEM, 00030 MESSAGE_ERROR, 00031 MESSAGE_DATA 00032 }; 00033 00035 class URBI_SDK_API UMessage 00036 { 00037 public: 00038 UMessage(UAbstractClient& client); 00039 00042 UMessage(UAbstractClient& client, int timestamp, 00043 const char* tag, const char* message, 00044 const binaries_type& bins = binaries_type()); 00046 UMessage(UAbstractClient& client, int timestamp, 00047 const std::string& tag, const std::string& message, 00048 const binaries_type& bins = binaries_type()); 00049 00050 UMessage(const UMessage& source); 00051 00053 ~UMessage(); 00054 00056 operator urbi::UValue&(); 00057 00059 std::ostream& print(std::ostream& o) const; 00060 00062 UAbstractClient& client; 00064 int timestamp; 00066 std::string tag; 00067 00069 UMessageType type; 00070 00072 urbi::UValue* value; 00074 std::string message; 00076 std::string rawMessage; 00077 00078 private: 00081 void init_(const binaries_type& bins); 00082 }; 00083 00085 std::ostream& operator<<(std::ostream& s, const UMessage& m); 00086 00090 template <typename T> 00091 int getValue(UMessage* m, T& val); 00092 00093 } // namespace urbi 00094 00095 00096 00097 # include <urbi/umessage.hxx> 00098 00099 #endif // URBI_UMESSAGE_HH