summaryrefslogtreecommitdiff
path: root/docs/domain.md
blob: f6e9b5f016be9f12b796abcaa3f849b7bed68fc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Domain Model

The domain model resembles the structure of our system as objects. It is build by the parser and is the input into the generator.

It is important to understand the domain model as it is the main input for the template generation.

The IDL is converted into an in memory domain model (see qface/idl/domain.py).

```yaml
    - System
        - Module
            - Import
            - Service
                - Property
                - Operation
                - Event
            - Enum
            - Flag
            - Struct
```

The domain model is the base for the code generation. You traverse the domain tree and trigger your own code generation.

```python
from qface.generator import FileSystem

system = FileSystem.parse_dir('interfaces')

for module in sytem.modules:
    print(module.name)

    for interfaces in module.interfaces:
        print(interfaces.name)

    for struct in module.structs:
        print(struct.name)
```

# Debug

At any time you can place a debug breakpoint:

```python
import ipdb; ipd.set_trace()
```

See https://pypi.python.org/pypi/ipdb


To see the object members just use:

```python
dir(module) # list all members of module
help(module) # prints the documentation
```