Graphite  Version 3
An experimental 3D geometry processing program
OGF::InputGraphiteFile Class Reference

An extension of InputGeoFile for storing a complete Graphite scenegraph in a structured binary file. More...

#include <OGF/scene_graph/types/geofile.h>

Inheritance diagram for OGF::InputGraphiteFile:
GEO::InputGeoFile GEO::GeoFile

Public Member Functions

 InputGraphiteFile (const std::string &filename)
 InputGeoFile constructor. More...
 
void read_scene_graph_header (ArgList &args)
 Reads a SceneGraph header. More...
 
void read_grob_header (ArgList &args)
 Reads a grob header. More...
 
void read_shader (ArgList &args)
 Readss shader informations. More...
 
void read_history (std::vector< std::string > &history)
 Reads the commands history from the geofile. More...
 
void read_arg_list (ArgList &args)
 Reads an ArgList from the GeoFile. More...
 
- Public Member Functions inherited from GEO::InputGeoFile
 InputGeoFile (const std::string &filename)
 InputGeoFile constructor. More...
 
const std::string & next_chunk ()
 Advances to the next chunk. More...
 
void read_attribute (void *addr)
 Reads the latest attribute. More...
 
void skip_attribute_set ()
 Indicates that all the attributes attached to the latest attribute set should be skipped. More...
 
const AttributeSetInfocurrent_attribute_set () const
 Gets the current attribute set. More...
 
const AttributeInfocurrent_attribute () const
 Gets the current attribute. More...
 
const std::string & current_comment () const
 
void read_command_line (std::vector< std::string > &args)
 Reads the command line from the file. More...
 
- Public Member Functions inherited from GEO::GeoFile
 GeoFile (const std::string &filename)
 GeoFile constructor. More...
 
 ~GeoFile ()
 GeoFile destructor.
 
bool is_ascii () const
 Tests whether this GeoFile is ascii. More...
 
const std::string & current_chunk_class () const
 Gets the current chunk class. More...
 
long current_chunk_size () const
 Gets the size of the current chunk. More...
 
AttributeSetInfofind_attribute_set (const std::string &name)
 Finds an attribute set by name. More...
 
const AttributeSetInfofind_attribute_set (const std::string &name) const
 Finds an attribute set by name. More...
 
index_t read_int ()
 Reads an integer from the file. More...
 
void write_int (index_t x, const char *comment=nullptr)
 Writes an integer into the file. More...
 
std::string read_string ()
 Reads a string from the file. More...
 
void write_string (const std::string &s, const char *comment=nullptr)
 Writes a string into the file. More...
 
size_t read_size ()
 Reads an unsigned 64 bits integer from the file. More...
 
void write_size (size_t x)
 Writes an unsigned 64 bits integer into the file. More...
 
std::string read_chunk_class ()
 Reads a chunk class from the file. More...
 
void write_chunk_class (const std::string &chunk_class)
 Writes a chunk class into the file. More...
 
void write_string_array (const std::vector< std::string > &strings)
 Writes a string array into the file. More...
 
void read_string_array (std::vector< std::string > &strings)
 Reads a string array from the file. More...
 
size_t string_size (const std::string &s) const
 Gets the size in bytes used by a given string in the file. More...
 
size_t string_array_size (const std::vector< std::string > &strings) const
 Gets the size in bytes used by a given string array in the file. More...
 
void read_chunk_header ()
 Reads a chunk header from the file.
 
void write_chunk_header (const std::string &chunk_class, size_t size)
 Writes a chunk header into the file. More...
 
void check_chunk_size ()
 Checks that the actual chunk size corresponds to the specified chunk size.
 
void check_zlib_version ()
 Compares the zlib version declared in the header file with the zlib version obtained from the runtime, and outputs an error message if they differ.
 
void clear_attribute_maps ()
 Clears all memorized information about attributes and attribute sets. More...
 

Additional Inherited Members

- Public Types inherited from GEO::GeoFile
typedef bool(* AsciiAttributeSerializer) (FILE *file, Memory::pointer base_address, index_t nb_elements)
 The function pointer type for reading and writing attributes in ASCII files.
 
- Static Public Member Functions inherited from GEO::GeoFile
static void register_ascii_attribute_serializer (const std::string &type_name, AsciiAttributeSerializer read, AsciiAttributeSerializer write)
 Declares a new attribute type that can be read from and written to ascii files. More...
 
- Protected Member Functions inherited from GEO::InputGeoFile
void skip_chunk ()
 Skips the latest chunk. More...
 
- Protected Attributes inherited from GEO::InputGeoFile
AttributeSetInfocurrent_attribute_set_
 
AttributeInfocurrent_attribute_
 
std::string current_comment_
 
- Protected Attributes inherited from GEO::GeoFile
std::string filename_
 
gzFile file_
 
bool ascii_
 
FILE * ascii_file_
 
std::string current_chunk_class_
 
long current_chunk_size_
 
long current_chunk_file_pos_
 
std::map< std::string, AttributeSetInfoattribute_sets_
 
- Static Protected Attributes inherited from GEO::GeoFile
static std::map< std::string, AsciiAttributeSerializerascii_attribute_read_
 
static std::map< std::string, AsciiAttributeSerializerascii_attribute_write_
 

Detailed Description

An extension of InputGeoFile for storing a complete Graphite scenegraph in a structured binary file.

In addition to GeoFile, InputGraphiteFile handles the following chunk classes:

  • SCNE (Scene): an ArgList with the global attributes related with the Graphite scene graph (current_object)
  • HIST (History): a strings array with all the commands that were recorded in the Graphite session
  • GROB (Graphite Object): an ArgList with the attributes that define a grob (name and classname)
  • SHDR (Shader): an ArgList with the attributes that define a shader attached to a grob (classname and all the properties)

Definition at line 67 of file geofile.h.

Constructor & Destructor Documentation

◆ InputGraphiteFile()

OGF::InputGraphiteFile::InputGraphiteFile ( const std::string &  filename)

InputGeoFile constructor.

Parameters
[in]filenamea const reference to the file name.

Member Function Documentation

◆ read_arg_list()

void OGF::InputGraphiteFile::read_arg_list ( ArgList args)

Reads an ArgList from the GeoFile.

Parameters
[out]argsthe read ArgList

◆ read_grob_header()

void OGF::InputGraphiteFile::read_grob_header ( ArgList args)

Reads a grob header.

Parameters
[out]argsa reference to the ArgList that defines the grob name, class name and attributes.
Precondition
current_chunk_class() == "GROB"

◆ read_history()

void OGF::InputGraphiteFile::read_history ( std::vector< std::string > &  history)

Reads the commands history from the geofile.

Parameters
[out]historya reference to a vector of strings with the history
Precondition
current_chunk_class() == "HIST"

◆ read_scene_graph_header()

void OGF::InputGraphiteFile::read_scene_graph_header ( ArgList args)

Reads a SceneGraph header.

Parameters
[out]argsa reference to the ArgList that defines the grob name, class name and attributes.
Precondition
current_chunk_class() == "SCNG"

◆ read_shader()

void OGF::InputGraphiteFile::read_shader ( ArgList args)

Readss shader informations.

Parameters
[in]argsa reference to the ArgList that defines the shader class name and properties.
Precondition
current_chunk_class() == "SHDR"

The documentation for this class was generated from the following file: