src/libYARP_OS/src/mesh.cpp
int Mesh::Store ( ostream& os, int style )
{
	int
    	verbose = ( ( style & FORMAT ) == PROSE_FORMAT ),
		exhaustive = ( ( style & CONTENT ) == EXHAUSTIVE_CONTENT ),
		failed = 0;
	MeshLink
		*cursor = root;

	if ( cursor != NULL )
	{
		while ( cursor->BaseGetMeshNext() != NULL )
		{
			cursor = cursor->BaseGetMeshNext();
		}

		while ( cursor != NULL && !failed )
		{
			os << cursor->GetLabel() << TabChar;
			if ( verbose )	os << "FROM " << TabChar;
			if ( cursor->BaseGetSource() != NULL )
			{
				os << cursor->BaseGetSource()->GetLabel() << TabChar;
			}
			else
			{
				os << NullName << TabChar;
			}
			if ( verbose )	os << "TO " << TabChar;
			if ( cursor->BaseGetDest() != NULL )
			{
				os << cursor->BaseGetDest()->GetLabel() << TabChar;
			}
			else
			{
				os << NullName << TabChar;
			}

			if ( verbose )	os << "( ";
			if ( !cursor->Write ( os, style ) )
			{
				os << "< Couldn't write object in ";
				os << ( verbose ? "Prose-like" : "Concise" );
				os << " format with ";
				os << ( exhaustive ? "Exhaustive" : "Minimal" );
                os << " content >";

				failed = 1;
			}

			if ( verbose )		os << " )";
			os << endl;

			cursor = cursor->BaseGetMeshPrev();
		}

	}

	//	Terminate file
	if ( verbose )
	{
		os << NullName << " : EndOfMesh" << endl;
	}
	else
	{
		os << NullName;
	}

	return !failed;
}
/*-----------------------------------------------------------------------------
Function	Store
                                                                           
Description	Stores a mesh on a stream.

Input		os				Output stream to write to.
			style			Style in which the mesh is to be described.
							This is a combination of
								PROSE_FORMAT or CONCISE_FORMAT
							and
								MINIMAL_CONTENT or EXHAUSTIVE_CONTENT.

Returns		True if no error while storing, false on error
-----------------------------------------------------------------------------*/
Function        Store
Description     Stores a mesh on a stream.

Input           os                              Output stream to write to.
style                   Style in which the mesh is to be described.

Returns         True if no error while storing, false on error
Function Store Description Stores a mesh on a stream . Input os Output stream to write to . style Style in which the mesh is to be described . Returns True if no error while storing false on error
int Mesh::Store ( ostream& os, int style )
{
	int
    	verbose = ( ( style & FORMAT ) == PROSE_FORMAT ),
		exhaustive = ( ( style & CONTENT ) == EXHAUSTIVE_CONTENT ),
		failed = 0;
	MeshLink
		*cursor = root;
	if ( cursor != NULL )
	{
		while ( cursor->BaseGetMeshNext() != NULL )
		{
			cursor = cursor->BaseGetMeshNext();
		}
		while ( cursor != NULL && !failed )
		{
			os << cursor->GetLabel() << TabChar;
			if ( verbose )	os << "FROM " << TabChar;
			if ( cursor->BaseGetSource() != NULL )
			{
				os << cursor->BaseGetSource()->GetLabel() << TabChar;
			}
			else
			{
				os << NullName << TabChar;
			}
			if ( verbose )	os << "TO " << TabChar;
			if ( cursor->BaseGetDest() != NULL )
			{
				os << cursor->BaseGetDest()->GetLabel() << TabChar;
			}
			else
			{
				os << NullName << TabChar;
			}
			if ( verbose )	os << "( ";
			if ( !cursor->Write ( os, style ) )
			{
				os << "< Couldn't write object in ";
				os << ( verbose ? "Prose-like" : "Concise" );
				os << " format with ";
				os << ( exhaustive ? "Exhaustive" : "Minimal" );
                os << " content >";
				failed = 1;
			}
			if ( verbose )		os << " )";
			os << endl;
			cursor = cursor->BaseGetMeshPrev();
		}
	}
	if ( verbose )
	{
		os << NullName << " : EndOfMesh" << endl;
	}
	else
	{
		os << NullName;
	}
	return !failed;
}
int Mesh :: Store ( ostream & os , int style ) { int verbose = ( ( style & FORMAT ) == PROSE_FORMAT ) , exhaustive = ( ( style & CONTENT ) == EXHAUSTIVE_CONTENT ) , failed = 0 ; MeshLink * cursor = root ; if ( cursor != NULL ) { while ( cursor -> BaseGetMeshNext ( ) != NULL ) { cursor = cursor -> BaseGetMeshNext ( ) ; } while ( cursor != NULL && ! failed ) { os << cursor -> GetLabel ( ) << TabChar ; if ( verbose ) os << " " << TabChar ; if ( cursor -> BaseGetSource ( ) != NULL ) { os << cursor -> BaseGetSource ( ) -> GetLabel ( ) << TabChar ; } else { os << NullName << TabChar ; } if ( verbose ) os << " " << TabChar ; if ( cursor -> BaseGetDest ( ) != NULL ) { os << cursor -> BaseGetDest ( ) -> GetLabel ( ) << TabChar ; } else { os << NullName << TabChar ; } if ( verbose ) os << " " ; if ( ! cursor -> Write ( os , style ) ) { os << " " ; os << ( verbose ? " " : " " ) ; os << " " ; os << ( exhaustive ? " " : " " ) ; os << " " ; failed = 1 ; } if ( verbose ) os << " " ; os << endl ; cursor = cursor -> BaseGetMeshPrev ( ) ; } } if ( verbose ) { os << NullName << " " << endl ; } else { os << NullName ; } return ! failed ; }
Function        Store
Description     Stores a mesh on a stream.
Function Store Description Stores a mesh on a stream .
//	Terminate file