1 #ifndef COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2 #define COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
4 #if !defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4) // GCC supports "pragma once" correctly since 3.4
14 struct CollectionType
{
15 enum value
{ None
, BlockMap
, BlockSeq
, FlowMap
, FlowSeq
, CompactMap
};
21 CollectionType::value
GetCurCollectionType() const {
22 if(collectionStack
.empty())
23 return CollectionType::None
;
24 return collectionStack
.top();
27 void PushCollectionType(CollectionType::value type
) { collectionStack
.push(type
); }
28 void PopCollectionType(CollectionType::value type
) { assert(type
== GetCurCollectionType()); collectionStack
.pop(); }
31 std::stack
<CollectionType::value
> collectionStack
;
35 #endif // COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66