Logo Khaganat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:packed_sheets [2017/01/30 09:52] osqualloen:packed_sheets [2021/12/03 18:19] (current) – external edit 127.0.0.1
Line 8: Line 8:
  
 ====== Packed sheet ====== ====== Packed sheet ======
-Packed Sheets 
-Summary 
  
 A packed sheet is a way of storing multiple Georges sheets in a binary format. What a packed sheet does is load all of the sheets/forms into a single binary file that can be serialized by a loader that can automatically populate the proper data. It also will update the packed sheet (if informed to) to either create a new packed sheet (if one does not already exist) or add new entries to a packed sheet. A packed sheet is a way of storing multiple Georges sheets in a binary format. What a packed sheet does is load all of the sheets/forms into a single binary file that can be serialized by a loader that can automatically populate the proper data. It also will update the packed sheet (if informed to) to either create a new packed sheet (if one does not already exist) or add new entries to a packed sheet.
Line 16: Line 14:
 For packed sheets, you must declare a class that will be used by the form packer: For packed sheets, you must declare a class that will be used by the form packer:
  
-1 - Create a class (or struct) that is needed to conform to the following interface:+===== Create a class (or struct) that is needed to conform to the following interface: ======
  
 +<code cpp>
 struct TMyLoader struct TMyLoader
  
Line 68: Line 67:
  
 }; };
 +</code>
  
 Loader Structure/Class Notes Loader Structure/Class Notes
Line 79: Line 79:
 Now that you have your class that conforms to the requirements of the packer and loader you have to create a container for the form loader to populate with sheets. This must always be like a map similar to the one below. Now that you have your class that conforms to the requirements of the packer and loader you have to create a container for the form loader to populate with sheets. This must always be like a map similar to the one below.
  
-2 - Declare a container for all the loaded sheets:+===== Declare a container for all the loaded sheets: =====
  
-std::map<CSheetId, TMyLoader> MySheets;+<code cpp>std::map<CSheetId, TMyLoader> MySheets;</code>
  
 Usually Nevrax declares this globally but there is no constraint about that. It is used for a single call to loadForm (which is described below) and not for all sheets in an application. This method loads all of the sheets into the container. Usually Nevrax declares this globally but there is no constraint about that. It is used for a single call to loadForm (which is described below) and not for all sheets in an application. This method loads all of the sheets into the container.
  
-3 - Call the packed sheet loader:+===== Call the packed sheet loader: =====
  
-loadForm( "my_extension", "packed_sheet_file_name.packed_sheets", MySheets, true);+<code cpp>loadForm( "my_extension", "packed_sheet_file_name.packed_sheets", MySheets, true);</code>
  
 Essentially what loadForm does is if told to go through the files with my_extension for an extension and check if there are newer ones than in the packed sheet, new ones period, or if some have been removed and marks these files appropriately in memory. It then loads all of the forms and puts them into cached lists and removes any files it found missing from the packed sheet. If it changed the container at all (added new files, updated changed files, or removed old files) it saves the file back out as the file passed in the parameter, which is packed_sheet_file_name.packed_sheets in the above example. In the process your map will be populated either via serialization (unchanged sheets) or by the readGeorges method (added or updated sheets.) Essentially what loadForm does is if told to go through the files with my_extension for an extension and check if there are newer ones than in the packed sheet, new ones period, or if some have been removed and marks these files appropriately in memory. It then loads all of the forms and puts them into cached lists and removes any files it found missing from the packed sheet. If it changed the container at all (added new files, updated changed files, or removed old files) it saves the file back out as the file passed in the parameter, which is packed_sheet_file_name.packed_sheets in the above example. In the process your map will be populated either via serialization (unchanged sheets) or by the readGeorges method (added or updated sheets.)
 Loading Notes Loading Notes
  
-    The packed sheet form loader requires that the file extension be .packed_sheets - however the logic lets you get away with .packed_sheetsbar for example. As a matter of practice though the packed sheet extension should stay with the standard. +The packed sheet form loader requires that the file extension be .packed_sheets - however the logic lets you get away with .packed_sheetsbar for example. As a matter of practice though the packed sheet extension should stay with the standard. 
-    The above function actually converts "my_extension" into a single-entry std::vector and calls:+The above function actually converts "my_extension" into a single-entry std::vector and calls:
  
 +<code cpp>
 void loadForm (const std::vector< std::string > &sheetFilters, const std::string &packedFilename, std::map< NLMISC::CSheetId, T > &container, bool updatePackedSheet=true, bool errorIfPackedSheetNotGood=true) void loadForm (const std::vector< std::string > &sheetFilters, const std::string &packedFilename, std::map< NLMISC::CSheetId, T > &container, bool updatePackedSheet=true, bool errorIfPackedSheetNotGood=true)
 +</code>
  
-    loadForm is a template function, as seen above it will deduce it's argument from the ''container'' paramenter, where you will pass ))MySheets((.+loadForm is a template function, as seen above it will deduce it's argument from the ''container'' paramenter, where you will pass ))MySheets((.
  
 Summary / Details Summary / Details
Line 115: Line 117:
 It has to be in your search path, then you call the init method in CSheetId (or somethink near that) It has to be in your search path, then you call the init method in CSheetId (or somethink near that)
  
 +<code cpp>
 CSheetId::init(false); CSheetId::init(false);
 +</code>
  
 Source: [[http://dev.ryzom.com/projects/ryzom/wiki/PackedSheets|Text from kervala on the dev.ryzom.com wiki]]. Source: [[http://dev.ryzom.com/projects/ryzom/wiki/PackedSheets|Text from kervala on the dev.ryzom.com wiki]].
 {{tag>Tag_a_ajouter}} {{tag>Tag_a_ajouter}}
CC Attribution-Share Alike 4.0 International Driven by DokuWiki
en/packed_sheets.1485769972.txt.gz · Last modified: (external edit)

Licences Mentions légales Accueil du site Contact Inclusion