unordered json working, needs to be optimized

This commit is contained in:
Shane Grant
2013-10-17 10:58:02 -07:00
parent 7bd5dffff9
commit 855002604b
2 changed files with 10 additions and 17 deletions

View File

@@ -360,7 +360,7 @@ namespace cereal
switch(itsType)
{
case Value : ++itsValueIt; break;
case Member: std::cerr << "Advancing from " << name() << std::endl; ++itsMemberIt; break;
case Member: /*std::cerr << "Advancing from " << name() << std::endl;*/ ++itsMemberIt; break;
default: throw cereal::Exception("Invalid Iterator Type!");
}
return *this;
@@ -410,16 +410,18 @@ namespace cereal
// The name an NVP provided with setNextName()
if( itsNextName )
{
std::cerr << "Next name is " << itsNextName << std::endl;
std::cerr << itsIteratorStack.size() << std::endl;
//std::cerr << "Next name is " << itsNextName << std::endl;
//std::cerr << itsIteratorStack.size() << std::endl;
// The actual name of the current node
auto const actualName = itsIteratorStack.back().name();
if( itsIteratorStack.back().value().IsNull() || ( actualName && std::strcmp( itsNextName, actualName ) != 0 ) )
//std::cerr << "Actual name was: " << (actualName?actualName:"null") << std::endl;
// when at end of an iterator, the next name will be null
if( itsIteratorStack.back().value().IsNull() || !actualName || std::strcmp( itsNextName, actualName ) != 0 )
{
std::cerr << "Searching for " << itsNextName << std::endl;
std::cerr << "Actual name was: " << (actualName?actualName:"null") << std::endl;
std::cerr << itsIteratorStack.size() << std::endl;
//std::cerr << "Searching for " << itsNextName << std::endl;
//std::cerr << itsIteratorStack.size() << std::endl;
// names don't match, perform a search and adjust our current iterator
itsIteratorStack.back().search( itsNextName,
/*if*/ (itsIteratorStack.size() > 1 ?
@@ -458,7 +460,7 @@ namespace cereal
{
itsIteratorStack.pop_back();
++itsIteratorStack.back();
std::cerr << "Finishing a node " << itsIteratorStack.size() << std::endl;
//std::cerr << "Finishing a node " << itsIteratorStack.size() << std::endl;
}
//! Sets the name for the next node created with startNode

View File

@@ -3082,7 +3082,6 @@ void test_unordered_loads()
std::ostringstream os;
{
OArchive oar(os);
OArchive oar2(std::cout);
oar( cereal::make_nvp( name1, o_int1 ),
cereal::make_nvp( name2, o_double2 ),
@@ -3091,14 +3090,6 @@ void test_unordered_loads()
cereal::make_nvp( name5, o_int5 ),
cereal::make_nvp( name6, o_int6 ),
cereal::make_nvp( name7, o_un7 ) );
oar2( cereal::make_nvp( name1, o_int1 ),
cereal::make_nvp( name2, o_double2 ),
cereal::make_nvp( name3, o_vecbool3 ),
cereal::make_nvp( name4, o_int4 ),
cereal::make_nvp( name5, o_int5 ),
cereal::make_nvp( name6, o_int6 ),
cereal::make_nvp( name7, o_un7 ) );
}
decltype(o_int1) i_int1;