4_cgenerator.cpp
Go to the documentation of this file.
1/** @file 4_cgenerator.cpp
2
3Tutorial, generator with controllability attributes
4
5
6The faudes::System class is inherited from the faudes::Generator class and only
7differs by definition of the controllabilty flags for events. Because
8of the inheritance, the System class's methods are a superset
9of the Generator. This tutorial demonstrates System specific methods.
10
11
12@ingroup Tutorials
13
14@include 4_cgenerator.cpp
15
16*/
17
18#include "libfaudes.h"
19
20
21// we make the faudes namespace available to our program
22using namespace faudes;
23
24
25/////////////////
26// main program
27/////////////////
28
29int main() {
30
31
32 ////////////////////////////////////////////
33 // Constructors & Assignment Operator
34 ////////////////////////////////////////////
35
36 // Create an empty System object
37
38 System cgen1;
39
40 // Create a System by reading a Generator file
41 // Events default to observable and uncontrollable
42
43 System cgen2("data/simplemachine.gen");
44
45 // Create a System by reading a System file
46
47 System cgen3("data/csimplemachine.gen");
48
49 // Copy constructor & assignment operator
50 // (same behaviour as in Generator class)
51
52 System cgen4(cgen3);
53 cgen4 = cgen3;
54
55 // report
56 cgen4.Write("tmp_csimplemachine.gen");
57 cgen4.Write();
58
59 ////////////////////////
60 // Controllable events
61 ////////////////////////
62
63 // Insert an event and set it controllable
64
65 cgen1.InsControllableEvent(1); // by index
66 cgen1.InsControllableEvent("newcevent1"); // by symbolic name
67
68 // Insert an event and set it uncontrollable
69
70 cgen1.InsUncontrollableEvent(2); // by index
71 cgen1.InsUncontrollableEvent("newcevent2"); // by symbolic name
72
73 // Set an existing event controllable
74
75 cgen1.SetControllable(2); // by index
76 cgen1.SetControllable((const std::string&) "newcevent2"); // by symbolic name
77
78 // Set an existing event uncontrollable
79
80 cgen1.ClrControllable(1); // by index
81 cgen1.ClrControllable((const std::string&) "newcevent1"); // by symbolic name
82
83 // Test wether an event is controllable
84
85 bool bool_eventcontrollable = cgen1.Controllable(1); // by index
86 bool_eventcontrollable = cgen1.Controllable("newcevent1"); // by symbolic name
87
88 // Retrieve an EventSet containing all the controllabe events of the
89 // System
90
91 EventSet eset_cevents = cgen2.ControllableEvents();
92
93 // Retrieve an EventSet containing all the uncontrollabe events of the
94 // System
95
96 EventSet eset_ucevents = cgen2.UncontrollableEvents();
97
98
99 return 0;
100}
101
102
103
int main()
void ClrControllable(Idx index)
EventSet UncontrollableEvents(void) const
EventSet ControllableEvents(void) const
void SetControllable(Idx index)
void InsUncontrollableEvent(Idx index)
void InsControllableEvent(Idx index)
bool Controllable(Idx index) const
void Write(const Type *pContext=0) const

libFAUDES 2.33k --- 2025.09.16 --- c++ api documentaion by doxygen