本文整理汇总了C++中PropertyBag::getProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyBag::getProperties方法的具体用法?C++ PropertyBag::getProperties怎么用?C++ PropertyBag::getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyBag
的用法示例。
在下文中一共展示了PropertyBag::getProperties方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configureHook
bool ImageDisplayComponent::configureHook(){
Logger::In in("ImageDisplayComponent");
// Load config file
if ( this->marshalling()->readProperties( this->getName() + ".cpf" ) == false)
return false;
log(Info) << "Loading Ports to display from file." <<endlog();
PropertyDemarshaller dem( config.get() );
PropertyBag bag;
if (dem.deserialize( bag ) == false ) {
log(Error) << "Reading file "<< config.get() << " failed."<<endlog();
return false;
}
bool ok = true;
PropertyBag::const_iterator it = bag.getProperties().begin();
while ( it != bag.getProperties().end() ){
Property<std::string>* compName = dynamic_cast<Property<std::string>* >( *it );
if ( !compName )
log(Error) << "Expected Property \""
<< (*it)->getName() <<"\" to be of type string."<< endlog();
else if ( compName->getName() == "ImagePort" ) {
string cname = compName->value().substr(0, compName->value().find("."));
string pname = compName->value().substr( compName->value().find(".")+1, string::npos);
ok &= this->addDisplayPort(cname, pname);
}
else {
log(Error) << "Expected \"Component\", \"Port\" or \"Data\", got "
<< compName->getName() << endlog();
ok = false;
}
++it;
}
deleteProperties( bag );
// Create window for every dataport
for(Reports::iterator it = root.begin(); it != root.end(); ++it ) {
// Update the dataport
(it->get<2>())->execute();
// Get the base dataport
DataSourceBase::shared_ptr source = it->get<3>();
// Convert to Dataport<IplImage>
DataSource<IplImage>::shared_ptr clone = AdaptDataSource<IplImage>()( source.get() );
IplImage localImage = clone->get();
string dataportName = it->get<0>();
cvNamedWindow(dataportName.data(),CV_WINDOW_AUTOSIZE);
cvShowImage(dataportName.data(),&localImage);
}
// Enter main loop of the window, and update the window if needed
int key;
key = cvWaitKey(3);
// Magic number 3
return ok;
}
示例2: serialize
virtual void serialize(const PropertyBag &v)
{
for (
PropertyBag::const_iterator i = v.getProperties().begin();
i != v.getProperties().end();
i++ )
{
this->serialize( *i );
}
}
示例3: serialize
virtual void serialize(const PropertyBag &v)
{
*(this->s) << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
*(this->s) << "<xmlrpc>\n";
for (
std::vector<base::PropertyBase*>::const_iterator i = v.getProperties().begin();
i != v.getProperties().end();
i++ )
{
(*i)->identify(this);
}
*(this->s) << "\n</xmlrpc>\n";
}
示例4: serialize
virtual void serialize(const PropertyBag &v)
{
int retval;
/**
* Check if the netcdf file is already in define mode.
* Increase counter every time serialize function is called and no errors occurs.
*/
if ( ncopen ) {
ncopen++;
}
else {
retval = nc_redef(ncid);
if ( retval )
log(Error) << "Could not enter define mode in NetcdfHeaderMarshaller, error "<< retval <<endlog();
else
ncopen++;
}
for (
PropertyBag::const_iterator i = v.getProperties().begin();
i != v.getProperties().end();
i++ )
{
this->serialize(*i);
}
/**
* Decrease counter, if zero enter data mode else stay in define mode
*/
if (--ncopen)
log(Info) << "Serializer still in progress" <<endlog();
else {
retval = nc_enddef(ncid);
if (retval)
log(Error) << "Could not leave define mode, error" << retval <<endlog();
}
}