void load( Archive& archive, int mode, const char* name, boost::scoped_ptr<Type>& object ) { SWEET_ASSERT( object.get() == NULL ); SWEET_ASSERT( mode == MODE_VALUE ); ObjectGuard<Archive> guard( archive, name, 0, MODE_VALUE ); object.reset( static_cast<Type*>(archive.create_and_persist<Type>()) ); }
void load( Archive& archive, int mode, const char* name, weak_ptr<Type>& object ) { SWEET_ASSERT( mode == MODE_REFERENCE ); SWEET_ASSERT( object.lock() == ptr<Type>() ); ObjectGuard<Archive> guard( archive, name, 0, MODE_REFERENCE ); archive.reference( archive.get_address(), reinterpret_cast<void**>(&object), &resolver<weak_ptr<Type> >::resolve ); }
void operator()( ParserStateMachine* parser_state_machine ) const { SWEET_ASSERT( parser_state_machine ); SWEET_ASSERT( application_ ); application_->remove_parser_state_machine( parser_state_machine ); delete parser_state_machine; parser_state_machine = NULL; }
void save( Archive& archive, int mode, const char* name, boost::scoped_ptr<Type>& object ) { SWEET_ASSERT( mode == MODE_VALUE ); ObjectGuard<Archive> guard( archive, name, object.get(), mode, object.get() != 0 ? 1: 0 ); if ( object.get() ) { archive.persist( SWEET_TYPEID(*object.get()), archive, object.get() ); } }
void load( Archive& archive, int mode, const char* name, ptr<Type>& object ) { SWEET_ASSERT( object.get() == NULL ); ObjectGuard<Archive> guard( archive, name, 0, mode ); switch ( mode ) { case MODE_VALUE: object.reset( static_cast<Type*>(archive.template create_and_persist<Type>()) ); break; case MODE_REFERENCE: archive.reference( archive.get_address(), reinterpret_cast<void**>(&object), &resolver<ptr<Type> >::resolve ); break; default: SWEET_ASSERT( false ); break; } }
void resolve( Archive& archive, int mode, boost::scoped_ptr<Type>& object ) { SWEET_ASSERT( mode == MODE_VALUE ); ObjectGuard<Archive> guard( archive, 0, object.get(), MODE_VALUE ); if ( object.get() != NULL ) { archive.track( object.get(), &object ); archive.persist( SWEET_TYPEID(*object.get()), archive, object.get() ); } }
TestBody( const char* filename ) : written_model_(), read_model_() { SWEET_ASSERT( filename ); Writer writer; writer.write( filename, "model", written_model_ ); read_model_.clear(); Reader reader; reader.read( filename, "model", read_model_ ); }
void save( Archive& archive, int mode, const char* name, weak_ptr<Type>& object ) { SWEET_ASSERT( mode == MODE_REFERENCE ); ptr<Type> locked_object = object.lock(); if ( locked_object ) { ObjectGuard<Archive> guard( archive, name, locked_object.get(), MODE_REFERENCE, 1 ); } else { ObjectGuard<Archive> guard( archive, name, NULL, MODE_REFERENCE, 0 ); } }
void save( Archive& archive, int mode, const char* name, ptr<Type>& object ) { ObjectGuard<Archive> guard( archive, name, object.get(), mode, object.get() != 0 ? 1 : 0 ); switch ( mode ) { case MODE_VALUE: if ( object.get() != 0 ) { archive.persist( SWEET_TYPEID(*object.get()), archive, object.get() ); } break; case MODE_REFERENCE: break; default: SWEET_ASSERT( false ); break; } }
void resolve( Archive& archive, int mode, ptr<Type>& object ) { ObjectGuard<Archive> guard( archive, 0, object.get(), mode ); switch ( mode ) { case MODE_VALUE: if ( object.get() ) { archive.track( object.get(), &object ); archive.persist( SWEET_TYPEID(*object.get()), archive, object.get() ); } break; case MODE_REFERENCE: archive.reference( 0, reinterpret_cast<void**>(&object), &resolver<ptr<Type> >::resolve ); break; default: SWEET_ASSERT( false ); break; } }
bool operator()( const ReaderType* lhs, const ReaderType* rhs ) const { SWEET_ASSERT( lhs && rhs ); return lhs->compare_by_name( *rhs ); }
void resolve( Archive& archive, int mode, weak_ptr<Type>& object ) { SWEET_ASSERT( mode == MODE_REFERENCE ); archive.reference( 0, reinterpret_cast<void**>(&object), &resolver<weak_ptr<Type> >::resolve ); }
void load( Archive& archive, int mode, const char* name, const char* child_name, std::deque<Type, ALLOCATOR>& container ) { SWEET_ASSERT( container.empty() ); load_stl_sequence( archive, mode, name, child_name, container ); }
ParserStateMachineDeleter( Application* application ) : application_( application ) { SWEET_ASSERT( application_ ); }