Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Cazier
CGoGN
Commits
01cf528d
Commit
01cf528d
authored
Dec 17, 2012
by
Sylvain Thery
Browse files
add checkAttribute function (get/test/add: see the doc)
parent
0da84625
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/Topology/generic/attribmap.h
View file @
01cf528d
...
...
@@ -72,6 +72,14 @@ public:
template
<
typename
T
,
unsigned
int
ORBIT
>
AttributeHandler
<
T
,
ORBIT
>
getAttribute
(
const
std
::
string
&
nameAttr
)
;
/**
* check if an attribute exist ( get, test if valid and add if necessary)
* @param nameAttr attribute name
* @return an AttributeHandler
*/
template
<
typename
T
,
unsigned
int
ORBIT
>
AttributeHandler
<
T
,
ORBIT
>
checkAttribute
(
const
std
::
string
&
nameAttr
)
;
/**
* swap the content of two attributes (efficient, only swap pointers)
*/
...
...
include/Topology/generic/attribmap.hpp
View file @
01cf528d
...
...
@@ -57,6 +57,17 @@ inline AttributeHandler<T ,ORBIT> AttribMap::getAttribute(const std::string& nam
return
AttributeHandler
<
T
,
ORBIT
>
(
this
,
amv
)
;
}
template
<
typename
T
,
unsigned
int
ORBIT
>
inline
AttributeHandler
<
T
,
ORBIT
>
AttribMap
::
checkAttribute
(
const
std
::
string
&
nameAttr
)
{
AttributeHandler
<
T
,
ORBIT
>
att
=
this
->
getAttribute
<
T
,
ORBIT
>
(
nameAttr
);
if
(
!
att
.
isValid
())
att
=
this
->
addAttribute
<
T
,
ORBIT
>
(
"position"
);
return
att
;
}
template
<
typename
T
,
unsigned
int
ORBIT
>
inline
bool
AttribMap
::
swapAttributes
(
AttributeHandler
<
T
,
ORBIT
>&
attr1
,
AttributeHandler
<
T
,
ORBIT
>&
attr2
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment