本文整理汇总了C++中prop函数的典型用法代码示例。如果您正苦于以下问题:C++ prop函数的具体用法?C++ prop怎么用?C++ prop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prop函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: prop
void MCWalkerConfiguration::loadEnsemble(MCWalkerConfiguration& other)
{
if(SampleStack.empty()) return;
Walker_t::PropertyContainer_t prop(1,PropertyList.size());
int nsamples=SampleStack.size();
for(int i=0; i<nsamples; ++i)
{
Walker_t* awalker=new Walker_t(getTotalNum());
// awalker->R = *(SampleStack[i]);
// awalker->Drift = 0.0;
awalker->R = SampleStack[i].R;
awalker->Grad = SampleStack[i].G;
awalker->Lap = SampleStack[i].L;
// Make sure properties is resized properly first
awalker->Properties.copy(prop);
RealType *myprop = awalker->getPropertyBase();
myprop[LOGPSI] = SampleStack[i].LogPsi;
myprop[LOCALENERGY] = SampleStack[i].KE + SampleStack[i].PE;
myprop[LOCALPOTENTIAL] = SampleStack[i].PE;
other.WalkerList.push_back(awalker);
// delete SampleStack[i];
}
SampleStack.clear();
}
开发者ID:digideskio,项目名称:qmcpack,代码行数:24,代码来源:MCWalkerConfiguration.cpp
示例2: AddArbitraryPropertyToParamListBuilder
void AddArbitraryPropertyToParamListBuilder( ICompoundProperty & parent,
const PropertyHeader &propHeader,
ISampleSelector &sampleSelector,
const std::string &rmanBaseType,
ParamListBuilder &ParamListBuilder
)
{
T prop( parent, propHeader.getName() );
if ( ! prop.valid() )
{
//TODO error message?
return;
}
std::string rmanType = GetPrmanScopeString(
GetGeometryScope( propHeader.getMetaData() ) ) + " ";
rmanType += rmanBaseType + " " + propHeader.getName();
typename T::sample_ptr_type propSample = prop.getValue( sampleSelector );
ParamListBuilder.add( rmanType, (RtPointer)propSample->get(), propSample );
}
开发者ID:ryutaro765,项目名称:Alembic,代码行数:24,代码来源:ArbAttrUtil.cpp
示例3: prop
void
prop(Reg *r, Bits ref, Bits cal)
{
Reg *r1, *r2;
int z;
for(r1 = r; r1 != R; r1 = (Reg*)r1->f.p1) {
for(z=0; z<BITS; z++) {
ref.b[z] |= r1->refahead.b[z];
if(ref.b[z] != r1->refahead.b[z]) {
r1->refahead.b[z] = ref.b[z];
change++;
}
cal.b[z] |= r1->calahead.b[z];
if(cal.b[z] != r1->calahead.b[z]) {
r1->calahead.b[z] = cal.b[z];
change++;
}
}
switch(r1->f.prog->as) {
case ACALL:
if(noreturn(r1->f.prog))
break;
for(z=0; z<BITS; z++) {
cal.b[z] |= ref.b[z] | externs.b[z];
ref.b[z] = 0;
}
break;
case ATEXT:
for(z=0; z<BITS; z++) {
cal.b[z] = 0;
ref.b[z] = 0;
}
break;
case ARET:
for(z=0; z<BITS; z++) {
cal.b[z] = externs.b[z] | ovar.b[z];
ref.b[z] = 0;
}
break;
default:
// Work around for issue 1304:
// flush modified globals before each instruction.
for(z=0; z<BITS; z++) {
cal.b[z] |= externs.b[z];
// issue 4066: flush modified return variables in case of panic
if(hasdefer)
cal.b[z] |= ovar.b[z];
}
break;
}
for(z=0; z<BITS; z++) {
ref.b[z] = (ref.b[z] & ~r1->set.b[z]) |
r1->use1.b[z] | r1->use2.b[z];
cal.b[z] &= ~(r1->set.b[z] | r1->use1.b[z] | r1->use2.b[z]);
r1->refbehind.b[z] = ref.b[z];
r1->calbehind.b[z] = cal.b[z];
}
if(r1->f.active)
break;
r1->f.active = 1;
}
for(; r != r1; r = (Reg*)r->f.p1)
for(r2 = (Reg*)r->f.p2; r2 != R; r2 = (Reg*)r2->f.p2link)
prop(r2, r->refbehind, r->calbehind);
}
开发者ID:TomHoenderdos,项目名称:go-sunos,代码行数:69,代码来源:reg.c
示例4: prop
void VCMatrix::editProperties()
{
VCMatrixProperties prop(this, m_doc);
if (prop.exec() == QDialog::Accepted)
m_doc->setModified();
}
开发者ID:Cingulingu,项目名称:qlcplus,代码行数:6,代码来源:vcmatrix.cpp
示例5: regopt
//.........这里部分代码省略.........
loopit(firstr, npc);
if(debug['R'] && debug['v']) {
print("\nlooping structure:\n");
for(r = firstr; r != R; r = r->link) {
print("%ld:%P", r->loop, r->prog);
for(z=0; z<BITS; z++)
bit.b[z] = r->use1.b[z] |
r->use2.b[z] |
r->set.b[z];
if(bany(&bit)) {
print("\t");
if(bany(&r->use1))
print(" u1=%B", r->use1);
if(bany(&r->use2))
print(" u2=%B", r->use2);
if(bany(&r->set))
print(" st=%B", r->set);
}
print("\n");
}
}
/*
* pass 3
* iterate propagating usage
* back until flow graph is complete
*/
loop1:
change = 0;
for(r = firstr; r != R; r = r->link)
r->active = 0;
for(r = firstr; r != R; r = r->link)
if(r->prog->as == ARET)
prop(r, zbits, zbits);
loop11:
/* pick up unreachable code */
i = 0;
for(r = firstr; r != R; r = r1) {
r1 = r->link;
if(r1 && r1->active && !r->active) {
prop(r, zbits, zbits);
i = 1;
}
}
if(i)
goto loop11;
if(change)
goto loop1;
/*
* pass 4
* iterate propagating register/variable synchrony
* forward until graph is complete
*/
loop2:
change = 0;
for(r = firstr; r != R; r = r->link)
r->active = 0;
synch(firstr, zbits);
if(change)
goto loop2;
/*
* pass 5
开发者ID:carriercomm,项目名称:legacy,代码行数:67,代码来源:reg.c
示例6: main
int main( int argc, char *argv[] ) {
// Init controller db file for backend
Q_INIT_RESOURCE( controllerdb );
// Uncomment this to enable the message handler for debugging and stack tracing
// qInstallMessageHandler( phoenixDebugMessageHandler );
// Handles stuff with the windowing system
QGuiApplication app( argc, argv );
// The engine that runs our QML-based UI
QQmlApplicationEngine engine;
// Set application metadata
QGuiApplication::setApplicationDisplayName( QStringLiteral( "Phoenix" ) );
QGuiApplication::setApplicationName( QStringLiteral( "Phoenix" ) );
QGuiApplication::setApplicationVersion( QStringLiteral( "0.0.1" ) );
QGuiApplication::setOrganizationName( QStringLiteral( "Team Phoenix" ) );
QGuiApplication::setOrganizationDomain( QStringLiteral( "phoenix.vg" ) );
// Figure out the right paths for the environment, and create user storage folders if not already there
Library::PhxPaths::initPaths();
// For release builds, write to a log file along with the console
#ifdef QT_NO_DEBUG
QFile logFile( Library::PhxPaths::userDataLocation() % '/' % QStringLiteral( "Logs" ) % '/' %
QDateTime::currentDateTime().toString( QStringLiteral( "ddd MMM d yyyy - h mm ss AP" ) ) %
QStringLiteral( ".log" ) );
// If this fails... how would we know? :)
logFile.open( QIODevice::WriteOnly | QIODevice::Text );
int logFD = logFile.handle();
logFP = fdopen( dup( logFD ), "w" );
qInstallMessageHandler( phoenixDebugMessageLog );
#endif
// Open connections to the SQL databases.
Library::LibretroDatabase::open();
Library::MetaDataDatabase::open();
// Necessary to quit properly
QObject::connect( &engine, &QQmlApplicationEngine::quit, &app, &QGuiApplication::quit );
// Register our custom types for use within QML
VideoItem::registerTypes();
InputManager::registerTypes();
// Register our custom QML-accessable/instantiable objects
qmlRegisterType<Library::PlatformsModel>( "vg.phoenix.models", 1, 0, "PlatformsModel" );
qmlRegisterType<Library::CollectionsModel>( "vg.phoenix.models", 1, 0, "CollectionsModel" );
qmlRegisterType<Library::LibraryModel>( "vg.phoenix.models", 1, 0, "LibraryModel" );
qmlRegisterType<Library::CoreModel>( "vg.phoenix.models", 1, 0, "CoreModel" );
qmlRegisterType<Library::ImageCacher>( "vg.phoenix.cache", 1, 0, "ImageCacher" );
qmlRegisterType<GameLauncher>( "vg.phoenix.launcher", 1, 0, "GameLauncher" );
// Register our custom QML-accessable objects and instantiate them here
qmlRegisterSingletonType( QUrl( "qrc:/PhxTheme.qml" ), "vg.phoenix.themes", 1, 0, "PhxTheme" );
qmlRegisterSingletonType<Library::PhxPaths>( "vg.phoenix.paths", 1, 0, "PhxPaths", PhxPathsSingletonProviderCallback );
qRegisterMetaType<Library::GameData>( "GameData" );
// Load the root QML object and everything under it
engine.load( QUrl( QStringLiteral( "qrc:/main.qml" ) ) );
// Ensure custom controller DB file exists
QFile gameControllerDBFile( Library::PhxPaths::userDataLocation() % '/' % QStringLiteral( "gamecontrollerdb.txt" ) );
if( !gameControllerDBFile.exists() ) {
gameControllerDBFile.open( QIODevice::ReadWrite );
QTextStream stream( &gameControllerDBFile );
stream << "# Insert your custom definitions here" << endl;
gameControllerDBFile.close();
}
// Set InputManager's custom controller DB file
QQmlProperty prop( engine.rootObjects().first(), "inputManager.controllerDBFile" );
Q_ASSERT( prop.isValid() );
QString path = Library::PhxPaths::userDataLocation() % QStringLiteral( "/gamecontrollerdb.txt" );
QVariant pathVar( path );
prop.write( pathVar );
// Run the app and write return code to the log file if in release mode
#ifdef QT_NO_DEBUG
int ret = app.exec();
fprintf( logFP, "Returned %d", ret );
fclose( logFP );
return ret;
#else
// Otherwise, just run it normally
return app.exec();
#endif
}
开发者ID:Limero,项目名称:Phoenix,代码行数:94,代码来源:main.cpp
示例7: prop
QString ItemRDFImpl::commentPostUri() const
{
PropertyPtr prop(new Property(commentApiNamespace() + QLatin1String("comment")));
return m_item.resource()->property(prop)->asString();
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:5,代码来源:itemrdfimpl.cpp
示例8: Q_ASSERT
QObject *QDeclarativeVME::run(QDeclarativeVMEObjectStack &stack,
QDeclarativeContextData *ctxt,
QDeclarativeCompiledData *comp,
int start, int count,
const QBitField &bindingSkipList)
{
Q_ASSERT(comp);
Q_ASSERT(ctxt);
const QList<QDeclarativeCompiledData::TypeReference> &types = comp->types;
const QList<QString> &primitives = comp->primitives;
const QList<QByteArray> &datas = comp->datas;
const QList<QDeclarativeCompiledData::CustomTypeData> &customTypeData = comp->customTypeData;
const QList<int> &intData = comp->intData;
const QList<float> &floatData = comp->floatData;
const QList<QDeclarativePropertyCache *> &propertyCaches = comp->propertyCaches;
const QList<QDeclarativeParser::Object::ScriptBlock> &scripts = comp->scripts;
const QList<QUrl> &urls = comp->urls;
QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding> bindValues;
QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus> parserStatus;
QDeclarativeVMEStack<ListInstance> qliststack;
vmeErrors.clear();
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(ctxt->engine);
int status = -1; //for dbus
QDeclarativePropertyPrivate::WriteFlags flags = QDeclarativePropertyPrivate::BypassInterceptor |
QDeclarativePropertyPrivate::RemoveBindingOnAliasWrite;
for (int ii = start; !isError() && ii < (start + count); ++ii) {
const QDeclarativeInstruction &instr = comp->bytecode.at(ii);
switch(instr.type) {
case QDeclarativeInstruction::Init:
{
if (instr.init.bindingsSize)
bindValues = QDeclarativeEnginePrivate::SimpleList<QDeclarativeAbstractBinding>(instr.init.bindingsSize);
if (instr.init.parserStatusSize)
parserStatus = QDeclarativeEnginePrivate::SimpleList<QDeclarativeParserStatus>(instr.init.parserStatusSize);
if (instr.init.contextCache != -1)
ctxt->setIdPropertyData(comp->contextCaches.at(instr.init.contextCache));
if (instr.init.compiledBinding != -1)
ctxt->optimizedBindings = new QDeclarativeCompiledBindings(datas.at(instr.init.compiledBinding).constData(), ctxt, comp);
}
break;
case QDeclarativeInstruction::CreateObject:
{
QBitField bindings;
if (instr.create.bindingBits != -1) {
const QByteArray &bits = datas.at(instr.create.bindingBits);
bindings = QBitField((const quint32*)bits.constData(),
bits.size() * 8);
}
if (stack.isEmpty())
bindings = bindings.united(bindingSkipList);
QObject *o =
types.at(instr.create.type).createInstance(ctxt, bindings, &vmeErrors);
if (!o) {
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className)));
}
QDeclarativeData *ddata = QDeclarativeData::get(o);
Q_ASSERT(ddata);
if (stack.isEmpty()) {
if (ddata->context) {
Q_ASSERT(ddata->context != ctxt);
Q_ASSERT(ddata->outerContext);
Q_ASSERT(ddata->outerContext != ctxt);
QDeclarativeContextData *c = ddata->context;
while (c->linkedContext) c = c->linkedContext;
c->linkedContext = ctxt;
} else {
ctxt->addObject(o);
}
ddata->ownContext = true;
} else if (!ddata->context) {
ctxt->addObject(o);
}
ddata->setImplicitDestructible();
ddata->outerContext = ctxt;
ddata->lineNumber = instr.line;
ddata->columnNumber = instr.create.column;
if (instr.create.data != -1) {
QDeclarativeCustomParser *customParser =
types.at(instr.create.type).type->customParser();
customParser->setCustomData(o, datas.at(instr.create.data));
}
if (!stack.isEmpty()) {
QObject *parent = stack.top();
if (o->isWidgetType()) {
QWidget *widget = static_cast<QWidget*>(o);
if (parent->isWidgetType()) {
//.........这里部分代码省略.........
开发者ID:maxxant,项目名称:qt,代码行数:101,代码来源:qdeclarativevme.cpp
示例9: regopt
//.........这里部分代码省略.........
}
r->s2 = r1;
r->p2link = r1->p2;
r1->p2 = r;
}
}
if(debug['R'] && debug['v'])
dumpit("pass2", firstr);
/*
* pass 2.5
* find looping structure
*/
for(r = firstr; r != R; r = r->link)
r->active = 0;
change = 0;
loopit(firstr, nr);
if(debug['R'] && debug['v'])
dumpit("pass2.5", firstr);
/*
* pass 3
* iterate propagating usage
* back until flow graph is complete
*/
loop1:
change = 0;
for(r = firstr; r != R; r = r->link)
r->active = 0;
for(r = firstr; r != R; r = r->link)
if(r->prog->as == ARET)
prop(r, zbits, zbits);
loop11:
/* pick up unreachable code */
i = 0;
for(r = firstr; r != R; r = r1) {
r1 = r->link;
if(r1 && r1->active && !r->active) {
prop(r, zbits, zbits);
i = 1;
}
}
if(i)
goto loop11;
if(change)
goto loop1;
if(debug['R'] && debug['v'])
dumpit("pass3", firstr);
/*
* pass 4
* iterate propagating register/variable synchrony
* forward until graph is complete
*/
loop2:
change = 0;
for(r = firstr; r != R; r = r->link)
r->active = 0;
synch(firstr, zbits);
if(change)
goto loop2;
if(debug['R'] && debug['v'])
开发者ID:jianfengye,项目名称:Go_source,代码行数:67,代码来源:reg.c
示例10: switch
void ShapeCL::update(int id)
{
switch (id)
{
case PROP_STENCIL:
{
if (prop(id) < 0.0) setProperty(id, 0.0);
else if (prop(id) > 3.0) setProperty(id, 3.0);
break;
}
case PROP_BLINK_FREQ:
{
if (prop(id) < 0.0)
{
setProperty(id, 0.0);
bBlinkOn = 1;
dBlinkClock = 0.0;
}
break;
}
// numbers between 0.0 and 1.0:
case PROP_BLINK_DUTY_CYCLE:
case PROP_BLINK_INITIAL_PHASE:
{
if (prop(id) < 0.0)
setProperty(id, 0.0);
else if (prop(id) > 1.0)
setProperty(id, 1.0);
break;
}
// properties that must be >= 0.0
case PROP_RAMP_REPEAT:
case PROP_RAMP_PERIOD:
{
if (prop(id) < 0.0)
setProperty(id, 0.0);
break;
}
// allow least sig 8 bits to be set, bit n [1..8] on
// means turn stimulus on for block n
case PROP_BLOCK:
{
if (prop(id) < 0)
setProperty(id, 0);
else if (prop(id) > 255)
setProperty(id, 255);
break;
}
// properties that should be integers in range [1..3]:
case PROP_EYE:
{
if (prop(id) < 1)
setProperty(id, 3);
else if (prop(id) > 3)
setProperty(id, 1);
break;
}
// properties than can be 0 or 1 or 2
case PROP_RAMPED:
{
if (prop(id) < 0)
setProperty(id, 2);
else if (prop(id) > 2)
setProperty(id, 0);
break;
}
// properties that are 0 or 1 (e.g. on/off properties)
case PROP_ALWAYS_ON:
case PROP_RAMP_UPORDOWN:
case PROP_COLOR_TRACK_BG:
{
if (prop(id) < 0)
setProperty(id, 1);
else if (prop(id) > 1)
setProperty(id, 0);
break;
}
case PROP_RED:
case PROP_GREEN:
case PROP_BLUE:
{
for (int i=PROP_RED; i<=PROP_BLUE; i++)
{
if (prop(i) < 0)
setProperty(i, 0);
else if (prop(i) > 255)
setProperty(i, 255);
fRGBA[i-PROP_RED] = prop(i) / 255.0;
}
break;
}
}
}
开发者ID:mbolding,项目名称:cdfitools,代码行数:94,代码来源:shape.cpp
示例11: prop
void ShapeCL::updateAt(double seconds)
{
if (prop(PROP_BLINK_FREQ) > 0.0)
{
dBlinkClock += seconds;
double period = 1.0/prop(PROP_BLINK_FREQ);
if (dBlinkClock > period)
{
dBlinkClock -= period;
}
bBlinkOn = 1;
if (dBlinkClock > period*prop(PROP_BLINK_DUTY_CYCLE))
bBlinkOn = 0;
}
if (prop(PROP_RAMP_REPEAT) > 0.0)
{
dRampClock += seconds;
if (dRampClock > prop(PROP_RAMP_REPEAT))
{
dRampClock -= prop(PROP_RAMP_REPEAT);
}
if (prop(PROP_RAMP_UPORDOWN) == 0)
{
if (prop(PROP_RAMP_PERIOD) > 0.0 && dRampClock < prop(PROP_RAMP_PERIOD))
setOpacity(dRampClock / prop(PROP_RAMP_PERIOD));
else
setOpacity(1.0);
}
else
{
if (prop(PROP_RAMP_PERIOD) > 0.0 && dRampClock < prop(PROP_RAMP_PERIOD))
setOpacity(1.0 - dRampClock / prop(PROP_RAMP_PERIOD));
else
setOpacity(0.0);
}
}
}
开发者ID:mbolding,项目名称:cdfitools,代码行数:37,代码来源:shape.cpp
示例12: dumpId
char *OpenDDLParser::parseHeader( char *in, char *end ) {
if( ddl_nullptr == in || in == end ) {
return in;
}
Text *id( ddl_nullptr );
in = OpenDDLParser::parseIdentifier( in, end, &id );
#ifdef DEBUG_HEADER_NAME
dumpId( id );
#endif // DEBUG_HEADER_NAME
in = lookForNextToken( in, end );
if( ddl_nullptr != id ) {
// store the node
DDLNode *node( createDDLNode( id, this ) );
if( ddl_nullptr != node ) {
pushNode( node );
} else {
std::cerr << "nullptr returned by creating DDLNode." << std::endl;
}
delete id;
Name *name(ddl_nullptr);
in = OpenDDLParser::parseName(in, end, &name);
if( ddl_nullptr != name && ddl_nullptr != node ) {
const std::string nodeName( name->m_id->m_buffer );
node->setName( nodeName );
delete name;
}
Property *first(ddl_nullptr);
in = lookForNextToken(in, end);
if (*in == Grammar::OpenPropertyToken[0]) {
in++;
Property *prop(ddl_nullptr), *prev(ddl_nullptr);
while (*in != Grammar::ClosePropertyToken[0] && in != end) {
in = OpenDDLParser::parseProperty(in, end, &prop);
in = lookForNextToken(in, end);
if (*in != Grammar::CommaSeparator[0] && *in != Grammar::ClosePropertyToken[0]) {
logInvalidTokenError(in, Grammar::ClosePropertyToken, m_logCallback);
return ddl_nullptr;
}
if (ddl_nullptr != prop && *in != Grammar::CommaSeparator[0]) {
if (ddl_nullptr == first) {
first = prop;
}
if (ddl_nullptr != prev) {
prev->m_next = prop;
}
prev = prop;
}
}
++in;
}
// set the properties
if (ddl_nullptr != first && ddl_nullptr != node) {
node->setProperties(first);
}
}
return in;
}
开发者ID:Ithamar,项目名称:assimp,代码行数:67,代码来源:OpenDDLParser.cpp
示例13: abstract_commutation
bool abstract_commutation(
const locst &locs,
impara_var_mapt &var_map,
node_reft current,
node_reft ancestor,
node_reft mover)
{
const namespacet &ns=var_map.ns;
std::cout << "<<<<<<<<<<<<<<<<<<<<" << std::endl;
std::cout << "abstract_commutation current " << current->number
<< " ancestor " << ancestor->number
<< " mover " << mover->number << std::endl;
for(; !ancestor.is_nil() && !ancestor->has_label();--ancestor);
propagationt prop(ns);
// turn A into a history
propagationt propagation_mover(
ns,
mover->history,
ancestor);
propagation_mover.set_hidden(true);
std::set<exprt> mover_reads, mover_writes;
cone_of_influence(locs, var_map, propagation_mover, mover, ancestor, mover_reads, mover_writes);
// split B into VCs
propagationt propagation_current(
ns,
current->history,
ancestor);
propagation_current.set_hidden(true);
std::set<exprt> current_reads, current_writes;
cone_of_influence(locs, var_map, propagation_current, current, ancestor, current_reads, current_writes);
bool dependence=shared_stept::intersect(current_reads, mover_writes)
|| shared_stept::intersect(current_writes, mover_reads)
|| shared_stept::intersect(current_writes, mover_writes);
#ifdef DEBUG
std::cout << "sensitivity checker VCs" << std::endl;
/*
for(unsigned i=0; i<vcs.size(); ++i)
{
std::cout << vcs[i].pretty(ns, locs) << std::endl;
}
*/
if(dependence)
{
std::cout << "Dependent"<<std::endl;
}
else
{
std::cout << "Independent"<<std::endl;
}
shared_stept::output(mover_reads, mover_writes,std::cout);
shared_stept::output(current_reads, current_writes,std::cout);
#endif
return !dependence;
}
开发者ID:bjowac,项目名称:impara,代码行数:81,代码来源:sensitivity.cpp
示例14: prop
void VCSlider::editProperties()
{
VCSliderProperties prop(_app, this);
if (prop.exec() == QDialog::Accepted)
_app->doc()->setModified();
}
开发者ID:Andersbakken,项目名称:qlc-svn,代码行数:6,代码来源:vcslider.cpp
示例15: doc
bool xmlImport::importProps() {
TiXmlDocument doc(xmlFile.c_str());
if(!doc.LoadFile()){
Logger::getLogger()->debug("Error: could not load properties XML file");
return false;
}
TiXmlElement* pElem;
TiXmlElement* pChild;
TiXmlHandle hDoc(&doc);
TiXmlHandle hRoot(0);
DesignStore::Ptr ds = Game::getGame()->getDesignStore();
int count=0; // item count
pElem = hDoc.FirstChildElement("properties").Element();
if(!pElem) return false;
hRoot = TiXmlHandle(pElem);
for(pElem=hRoot.FirstChild("prop").Element(); pElem != NULL;
pElem = pElem->NextSiblingElement())
{
TiXmlElement* pCur = 0;
std::string propName, propDisplayName, propDescription, propTpclDisplay,
propTpclRequirement, propIDName;
int propRank;
std::map<uint32_t, std::string> propertylist;
pChild = hRoot.Child("prop",count).Element();
//debug: cout << "count: " << count << endl;
if(pChild) {
//read and set the name of the property
pCur = pChild->FirstChildElement("name");
if (pCur) {
propName = pCur->GetText();
if (propName.empty()) return false;
} else {
return false;
}
//read and set the name of the property
pCur = pChild->FirstChildElement("displayName");
if (pCur) {
propDisplayName = pCur->GetText();
if (propDisplayName.empty()) return false;
} else {
return false;
}
//read and set the ID of the property
pCur = pChild->FirstChildElement("PropertyIDName");
if (pCur) {
propIDName = pCur->GetText();
if (propIDName.empty()) return false;
} else {
return false;
}
//read and set the rank of the property
pCur = pChild->FirstChildElement("rank");
if (pCur) {
if (pCur->QueryIntAttribute("value", &(propRank)) != TIXML_SUCCESS) {
return false;
}
}
//read and set the description of the property
pCur = pChild->FirstChildElement("description");
if (pCur) {
propDescription = pCur->GetText();
if (propDescription.empty()) return false;
} else {
return false;
}
//read and set the tpclDisplayFunction of the property
pCur = pChild->FirstChildElement("tpclDisplayFunction");
if (pCur) {
propTpclDisplay = pCur->GetText();
if (propTpclDisplay.empty()) return false;
} else {
return false;
}
//read and set the tpclRequirementsFunction of the property
pCur = pChild->FirstChildElement("tpclRequirementsFunction");
if (pCur) {
propTpclRequirement = pCur->GetText();
if (propTpclRequirement.empty()) return false;
} else {
return false;
}
//do the property
Property::Ptr prop( new Property() );
prop->addCategoryId(ds->getCategoryByName(propIDName));
prop->setRank((uint32_t)propRank);
prop->setName(propName);
prop->setDisplayName(propDisplayName);
prop->setDescription(propDescription);
prop->setTpclDisplayFunction(propTpclDisplay);
prop->setTpclRequirementsFunction(propTpclRequirement);
ds->addProperty(prop);
//.........这里部分代码省略.........
开发者ID:epyon,项目名称:tpserver-cpp,代码行数:101,代码来源:xmlimport.cpp
示例16: main
int main(int argc, char** argv){
//ShowWindow(GetForegroundWindow(), SW_HIDE);
Display display(WIDTH, HEIGHT, "OpenGL");
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0){ std::cout << "ERROR: MixOpenAudio: " << Mix_GetError() << std::endl; }
World world; Shader* shader = world.GetShader();
Brush br(24, 6, 24, &world, "./res/tex/pxl_cuboid.jpg"); br.Move(-2, 0, -2);
Brush c1(1, 0.5, 3, &world, "./res/tex/pxl_cuboid.jpg"); c1.Move(2, 0, 2);
Brush c2(1, 1.0, 3, &world, "./res/tex/pxl_cuboid.jpg"); c2.Move(3, 0, 2);
Brush c3(1, 0.2, 1.5, &world, "./res/tex/pxl_cuboid.jpg"); c3.Move(6, 0.9, 2);
Brush c4(1, 0.2, 1.5, &world, "./res/tex/pxl_cuboid.jpg"); c4.Move(6, 1.1, 3.5);
Brush box(1, 1, 1, &world, "./res/tex/pxl_cuboid.jpg"); box.Move(6, 0.5, 6);
Player player(shader); display.SetPlayer(player);
Camera cammy; cammy.Init(glm::vec3(0, 0, 0), 70.0f, 1600 / 900, 0.01f, 1000.0f);
Ambient amb1; shader->AddAmbient(&amb1); amb1.m_range = 3; amb1.m_intensity = 0.2;
Ambient amb2; shader->AddAmbient(&amb2); amb2.SetPosition(1, 1, 1);
Ambient amb3; shader->AddAmbient(&amb3); amb3.SetPosition(15, 1, 10); amb3.SetColor(0.2, 0.5, 0.7);
Prop prop(world.GetMesh("./res/models/cucco.obj"), world.GetTexture("./res/models/cucco.jpg"), shader); world.AddProp(&prop);
Prop stone(world.GetMesh("./res/models/salesman.obj"), world.GetTexture("./res/models/salesman.jpg"), shader); world.AddProp(&stone); stone.Scale(0.01); stone.Teleport(0, -10, 0);
Sound laugh; laugh.Init("./res/sounds/sale_laugh.wav", 0.7); laugh.Load();
player.SetListener(Player_OnClick, OnClick);
float count = 0.0f;
while (!display.IsClosed()){
display.Clear(0.1f, 0.3f, 0.8f, 1.0f);
world.Draw(&player.GetCamera());
player.DrawHUD();
display.Update();
laugh.Update(player.GetCamera().GetPos());
if (count >= 2 * PI){ count = 0; }
count += 0.05f;
c4.Rotate(0, 1, 0);
if (glm::distance(prop.position, player.GetCamera().GetPos()) >= 2){
prop.velocity = (player.GetCamera().GetPos() - prop.position) / 64.0f;
prop.velocity.y = 0;
prop.SetRotate(0, PI / 2 - GetAngleRad(glm::vec2(0, 0), GetXZ(prop.velocity)), 0);
}
else{
prop.velocity *= 0;
}
prop.Rotate(0, sin(count) * PI / 360, 0);
amb1.m_position = player.GetCamera().GetPos();
if (player.mouse_buttons[0]){//Left Clicking
player.mouse_buttons[0] = false;
stone.Teleport(world.GetAimPoint(&player));
stone.SetRotate(0, PI / 2 - GetAngleRad(glm::vec2(0, 0), GetXZ(player.GetCamera().GetPos() - stone.position)), 0);
laugh.pos = stone.position;
laugh.Emit(player.GetCamera().GetPos());
}
world.Update();
player.Update();
world.IsCollide(&player);
player.CommenceVelocity();
}
Mix_CloseAudio();
Mix_Quit();
return 0;
}
开发者ID:Cootkri,项目名称:CootkriEngine,代码行数:68,代码来源:main.cpp
示例17: prop
BOOL CMAPIContact::GetNamedProperty(LPCTSTR szFieldName,CString& strField)
{
CMAPINamedProperty prop(m_pUser);
return prop.GetNamedProperty(szFieldName,strField);
}
开发者ID:bicomsystems,项目名称:outcall2,代码行数:5,代码来源:MAPIContact.cpp
示例18: main
int main(int argc, const char *argv[])
{
InitModuleObjects();
EnableSEHtoExceptionMapping();
NoQuickEditSection xxx;
Owned<IFile> file = createIFile("dfuserver.xml");
if (file->exists())
globals.setown(createPTreeFromXMLFile("dfuserver.xml", ipt_caseInsensitive));
else
globals.setown(readOldIni());
for (unsigned i=1;i<(unsigned)argc;i++) {
const char *arg = argv[i];
StringBuffer prop("@");
StringBuffer val;
while (*arg && *arg != '=')
prop.append(*arg++);
if (*arg) {
arg++;
while (isspace(*arg))
arg++;
val.append(arg);
prop.clip();
val.clip();
if (prop.length()>1)
globals->setProp(prop.str(), val.str());
}
}
StringBuffer daliServer;
StringBuffer queue;
if (!globals->getProp("@DALISERVERS", daliServer)||!globals->getProp("@QUEUE", queue)) {
usage();
globals.clear();
releaseAtoms();
return 1;
}
Owned<IFile> sentinelFile;
bool stop = globals->getPropInt("@STOP",0)!=0;
if (!stop) {
sentinelFile.setown(createSentinelTarget());
removeSentinelFile(sentinelFile);
StringBuffer logname;
StringBuffer logdir;
if (!getConfigurationDirectory(globals->queryPropTree("Directories"),"log","dfuserver",globals->queryProp("@name"),logdir))
globals->getProp("@LOG_DIR", logdir);
if (logdir.length() && recursiveCreateDirectory(logdir.str()))
logname.append(logdir);
else
appendCurrentDirectory(logname, true);
if (logname.length() && logname.charAt(logname.length()-1) != PATHSEPCHAR)
logname.append(PATHSEPCHAR);
logname.append("dfuserver");
StringBuffer aliasLogName(logname);
aliasLogName.append(".log");
fileMsgHandler = getRollingFileLogMsgHandler(logname.str(), ".log", MSGFIELD_STANDARD, false, true, NULL, aliasLogName.str());
queryLogMsgManager()->addMonitorOwn(fileMsgHandler, getCategoryLogMsgFilter(MSGAUD_all, MSGCLS_all, 1000));
}
StringBuffer ftslogdir;
if (getConfigurationDirectory(globals->queryPropTree("Directories"),"log","ftslave",globals->queryProp("@name"),ftslogdir)) // NB instance deliberately dfuserver's
setFtSlaveLogDir(ftslogdir.str());
setRemoteSpawnSSH(
globals->queryProp("SSH/@SSHidentityfile"),
globals->queryProp("SSH/@SSHusername"),
globals->queryProp("SSH/@SSHpassword"),
globals->getPropInt("SSH/@SSHtimeout",0),
globals->getPropInt("SSH/@SSHretries",3),
"run_");
bool enableSNMP = globals->getPropInt("@enableSNMP")!=0;
CSDSServerStatus *serverstatus=NULL;
Owned<IReplicateServer> replserver;
try {
Owned<IGroup> serverGroup = createIGroup(daliServer.str(),DALI_SERVER_PORT);
initClientProcess(serverGroup, DCR_DfuServer, 0, NULL, NULL, stop?(1000*30):MP_WAIT_FOREVER);
setPasswordsFromSDS();
if(!stop)
{
if (globals->getPropBool("@enableSysLog",true))
UseSysLogForOperatorMessages();
serverstatus = new CSDSServerStatus("DFUserver");
setDaliServixSocketCaching(true); // speeds up lixux operations
startLogMsgParentReceiver(); // for auditing
connectLogMsgManagerToDali();
engine.setown(createDFUengine());
addAbortHandler(exitDFUserver);
}
const char *q = queue.str();
loop {
StringBuffer subq;
const char *comma = strchr(q,',');
if (comma)
subq.append(comma-q,q);
else
//.........这里部分代码省略.........
开发者ID:EwokVillage,项目名称:HPCC-Platform,代码行数:101,代码来源:dfuserver.cpp
示例19: replaceCommaByDot
int GModel::readPLY(const std::string &name)
{
// this is crazy!?
replaceCommaByDot(name);
FILE *fp = Fopen(name.c_str(), "r");
if(!fp){
Msg::Error("Unable to open file '%s'", name.c_str());
return 0;
}
std::vector<MVertex*> vertexVector;
std::map<int, std::vector<MElement*> > elements[5];
std::map<int, std::vector<double> > properties;
char buffer[256], str[256], str2[256], str3[256];
std::string s1;
int elementary = getMaxElementaryNumber(-1) + 1;
int nbv = 0, nbf = 0;
int nbprop = 0;
int nbView = 0;
std::vector<std::string> propName;
while(!feof(fp)) {
if(!fgets(buffer, sizeof(buffer), fp)) break;
if(buffer[0] != '#'){ // skip comments
sscanf(buffer, "%s %s", str, str2);
if(!strcmp(str, "element") && !strcmp(str2, "vertex")){
sscanf(buffer, "%s %s %d", str, str2, &nbv);
}
if(!strcmp(str, "format") && strcmp(str2, "ascii")){
Msg::Error("Only reading of ascii PLY files implemented");
fclose(fp);
return 0;
}
if(!strcmp(str, "property") && strcmp(str2, "list")){
nbprop++;
sscanf(buffer, "%s %s %s", str, str2, str3);
if (nbprop > 3) propName.push_back(s1+str3);
}
if(!strcmp(str, "element") && !strcmp(str2, "face")){
sscanf(buffer, "%s %s %d", str, str2, &nbf);
}
if(!strcmp(str, "end_header")){
nbView = nbprop -3;
Msg::Info("%d elements", nbv);
Msg::Info("%d triangles", nbf);
Msg::Info("%d properties", nbView);
vertexVector.resize(nbv);
for(int i = 0; i < nbv; i++) {
double x,y,z;
char line[10000], *pEnd, *pEnd2, *pEnd3;
if(!fgets(line, sizeof(line), fp)){ fclose(fp); return 0; }
x = strtod(line, &pEnd);
y = strtod(pEnd, &pEnd2);
z = strtod(pEnd2, &pEnd3);
vertexVector[i] = new MVertex(x, y, z);
pEnd = pEnd3;
std::vector<double> prop(nbView);
for (int k = 0; k < nbView; k++){
prop[k]=strtod(pEnd, &pEnd2);
pEnd = pEnd2;
properties[k].push_back(prop[k]);
}
}
for(int i = 0; i < nbf; i++) {
if(!fgets(buffer, sizeof(buffer), fp)) break;
int n[3], nbe;
sscanf(buffer, "%d %d %d %d", &nbe, &n[0], &n[1], &n[2]);
std::vector<MVertex*> vertices;
if(!getVertices(3, n, vertexVector, vertices)){ fclose(fp); return 0; }
elements[0][elementary].push_back(new MTriangle(vertices));
}
}
}
}
for(int i = 0; i < (int)(sizeof(elements) / sizeof(elements[0])); i++)
_storeElementsInEntities(elements[i]);
_associateEntityWithMeshVertices();
_storeVerticesInEntities(vertexVector);
#if defined(HAVE_POST)
// create PViews here
std::vector<GEntity*> _entities;
getEntities(_entities);
for (int iV=0; iV< nbView; iV++){
PView *view = new PView();
PViewDataList *data = dynamic_cast<PViewDataList*>(view->getData());
for(unsigned int ii = 0; ii < _entities.size(); ii++){
for(unsigned int i = 0; i < _entities[ii]->getNumMeshElements(); i++){
|
请发表评论