aboutsummaryrefslogtreecommitdiff
path: root/examples/cxx/hybrid/allocator/README
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cxx/hybrid/allocator/README')
-rw-r--r--examples/cxx/hybrid/allocator/README62
1 files changed, 62 insertions, 0 deletions
diff --git a/examples/cxx/hybrid/allocator/README b/examples/cxx/hybrid/allocator/README
new file mode 100644
index 0000000..f2ea51c
--- /dev/null
+++ b/examples/cxx/hybrid/allocator/README
@@ -0,0 +1,62 @@
+This example shows how to use a custom memory allocator implementation
+with the Embedded C++/Hybrid mapping. It is based on the 'minimal' example
+(so the support for STL, iostream, and C++ exceptions is disabled) and the
+only changes made are to the memory management.
+
+The example consists of the following files:
+
+people.xsd
+ XML Schema which describes a collection of person records.
+
+people.xml
+ Sample XML instance document.
+
+people.hxx
+people.cxx
+
+people-pskel.hxx
+people-pskel.cxx
+people-pimpl.hxx
+people-pimpl.cxx
+
+people-pskel.hxx
+people-pskel.cxx
+people-pimpl.hxx
+people-pimpl.cxx
+ Object model (the first pair of files), parser skeletons (the second
+ pair), parser implementations (the third pair), serializer skeletons
+ (the fourth pair), and serializer implementations (the fifth pair).
+ These files are generated by the XSD/e compiler from people.xsd. The
+ --generate-parser, --generate-serializer, --generate-aggregate,
+ --no-stl, --no-iostream, and --no-exceptions options were used to
+ request the generation of the parsing and serialization code as well
+ as to disable the use of STL, iostream, and C++ exceptions. Furthermore,
+ the --custom-allocator option was specific to make the generated code
+ use custom memory management functions instead of the standard new and
+ delete operators.
+
+arena.hxx
+arena.cxx
+ An implementation of a simple pooled memory allocator.
+
+driver.cxx
+ Driver for the example. Besides the implementation of the main()
+ function, this file also provides the implementations of the custom
+ memory management function, xsde_alloc, xsde_realloc, and xsde_free,
+ that are used by the XSD/e runtime and the generated code.
+
+ The driver first sets up the memory pool using a stack-allocated memory
+ region. It then calls the parser that constructs the object model from
+ the input XML file. After that the driver prints the content of the
+ object model to STDERR. Finally, the driver modifies the object model
+ and calls the serializer to serialize it back to XML. The implementation
+ also prints the memory usage statistics after parsing and after
+ serialization.
+
+To run the example on the sample XML instance document simply execute:
+
+$ ./driver people.xml
+
+The example reads from STDIN if input file is not specified:
+
+$ ./driver <people.xml