lltemplatemessagebuilder.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLTEMPLATEMESSAGEBUILDER_H
00033 #define LL_LLTEMPLATEMESSAGEBUILDER_H
00034 
00035 #include <map>
00036 
00037 #include "llmessagebuilder.h"
00038 #include "llmsgvariabletype.h"
00039 
00040 class LLMsgData;
00041 class LLMessageTemplate;
00042 class LLMsgBlkData;
00043 class LLMessageTemplate;
00044 
00045 class LLTemplateMessageBuilder : public LLMessageBuilder
00046 {
00047 public:
00048         
00049         typedef std::map<const char* , LLMessageTemplate*> message_template_name_map_t;
00050 
00051         LLTemplateMessageBuilder(message_template_name_map_t&);
00052         virtual ~LLTemplateMessageBuilder();
00053 
00054         virtual void newMessage(const char* name);
00055 
00056         virtual void nextBlock(const char* blockname);
00057         virtual BOOL removeLastBlock(); // TODO: babbage: remove this horror...
00058 
00060         virtual void addBinaryData(const char *varname, const void *data, 
00061                                                            S32 size);
00062         virtual void addBOOL(const char* varname, BOOL b);
00063         virtual void addS8(const char* varname, S8 s);
00064         virtual void addU8(const char* varname, U8 u);
00065         virtual void addS16(const char* varname, S16 i);
00066         virtual void addU16(const char* varname, U16 i);
00067         virtual void addF32(const char* varname, F32 f);
00068         virtual void addS32(const char* varname, S32 s);
00069         virtual void addU32(const char* varname, U32 u);
00070         virtual void addU64(const char* varname, U64 lu);
00071         virtual void addF64(const char* varname, F64 d);
00072         virtual void addVector3(const char* varname, const LLVector3& vec);
00073         virtual void addVector4(const char* varname, const LLVector4& vec);
00074         virtual void addVector3d(const char* varname, const LLVector3d& vec);
00075         virtual void addQuat(const char* varname, const LLQuaternion& quat);
00076         virtual void addUUID(const char* varname, const LLUUID& uuid);
00077         virtual void addIPAddr(const char* varname, const U32 ip);
00078         virtual void addIPPort(const char* varname, const U16 port);
00079         virtual void addString(const char* varname, const char* s);
00080         virtual void addString(const char* varname, const std::string& s);
00081 
00082         virtual BOOL isMessageFull(const char* blockname) const;
00083         virtual void compressMessage(U8*& buf_ptr, U32& buffer_length);
00084 
00085         virtual BOOL isBuilt() const;
00086         virtual BOOL isClear() const;
00087         virtual U32 buildMessage(U8* buffer, U32 buffer_size, U8 offset_to_data);
00090         virtual void clearMessage();
00091 
00092         // TODO: babbage: remove this horror.
00093         virtual void setBuilt(BOOL b);
00094 
00095         virtual S32 getMessageSize();
00096         virtual const char* getMessageName() const;
00097 
00098         virtual void copyFromMessageData(const LLMsgData& data);
00099         virtual void copyFromLLSD(const LLSD&);
00100 
00101 private:
00102         void addData(const char* varname, const void* data, 
00103                                          EMsgVariableType type, S32 size);
00104         
00105         void addData(const char* varname, const void* data, 
00106                                                 EMsgVariableType type);
00107 
00108         LLMsgData* mCurrentSMessageData;
00109         const LLMessageTemplate* mCurrentSMessageTemplate;
00110         LLMsgBlkData* mCurrentSDataBlock;
00111         char* mCurrentSMessageName;
00112         char* mCurrentSBlockName;
00113         BOOL mbSBuilt;
00114         BOOL mbSClear;
00115         S32      mCurrentSendTotal;
00116         message_template_name_map_t& mMessageTemplates;
00117 };
00118 
00119 #endif // LL_LLTEMPLATEMESSAGEBUILDER_H

Generated on Thu Jul 1 06:09:15 2010 for Second Life Viewer by  doxygen 1.4.7