mirror of
https://github.com/USCiLab/cereal.git
synced 2025-10-18 01:45:52 +02:00
unordered json working, needs to be optimized
This commit is contained in:
@@ -360,7 +360,7 @@ namespace cereal
|
|||||||
switch(itsType)
|
switch(itsType)
|
||||||
{
|
{
|
||||||
case Value : ++itsValueIt; break;
|
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!");
|
default: throw cereal::Exception("Invalid Iterator Type!");
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
@@ -410,16 +410,18 @@ namespace cereal
|
|||||||
// The name an NVP provided with setNextName()
|
// The name an NVP provided with setNextName()
|
||||||
if( itsNextName )
|
if( itsNextName )
|
||||||
{
|
{
|
||||||
std::cerr << "Next name is " << itsNextName << std::endl;
|
//std::cerr << "Next name is " << itsNextName << std::endl;
|
||||||
std::cerr << itsIteratorStack.size() << std::endl;
|
//std::cerr << itsIteratorStack.size() << std::endl;
|
||||||
// The actual name of the current node
|
// The actual name of the current node
|
||||||
auto const actualName = itsIteratorStack.back().name();
|
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 << "Searching for " << itsNextName << std::endl;
|
||||||
std::cerr << "Actual name was: " << (actualName?actualName:"null") << std::endl;
|
//std::cerr << itsIteratorStack.size() << std::endl;
|
||||||
std::cerr << itsIteratorStack.size() << std::endl;
|
|
||||||
// names don't match, perform a search and adjust our current iterator
|
// names don't match, perform a search and adjust our current iterator
|
||||||
itsIteratorStack.back().search( itsNextName,
|
itsIteratorStack.back().search( itsNextName,
|
||||||
/*if*/ (itsIteratorStack.size() > 1 ?
|
/*if*/ (itsIteratorStack.size() > 1 ?
|
||||||
@@ -458,7 +460,7 @@ namespace cereal
|
|||||||
{
|
{
|
||||||
itsIteratorStack.pop_back();
|
itsIteratorStack.pop_back();
|
||||||
++itsIteratorStack.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
|
//! Sets the name for the next node created with startNode
|
||||||
|
|||||||
@@ -3082,7 +3082,6 @@ void test_unordered_loads()
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
{
|
{
|
||||||
OArchive oar(os);
|
OArchive oar(os);
|
||||||
OArchive oar2(std::cout);
|
|
||||||
|
|
||||||
oar( cereal::make_nvp( name1, o_int1 ),
|
oar( cereal::make_nvp( name1, o_int1 ),
|
||||||
cereal::make_nvp( name2, o_double2 ),
|
cereal::make_nvp( name2, o_double2 ),
|
||||||
@@ -3091,14 +3090,6 @@ void test_unordered_loads()
|
|||||||
cereal::make_nvp( name5, o_int5 ),
|
cereal::make_nvp( name5, o_int5 ),
|
||||||
cereal::make_nvp( name6, o_int6 ),
|
cereal::make_nvp( name6, o_int6 ),
|
||||||
cereal::make_nvp( name7, o_un7 ) );
|
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;
|
decltype(o_int1) i_int1;
|
||||||
|
|||||||
Reference in New Issue
Block a user