Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-09-22 14:09:24 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ca3b89aa7de73f47d6767d5d5d6e408c54ffb696
ca3b89aa
1 parent
8a6edac4
add kafka array, use c++ template.
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
29 行增加
和
0 行删除
trunk/src/protocol/srs_kafka_stack.hpp
trunk/src/protocol/srs_kafka_stack.hpp
查看文件 @
ca3b89a
...
...
@@ -70,6 +70,35 @@ public:
};
/**
* This is a notation for handling repeated structures. These will always be encoded as an
* int32 size containing the length N followed by N repetitions of the structure which can
* itself be made up of other primitive types. In the BNF grammars below we will show an
* array of a structure foo as [foo].
* @see https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-Requests
*/
template
<
typename
T
>
class
SrsKafkaArray
{
private
:
int
length
;
std
::
vector
<
T
*>
elems
;
typedef
typename
std
::
vector
<
T
*>::
iterator
SrsIterator
;
public
:
SrsKafkaArray
()
{
length
=
0
;
}
virtual
~
SrsKafkaArray
()
{
for
(
SrsIterator
it
=
elems
.
begin
();
it
!=
elems
.
end
();
++
it
)
{
T
*
elem
=
*
it
;
srs_freep
(
elem
);
}
elems
.
clear
();
}
};
/**
* the header of request, includes the size of request.
* @see https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-Requests
*/
...
...
请
注册
或
登录
后发表评论