00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef YCPExternal_h
00022 #define YCPExternal_h
00023
00024
00025 #include "YCPValue.h"
00026
00027
00033 class YCPExternalRep : public YCPValueRep
00034 {
00035 void * m_payload;
00036 string m_magic;
00037 void (*m_destructor)(void *, string);
00038
00039 protected:
00040 friend class YCPExternal;
00041
00049 YCPExternalRep(void * payload, string magic, void (*destructor)(void *, string) = 0);
00050
00054 ~YCPExternalRep();
00055
00056 public:
00059 void * payload() const;
00060
00063 string magic () const;
00064
00068 string toString() const;
00069
00075 std::ostream & toStream (std::ostream & str) const;
00076
00080 YCPValueType valuetype() const;
00081 };
00082
00089 class YCPExternal : public YCPValue
00090 {
00091 DEF_COMMON(External, Value);
00092 public:
00093 YCPExternal(void * payload, string magic, void (*destructor)(void*, string) = 0)
00094 : YCPValue(new YCPExternalRep(payload, magic, destructor)) {}
00095 YCPExternal(bytecodeistream & str);
00096 };
00097
00098 #endif // YCPExternal_h