xmscore  1.0
DynBitset.cpp
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
6 //------------------------------------------------------------------------------
7 
8 //----- Included files ---------------------------------------------------------
9 
10 // 1. Precompiled header
11 
12 // 2. My own header
13 #include <xmscore/misc/DynBitset.h>
14 
15 // 3. Standard library headers
16 
17 // 4. External library headers
18 
19 // 5. Shared code headers
20 
21 // 6. Non-shared code headers
22 
23 //----- Forward declarations ---------------------------------------------------
24 
25 //----- External globals -------------------------------------------------------
26 
27 //----- Namespace declaration --------------------------------------------------
28 namespace xms
29 {
30 //----- Constants / Enumerations -----------------------------------------------
31 
32 //----- Classes / Structs ------------------------------------------------------
33 
34 //----- Internal functions -----------------------------------------------------
35 
36 //----- Class / Function definitions -------------------------------------------
37 
38 //------------------------------------------------------------------------------
42 //------------------------------------------------------------------------------
43 void VecBooleanToDynBitset(const std::vector<unsigned char>& a_from, DynBitset& a_to)
44 {
45  a_to.resize(a_from.size());
46  for (size_t i = 0; i < a_from.size(); ++i)
47  {
48  a_to[i] = a_from[i] != 0;
49  }
50 } // VecBooleanToDynBitset
51 //------------------------------------------------------------------------------
55 //------------------------------------------------------------------------------
56 void DynBitsetToVecBoolean(const DynBitset& a_from, std::vector<unsigned char>& a_to)
57 {
58  a_to.clear();
59  a_to.reserve(a_from.size());
60  for (size_t i = 0; i < a_from.size(); ++i)
61  {
62  a_to.push_back(a_from[i]);
63  }
64 } // DynBitsetToVecBoolean
65 
66 } // namespace xms
void VecBooleanToDynBitset(const std::vector< unsigned char > &a_from, DynBitset &a_to)
Convert from a VecBoolean to a DynBitset.
Definition: DynBitset.cpp:43
void DynBitsetToVecBoolean(const DynBitset &a_from, std::vector< unsigned char > &a_to)
Convert from a DynBitset to a VecBoolean.
Definition: DynBitset.cpp:56
Macros etc that make boost more convenient to use.
boost::dynamic_bitset< size_t > DynBitset
vector of flags
Definition: DynBitset.h:24