+ template< int DEPTH >
+ void insertOcRep(Detail::Int2Type< DEPTH >,
+ const OC::OCRepresentation::AttributeItem& item)
+ {
+ typedef typename Detail::OCItemType< DEPTH,
+ OC::AttributeType::OCRepresentation >::type ItemType;
+
+ putValue(item.attrname(),
+ insertOcRep(Detail::Int2Type< DEPTH >{ }, item.getValue< ItemType >()));
+ }
+
+ template< typename OCREP >
+ RCSByteString insertOcBinary(Detail::Int2Type< 0 >, const OCREP& ocBinary)
+ {
+ return RCSByteString(ocBinary);
+ }
+
+ template< int DEPTH, typename OCREPS,
+ typename ATTRS = typename Detail::SeqType< DEPTH, RCSByteString >::type >
+ ATTRS insertOcBinary(Detail::Int2Type< DEPTH >, const OCREPS& ocBinaryVec)
+ {
+ ATTRS result;
+
+ for (const auto& nested : ocBinaryVec)
+ {
+ result.push_back(insertOcBinary(Detail::Int2Type< DEPTH - 1 >{ }, nested));
+ }
+
+ return result;
+ }
+
+ template< OC::AttributeType BASE_TYPE, int DEPTH >
+ void insertOcBinary(Detail::Int2Type< DEPTH >,
+ const OC::OCRepresentation::AttributeItem& item)
+ {
+ typedef typename Detail::OCItemType< DEPTH, BASE_TYPE >::type ItemType;
+
+ putValue(item.attrname(),
+ insertOcBinary(Detail::Int2Type< DEPTH >{ },
+ item.getValue< ItemType >()));
+ }
+
+ public:
+ ResourceAttributesBuilder() = default;
+
+ void insertItem(const OC::OCRepresentation::AttributeItem& item)
+ {
+ switch (item.depth())
+ {
+ case 0:
+ return insertItem(Detail::Int2Type< 0 >{ }, item);
+ case 1:
+ return insertItem(Detail::Int2Type< 1 >{ }, item);
+ case 2:
+ return insertItem(Detail::Int2Type< 2 >{ }, item);
+ case 3:
+ return insertItem(Detail::Int2Type< 3 >{ }, item);
+
+ default:
+ assert("There must be no another depth!");
+ }
+ }
+
+ RCSResourceAttributes&& extract()
+ {
+ return std::move(m_target);
+ }
+
+ private: