Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
a4f08955
Commit
a4f08955
authored
Jul 24, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Orbit templated attributeHandlerGen + type_code
parent
350e8781
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
297 additions
and
41 deletions
+297
-41
Apps/Tuto/Attributes/multi_attribs.cpp
Apps/Tuto/Attributes/multi_attribs.cpp
+7
-0
Apps/Tuto/Attributes/simple_attribs.cpp
Apps/Tuto/Attributes/simple_attribs.cpp
+26
-0
include/Algo/Modelisation/subdivision.h
include/Algo/Modelisation/subdivision.h
+59
-6
include/Container/attributeContainer.h
include/Container/attributeContainer.h
+3
-1
include/Container/attributeContainer.hpp
include/Container/attributeContainer.hpp
+11
-0
include/Container/attributeMultiVector.h
include/Container/attributeMultiVector.h
+20
-0
include/Container/attributeMultiVector.hpp
include/Container/attributeMultiVector.hpp
+91
-0
include/Topology/generic/attributeHandler.h
include/Topology/generic/attributeHandler.h
+31
-2
include/Topology/generic/attributeHandler.hpp
include/Topology/generic/attributeHandler.hpp
+25
-25
include/Topology/generic/mapCommon.h
include/Topology/generic/mapCommon.h
+9
-0
include/Topology/generic/mapCommon.hpp
include/Topology/generic/mapCommon.hpp
+8
-0
include/Topology/generic/multi3Attribs.h
include/Topology/generic/multi3Attribs.h
+2
-2
include/Topology/generic/multi4Attribs.h
include/Topology/generic/multi4Attribs.h
+2
-2
include/Topology/generic/multiAttribs.h
include/Topology/generic/multiAttribs.h
+2
-2
src/Container/attributeContainer.cpp
src/Container/attributeContainer.cpp
+1
-1
No files found.
Apps/Tuto/Attributes/multi_attribs.cpp
View file @
a4f08955
...
...
@@ -80,6 +80,13 @@ void applySmooth(MAP& map, const ATT& att_in, ATT& att_out)
// check at compile if ATT is an AttributeHandler on orbit VERTEX
CHECK_ATTRIBUTEHANDLER_ORBIT
(
ATT
,
VERTEX
);
// or check at runtime(take care of const!)
if
(
!
checkAttributeHandlerOrbit
<
VERTEX
>
(
att_in
))
{
CGoGNerr
<<
"function applySmooth work only with VertexAttributes !"
<<
CGoGNendl
;
return
;
}
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
)
// for all vertex v of map do
{
att_out
[
v
]
=
smooth
(
map
,
v
,
att_in
);
...
...
Apps/Tuto/Attributes/simple_attribs.cpp
View file @
a4f08955
...
...
@@ -125,6 +125,30 @@ void dumpAttribute(const ATTRIB& attr)
}
//function that apply on vertice with templated attribute type
template
<
typename
T
>
void
VertexTyped
(
MAP
&
map
,
T
&
va
)
{
foreach_cell
<
VERTEX
>
(
map
,[
&
](
Vertex
v
)
// for all vertices
{
va
[
v
]
=
1.1
*
va
[
v
];
});
}
// version that take a VertexAttribute, check type at runtime and call instancied template version
void
VertexGeneric
(
MAP
&
map
,
VertexAttributeGen
&
vg
)
{
auto
va3
=
dynamic_cast
<
VertexAttribute
<
VEC3
,
MAP
>*>
(
&
vg
);
if
(
va3
!=
NULL
)
return
VertexTyped
(
map
,
*
va3
);
auto
vaf
=
dynamic_cast
<
VertexAttribute
<
float
,
MAP
>*>
(
&
vg
);
if
(
vaf
!=
NULL
)
return
VertexTyped
(
map
,
*
vaf
);
}
int
main
()
{
// declare a map to handle the mesh
...
...
@@ -142,6 +166,8 @@ int main()
grid
.
embedIntoGrid
(
positionAtt
,
1.
,
1.
,
0.
);
VertexGeneric
(
myMap
,
positionAtt
);
// ATTRIBUTE DECLARATION
// add an attribute of type float on orbit EDGE
...
...
include/Algo/Modelisation/subdivision.h
View file @
a4f08955
...
...
@@ -93,18 +93,71 @@ void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs) ;
template
<
typename
PFP
,
typename
EMBV
>
void
CatmullClarkSubdivision
(
typename
PFP
::
MAP
&
map
,
EMBV
&
attributs
)
;
//template <typename PFP>
//void CatmullClarkSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position) ;
/**
* Loop subdivision scheme
*/
//template <typename PFP, typename EMBV, typename EMB>
template
<
typename
PFP
,
typename
EMBV
>
void
LoopSubdivision
(
typename
PFP
::
MAP
&
map
,
EMBV
&
attributs
)
;
//template <typename PFP>
//void LoopSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position) ;
template
<
typename
PFP
>
void
LoopSubdivisionGen
(
typename
PFP
::
MAP
&
map
,
VertexAttributeGen
&
attrib
)
{
auto
va3
=
dynamic_cast
<
VertexAttribute
<
typename
PFP
::
VEC3
,
typename
PFP
::
MAP
>*>
(
&
attrib
);
if
(
va3
!=
NULL
)
return
LoopSubdivision
<
PFP
>
(
map
,
*
va3
);
auto
va4
=
dynamic_cast
<
VertexAttribute
<
typename
PFP
::
VEC4
,
typename
PFP
::
MAP
>*>
(
&
attrib
);
if
(
va4
!=
NULL
)
return
LoopSubdivision
<
PFP
>
(
map
,
*
va4
);
auto
var
=
dynamic_cast
<
VertexAttribute
<
typename
PFP
::
REAL
,
typename
PFP
::
MAP
>*>
(
&
attrib
);
if
(
var
!=
NULL
)
return
LoopSubdivision
<
PFP
>
(
map
,
*
var
);
CGoGNerr
<<
"LoopSubdivision not supported on attribute of type "
<<
attrib
.
typeName
()
<<
CGoGNendl
;
}
/**
* Loop typed version with attribute name parameter
*/
template
<
typename
PFP
,
typename
T
>
inline
void
LoopSubdivisionAttribNameTyped
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
nameAttrib
)
{
VertexAttribute
<
T
,
typename
PFP
::
MAP
>
va
=
map
.
template
getAttribute
<
T
,
VERTEX
,
typename
PFP
::
MAP
>(
nameAttrib
)
;
}
/**
* Loop genereo version with attribute name parameter
*/
template
<
typename
PFP
>
void
LoopSubdivisionAttribName
(
typename
PFP
::
MAP
&
map
,
const
std
::
string
&
nameAttrib
)
{
typedef
typename
PFP
::
MAP
MAP
;
switch
(
map
.
template
getAttributeTypeCode
<
VERTEX
>(
nameAttrib
))
{
case
CGoGNFLOAT
:
return
LoopSubdivisionAttribNameTyped
<
PFP
,
float
>
(
map
,
nameAttrib
);
break
;
case
CGoGNDOUBLE
:
return
LoopSubdivisionAttribNameTyped
<
PFP
,
double
>
(
map
,
nameAttrib
);
break
;
case
CGoGNVEC3F
:
return
LoopSubdivisionAttribNameTyped
<
PFP
,
Geom
::
Vec3f
>
(
map
,
nameAttrib
);
break
;
case
CGoGNVEC3D
:
return
LoopSubdivisionAttribNameTyped
<
PFP
,
Geom
::
Vec3d
>
(
map
,
nameAttrib
);
break
;
case
CGoGNVEC4F
:
return
LoopSubdivisionAttribNameTyped
<
PFP
,
Geom
::
Vec4f
>
(
map
,
nameAttrib
);
break
;
case
CGoGNVEC4D
:
return
LoopSubdivisionAttribNameTyped
<
PFP
,
Geom
::
Vec4d
>
(
map
,
nameAttrib
);
break
;
}
CGoGNerr
<<
"LoopSubdivision not supported on attribute "
<<
nameAttrib
<<
CGoGNendl
;
}
/**
...
...
include/Container/attributeContainer.h
View file @
a4f08955
...
...
@@ -287,7 +287,7 @@ public:
* @param attribName nom de l'attribut
* @return l'indice de l'attribut
*/
unsigned
int
getAttributeIndex
(
const
std
::
string
&
attribName
);
unsigned
int
getAttributeIndex
(
const
std
::
string
&
attribName
)
const
;
/**
* get the name of an attribute, given its index in the container
...
...
@@ -417,6 +417,8 @@ public:
* ATTRIBUTES DATA ACCESS *
**************************************/
inline
CGoGNCodeType
getTypeCode
(
const
std
::
string
&
attribName
)
const
;
/**
* get an AttributeMultiVector
* @param attrIndex index of the attribute
...
...
include/Container/attributeContainer.hpp
View file @
a4f08955
...
...
@@ -421,6 +421,17 @@ AttributeMultiVector<T>* AttributeContainer::getDataVector(const std::string& at
return
atm
;
}
inline
CGoGNCodeType
AttributeContainer
::
getTypeCode
(
const
std
::
string
&
attribName
)
const
{
unsigned
int
index
=
getAttributeIndex
(
attribName
)
;
if
(
index
==
UNKNOWN
)
return
CGoGNUNKNOWNTYPE
;
return
m_tableAttribs
[
index
]
->
getTypeCode
();
}
inline
AttributeMultiVectorGen
*
AttributeContainer
::
getVirtualDataVector
(
const
std
::
string
&
attribName
)
{
unsigned
int
index
=
getAttributeIndex
(
attribName
)
;
...
...
include/Container/attributeMultiVector.h
View file @
a4f08955
...
...
@@ -38,6 +38,17 @@
namespace
CGoGN
{
enum
CGoGNCodeType
{
CGoGNUNKNOWNTYPE
=
0
,
CGoGNINT
,
CGoGNUINT
,
CGoGNSHORT
,
CGoGNUSHORT
,
CGoGNCHAR
,
CGoGNUCHAR
,
CGoGNFLOAT
,
CGoGNDOUBLE
,
CGoGNVEC2F
,
CGoGNVEC2D
,
CGoGNVEC3F
,
CGoGNVEC3D
,
CGoGNVEC4F
,
CGoGNVEC4D
};
class
AttributeMultiVectorGen
{
protected:
...
...
@@ -51,6 +62,11 @@ protected:
*/
std
::
string
m_typeName
;
/**
* Code of type
*/
CGoGNCodeType
m_typeCode
;
/**
* orbit of the attribute
*/
...
...
@@ -102,6 +118,8 @@ public:
void
setTypeName
(
const
std
::
string
&
n
);
CGoGNCodeType
getTypeCode
()
const
;
/**
* get block size
*/
...
...
@@ -192,6 +210,8 @@ class AttributeMultiVector : public AttributeMultiVectorGen
*/
std
::
vector
<
T
*>
m_tableData
;
inline
void
setTypeCode
();
public:
AttributeMultiVector
(
const
std
::
string
&
strName
,
const
std
::
string
&
strType
);
...
...
include/Container/attributeMultiVector.hpp
View file @
a4f08955
...
...
@@ -21,6 +21,7 @@
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "Geometry/vector_gen.h"
namespace
CGoGN
{
...
...
@@ -84,6 +85,10 @@ inline unsigned int AttributeMultiVectorGen::getBlockSize() const
return
_BLOCKSIZE_
;
}
inline
CGoGNCodeType
AttributeMultiVectorGen
::
getTypeCode
()
const
{
return
m_typeCode
;
}
/***************************************************************************************************/
/***************************************************************************************************/
...
...
@@ -413,4 +418,90 @@ void AttributeMultiVector<T>::dump(unsigned int i) const
CGoGNout
<<
this
->
operator
[](
i
);
}
template
<
typename
T
>
inline
void
AttributeMultiVector
<
T
>::
setTypeCode
()
{
m_typeCode
=
CGoGNUNKNOWNTYPE
;
}
template
<
>
inline
void
AttributeMultiVector
<
int
>::
setTypeCode
()
{
m_typeCode
=
CGoGNINT
;
}
template
<
>
inline
void
AttributeMultiVector
<
unsigned
int
>::
setTypeCode
()
{
m_typeCode
=
CGoGNUINT
;
}
template
<
>
inline
void
AttributeMultiVector
<
short
>::
setTypeCode
()
{
m_typeCode
=
CGoGNSHORT
;
}
template
<
>
inline
void
AttributeMultiVector
<
unsigned
short
>::
setTypeCode
()
{
m_typeCode
=
CGoGNUSHORT
;
}
template
<
>
inline
void
AttributeMultiVector
<
char
>::
setTypeCode
()
{
m_typeCode
=
CGoGNCHAR
;
}
template
<
>
inline
void
AttributeMultiVector
<
unsigned
char
>::
setTypeCode
()
{
m_typeCode
=
CGoGNUCHAR
;
}
template
<
>
inline
void
AttributeMultiVector
<
float
>::
setTypeCode
()
{
m_typeCode
=
CGoGNFLOAT
;
}
template
<
>
inline
void
AttributeMultiVector
<
double
>::
setTypeCode
()
{
m_typeCode
=
CGoGNDOUBLE
;
}
template
<
>
inline
void
AttributeMultiVector
<
Geom
::
Vec2f
>::
setTypeCode
()
{
m_typeCode
=
CGoGNVEC2F
;
}
template
<
>
inline
void
AttributeMultiVector
<
Geom
::
Vec2d
>::
setTypeCode
()
{
m_typeCode
=
CGoGNVEC2D
;
}
template
<
>
inline
void
AttributeMultiVector
<
Geom
::
Vec3f
>::
setTypeCode
()
{
m_typeCode
=
CGoGNVEC3F
;
}
template
<
>
inline
void
AttributeMultiVector
<
Geom
::
Vec3d
>::
setTypeCode
()
{
m_typeCode
=
CGoGNVEC3D
;
}
template
<
>
inline
void
AttributeMultiVector
<
Geom
::
Vec4f
>::
setTypeCode
()
{
m_typeCode
=
CGoGNVEC4F
;
}
template
<
>
inline
void
AttributeMultiVector
<
Geom
::
Vec4d
>::
setTypeCode
()
{
m_typeCode
=
CGoGNVEC4D
;
}
}
// namespace CGoGN
include/Topology/generic/attributeHandler.h
View file @
a4f08955
...
...
@@ -72,8 +72,20 @@ public:
protected:
void
setInvalid
()
{
valid
=
false
;
}
void
setValid
()
{
valid
=
true
;
}
}
;
template
<
unsigned
int
ORB
>
class
AttributeHandlerOrbit
:
public
AttributeHandlerGen
{
public:
AttributeHandlerOrbit
(
bool
v
)
:
AttributeHandlerGen
(
v
)
{}
static
const
unsigned
int
ORBIT
=
ORB
;
};
/**
* Class that create an access-table to an existing attribute
* Main available operations are:
...
...
@@ -82,7 +94,7 @@ protected:
* - begin / end / next to manage indexing
*/
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
class
AttributeHandler
:
public
AttributeHandler
Gen
class
AttributeHandler
:
public
AttributeHandler
Orbit
<
ORB
>
{
protected:
// the map that contains the linked attribute
...
...
@@ -95,7 +107,7 @@ protected:
public:
typedef
T
DATA_TYPE
;
static
const
unsigned
int
ORBIT
=
ORB
;
//
static const unsigned int ORBIT = ORB;
/**
* Default constructor
...
...
@@ -253,30 +265,41 @@ public:
template
<
typename
T
,
typename
MAP
>
using
DartAttribute
=
AttributeHandler
<
T
,
DART
,
MAP
>
;
typedef
AttributeHandlerOrbit
<
DART
>
DartAttributeGen
;
/**
* c++11 shortcut for Vertex Attribute (Handler)
*/
template
<
typename
T
,
typename
MAP
>
using
VertexAttribute
=
AttributeHandler
<
T
,
VERTEX
,
MAP
>
;
typedef
AttributeHandlerOrbit
<
VERTEX
>
VertexAttributeGen
;
/**
* c++11 shortcut for Edge Attribute (Handler)
*/
template
<
typename
T
,
typename
MAP
>
using
EdgeAttribute
=
AttributeHandler
<
T
,
EDGE
,
MAP
>
;
typedef
AttributeHandlerOrbit
<
EDGE
>
EdgeAttributeGen
;
/**
* c++11 shortcut for Face Attribute (Handler)
*/
template
<
typename
T
,
typename
MAP
>
using
FaceAttribute
=
AttributeHandler
<
T
,
FACE
,
MAP
>
;
typedef
AttributeHandlerOrbit
<
FACE
>
FaceAttributeGen
;
/**
* c++11 shortcut for Volume Attribute (Handler)
*/
template
<
typename
T
,
typename
MAP
>
using
VolumeAttribute
=
AttributeHandler
<
T
,
VOLUME
,
MAP
>
;
typedef
AttributeHandlerOrbit
<
VOLUME
>
VolumeAttributeGen
;
...
...
@@ -309,6 +332,12 @@ void foreach_attribute(ATTR& attribute, FUNC func, unsigned int nbth = NumberOfT
}
template
<
unsigned
int
ORBIT
>
inline
bool
checkAttributeHandlerOrbit
(
const
AttributeHandlerGen
&
att
)
{
return
(
dynamic_cast
<
const
AttributeHandlerOrbit
<
ORBIT
>*>
(
&
att
)
!=
NULL
)
!=
NULL
;
}
}
// namespace CGoGN
#include "Topology/generic/attributeHandler.hpp"
...
...
include/Topology/generic/attributeHandler.hpp
View file @
a4f08955
...
...
@@ -58,62 +58,62 @@ inline void AttributeHandler<T, ORB, MAP>::unregisterFromMap()
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
,
MAP
>::
AttributeHandler
()
:
AttributeHandler
Gen
(
false
),
AttributeHandler
Orbit
<
ORB
>
(
false
),
m_map
(
NULL
),
m_attrib
(
NULL
)
{}
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
,
MAP
>::
AttributeHandler
(
MAP
*
m
,
AttributeMultiVector
<
T
>*
amv
)
:
AttributeHandler
Gen
(
false
),
AttributeHandler
Orbit
<
ORB
>
(
false
),
m_map
(
m
),
m_attrib
(
amv
)
{
if
(
m
!=
NULL
&&
amv
!=
NULL
&&
amv
->
getIndex
()
!=
AttributeContainer
::
UNKNOWN
)
{
assert
(
ORB
==
amv
->
getOrbit
()
||
!
"AttributeHandler: orbit incompatibility"
)
;
valid
=
true
;
this
->
valid
=
true
;
registerInMap
()
;
}
else
valid
=
false
;
this
->
valid
=
false
;
}
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
,
MAP
>::
AttributeHandler
(
const
AttributeHandler
<
T
,
ORB
,
MAP
>&
ta
)
:
AttributeHandler
Gen
(
ta
.
valid
),
AttributeHandler
Orbit
<
ORB
>
(
ta
.
valid
),
m_map
(
ta
.
m_map
),
m_attrib
(
ta
.
m_attrib
)
{
if
(
valid
)
if
(
this
->
valid
)
registerInMap
()
;
}
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
template
<
unsigned
int
ORBIT2
>
AttributeHandler
<
T
,
ORB
,
MAP
>::
AttributeHandler
(
const
AttributeHandler
<
T
,
ORBIT2
,
MAP
>&
h
)
:
AttributeHandler
Gen
(
h
.
valid
),
AttributeHandler
Orbit
<
ORB
>
(
h
.
valid
),
m_map
(
h
.
m_map
),
m_attrib
(
h
.
m_attrib
)
{
if
(
m_attrib
->
getOrbit
()
==
ORBIT2
)
{
if
(
valid
)
if
(
this
->
valid
)
registerInMap
()
;
}
else
valid
=
false
;
this
->
valid
=
false
;
}
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
AttributeHandler
<
T
,
ORB
,
MAP
>&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
=
(
const
AttributeHandler
<
T
,
ORB
,
MAP
>&
ta
)
{
if
(
valid
)
if
(
this
->
valid
)
unregisterFromMap
()
;
m_map
=
ta
.
m_map
;
m_attrib
=
ta
.
m_attrib
;
valid
=
ta
.
valid
;
if
(
valid
)
this
->
valid
=
ta
.
valid
;
if
(
this
->
valid
)
registerInMap
()
;
return
*
this
;
}
...
...
@@ -122,12 +122,12 @@ template <typename T, unsigned int ORB, typename MAP>
template
<
unsigned
int
ORBIT2
>
inline
AttributeHandler
<
T
,
ORB
,
MAP
>&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
=
(
const
AttributeHandler
<
T
,
ORBIT2
,
MAP
>&
ta
)
{
if
(
valid
)
if
(
this
->
valid
)
unregisterFromMap
()
;
m_map
=
ta
.
map
()
;
m_attrib
=
ta
.
getDataVector
()
;
valid
=
ta
.
isValid
()
;
if
(
valid
)
this
->
valid
=
ta
.
isValid
()
;
if
(
this
->
valid
)
registerInMap
()
;
return
*
this
;
}
...
...
@@ -135,7 +135,7 @@ inline AttributeHandler<T, ORB, MAP>& AttributeHandler<T, ORB, MAP>::operator=(c
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
AttributeHandler
<
T
,
ORB
,
MAP
>::~
AttributeHandler
()
{
if
(
valid
)
if
(
this
->
valid
)
unregisterFromMap
()
;
}
...
...
@@ -191,7 +191,7 @@ inline unsigned int AttributeHandler<T, ORB, MAP>::nbElements() const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
T
&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
[](
Cell
<
ORB
>
c
)
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
assert
(
this
->
valid
||
!
"Invalid AttributeHandler"
)
;
unsigned
int
a
=
m_map
->
getEmbedding
(
c
)
;
if
(
a
==
EMBNULL
)
...
...
@@ -203,7 +203,7 @@ inline T& AttributeHandler<T, ORB, MAP>::operator[](Cell<ORB> c)
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
const
T
&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
[](
Cell
<
ORB
>
c
)
const
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
assert
(
this
->
valid
||
!
"Invalid AttributeHandler"
)
;
unsigned
int
a
=
m_map
->
getEmbedding
(
c
)
;
return
m_attrib
->
operator
[](
a
)
;
}
...
...
@@ -211,21 +211,21 @@ inline const T& AttributeHandler<T, ORB, MAP>::operator[](Cell<ORB> c) const
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
T
&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
[](
unsigned
int
a
)
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
assert
(
this
->
valid
||
!
"Invalid AttributeHandler"
)
;
return
m_attrib
->
operator
[](
a
)
;
}
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
const
T
&
AttributeHandler
<
T
,
ORB
,
MAP
>::
operator
[](
unsigned
int
a
)
const
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
assert
(
this
->
valid
||
!
"Invalid AttributeHandler"
)
;
return
m_attrib
->
operator
[](
a
)
;
}
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
insert
(
const
T
&
elt
)
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
assert
(
this
->
valid
||
!
"Invalid AttributeHandler"
)
;
unsigned
int
idx
=
m_map
->
template
getAttributeContainer
<
ORB
>().
insertLine
()
;
m_attrib
->
operator
[](
idx
)
=
elt
;
return
idx
;
...
...
@@ -234,7 +234,7 @@ inline unsigned int AttributeHandler<T, ORB, MAP>::insert(const T& elt)
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
newElt
()
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
assert
(
this
->
valid
||
!
"Invalid AttributeHandler"
)
;
unsigned
int
idx
=
m_map
->
template
getAttributeContainer
<
ORB
>().
insertLine
()
;
return
idx
;
}
...
...
@@ -249,21 +249,21 @@ inline void AttributeHandler<T, ORB, MAP>::setAllValues(const T& v)
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
begin
()
const
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
assert
(
this
->
valid
||
!
"Invalid AttributeHandler"
)
;
return
m_map
->
template
getAttributeContainer
<
ORB
>().
begin
()
;
}
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
unsigned
int
AttributeHandler
<
T
,
ORB
,
MAP
>::
end
()
const
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
assert
(
this
->
valid
||
!
"Invalid AttributeHandler"
)
;
return
m_map
->
template
getAttributeContainer
<
ORB
>().
end
()
;
}
template
<
typename
T
,
unsigned
int
ORB
,
typename
MAP
>
inline
void
AttributeHandler
<
T
,
ORB
,
MAP
>::
next
(
unsigned
int
&
iter
)
const
{
assert
(
valid
||
!
"Invalid AttributeHandler"
)
;
assert
(
this
->
valid
||
!
"Invalid AttributeHandler"
)
;
m_map
->
template
getAttributeContainer
<
ORB
>().
next
(
iter
)
;
}
...
...
include/Topology/generic/mapCommon.h
View file @
a4f08955
...
...
@@ -149,6 +149,15 @@ public:
template
<
typename
T
,
unsigned
int
ORBIT
,
typename
MAP
>
inline
AttributeHandler
<
T
,
ORBIT
,
MAP
>
getAttribute
(
const
std
::
string
&
nameAttr
)
;
/**
* @brief get attribute type code
* @param nameAttr name of attribute
* @return code enum
*/
template
<
unsigned
int
ORBIT
>
inline
CGoGNCodeType
getAttributeTypeCode
(
const
std
::
string
&
nameAttr
);