bool writeFieldsOftenFunctionObject::start()
{
    writeFieldsGeneralFunctionObject::start();

    word wcName=dict_.lookup("writeControl");

    writeControl_ = writeControlNames.read
        (
            dict_.lookup("writeControl")
        );

    writeInterval_ = readScalar(dict_.lookup("writeIntervall"));
    if(writeControl_ == Time::wcTimeStep && label(writeInterval_) <1) {
        WarningIn("bool writeFieldsOftenFunctionObject::start()")
            << "writeInterval " << writeInterval_
                << " < 1 for writeControl timeStep. Reseting to 1 "<< endl;
        writeInterval_=1;
    }

    Info << "Additional fields " << fieldNames() << " will be written "
        << "with writeControl " << wcName << " and intervall " << writeInterval_ << endl;

    if(writeControl_ == Time::wcAdjustableRunTime) {
        WarningIn("bool writeFieldsOftenFunctionObject::start()")
            << "Cant adjust the run-time. Defaulting to runTime" << endl;

    }

    outputTimeIndex_=0;

    return true;
}
bool writeAdditionalFieldsFunctionObject::start()
{
    writeFieldsGeneralFunctionObject::start();

    Info << "Additional fields " << fieldNames() << " will be written" << endl;

    return true;
}
Example #3
0
 void BtreeKeyGenerator::getKeys(const BSONObj &obj, BSONObjSet *keys) const {
     // These are mutated as part of the getKeys call.  :|
     vector<const char*> fieldNames(_fieldNames);
     vector<BSONElement> fixed(_fixed);
     getKeysImpl(fieldNames, fixed, obj, keys);
     if (keys->empty() && ! _isSparse) {
         keys->insert(_nullKey);
     }
 }
Example #4
0
 void IndexSpec::getKeys( const BSONObj &obj, BSONObjSetDefaultOrder &keys ) const {
     if ( _indexType.get() ){
         _indexType->getKeys( obj , keys );
         return;
     }
     vector<const char*> fieldNames( _fieldNames );
     vector<BSONElement> fixed( _fixed );
     _getKeys( fieldNames , fixed , obj, keys );
     if ( keys.empty() )
         keys.insert( _nullKey );
 }
Example #5
0
 void getKeys( const BSONObj &obj, BSONObjSet &keys ) const {
     if ( _spec._indexType.get() ) { //plugin (eg geo)
         _spec._indexType->getKeys( obj , keys );
         return;
     }
     vector<const char*> fieldNames( _spec._fieldNames );
     vector<BSONElement> fixed( _spec._fixed );
     _getKeys( fieldNames , fixed , obj, keys );
     if ( keys.empty() && ! _spec._sparse )
         keys.insert( _spec._nullKey );
 }     
PVStructurePtr PVDataCreate::createPVStructure(PVStructurePtr const & structToClone)
{
    FieldConstPtrArray field;
    if(!structToClone) {
        // is this correct?!
        FieldConstPtrArray fields(0);
        StringArray fieldNames(0);
        StructureConstPtr structure = fieldCreate->createStructure(fieldNames,fields);
        return PVStructurePtr(new PVStructure(structure));
    }
    StructureConstPtr structure = structToClone->getStructure();
    PVStructurePtr pvStructure(new PVStructure(structure));
    pvStructure->copyUnchecked(*structToClone);
    return pvStructure;
}
Example #7
0
/**
 * Return a named list representation of the fields set in a message.
 *
 * @param xp external pointer to a Message
 * @return the message as an R list
 */
RPB_FUNCTION_1(Rcpp::List, METHOD(as_list), Rcpp::XPtr<GPB::Message> message) {

    const GPB::Descriptor* desc = message->GetDescriptor();
    int nf = desc->field_count();

    Rcpp::CharacterVector fieldNames(nf);
    Rcpp::List val(nf);
    /* TODO: not use getMessageField */
    for (int i = 0; i < nf; i++) {
        const GPB::FieldDescriptor* fd = desc->field(i);
        val[i] = getMessageField(message, Rcpp::CharacterVector::create(fd->name()));
        fieldNames[i] = fd->name();
    }
    val.names() = fieldNames;
    return val;
}
Example #8
0
      // PD_TRACE_DECLARE_FUNCTION ( SDB__IXMKEYGEN_GETKEYS, "_ixmKeyGenerator::getKeys" )
      INT32 getKeys ( const BSONObj &obj, BSONObjSet &keys,
                      BSONElement *pArrEle ) const
      {
         INT32 rc = SDB_OK ;
         PD_TRACE_ENTRY ( SDB__IXMKEYGEN_GETKEYS );
         SDB_ASSERT( _keygen, "spec can't be NULL" ) ;
         SDB_ASSERT( !_keygen->_fieldNames.empty(), "can not be empty" ) ;
         vector<const CHAR*> fieldNames ( _keygen->_fieldNames ) ;
         BSONElement arrEle ;
         try
         {
            rc = _getKeys( fieldNames, obj, keys, &arrEle ) ;
         }
         catch ( std::exception &e )
         {
            PD_LOG( PDERROR, "unexpected err:%s", e.what() ) ;
            rc = SDB_INVALIDARG ;
            goto error ;
         }

         if ( SDB_OK != rc )
         {
            PD_LOG ( PDERROR, "Failed to generate key from object: %s",
                     obj.toString().c_str() ) ;
            goto error ;
         }

         if ( keys.empty() )
         {
            keys.insert ( _keygen->_undefinedKey ) ;
         }

         if ( NULL != pArrEle && !arrEle.eoo() )
         {
            *pArrEle = arrEle ;
         }
      done :
         PD_TRACE_EXITRC ( SDB__IXMKEYGEN_GETKEYS, rc );
         return rc ;
      error :
         goto done ;
      }
Example #9
0
QStringList QDjangoCompiler::fieldNames(bool recurse, QDjangoMetaModel *metaModel, const QString &modelPath)
{
    QStringList columns;
    if (!metaModel)
        metaModel = &baseModel;

    // store reference
    const QString tableName = referenceModel(modelPath, metaModel);
    foreach (const QDjangoMetaField &field, metaModel->localFields())
        columns << tableName + QLatin1Char('.') + driver->escapeIdentifier(field.column(), QSqlDriver::FieldName);
    if (!recurse)
        return columns;

    // recurse for foreign keys
    const QString pathPrefix = modelPath.isEmpty() ? QString() : (modelPath + QLatin1String("__"));
    foreach (const QByteArray &fkName, metaModel->foreignFields().keys()) {
        QDjangoMetaModel metaForeign = QDjango::metaModel(metaModel->foreignFields()[fkName]);
        columns += fieldNames(recurse, &metaForeign, pathPrefix + QString::fromLatin1(fkName));
    }
    return columns;
}
Example #10
0
QStringList KoReportData::fieldKeys() const
{
    return fieldNames();
}