summaryrefslogtreecommitdiffabout
path: root/include/sitecing/acomponent.h
Unidiff
Diffstat (limited to 'include/sitecing/acomponent.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/sitecing/acomponent.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/include/sitecing/acomponent.h b/include/sitecing/acomponent.h
new file mode 100644
index 0000000..160e854
--- a/dev/null
+++ b/include/sitecing/acomponent.h
@@ -0,0 +1,78 @@
1#ifndef __SITECING_ACOMPONENT_H
2#define __SITECING_ACOMPONENT_H
3
4#include "sitecing/sitecing_interface.h"
5
6/**
7 * @file
8 * @brief The acomponent class declaration.
9 */
10
11namespace sitecing {
12
13 /**
14 * An abstract base class for sitecing components.
15 */
16 class acomponent {
17 public:
18 /**
19 * Pointer to the interface object, used to communicate with the
20 * site-C-ing core.
21 */
22 sitecing_interface *__SCIF;
23
24 acomponent();
25 virtual ~acomponent();
26
27 /**
28 * Set the interface to core pointer.
29 * @param scif the pointer to the interface object.
30 */
31 virtual void __set_interface(sitecing_interface *scif=0);
32 /**
33 * Invoked if the interface to the core has changed.
34 * @param oscif pointer to the old interface object.
35 */
36 virtual void __on_change_interface(sitecing_interface *oscif);
37
38 /**
39 * do import components.
40 */
41 virtual void __do_imports();
42 /**
43 * invoked on components imports.
44 */
45 virtual void __on_imports();
46 /**
47 * fetch the pointer to the most derived component.
48 * @returns pointer to the most derived object.
49 */
50 virtual void *__the_most_derived_this() = 0;
51
52 /**
53 * Do the job.
54 * @param __magic the magic number used as a key to decipher the
55 * rest of parameters.
56 * @param __args the parameters.
57 */
58 virtual void main(int __magic,va_list __args) = 0;
59
60 /**
61 * Run the component. Convenience helper for calling main().
62 * @param __magic the magic number.
63 * @param ... the rest of parameters.
64 * @see main();
65 */
66 void run(int __magic,...);
67
68 /**
69 * Helper function (which doesn't necessarily belongs here!) for
70 * reading the file and passing it to the output stream.
71 * @param fn the file name.
72 */
73 void pass_file_through(const char *fn);
74 };
75
76}
77
78#endif /* __SITECING_ACOMPONENT_H */