Skip to content

Commit

Permalink
Extend README.md, fix obsolete info, unify naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Mi-La committed Jan 8, 2024
1 parent 2d79828 commit 22fa364
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ jobs:
build/Release/ZserioTutorialCpp read
shell: bash

- name: Test Zserio C++ tutorial (sources regeneration)
run: |
build/Release/ZserioTutorialCpp write_joe
build/Release/ZserioTutorialCpp read
build/Release/ZserioTutorialCpp write_boss
build/Release/ZserioTutorialCpp read
shell: bash

- name: Archive Zserio C++ tutorial binary
uses: actions/upload-artifact@v3
with:
Expand Down
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ the project folder:
from conan import ConanFile
from conan.tools.cmake import CMake
class ZserioCppTutorialRecipe(ConanFile):
class ZserioTutorialCppRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps"
Expand Down Expand Up @@ -281,6 +281,11 @@ Don't forget to set Joe's skills:
joe.setSkills(skills);
```

> Note that the l-value setter `setSkills(const std::vector<tutorial::Experience>&)` will perform a copy of
> the skills vector. It can be bypassed either by using a non-const getter
> `std::vector<tutorial::Experience>& getSkills` and populating it directly or using the r-value setter
> `setSkills(std::vector<tutorial::Experience>&&)`.
After we have set all the fields, we have to declare a BitStreamWriter and write the stream:

```cpp
Expand Down Expand Up @@ -360,6 +365,16 @@ if (employee.isBonusUsed())

For the rest of the processing please refer to the code. You should have gotten the main point by now.

## Play with the compiled tutorial

You can find the compiled `ZserioTutorialCpp` executable in the `build` folder.

```bash
build/ZserioTutorialCpp # prints usage
build/ZserioTutorialCpp write_joe # creates the employee.zsb which contains serialized Joe's data
build/zserioTutorialCpp read # deserializes the employee.zsb and prints out info about the employee
```

## Additions you will find in the code

There are some other features that we used in the code in this repo that we would like to point out briefly:
Expand Down Expand Up @@ -414,7 +429,7 @@ You can simply access the symbol name of any enumeration as a string:
const tutorial::Language language = it->getProgrammingLanguage();

/* get string representation of Language enum value */
const std::string languageString = language.toString();
const std::string languageString = ::zserio::enumToString(language);
```

Of course checking for the value has better runtime performance once you do comparisons. But for debug purposes
Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from conan import ConanFile
from conan.tools.cmake import CMake

class ZserioCppTutorialRecipe(ConanFile):
class ZserioTutorialCppRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps"

Expand Down

0 comments on commit 22fa364

Please sign in to comment.