Message.h
Go to the documentation of this file.
00001 /* 00002 * 00003 * Copyright 2006 Savarese Software Research Corporation 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.savarese.com/software/ApacheLicense-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00023 #ifndef __SSRC_SPREAD_MESSAGE_H 00024 #define __SSRC_SPREAD_MESSAGE_H 00025 00026 #include <ssrc/spread/detail/ByteBuffer.h> 00027 #include <ssrc/spread/MembershipInfo.h> 00028 00029 __BEGIN_NS_SSRC_SPREAD 00030 00047 class Message : public BaseMessage, public detail::ByteBuffer { 00048 protected: 00049 00050 #ifdef LIBSSRCSPREAD_ENABLE_MEMBERSHIP_INFO 00051 00052 virtual int sp_get_membership_info(Spread::membership_info *info) const { 00053 return Spread::SP_get_memb_info(&(this->operator[](0)), service(), info); 00054 } 00055 00056 virtual int sp_get_vs_set_members(const Spread::vs_set_info *vs_set, 00057 Spread::group_type member_names[], 00058 unsigned int member_names_count) 00059 const 00060 { 00061 return 00062 Spread::SP_get_vs_set_members(&(this->operator[](0)), 00063 vs_set, member_names, member_names_count); 00064 } 00065 00066 virtual int sp_get_vs_sets_info(Spread::vs_set_info *vs_sets, 00067 unsigned int num_vs_sets, 00068 unsigned int *index) 00069 const 00070 { 00071 return 00072 Spread::SP_get_vs_sets_info(&(this->operator[](0)), 00073 vs_sets, num_vs_sets, index); 00074 } 00075 00076 #endif 00077 00078 public: 00079 00080 enum { 00082 DefaultCapacity = 4096 00083 }; 00084 00093 explicit Message(const unsigned int capacity = DefaultCapacity) : 00094 detail::ByteBuffer(capacity) { } 00095 00096 virtual unsigned int size() const { 00097 return detail::ByteBuffer::size(); 00098 } 00099 00100 virtual void clear() { 00101 return detail::ByteBuffer::clear(); 00102 } 00103 00104 }; 00105 00106 __END_NS_SSRC_SPREAD 00107 00108 #endif
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.
Copyright © 2011 Savarese Software Research Corporation. All rights reserved