本文整理汇总了C++中PropertySet类的典型用法代码示例。如果您正苦于以下问题:C++ PropertySet类的具体用法?C++ PropertySet怎么用?C++ PropertySet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PropertySet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
RunConfiguration::addConfigurations(std::istream& is)
{
std::string type;
PropertySet conf;
while(is >> type)
{
is >> conf;
if (type == INFERENCE_CONF_TOKEN) {
_inferences.push_back(conf);
} else if (type == EVIDENCE_CONF_TOKEN) {
_evidences.push_back(conf);
} else if (type == EM_STEP_CONF_TOKEN) {
std::set<PropertyKey> keys = conf.keys();
std::set<PropertyKey>::iterator i = keys.begin();
EMStep e;
for ( ; i != keys.end(); ++i) {
std::vector< std::string > edges =
tokenizeString(conf.getAs<std::string>(*i), false, ";");
SmallSet< std::string > s(edges.begin(), edges.end(), edges.size());
e[*i] = s;
}
_emsteps.push_back(e);
} else if (type == EM_CONF_TOKEN) {
_em = conf;
} else if (type == PATHWAY_CONF_TOKEN) {
_path = conf;
} else {
THROW("Expecting an inference or evidence token in conf file");
}
}
}
示例2: building_get_property
SCM
building_get_property(int handle, const char* name)
{
Building* building = BuildingManager::current()->get_building_by_id(handle);
if (!building)
{
std::cout << "building_get_property: unknown handle: " << handle << std::endl;
return SCM_UNSPECIFIED;
}
else
{
PropertySet* properties = building->get_properties();
if (!properties)
{
return SCM_UNSPECIFIED;
}
else
{
Property* property = properties->lookup(name);
if (!property)
{
return SCM_UNSPECIFIED;
}
else
{
return Guile::property2scm(*property);
}
}
}
}
示例3: getApplicationProperties
File ApplicationConfiguration::getApplicationDirectory(){
PropertySet* properties = getApplicationProperties();
File dir(properties->getValue("application-directory"));
if(!dir.exists())
dir.createDirectory();
return dir;
}
示例4: CVF_ASSERT
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PropertyXmlSerializer::createAddXmlElementFromPropertySet(const PropertySet& propertySet, XmlElement* parent)
{
CVF_ASSERT(parent);
XmlElement* xmlPropSet = parent->addChildElement("PropertySet");
CVF_ASSERT(xmlPropSet);
xmlPropSet->setAttributeString("classType", propertySet.classType());
std::vector<String> keys = propertySet.allKeys();
std::vector<Variant> values = propertySet.allValues();
size_t numKeyValues = keys.size();
CVF_ASSERT(numKeyValues == values.size());
for (size_t i = 0; i < numKeyValues; i++)
{
const String& key = keys[i];
const Variant& value = values[i];
if (value.isValid())
{
XmlElement* xmlKeyValueElement = createAddXmlElementFromVariant(value, xmlPropSet);
CVF_ASSERT(xmlKeyValueElement);
xmlKeyValueElement->setAttributeString("key", key);
}
}
}
示例5: TEST
TEST(Property, StringProp) {
#if __cplusplus > 201100L || (defined(_MSC_VER) && _MSC_VER >= 1800)
using namespace std;
#else
using namespace std::tr1;
#endif
PropertyDefMap propertyDefs;
Foo foo;
PropertySet props;
PropertyDefMap::iterator defi = propertyDefs.insert(PropertyDefMap::value_type("name",
PropertyDef("name",
"The name of the object.", PROP_STRING))).first;
props.addProperty(
OGRE_NEW Property<String>(&(defi->second),
bind(&Foo::getName, &foo),
bind(&Foo::setName, &foo, placeholders::_1)));
Ogre::String strName, strTest;
strTest = "A simple name";
props.setValue("name", strTest);
props.getValue("name", strName);
ASSERT_EQ(strTest, strName);
}
示例6:
ImageEffect::SequenceArgs::SequenceArgs(ImageEffectHost *host, PropertySet &inArgs)
: ImageEffect::RenderScaleArgs(host, inArgs) {
interactive = (inArgs.getInt(kOfxPropIsInteractive, 0) == 1);
#ifdef OFX_API_1_2
if (host->checkAPIVersion(1, 2)) {
// Specification Mismatch
// -> Nuke 6.1, supposed to support OpenFX API 1.2 does not set those
//sequentialRender = (inArgs.getInt(kOfxImageEffectPropSequentialRenderStatus, 0) != 0);
//interactiveRender = (inArgs.getInt(kOfxImageEffectPropInteractiveRenderStatus, 0) != 0);
sequentialRender = false;
interactiveRender = false;
} else {
sequentialRender = false;
interactiveRender = false;
}
#endif
#ifdef OFX_API_1_3
if (host->checkAPIVersion(1, 3)) {
glEnabled = (inArgs.getInt(kOfxImageEffectPropOpenGLEnabled, 0) == 1);
glTextureIndex = inArgs.getInt(kOfxImageEffectPropOpenGLTextureIndex, 0);
glTextureTarget = inArgs.getInt(kOfxImageEffectPropOpenGLTextureTarget, 0);
} else {
glEnabled = false;
glTextureIndex = -1;
glTextureTarget = -1;
}
#endif
}
示例7: InteractArgs
/** @brief ctor */
KeyArgs::KeyArgs( const PropertySet& props )
: InteractArgs( props )
{
time = props.propGetDouble( kOfxPropTime );
renderScale = getRenderScale( props );
keyString = props.propGetString( kOfxPropKeyString );
}
示例8: adoptPtrWillBeNoop
void KeyframeEffectModelBase::ensureKeyframeGroups() const
{
if (m_keyframeGroups)
return;
m_keyframeGroups = adoptPtrWillBeNoop(new KeyframeGroupMap);
const KeyframeVector keyframes = normalizedKeyframes(getFrames());
for (KeyframeVector::const_iterator keyframeIter = keyframes.begin(); keyframeIter != keyframes.end(); ++keyframeIter) {
const Keyframe* keyframe = keyframeIter->get();
PropertySet keyframeProperties = keyframe->properties();
for (PropertySet::const_iterator propertyIter = keyframeProperties.begin(); propertyIter != keyframeProperties.end(); ++propertyIter) {
CSSPropertyID property = *propertyIter;
ASSERT_WITH_MESSAGE(!isExpandedShorthand(property), "Web Animations: Encountered shorthand CSS property (%d) in normalized keyframes.", property);
KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(property);
PropertySpecificKeyframeGroup* group;
if (groupIter == m_keyframeGroups->end())
group = m_keyframeGroups->add(property, adoptPtrWillBeNoop(new PropertySpecificKeyframeGroup)).storedValue->value.get();
else
group = groupIter->value.get();
group->appendKeyframe(keyframe->createPropertySpecificKeyframe(property));
}
}
// Add synthetic keyframes.
for (KeyframeGroupMap::iterator iter = m_keyframeGroups->begin(); iter != m_keyframeGroups->end(); ++iter) {
iter->value->addSyntheticKeyframeIfRequired(this);
iter->value->removeRedundantKeyframes();
}
}
示例9: getLikelihood
double SemanticObject::getLikelihood(const PropertySet& ev) const {
//propagate(ev.getTimeStamp());
double likelihood = 1;
vector<Attribute> need_to_deduce;
const map<Attribute, Property*>& ev_props = ev.getPropertyMap();
for(map<Attribute, Property*>::const_iterator it = ev_props.begin(); it != ev_props.end(); ++it) {
const Attribute& attribute = it->first;
const Property* ev_prop = it->second;
const Property* this_prop = getProperty(attribute);
if (this_prop) {
likelihood *= this_prop->getLikelihood(ev_prop->getValue());
} else {
need_to_deduce.push_back(attribute);
}
}
vector<Property> deduced_props = KnowledgeDatabase::getInstance().inferProperties(*this, need_to_deduce);
for(vector<Property>::iterator it_prop = deduced_props.begin(); it_prop != deduced_props.end(); ++it_prop) {
const Property* ev_prop = ev.getProperty(it_prop->getAttribute());
assert(ev_prop);
likelihood *= it_prop->getLikelihood(ev_prop->getValue());
}
// cout << " Likelihood existing = " << likelihood << endl;
return likelihood;
}
示例10: StringToImageField
ImageEffect::RenderArgs::RenderArgs(ImageEffectHost *host, PropertySet &inArgs)
: ImageEffect::RenderScaleArgs(host, inArgs), ImageEffect::TimeArgs(host, inArgs) {
field = StringToImageField(inArgs.getString(kOfxImageEffectPropFieldToRender, 0));
inArgs.getInts(kOfxImageEffectPropRenderWindow, 4, &(renderWindow.x1));
#ifdef OFX_API_1_2
if (host->checkAPIVersion(1, 2)) {
// Specification Mismatch
// -> Nuke 6.1, supposed to support OpenFX API 1.2 does not set those
//sequentialRender = (inArgs.getInt(kOfxImageEffectPropSequentialRenderStatus, 0) != 0);
//interactiveRender = (inArgs.getInt(kOfxImageEffectPropInteractiveRenderStatus, 0) != 0);
sequentialRender = false;
interactiveRender = false;
} else {
sequentialRender = false;
interactiveRender = false;
}
#endif
#ifdef OFX_API_1_3
if (host->checkAPIVersion(1, 3)) {
glEnabled = (inArgs.getInt(kOfxImageEffectPropOpenGLEnabled, 0) == 1);
glTextureIndex = inArgs.getInt(kOfxImageEffectPropOpenGLTextureIndex, 0);
glTextureTarget = inArgs.getInt(kOfxImageEffectPropOpenGLTextureTarget, 0);
} else {
glEnabled = false;
glTextureIndex = -1;
glTextureTarget = -1;
}
#endif
}
示例11: param
void TestHSMM::test_loglik(const char* filename, size_t ID, string type){
HSMMparam param(filename);
vector<Real> likelihood_test;
FactorGraph *graph;
JTree *jt;
// Set some constants
size_t maxiter = 10000;
Real tol = 1e-9;
size_t verb = 0;
// Store the constants in a PropertySet object
PropertySet opts;
opts.set("maxiter",maxiter); // Maximum number of iterations
opts.set("tol",tol); // Tolerance for convergence
opts.set("verbose",verb); // Verbosity (amount of output generated)
cout << "Now we do testing...\n";
for(size_t i=0; i<test_data.size(); i++) {
//initialize HSMM of size equal the number of observations
graph = new FactorGraph();
graph->createHSMMFactorGraph(param.init, param.dist, test_data[i].size());
jt = new JTree(*graph, opts("updates",string("HUGIN"))("heuristic",string("MINWEIGHT")) );
//clamp the observation variables to their observed values
for(size_t j = 0; j < test_data[i].size(); j++ ){
//cout << "clamping var" << test_data[i][j].first << " to value " << test_data[i][j].second << "\n";
jt->clamp(test_data[i][j].first, test_data[i][j].second);
}
jt->init();
jt->run();
//compute normalized loglikelyhood
likelihood_test.push_back(jt->logZ()/test_data[i].size());
delete jt;
delete graph;
cout << "Tested point " << i << " out of " << test_data.size() <<"\n";
}
cout << "done.\n";
ofstream os;
stringstream result;
result << string("data/HSMMlikelihood_") << type << string("_") << ID << string(".txt");
os.open(result.str().c_str(), ios::trunc);
for(size_t i=0; i<likelihood_test.size(); i++){
os << likelihood_test.at(i)<<"\n";
}
}
示例12: toKeyframeEffectModelBase
bool CompositorAnimations::getAnimatedBoundingBox(FloatBox& box, const AnimationEffect& effect, double minValue, double maxValue) const
{
const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(effect);
PropertySet properties = keyframeEffect.properties();
if (properties.isEmpty())
return true;
minValue = std::min(minValue, 0.0);
maxValue = std::max(maxValue, 1.0);
for (const auto& property : properties) {
// TODO: Add the ability to get expanded bounds for filters as well.
if (property != CSSPropertyTransform && property != CSSPropertyWebkitTransform)
continue;
const PropertySpecificKeyframeVector& frames = keyframeEffect.getPropertySpecificKeyframes(property);
if (frames.isEmpty() || frames.size() < 2)
continue;
FloatBox originalBox(box);
for (size_t j = 0; j < frames.size() - 1; ++j) {
const AnimatableTransform* startTransform = toAnimatableTransform(frames[j]->getAnimatableValue().get());
const AnimatableTransform* endTransform = toAnimatableTransform(frames[j+1]->getAnimatableValue().get());
if (!startTransform || !endTransform)
return false;
// TODO: Add support for inflating modes other than Replace.
if (frames[j]->composite() != AnimationEffect::CompositeReplace)
return false;
const TimingFunction& timing = frames[j]->easing();
double min = 0;
double max = 1;
if (j == 0) {
float frameLength = frames[j+1]->offset();
if (frameLength > 0) {
min = minValue / frameLength;
}
}
if (j == frames.size() - 2) {
float frameLength = frames[j+1]->offset() - frames[j]->offset();
if (frameLength > 0) {
max = 1 + (maxValue - 1) / frameLength;
}
}
FloatBox bounds;
timing.range(&min, &max);
if (!endTransform->transformOperations().blendedBoundsForBox(originalBox, startTransform->transformOperations(), min, max, &bounds))
return false;
box.expandTo(bounds);
}
}
return true;
}
示例13: ASSERT
void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, const KeyframeEffectModel& effect, Vector<OwnPtr<blink::WebAnimation> >& animations)
{
ASSERT(animations.isEmpty());
CompositorTiming compositorTiming;
bool timingValid = convertTimingForCompositor(timing, compositorTiming);
ASSERT_UNUSED(timingValid, timingValid);
RefPtr<TimingFunction> timingFunction = timing.timingFunction;
if (compositorTiming.reverse)
timingFunction = CompositorAnimationsTimingFunctionReverser::reverse(timingFunction.get());
PropertySet properties = effect.properties();
ASSERT(!properties.isEmpty());
for (PropertySet::iterator it = properties.begin(); it != properties.end(); ++it) {
KeyframeVector values;
getKeyframeValuesForProperty(&effect, *it, compositorTiming.scaledDuration, compositorTiming.reverse, values);
blink::WebAnimation::TargetProperty targetProperty;
OwnPtr<blink::WebAnimationCurve> curve;
switch (*it) {
case CSSPropertyOpacity: {
targetProperty = blink::WebAnimation::TargetPropertyOpacity;
blink::WebFloatAnimationCurve* floatCurve = blink::Platform::current()->compositorSupport()->createFloatAnimationCurve();
addKeyframesToCurve(*floatCurve, values, *timingFunction.get());
curve = adoptPtr(floatCurve);
break;
}
case CSSPropertyWebkitFilter: {
targetProperty = blink::WebAnimation::TargetPropertyFilter;
blink::WebFilterAnimationCurve* filterCurve = blink::Platform::current()->compositorSupport()->createFilterAnimationCurve();
addKeyframesToCurve(*filterCurve, values, *timingFunction);
curve = adoptPtr(filterCurve);
break;
}
case CSSPropertyWebkitTransform: {
targetProperty = blink::WebAnimation::TargetPropertyTransform;
blink::WebTransformAnimationCurve* transformCurve = blink::Platform::current()->compositorSupport()->createTransformAnimationCurve();
addKeyframesToCurve(*transformCurve, values, *timingFunction.get());
curve = adoptPtr(transformCurve);
break;
}
default:
ASSERT_NOT_REACHED();
continue;
}
ASSERT(curve.get());
OwnPtr<blink::WebAnimation> animation = adoptPtr(blink::Platform::current()->compositorSupport()->createAnimation(*curve, targetProperty));
animation->setIterations(compositorTiming.adjustedIterationCount);
animation->setTimeOffset(compositorTiming.scaledTimeOffset);
animation->setAlternatesDirection(compositorTiming.alternate);
animations.append(animation.release());
}
ASSERT(!animations.isEmpty());
}
示例14: getProperties
PropertySet MR::getProperties() const {
PropertySet opts;
opts.set( "tol", props.tol );
opts.set( "verbose", props.verbose );
opts.set( "updates", props.updates );
opts.set( "inits", props.inits );
return opts;
}
示例15: getProperties
PropertySet MF::getProperties() const {
PropertySet opts;
opts.Set( "tol", props.tol );
opts.Set( "maxiter", props.maxiter );
opts.Set( "verbose", props.verbose );
opts.Set( "damping", props.damping );
return opts;
}