Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sot-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
sot-core
Commits
a071874e
Commit
a071874e
authored
14 years ago
by
Francois Bleibel
Browse files
Options
Downloads
Patches
Plain Diff
Added forgotten test file test_depend.cpp
parent
5f0c35b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unitTesting/signal/test_depend.cpp
+160
-0
160 additions, 0 deletions
unitTesting/signal/test_depend.cpp
with
160 additions
and
0 deletions
unitTesting/signal/test_depend.cpp
0 → 100644
+
160
−
0
View file @
a071874e
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Copyright Projet VISTA / IRISA, 2003
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* File: test_categorie.cc
* Project: Traces
* Author: Nicolas Mansard
*
* Version control
* ===============
*
* $Id: test_boost.cpp,v 1.1.1.1 2006-07-03 05:17:37 nmansard Exp $
*
* Description
* ============
*
* Test la classe CategorieTrace.
*
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* -------------------------------------------------------------------------- */
/* --- INCLUDES ------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
// #include <dynamic-graph/all-signals.h>
#include
<dynamic-graph/all-signals.h>
//#include <sot/TimeDependancy.h>
#include
<sot/sotDebug.h>
#include
<iostream>
#include
<MatrixAbstractLayer/boost.h>
using
namespace
std
;
namespace
ml
=
maal
::
boost
;
template
<
class
Res
=
double
>
class
DummyClass
{
public:
std
::
string
proname
;
list
<
SignalTimeDependant
<
double
,
int
>*
>
inputsig
;
list
<
SignalTimeDependant
<
ml
::
Vector
,
int
>*
>
inputsigV
;
public:
DummyClass
(
const
std
::
string
&
n
)
:
proname
(
n
),
res
(),
appel
(
0
),
timedata
(
0
)
{}
Res
&
fun
(
Res
&
res
,
int
t
)
{
appel
++
;
timedata
=
t
;
cout
<<
"Inside "
<<
proname
<<
" -> "
<<
this
<<
endl
;
for
(
list
<
SignalTimeDependant
<
double
,
int
>*
>::
iterator
it
=
inputsig
.
begin
();
it
!=
inputsig
.
end
();
++
it
)
{
cout
<<
*
(
*
it
)
<<
endl
;
(
*
it
)
->
access
(
timedata
);
}
for
(
list
<
SignalTimeDependant
<
ml
::
Vector
,
int
>*
>::
iterator
it
=
inputsigV
.
begin
();
it
!=
inputsigV
.
end
();
++
it
)
{
cout
<<
*
(
*
it
)
<<
endl
;
(
*
it
)
->
access
(
timedata
);}
return
res
=
(
*
this
)();
}
void
add
(
SignalTimeDependant
<
double
,
int
>&
sig
)
{
inputsig
.
push_back
(
&
sig
);
}
void
add
(
SignalTimeDependant
<
ml
::
Vector
,
int
>&
sig
)
{
inputsigV
.
push_back
(
&
sig
);
}
Res
operator
()
(
void
);
Res
res
;
int
appel
;
int
timedata
;
};
template
<
class
Res
>
Res
DummyClass
<
Res
>::
operator
()
(
void
)
{
return
this
->
res
;
}
template
<
>
double
DummyClass
<
double
>::
operator
()
(
void
)
{
res
=
appel
*
timedata
;
return
res
;
}
template
<
>
ml
::
Vector
DummyClass
<
ml
::
Vector
>::
operator
()
(
void
)
{
res
.
resize
(
3
);
res
.
fill
(
appel
*
timedata
);
return
res
;
}
int
main
(
void
)
{
DummyClass
<
double
>
pro1
(
"pro1"
),
pro3
(
"pro3"
),
pro5
(
"pro5"
);
DummyClass
<
ml
::
Vector
>
pro2
(
"pro2"
),
pro4
(
"pro4"
),
pro6
(
"pro6"
);
SignalTimeDependant
<
double
,
int
>
sig5
(
"Sig5"
);
SignalTimeDependant
<
ml
::
Vector
,
int
>
sig6
(
"Sig6"
);
SignalTimeDependant
<
ml
::
Vector
,
int
>
sig4
(
sig5
,
"Sig4"
);
SignalTimeDependant
<
ml
::
Vector
,
int
>
sig2
(
sig4
<<
sig4
<<
sig4
<<
sig6
,
"Sig2"
);
SignalTimeDependant
<
double
,
int
>
sig3
(
sig2
<<
sig5
<<
sig6
,
"Sig3"
);
SignalTimeDependant
<
double
,
int
>
sig1
(
boost
::
bind
(
&
DummyClass
<
double
>::
fun
,
&
pro1
,
_1
,
_2
),
sig2
<<
sig3
,
"Sig1"
);
// cout << "--- Test Array ------ "<<endl;
// SignalArray<int> tarr(12);
// tarr<<sig3<<sig2;//+sig2+sig3;
// dispArray(sig4<<sig2<<sig3);
// dispArray(tarr);
sig2
.
setFunction
(
boost
::
bind
(
&
DummyClass
<
ml
::
Vector
>::
fun
,
&
pro2
,
_1
,
_2
)
);
sig3
.
setFunction
(
boost
::
bind
(
&
DummyClass
<
double
>::
fun
,
&
pro3
,
_1
,
_2
)
);
sig4
.
setFunction
(
boost
::
bind
(
&
DummyClass
<
ml
::
Vector
>::
fun
,
&
pro4
,
_1
,
_2
)
);
sig5
.
setFunction
(
boost
::
bind
(
&
DummyClass
<
double
>::
fun
,
&
pro5
,
_1
,
_2
)
);
sig6
.
setFunction
(
boost
::
bind
(
&
DummyClass
<
ml
::
Vector
>::
fun
,
&
pro6
,
_1
,
_2
)
);
pro1
.
add
(
sig2
);
pro1
.
add
(
sig3
);
pro2
.
add
(
sig4
);
pro2
.
add
(
sig4
);
pro2
.
add
(
sig4
);
pro3
.
add
(
sig2
);
pro4
.
add
(
sig5
);
pro2
.
add
(
sig6
);
pro3
.
add
(
sig5
);
pro3
.
add
(
sig6
);
sig5
.
setDependancyType
(
TimeDependancy
<
int
>::
ALWAYS_READY
);
sig6
.
setDependancyType
(
TimeDependancy
<
int
>::
BOOL_DEPENDANT
);
sig6
.
setReady
();
sig1
.
displayDependancies
(
cout
)
<<
endl
;
cout
<<
"Needs update?"
<<
endl
<<
sig1
.
needUpdate
(
2
)
<<
endl
;
dgDEBUG
(
1
)
<<
"Access sig1(2) "
<<
endl
;
sig1
.
access
(
2
);
sig1
.
displayDependancies
(
cout
)
<<
endl
;
dgDEBUG
(
1
)
<<
"Access sig2(4) "
<<
endl
;
sig2
.
access
(
4
);
sig1
.
displayDependancies
(
cout
)
<<
endl
;
dgDEBUG
(
1
)
<<
"Access sig1(4) "
<<
endl
;
sig1
.
access
(
4
);
sig1
.
displayDependancies
(
cout
)
<<
endl
;
sig1
.
needUpdate
(
6
);
sig1
.
needUpdate
(
6
);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment