Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
CAMP
campvis-public
Commits
cf636de1
Commit
cf636de1
authored
Feb 13, 2015
by
Hossain Mahmud
Browse files
minor changes
parent
66c8e970
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/processorfactory.h
View file @
cf636de1
...
...
@@ -65,41 +65,49 @@ namespace campvis {
AbstractProcessor
*
createProcessor
(
const
std
::
string
&
id
,
IVec2Property
*
viewPortSizeProp
=
0
)
const
;
/**
* Statically registers the processor of type T using \a callee as factory method.
* Statically registers the processor of type T
with construction T()
using \a callee as factory method.
* \note The template instantiation of ProcessorRegistrar takes care of calling this method.
* \param callee Factory method to call to create an instance of type T
* \return The registration index.
*/
template
<
typename
T
>
size_t
registerProcessor
2
(
std
::
function
<
AbstractProcessor
*
(
IVec2Property
*
)
>
callee
)
{
size_t
registerProcessor
(
std
::
function
<
AbstractProcessor
*
()
>
callee
)
{
tbb
::
spin_mutex
::
scoped_lock
lock
(
_mutex
);
auto
it
=
_processorMap
2
.
lower_bound
(
T
::
getId
());
if
(
it
==
_processorMap
2
.
end
()
||
it
->
first
!=
T
::
getId
())
{
_processorMap
2
.
insert
(
it
,
std
::
make_pair
(
T
::
getId
(),
callee
));
auto
it
=
_processorMap
.
lower_bound
(
T
::
getId
());
if
(
it
==
_processorMap
.
end
()
||
it
->
first
!=
T
::
getId
())
{
_processorMap
.
insert
(
it
,
std
::
make_pair
(
T
::
getId
(),
callee
));
}
else
{
cgtAssert
(
false
,
"Registered two processors with the same ID."
);
}
return
_processorMap
2
.
size
();
return
_processorMap
.
size
();
}
/**
* Statically registers the processor of type T with constructor T(IVec2Property) using \a callee as factory method.
* \note The template instantiation of ProcessorRegistrar takes care of calling this method.
* \param callee Factory method to call to create an instance of type T
* \return The registration index.
*/
template
<
typename
T
>
size_t
registerProcessor
(
std
::
function
<
AbstractProcessor
*
()
>
callee
)
{
size_t
registerProcessor
2
(
std
::
function
<
AbstractProcessor
*
(
IVec2Property
*
)
>
callee
)
{
tbb
::
spin_mutex
::
scoped_lock
lock
(
_mutex
);
auto
it
=
_processorMap
.
lower_bound
(
T
::
getId
());
if
(
it
==
_processorMap
.
end
()
||
it
->
first
!=
T
::
getId
())
{
_processorMap
.
insert
(
it
,
std
::
make_pair
(
T
::
getId
(),
callee
));
auto
it
=
_processorMap
2
.
lower_bound
(
T
::
getId
());
if
(
it
==
_processorMap
2
.
end
()
||
it
->
first
!=
T
::
getId
())
{
_processorMap
2
.
insert
(
it
,
std
::
make_pair
(
T
::
getId
(),
callee
));
}
else
{
cgtAssert
(
false
,
"Registered two processors with the same ID."
);
}
return
_processorMap
.
size
();
return
_processorMap
2
.
size
();
}
private:
mutable
tbb
::
spin_mutex
_mutex
;
static
tbb
::
atomic
<
ProcessorFactory
*>
_singleton
;
///< the singleton object
...
...
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