FactoryCollectionBase.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5
*
6
* ArmarX is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
9
*
10
* ArmarX is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*
18
* @package
19
* @author Mirko Waechter( waechter at kit dot edu)
20
* @date 2013
21
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22
* GNU General Public License
23
*/
24
25
#include "
FactoryCollectionBase.h
"
26
27
#include <mutex>
28
29
namespace
armarx
30
{
31
FactoryCollectionBase::FactoryCollectionBase
()
32
{
33
}
34
35
std::mutex&
FactoryCollectionBase_RegistrationListMutex
()
36
{
37
static
std::mutex mutex;
38
return
mutex;
39
}
40
41
FactoryCollectionBaseCleanUp
FactoryCollectionBase::addToPreregistration
(
FactoryCollectionBasePtr
factoryCollection)
42
{
43
std::unique_lock lock(
FactoryCollectionBase_RegistrationListMutex
());
44
45
//ARMARX_IMPORTANT_S << VAROUT(factoryCollection->getFactories());
46
47
PreregistrationList
().push_back(factoryCollection);
48
49
/*for(const FactoryCollectionBasePtr& fc : PreregistrationList())
50
{
51
ARMARX_IMPORTANT_S << VAROUT(fc->getFactories());
52
}*/
53
54
return
FactoryCollectionBaseCleanUp
(factoryCollection);
55
}
56
57
std::vector<FactoryCollectionBasePtr>&
FactoryCollectionBase::PreregistrationList
()
58
{
59
60
// std::unique_lock lock(registrationListMutex());
61
static
std::vector<FactoryCollectionBasePtr>
list
;
62
return
list
;
63
}
64
65
FactoryCollectionBaseCleanUp::FactoryCollectionBaseCleanUp(
FactoryCollectionBasePtr
factoryToRemoveOnDesctruction)
66
{
67
factoryCollection = factoryToRemoveOnDesctruction;
68
//ARMARX_INFO << "ctor FactoryCollectionBaseCleanUp " << factoryToRemoveOnDesctruction->getFactories();
69
}
70
71
FactoryCollectionBaseCleanUp::~FactoryCollectionBaseCleanUp
()
72
{
73
std::unique_lock lock(
FactoryCollectionBase_RegistrationListMutex
());
74
75
//ARMARX_INFO << "Destruct FactoryCollectionBaseCleanUp";
76
77
// std::cout << "FactoryCollectionBaseCleanUp" << std::endl;
78
for
(
unsigned
int
i = 0; i <
FactoryCollectionBase::PreregistrationList
().size(); i++)
79
{
80
if
(
FactoryCollectionBase::PreregistrationList
().at(i).get() == factoryCollection.get())
81
{
82
//ARMARX_INFO << "erasing: " <<factoryCollection->getFactories().begin()->first << " and co." << std::endl;
83
// std::cout << "erasing: " <<factoryCollection->getFactories().begin()->first << " and co." << std::endl;
84
FactoryCollectionBase::PreregistrationList
().erase(
FactoryCollectionBase::PreregistrationList
().begin() + i);
85
}
86
}
87
}
88
}
list
list(APPEND SOURCES ${QT_RESOURCES}) set(COMPONENT_LIBS ArmarXGui ArmarXCoreObservers ArmarXCoreEigen3Variants PlotterController $
Definition:
CMakeLists.txt:49
FactoryCollectionBase.h
armarx::FactoryCollectionBase::FactoryCollectionBase
FactoryCollectionBase()
Definition:
FactoryCollectionBase.cpp:31
armarx::FactoryCollectionBaseCleanUp::~FactoryCollectionBaseCleanUp
~FactoryCollectionBaseCleanUp()
Definition:
FactoryCollectionBase.cpp:71
armarx::FactoryCollectionBase::addToPreregistration
static FactoryCollectionBaseCleanUp addToPreregistration(FactoryCollectionBasePtr factoryCollection)
Definition:
FactoryCollectionBase.cpp:41
armarx::FactoryCollectionBase::PreregistrationList
static std::vector< FactoryCollectionBasePtr > & PreregistrationList()
Definition:
FactoryCollectionBase.cpp:57
armarx::FactoryCollectionBase::FactoryCollectionBaseCleanUp
friend class FactoryCollectionBaseCleanUp
Definition:
FactoryCollectionBase.h:93
IceUtil::Handle< FactoryCollectionBase >
armarx::FactoryCollectionBase_RegistrationListMutex
std::mutex & FactoryCollectionBase_RegistrationListMutex()
Definition:
FactoryCollectionBase.cpp:35
armarx::FactoryCollectionBaseCleanUp
Definition:
FactoryCollectionBase.h:38
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition:
ArmarXTimeserver.cpp:28
ArmarXCore
core
system
FactoryCollectionBase.cpp
Generated on Sat Oct 12 2024 09:14:02 for armarx_documentation by
1.8.17