33 template class ::IceInternal::Handle<::armarx::LiteralImpl>;
46 LiteralImpl::LiteralImpl()
49 this->type = eLiteral;
50 impl->installed =
false;
58 LiteralImpl::LiteralImpl(
const std::string& dataFieldIdentifierStr,
const std::string& checkName,
const ParameterList& checkParameters)
61 init(dataFieldIdentifierStr, checkName, checkParameters);
73 init(dataFieldIdentifier->getIdentifierStr(), checkName, checkParameters);
76 LiteralImpl::LiteralImpl(
const DatafieldRefBasePtr& dataFieldIdentifier,
const std::string& checkName,
const ParameterList& checkParameters)
79 DatafieldRefPtr ref = DatafieldRefPtr::dynamicCast(dataFieldIdentifier);
80 init(ref->getDataFieldIdentifier()->getIdentifierStr(), checkName, checkParameters);
110 literal->type = this->type;
111 literal->impl->installed = this->impl->installed;
112 literal->impl->checkIdentifier = this->impl->checkIdentifier;
113 literal->checkConfig = this->checkConfig;
114 literal->impl->myProxy = this->impl->myProxy;
121 DataFieldIdentifierPtr dataFieldIdentifier = DataFieldIdentifierPtr::dynamicCast(checkConfig.dataFieldIdentifier);
123 out << checkConfig.checkName <<
"(";
125 if (dataFieldIdentifier)
127 out << dataFieldIdentifier;
135 ParameterList::const_iterator iter = checkConfig.checkParameters.begin();
137 while (iter != checkConfig.checkParameters.end())
139 if (iter == checkConfig.checkParameters.begin())
144 VariantPtr var = VariantPtr::dynamicCast(*iter);
157 if (iter != checkConfig.checkParameters.end())
166 void LiteralImpl::init(
const std::string& dataFieldIdentifierStr,
const std::string& checkName,
const ParameterList& checkParameters)
171 this->checkConfig.dataFieldIdentifier = dataFieldIdentifier;
172 this->checkConfig.checkName = checkName;
174 ParameterList::const_iterator iter = checkParameters.begin();
176 while (iter != checkParameters.end())
178 this->checkConfig.checkParameters.push_back(
VariantPtr(
new Variant(*VariantPtr::dynamicCast(*iter))));
183 void LiteralImpl::installCheck(
const Ice::ObjectAdapterPtr& adapter,
const ObserverInterfacePrx& proxy)
185 std::unique_lock lock(impl->accessLock);
193 impl->myProxy = adapter->addWithUUID(
this);
194 checkConfig.listener = LiteralImplBasePrx::uncheckedCast(impl->myProxy);
197 impl->checkIdentifier = proxy->installCheck(checkConfig);
199 impl->installed =
true;
202 void LiteralImpl::removeCheck(
const Ice::ObjectAdapterPtr& adapter,
const ObserverInterfacePrx& proxy)
204 std::unique_lock lock(impl->accessLock);
206 if (!impl->installed)
212 proxy->removeCheck(impl->checkIdentifier);
215 adapter->remove(impl->myProxy->ice_getIdentity());
217 impl->installed =
false;