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
Hurstel
CGoGN
Commits
e2fc1ed9
Commit
e2fc1ed9
authored
Mar 14, 2012
by
Sylvain Thery
Browse files
add copyFrom method in genericmap (testing in progress)
add some const
parent
11ba46af
Changes
21
Hide whitespace changes
Inline
Side-by-side
include/Container/attributeContainer.h
View file @
e2fc1ed9
...
...
@@ -530,6 +530,13 @@ public:
* @param id ??
*/
bool
loadBin
(
CGoGNistream
&
fs
);
/**
* copy container
* TODO a version that compact on the fly ?
*/
void
copyFrom
(
const
AttributeContainer
&
cont
);
};
}
// namespace CGoGN
...
...
include/Container/attributeMultiVector.h
View file @
e2fc1ed9
...
...
@@ -126,6 +126,8 @@ public:
*/
virtual
void
setNbBlocks
(
unsigned
int
nbb
)
=
0
;
virtual
unsigned
int
getNbBlocks
()
const
=
0
;
virtual
void
addBlocksBefore
(
unsigned
int
nbb
)
=
0
;
virtual
bool
copy
(
const
AttributeMultiVectorGen
*
atmvg
)
=
0
;
...
...
@@ -244,6 +246,8 @@ public:
void
setNbBlocks
(
unsigned
int
nbb
);
unsigned
int
getNbBlocks
()
const
;
void
addBlocksBefore
(
unsigned
int
nbb
);
bool
copy
(
const
AttributeMultiVectorGen
*
atmvg
);
...
...
include/Container/attributeMultiVector.hpp
View file @
e2fc1ed9
...
...
@@ -132,7 +132,9 @@ AttributeMultiVector<T>::~AttributeMultiVector()
template
<
typename
T
>
inline
AttributeMultiVectorGen
*
AttributeMultiVector
<
T
>::
new_obj
()
{
return
new
AttributeMultiVector
<
T
>
;
AttributeMultiVectorGen
*
ptr
=
new
AttributeMultiVector
<
T
>
;
ptr
->
setTypeName
(
m_typeName
);
return
ptr
;
}
/**************************************
...
...
@@ -166,6 +168,12 @@ void AttributeMultiVector<T>::setNbBlocks(unsigned int nbb)
}
}
template
<
typename
T
>
unsigned
int
AttributeMultiVector
<
T
>::
getNbBlocks
()
const
{
return
m_tableData
.
size
();
}
template
<
typename
T
>
void
AttributeMultiVector
<
T
>::
addBlocksBefore
(
unsigned
int
nbb
)
{
...
...
include/Container/holeblockref.h
View file @
e2fc1ed9
...
...
@@ -27,6 +27,7 @@
#include
<fstream>
#include
<iostream>
#include
<assert.h>
#include
"Container/sizeblock.h"
...
...
@@ -49,7 +50,7 @@ protected:
unsigned
int
m_nbref
;
/**
* nb element in block
* nb element
s
in block
*/
unsigned
int
m_nb
;
...
...
@@ -59,6 +60,11 @@ public:
*/
HoleBlockRef
();
/**
* copy constructor
*/
HoleBlockRef
(
const
HoleBlockRef
&
hb
);
/**
* destructor
*/
...
...
@@ -149,6 +155,7 @@ public:
*/
inline
bool
unref
(
unsigned
int
i
)
{
// assert(m_refCount[i] > 1);
m_refCount
[
i
]
--
;
if
(
m_refCount
[
i
]
==
1
)
{
...
...
@@ -165,7 +172,7 @@ public:
/**
* number of references of element i
* @return the number of references
(0 = no elements
)
* @return the number of references
+1 (stored as n+1, 0 = not used, 1 used but not refs, ...
)
*/
inline
unsigned
int
nbRefs
(
unsigned
int
i
)
{
return
m_refCount
[
i
];
}
...
...
include/Topology/generic/genericmap.h
View file @
e2fc1ed9
...
...
@@ -150,7 +150,7 @@ public:
~
GenericMap
()
;
virtual
std
::
string
mapTypeName
()
=
0
;
virtual
std
::
string
mapTypeName
()
const
=
0
;
/**
* Clear the map
...
...
@@ -503,6 +503,11 @@ public:
*/
bool
loadMapBin
(
const
std
::
string
&
filename
)
;
/**
* copy from another map (of same type)
*/
bool
copyFrom
(
const
GenericMap
&
map
);
/**
* Dump attributes types and names per orbit
*/
...
...
include/Topology/gmap/gmap0.h
View file @
e2fc1ed9
...
...
@@ -46,7 +46,7 @@ protected:
public:
GMap0
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/gmap/gmap0.hpp
View file @
e2fc1ed9
...
...
@@ -37,7 +37,7 @@ inline GMap0::GMap0() : AttribMap()
init
()
;
}
inline
std
::
string
GMap0
::
mapTypeName
()
inline
std
::
string
GMap0
::
mapTypeName
()
const
{
return
"GMap0"
;
}
...
...
include/Topology/gmap/gmap1.h
View file @
e2fc1ed9
...
...
@@ -45,7 +45,7 @@ public:
GMap1
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/gmap/gmap1.hpp
View file @
e2fc1ed9
...
...
@@ -35,7 +35,7 @@ inline GMap1::GMap1() : GMap0()
init
()
;
}
inline
std
::
string
GMap1
::
mapTypeName
()
inline
std
::
string
GMap1
::
mapTypeName
()
const
{
return
"GMap1"
;
}
...
...
include/Topology/gmap/gmap2.h
View file @
e2fc1ed9
...
...
@@ -50,7 +50,7 @@ public:
GMap2
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/gmap/gmap2.hpp
View file @
e2fc1ed9
...
...
@@ -35,7 +35,7 @@ inline GMap2::GMap2() : GMap1()
init
()
;
}
inline
std
::
string
GMap2
::
mapTypeName
()
inline
std
::
string
GMap2
::
mapTypeName
()
const
{
return
"GMap2"
;
}
...
...
include/Topology/gmap/gmap3.h
View file @
e2fc1ed9
...
...
@@ -55,7 +55,7 @@ public:
GMap3
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/gmap/gmap3.hpp
View file @
e2fc1ed9
...
...
@@ -35,7 +35,7 @@ inline GMap3::GMap3() : GMap2()
init
()
;
}
inline
std
::
string
GMap3
::
mapTypeName
()
inline
std
::
string
GMap3
::
mapTypeName
()
const
{
return
"GMap3"
;
}
...
...
include/Topology/map/map1.h
View file @
e2fc1ed9
...
...
@@ -51,7 +51,7 @@ protected:
public:
Map1
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/map/map1.hpp
View file @
e2fc1ed9
...
...
@@ -38,7 +38,7 @@ inline Map1::Map1() : AttribMap()
init
()
;
}
inline
std
::
string
Map1
::
mapTypeName
()
inline
std
::
string
Map1
::
mapTypeName
()
const
{
return
"Map1"
;
}
...
...
include/Topology/map/map2.h
View file @
e2fc1ed9
...
...
@@ -62,7 +62,7 @@ public:
Map2
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/map/map2.hpp
View file @
e2fc1ed9
...
...
@@ -37,7 +37,7 @@ inline Map2::Map2() : Map1()
init
()
;
}
inline
std
::
string
Map2
::
mapTypeName
()
inline
std
::
string
Map2
::
mapTypeName
()
const
{
return
"Map2"
;
}
...
...
include/Topology/map/map3.h
View file @
e2fc1ed9
...
...
@@ -69,7 +69,7 @@ public:
Map3
();
virtual
std
::
string
mapTypeName
();
virtual
std
::
string
mapTypeName
()
const
;
virtual
unsigned
int
dimension
();
...
...
include/Topology/map/map3.hpp
View file @
e2fc1ed9
...
...
@@ -35,7 +35,7 @@ inline Map3::Map3() : Map2()
init
()
;
}
inline
std
::
string
Map3
::
mapTypeName
()
inline
std
::
string
Map3
::
mapTypeName
()
const
{
return
"Map3"
;
}
...
...
src/Container/attributeContainer.cpp
View file @
e2fc1ed9
...
...
@@ -690,4 +690,57 @@ bool AttributeContainer::loadBin(CGoGNistream& fs)
return
true
;
}
void
AttributeContainer
::
copyFrom
(
const
AttributeContainer
&
cont
)
{
// clear is done from the map
m_size
=
cont
.
m_size
;
m_maxSize
=
cont
.
m_maxSize
;
m_orbit
=
cont
.
m_orbit
;
m_nbUnknown
=
cont
.
m_nbUnknown
;
m_nbAttributes
=
cont
.
m_nbAttributes
;
m_lineCost
=
cont
.
m_lineCost
;
// blocks
unsigned
int
sz
=
cont
.
m_holesBlocks
.
size
();
m_holesBlocks
.
resize
(
sz
);
for
(
unsigned
int
i
=
0
;
i
<
sz
;
++
i
)
m_holesBlocks
[
i
]
=
new
HoleBlockRef
(
*
(
cont
.
m_holesBlocks
[
i
]));
// blocks with free
sz
=
cont
.
m_tableBlocksWithFree
.
size
();
m_tableBlocksWithFree
.
resize
(
sz
);
for
(
unsigned
int
i
=
0
;
i
<
sz
;
++
i
)
m_tableBlocksWithFree
[
i
]
=
cont
.
m_tableBlocksWithFree
[
i
];
// empty blocks
sz
=
cont
.
m_tableBlocksEmpty
.
size
();
m_tableBlocksEmpty
.
resize
(
sz
);
for
(
unsigned
int
i
=
0
;
i
<
sz
;
++
i
)
m_tableBlocksEmpty
[
i
]
=
cont
.
m_tableBlocksEmpty
[
i
];
//attributes (warning attribute can have different numbers than in original)
m_tableAttribs
.
reserve
(
m_nbAttributes
);
sz
=
cont
.
m_tableAttribs
.
size
();
for
(
unsigned
int
i
=
0
;
i
<
sz
;
++
i
)
{
if
(
cont
.
m_tableAttribs
[
i
]
!=
NULL
)
{
AttributeMultiVectorGen
*
ptr
=
cont
.
m_tableAttribs
[
i
]
->
new_obj
();
ptr
->
setName
(
cont
.
m_tableAttribs
[
i
]
->
getName
());
ptr
->
setOrbit
(
cont
.
m_tableAttribs
[
i
]
->
getIndex
());
ptr
->
setIndex
(
m_tableAttribs
.
size
());
ptr
->
setNbBlocks
(
cont
.
m_tableAttribs
[
i
]
->
getNbBlocks
());
ptr
->
copy
(
cont
.
m_tableAttribs
[
i
]);
if
(
cont
.
m_tableAttribs
[
i
]
->
toProcess
())
ptr
->
toggleProcess
();
else
ptr
->
toggleNoProcess
();
m_tableAttribs
.
push_back
(
ptr
);
}
}
}
}
Prev
1
2
Next
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