new_case_studies.html 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!--
  4. (C) Copyright 2002-4 Robert Ramey - http://www.rrsd.com .
  5. Use, modification and distribution is subject to the Boost Software
  6. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  7. http://www.boost.org/LICENSE_1_0.txt)
  8. -->
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  11. <link rel="stylesheet" type="text/css" href="../../../boost.css">
  12. <link rel="stylesheet" type="text/css" href="style.css">
  13. <title>Serialization - Proposed Case Studies</title>
  14. </head>
  15. <body link="#0000ff" vlink="#800080">
  16. <table border="0" cellpadding="7" cellspacing="0" width="100%" summary="header">
  17. <tr>
  18. <td valign="top" width="300">
  19. <h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../boost.png" border="0"></a></h3>
  20. </td>
  21. <td valign="top">
  22. <h1 align="center">Serialization</h1>
  23. <h2 align="center">Proposed Case Studies</h2>
  24. </td>
  25. </tr>
  26. </table>
  27. <hr>
  28. <dl class="index">
  29. <dt><a href="#functionobject">Serializing a Function Object</a></dt>
  30. <dt><a href="#archiveadaptor">Archive Adaptors</a></dt>
  31. <dt><a href="#archivehelper">Archive Helpers</a></dt>
  32. </dl>
  33. These are not part of the library itself, but rather
  34. techiques on how to use the library to address specific situations.
  35. <h2><a name="functionobject"></a>Serializing a Function Object</h2>
  36. An example on how to serialize a function object. I believe this
  37. could be done by serializing a pointer to the object in question. Since
  38. the Serialization library resurrects a pointer of the correct type
  39. this should be easily implementable.
  40. <p>
  41. If a group of function objects were all derived from the
  42. same polymorphic base class - perhaps via multiple inheritance,
  43. then the function object effectively becomes a "variable" which
  44. encapsulates code.
  45. <p>
  46. This case study would show how to do this.
  47. <h2><a name="archiveadaptor"></a>Archive Adaptors</h2>
  48. Often users want to add their own special functionality to an
  49. existing archive. Examples of this are performance enhancements
  50. for specific types, adjustment of output syntax for xml archives,
  51. and logging/debug output as archives are written and/or read.
  52. If this functionality is implemented as an "adaptor" template
  53. which takes the base class as a template argument, such functionality could be
  54. appended to any archive for which that functionality makes sense.
  55. For example, an adaptor for generating an xml schema could be
  56. appended to both wide and narrow character versions of xml archives.
  57. <p>
  58. This case study would show how to make a useful archive adaptor.
  59. <h2><a name="archivehelper"></a>Archive Helpers</h2>
  60. Some types are not serializable as they stand. That is - they
  61. do not fulfill the requirements of the "Serializable Concept".
  62. The iconic example of this is boost::shared_ptr. Sometimes
  63. these types could be made serializable by adding code inside
  64. the library. Of course, doing that would create a lifetime
  65. of unpaid employment for the library author. Rather than
  66. adding a bunch of special code to the library itself, this
  67. code can packaged as a "helper" or "mix-in" class. Then
  68. a new archive is derived from both the "base" archive class
  69. AND the "helper" class. This is how boost::shared_ptr
  70. has been implemented.
  71. <p>
  72. It would also be possible to make a "generic runtime helper"
  73. which would effectively extend the API of the library. Previously
  74. the library included such a helper class. It was removed
  75. in favor of the current implementation. But this functionality
  76. should be added back in with another adaptor which would
  77. become part of the library.
  78. <hr>
  79. <p>Revised 1 November, 2008
  80. <p><i>&copy; Copyright <a href="http://www.rrsd.com">Robert Ramey</a> 2002-2008.
  81. Distributed under the Boost Software License, Version 1.0. (See
  82. accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  83. </i></p>
  84. </body>
  85. </html>