Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
8c426a9e
Commit
8c426a9e
authored
Dec 09, 2014
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX
#387
] connections can now be forced if the connector output was not set.
parent
0a1e4614
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
7 deletions
+72
-7
src/core/kernel/WModuleConnector.cpp
src/core/kernel/WModuleConnector.cpp
+19
-5
src/core/kernel/WModuleConnector.h
src/core/kernel/WModuleConnector.h
+12
-1
src/core/kernel/WModuleInputConnector.cpp
src/core/kernel/WModuleInputConnector.cpp
+10
-0
src/core/kernel/WModuleInputConnector.h
src/core/kernel/WModuleInputConnector.h
+9
-0
src/core/kernel/WModuleOutputConnector.cpp
src/core/kernel/WModuleOutputConnector.cpp
+11
-0
src/core/kernel/WModuleOutputConnector.h
src/core/kernel/WModuleOutputConnector.h
+9
-0
src/core/kernel/combiner/WModuleProjectFileCombiner.cpp
src/core/kernel/combiner/WModuleProjectFileCombiner.cpp
+2
-1
No files found.
src/core/kernel/WModuleConnector.cpp
View file @
8c426a9e
...
...
@@ -112,7 +112,7 @@ unsigned int WModuleConnector::isConnected()
return
count
;
}
void
WModuleConnector
::
connect
(
boost
::
shared_ptr
<
WModuleConnector
>
con
)
void
WModuleConnector
::
connect
(
boost
::
shared_ptr
<
WModuleConnector
>
con
,
bool
force
)
{
boost
::
shared_ptr
<
WModule
>
module
=
m_module
.
lock
();
// it is "unlocked" at the end of this function as "module" looses its scope
std
::
string
containerName
=
"Unknown"
;
...
...
@@ -126,11 +126,25 @@ void WModuleConnector::connect( boost::shared_ptr<WModuleConnector> con )
"ModuleContainer ("
+
containerName
+
")"
,
LL_INFO
);
// are both partners compatible to each other?
if
(
!
(
con
->
connectable
(
shared_from_this
()
)
&&
connectable
(
con
)
)
)
if
(
force
)
{
std
::
ostringstream
s
;
s
<<
"Connection between "
<<
getCanonicalName
()
<<
" and "
<<
con
->
getCanonicalName
()
<<
" failed."
;
throw
WModuleConnectorsIncompatible
(
s
.
str
()
);
// if not forced, use a complete compatibility check
if
(
!
(
con
->
lazyConnectable
(
shared_from_this
()
)
&&
lazyConnectable
(
con
)
)
)
{
std
::
ostringstream
s
;
s
<<
"Connection between "
<<
getCanonicalName
()
<<
" and "
<<
con
->
getCanonicalName
()
<<
" failed."
;
throw
WModuleConnectorsIncompatible
(
s
.
str
()
);
}
}
else
{
// if not forced, use a complete compatibility check
if
(
!
(
con
->
connectable
(
shared_from_this
()
)
&&
connectable
(
con
)
)
)
{
std
::
ostringstream
s
;
s
<<
"Connection between "
<<
getCanonicalName
()
<<
" and "
<<
con
->
getCanonicalName
()
<<
" failed."
;
throw
WModuleConnectorsIncompatible
(
s
.
str
()
);
}
}
// check whether they are already connected
...
...
src/core/kernel/WModuleConnector.h
View file @
8c426a9e
...
...
@@ -102,12 +102,13 @@ public:
* WModuleConnector::connectable is used to determine whether the connection is possible or not.
*
* \param con the connector to connect.
* \param force force connection even if incompatible. Used primarily for project file loader. If true, only a \ref lazyConnectable is used.
*
* \exception WModuleConnectionFailed if connection can not be established.
*
* \return true if successful
*/
virtual
void
connect
(
boost
::
shared_ptr
<
WModuleConnector
>
con
);
virtual
void
connect
(
boost
::
shared_ptr
<
WModuleConnector
>
con
,
bool
force
=
false
);
/**
* Checks whether this connector is connected to the given one. If there is the strange case where one connector is connected
...
...
@@ -185,6 +186,16 @@ public:
*/
virtual
bool
connectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
)
=
0
;
/**
* Checks whether the specified connector is connectable to this one, but ignores compatibility the type to be transferred. If you implement your
* own connectors, please override and check for compatibility with your matching connectors, but ignore the transfer type.
*
* \param con the connector to check against.
*
* \return true if compatible.
*/
virtual
bool
lazyConnectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
)
=
0
;
/**
* Returns a list of possible disconnections for this connector. Please be aware that the connections might change during the life-time of
* the returned DisconnectCombiner instances.
...
...
src/core/kernel/WModuleInputConnector.cpp
View file @
8c426a9e
...
...
@@ -66,6 +66,16 @@ bool WModuleInputConnector::connectable( boost::shared_ptr<WModuleConnector> con
return
false
;
}
bool
WModuleInputConnector
::
lazyConnectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
)
{
// output connectors are just allowed to get connected with input connectors
if
(
dynamic_cast
<
WModuleOutputConnector
*>
(
con
.
get
()
)
)
// NOLINT - since we really need them here
{
return
true
;
}
return
false
;
}
void
WModuleInputConnector
::
connectSignals
(
boost
::
shared_ptr
<
WModuleConnector
>
con
)
{
WModuleConnector
::
connectSignals
(
con
);
...
...
src/core/kernel/WModuleInputConnector.h
View file @
8c426a9e
...
...
@@ -65,6 +65,15 @@ public:
*/
virtual
bool
connectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
);
/**
* Checks whether the specified connector is connectable to this one, but ignores compatibility the type to be transferred.
*
* \param con the connector to check against.
*
* \return true if compatible.
*/
virtual
bool
lazyConnectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
);
/**
* Gets the condition variable that gets fired whenever new data has been sent.
*
...
...
src/core/kernel/WModuleOutputConnector.cpp
View file @
8c426a9e
...
...
@@ -54,6 +54,17 @@ bool WModuleOutputConnector::connectable( boost::shared_ptr<WModuleConnector> co
return
false
;
}
bool
WModuleOutputConnector
::
lazyConnectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
)
{
// output connectors are just allowed to get connected with input connectors
if
(
dynamic_cast
<
WModuleInputConnector
*>
(
con
.
get
()
)
)
// NOLINT - since we really need them here
{
return
true
;
}
return
false
;
}
boost
::
signals2
::
connection
WModuleOutputConnector
::
subscribeSignal
(
MODULE_CONNECTOR_SIGNAL
signal
,
t_GenericSignalHandlerType
notifier
)
{
...
...
src/core/kernel/WModuleOutputConnector.h
View file @
8c426a9e
...
...
@@ -83,6 +83,15 @@ public:
*/
virtual
bool
connectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
);
/**
* Checks whether the specified connector is connectable to this one, but ignores compatibility the type to be transferred.
*
* \param con the connector to check against.
*
* \return true if compatible.
*/
virtual
bool
lazyConnectable
(
boost
::
shared_ptr
<
WModuleConnector
>
con
);
/**
* Returns the prototype of the WTransferable used in this connector.
*
...
...
src/core/kernel/combiner/WModuleProjectFileCombiner.cpp
View file @
8c426a9e
...
...
@@ -343,7 +343,8 @@ void WModuleProjectFileCombiner::apply()
// finally, connect them
try
{
con1
->
connect
(
con2
);
// force connection since data modules might not yet have set an output -> makes them incompatible -> con fails.
con1
->
connect
(
con2
,
true
);
}
catch
(
const
WException
&
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment