7 #ifndef ISEEML_ARRAY_PATHS_HH
8 #define ISEEML_ARRAY_PATHS_HH
11 #include <iSeeML/rob/CompoundPath.hpp>
26 class CoupleTypePointer {
30 CoupleTypePointer() : isBasicPath(
true), path(NULL) {}
32 : isBasicPath(basic), path(ptr) {}
34 return ( isBasicPath ? 1 :
42 CoupleTypePointer *array;
60 : array(new CoupleTypePointer[n]), nb_paths(n) {}
64 for(
int idx = 0; idx < nb_paths; idx++)
65 free(array[idx].path);
76 #ifdef ISEEML_CHECK_COMP_PATH_PRECOND
77 if ( (index < 0) || (index >= nb_paths) )
78 cerr <<
ClassName <<
"::setPath: incorrect index "
79 << index <<
" (not in 0-" << nb_paths - 1 <<
")!" << endl;
81 array[index] = CoupleTypePointer(isBasic, path);
89 for(
int idx = 0; idx < nb_paths; idx++)
90 new_one->
setPath( idx, array[idx].isBasicPath,
92 (& array[idx].path->clone() ) );
99 for(nb = 0, idx = 0; idx < nb_paths; idx++)
109 int idx = index, i = 0, pieces;
112 pieces = array[i].nbPieces();
113 step = (idx > pieces);
114 if (step) { idx -= pieces; i++; }
115 }
while ( (i < nb_paths) && (step) );
117 if (i >= nb_paths) { idx = pieces ; i = nb_paths - 1; }
118 return ( array[i].isBasicPath ?
126 #endif // end of definition
This class is the base class of all robotic paths in ISeeML.
Definition: Path.hpp:51
const iSeeML::rob::BasicPath & piece(const int index) const
Description method, returning the (constant) basic path of given index in the list of which this comp...
Definition: CompoundPath.hpp:114
iSeeML::rob::BasicPath & _piece(const int index) const
Virtual method returning the basic path of given index in the list of which this compound path is mad...
Definition: ArrayPaths.hpp:108
ArrayPaths(const int n)
The main constructor only needs a number of paths.
Definition: ArrayPaths.hpp:59
~ArrayPaths()
The destructor frees all the paths and the array.
Definition: ArrayPaths.hpp:63
void setPath(const int index, const bool isBasic, iSeeML::rob::Path *path)
Add a given (dynamically allocated) path to the array.
Definition: ArrayPaths.hpp:74
static const string ClassName
The class name is public, as this class can be instanced.
Definition: ArrayPaths.hpp:52
iSeeML::Object & clone() const
Description method, giving a copy of the current object.
Definition: ArrayPaths.hpp:87
This class is the base class of ISeeML: every class of ISeeML inherits this one.
Definition: Object.hpp:47
This class defines superclass of basic paths, from which compound paths can be built.
Definition: BasicPath.hpp:21
This class defines compound (or complex, or composed) paths, which are made of a set of basic paths.
Definition: ArrayPaths.hpp:25
int nbPieces() const
Description method, giving the number of pieces of the path.
Definition: ArrayPaths.hpp:97
This class defines compound (or complex, or composed) paths, which are made of a set of basic paths.
Definition: CompoundPath.hpp:28