1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/include/Component.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | |
---|
13 | #undef FUNCTION |
---|
14 | #define FUNCTION "Component::port_map" |
---|
15 | void Component::port_map (string component_src , |
---|
16 | string port_src , |
---|
17 | string component_dest, |
---|
18 | string port_dest ) |
---|
19 | { |
---|
20 | log_printf(FUNC,Behavioural,FUNCTION,"Begin"); |
---|
21 | |
---|
22 | string name_entity = _entity->get_name(); |
---|
23 | |
---|
24 | // First entity |
---|
25 | Entity * entity_dest = find_entity(component_dest); |
---|
26 | |
---|
27 | if (entity_dest == NULL) |
---|
28 | throw (ErrorMorpheo ("<Component::port_map> in component \""+name_entity+"\", port map with unknow component \""+component_dest+"\".")); |
---|
29 | |
---|
30 | Signal * signal_dest = entity_dest->find_signal (port_dest); |
---|
31 | |
---|
32 | if (signal_dest == NULL) |
---|
33 | throw (ErrorMorpheo ("<Component::port_map> in component \""+name_entity+"\", port map with component \""+component_dest+"\" and a unknow signal \""+port_dest+"\".")); |
---|
34 | |
---|
35 | // Second entity |
---|
36 | Entity * entity_src = find_entity(component_src); |
---|
37 | |
---|
38 | if (entity_src == NULL) |
---|
39 | throw (ErrorMorpheo ("<Component::port_map> in component \""+name_entity+"\", port map with unknow component \""+component_src+"\".")); |
---|
40 | |
---|
41 | Signal * signal_src = entity_src->find_signal (port_src); |
---|
42 | |
---|
43 | if (signal_src == NULL) |
---|
44 | throw (ErrorMorpheo ("<Component::port_map> in component \""+name_entity+"\", port map with component \""+component_src+"\" and a unknow signal \""+port_src+"\".")); |
---|
45 | |
---|
46 | // If all is ok, mapping |
---|
47 | log_printf(TRACE,Behavioural,FUNCTION, "Signal \"%s.%s\"\tlink with \"%s.%s\"" |
---|
48 | ,entity_src ->get_name().c_str() |
---|
49 | ,signal_src ->get_name().c_str() |
---|
50 | ,entity_dest->get_name().c_str() |
---|
51 | ,signal_dest->get_name().c_str()); |
---|
52 | |
---|
53 | signal_src ->link (signal_dest, entity_dest == _entity); |
---|
54 | //signal_dest->mapping(signal_src ); |
---|
55 | |
---|
56 | log_printf(FUNC,Behavioural,FUNCTION,"End"); |
---|
57 | }; |
---|
58 | |
---|
59 | }; // end namespace behavioural |
---|
60 | }; // end namespace morpheo |
---|