Bitstream Interpretation Library (BIL)
0.1
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
bitstream
SyncWordRawData.cpp
Go to the documentation of this file.
1
6
#include <
bitstream/SyncWordRawData.hpp
>
7
#include <
exception/Exception.hpp
>
8
9
using namespace
bil;
10
11
12
const
size_t
SYNCHRO_WORD_SIZE
= 1;
13
const
boost::uint32_t
SYNCHRO_WORD
= 0xaa995566;
14
15
16
size_t
bil::isSyncWord
(
const
boost::uint32_t* words,
size_t
wordCount)
17
{
18
// test if data is large enough
19
if
(
SYNCHRO_WORD_SIZE
> wordCount)
return
0;
20
// test if sync word is correct
21
if
(
SYNCHRO_WORD
!= *words)
return
0;
22
// sync word raw data found, return its size
23
return
SYNCHRO_WORD_SIZE
;
24
}
25
26
27
size_t
bil::writeSyncWord
(boost::uint32_t* words,
size_t
wordCount)
28
{
29
// check if buffer is large enough
30
if
(
SYNCHRO_WORD_SIZE
> wordCount)
throw
Exception
();
31
// write sync word
32
*words =
SYNCHRO_WORD
;
33
// return written size
34
return
SYNCHRO_WORD_SIZE
;
35
}
Generated on Wed Aug 8 2012 21:57:40 for Bitstream Interpretation Library (BIL) by
1.8.1.1