Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpRfstack.cpp
1
/*
2
* ViSP, open source Visual Servoing Platform software.
3
* Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4
*
5
* This software is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
* See the file LICENSE.txt at the root directory of this source
10
* distribution for additional information about the GNU GPL.
11
*
12
* For using ViSP with software that can not be combined with the GNU
13
* GPL, please contact Inria about acquiring a ViSP Professional
14
* Edition License.
15
*
16
* See https://visp.inria.fr for more information.
17
*
18
* This software was developed at:
19
* Inria Rennes - Bretagne Atlantique
20
* Campus Universitaire de Beaulieu
21
* 35042 Rennes Cedex
22
* France
23
*
24
* If you have questions regarding the use of this file, please contact
25
* Inria at visp@inria.fr
26
*
27
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29
*
30
* Description:
31
* Le module "rfstack.c" contient les procedures de gestion
32
* de la pile d'elimination de faces (Remove Faces STACK).
33
*
34
* Authors:
35
* Jean-Luc CORRE
36
*/
37
38
#include <visp3/core/vpConfig.h>
39
40
#ifndef DOXYGEN_SHOULD_SKIP_THIS
41
#include "vpArit.h"
42
#include "vpMy.h"
43
#include "vpRfstack.h"
44
#include "vpView.h"
45
#include <stdio.h>
46
#include <string.h>
47
#define STACKSIZE 32
48
49
static
int
stack[STACKSIZE] = { vpDEFAULT_REMOVE };
/* pile */
50
static
int
*sp = stack;
/* sommet */
51
52
BEGIN_VISP_NAMESPACE
53
/*
54
* La procedure "fprintf_rfstack" affiche le sommet
55
* de la pile des drapeaux d'elimination de faces.
56
* Entree :
57
* fp Fichier en sortie.
58
*/
59
void
fprintf_rfstack(FILE *fp)
60
{
61
int
flg;
62
flg = 0;
/* nul si element unique */
63
64
if
(*sp == IS_INSIDE) {
65
fprintf(fp,
"(null)\n"
);
66
return
;
67
}
68
fprintf(fp,
"("
);
69
if
(*sp & IS_ABOVE) {
70
// if (flg) fprintf (fp, " "); Removed since if (flg) cannot be true
71
flg++;
72
fprintf(fp,
"above"
);
73
}
74
if
(*sp & IS_BELOW) {
75
if
(flg)
76
fprintf(fp,
" "
);
77
flg++;
78
fprintf(fp,
"below"
);
79
}
80
if
(*sp & IS_RIGHT) {
81
if
(flg)
82
fprintf(fp,
" "
);
83
flg++;
84
fprintf(fp,
"right"
);
85
}
86
if
(*sp & IS_LEFT) {
87
if
(flg)
88
fprintf(fp,
" "
);
89
flg++;
90
fprintf(fp,
"left"
);
91
}
92
if
(*sp & IS_BACK) {
93
if
(flg)
94
fprintf(fp,
" "
);
95
flg++;
96
fprintf(fp,
"back"
);
97
}
98
if
(*sp & IS_FRONT) {
99
/*if (flg)*/
fprintf(fp,
" "
);
100
flg++;
101
fprintf(fp,
"front"
);
102
}
103
fprintf(fp,
")\n"
);
104
}
105
106
/*
107
* La procedure "get_rfstack" retourne les drapeaux au sommet
108
* de la pile des drapeaux d'elimination de faces.
109
* Sortie :
110
* Pointeur sur les drapeaux d'elimination du sommet de la pile.
111
*/
112
int
*get_rfstack(
void
) {
return
(sp); }
113
114
/*
115
* La procedure "load_rfstack" charge des drapeaux au sommet
116
* de la pile des drapeaux d'elimination de faces.
117
* Entree :
118
* i Niveau a charger.
119
*/
120
void
load_rfstack(
int
i) { *sp =
i
; }
121
122
/*
123
* La procedure "pop_rfstack" depile les drapeaux au sommet
124
* de la pile des drapeaux d'elimination de faces.
125
*/
126
void
pop_rfstack(
void
)
127
{
128
if
(sp == stack) {
129
static
char
proc_name[] =
"pop_rfstack"
;
130
fprintf(stderr,
"%s: stack underflow\n"
, proc_name);
131
return
;
132
}
133
else
134
sp--;
135
}
136
137
/*
138
* La procedure "push_rfstack" empile et duplique les drapeaux du sommet
139
* de la pile des drapeaux d'elimination de faces.
140
*/
141
void
push_rfstack(
void
)
142
{
143
if
(sp == stack + STACKSIZE - 1) {
144
static
char
proc_name[] =
"push_rfstack"
;
145
fprintf(stderr,
"%s: stack overflow\n"
, proc_name);
146
return
;
147
}
148
sp++;
149
*sp = *(sp - 1);
150
}
151
152
/*
153
* La procedure "swap_rfstack" echange les deux premiers elements
154
* de la pile des drapeaux d'elimination de faces.
155
*/
156
void
swap_rfstack(
void
)
157
{
158
int
*ip;
159
160
ip = (sp == stack) ? sp + 1 : sp - 1;
161
int
tmp;
162
// SWAP(*sp, *ip, tmp); // produce a cppcheck warning
163
tmp = *sp;
164
*sp = *ip;
165
*ip = tmp;
166
}
167
168
/*
169
* La procedure "add_rfstack" ajoute des drapeaux au sommet
170
* de la pile des drapeaux d'elimination de faces.
171
*/
172
void
add_rfstack(
int
i) { *sp |=
i
; }
173
174
/*
175
* La procedure "sub_rfstack" soustrait des drapeaux au sommet
176
* de la pile des drapeaux d'elimination de faces.
177
*/
178
void
sub_rfstack(
int
i) { *sp &= ~i; }
179
END_VISP_NAMESPACE
180
#endif
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
yolo-centering-task-afma6.i
i
Definition
yolo-centering-task-afma6.py:329
modules
robot
src
wireframe-simulator
vpRfstack.cpp
Generated by
1.17.0