void ConnectorTypeWidget::cancel() {
	setType(m_typeBackUp);
}
Esempio n. 2
0
gqbTable::gqbTable(gqbObject *parent, wxString name, pgConn *connection, type_gqbObject type, OID oid)
	: gqbObjectCollection(name, parent, connection, oid)
{
	setType(type);
}
JNIEXPORT jobject JNICALL
Java_org_ocera_orte_Publication_jORTEPublicationPropertiesGet
  (JNIEnv *env, jobject obj, jlong j_appDomain_handle)
{
  // jni types
  jclass         cls_pp   = NULL; // PublProp class
  jclass         cls_ntpT = NULL; // NtpTime class
  jobject        obj_pp   = NULL; // instance of PublProp
  jobject        obj_ntpT = NULL; // instance of NtpTime
  jfieldID       fid      = NULL;
  jmethodID      mid;
  jboolean       jbool = 0;
  //
  int            b = 0;
  int            flag_ok = 0;
  ORTEPublProp   pp;
  ORTEPublProp  *publ_prop = &pp;

  // calling original orte function
  #ifdef TEST_STAGE
  printf(":c: ORTEPublicationPropertiesGet() called.. \n");
  #endif

  // create new PublProps instance and set its fields
  do {
    // call ORTE function
    b = ORTEPublicationPropertiesGet((ORTEPublication *)j_appDomain_handle,
				     publ_prop);
    if (b == ORTE_BAD_HANDLE) {
      printf(":!c: PublicationPropertiesGet() failed! [bad pub handle] \n");
      break;
    }
    // find class
    cls_pp = findClass(env, "org.ocera.orte.types.PublProp");
    if (cls_pp == 0) {
      #ifdef TEST_STAGE
      printf(":!c: cls_pp = NULL \n");
      #endif
      break;
    }
    // call object constructor
    mid = (*env)->GetMethodID(env, cls_pp, "<init>", "()V");
    if (mid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: mid = NULL \n");
      #endif
      break;
    }
    // new object
    obj_pp = (*env)->NewObject(env, cls_pp, mid);
    if (obj_pp == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_pp = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.PublProp' created..\n");
    #endif
    // ///////////////////////////////////////////////
    // setting object's fields
    /////////////////////////////////////////////////
    // set topic
    if (!setTopic(env, cls_pp, obj_pp, (const char *)publ_prop->topic)) {
      #ifdef TEST_STAGE
      printf(":!c: setTopic() failed! \n");
      #endif
      break;
    }
    /////////////////////////////////////////////////
    // set type
    if (!setType(env, cls_pp, obj_pp, (const char *)publ_prop->typeName)) {
      #ifdef TEST_STAGE
      printf(":!c: setType() failed! \n");
      #endif
      break;
    }
    /////////////////////////////////////////////////
    // fieldID - typeChecksum
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "typeChecksum",
			     "I");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetIntField(env,
			obj_pp,
			fid,
			(jint)publ_prop->typeChecksum);
    /////////////////////////////////////////////////
    // fieldID - expectsAck
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "expectsAck",
			     "Z");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    if (publ_prop->expectsAck == ORTE_FALSE)
      jbool = 0;
    else
      jbool = 1;
    (*env)->SetBooleanField(env,
			    obj_pp,
			    fid,
			    jbool);
    /////////////////////////////////////////////////
    // fieldID - persistence
    cls_ntpT = findClass(env, "org.ocera.orte.types.NtpTime");
    if (cls_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: cls_ntpT = NULL \n");
      #endif
      break;
    }
    // call object constructor
    mid = (*env)->GetMethodID(env, cls_ntpT, "<init>", "(IJ)V");
    if (mid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: mid = NULL \n");
      #endif
      break;
    }
    // new object
    obj_ntpT = (*env)->NewObject(env,
				 cls_ntpT,
				 mid,
				 (jint)publ_prop->persistence.seconds,
				 (jlong)publ_prop->persistence.fraction);
    if (obj_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_ntpT = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
    #endif
    // set 'PublProp' NtpTime's field
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "persistence",
			     "Lorg/ocera/orte/types/NtpTime;");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetObjectField(env,
			   obj_pp,
			   fid,
			   obj_ntpT);
    /////////////////////////////////////////////////
    // fieldID - HBNornalRate
    // cls_ntpT and obj_ntpT already readed!!
    // new object
    obj_ntpT = (*env)->NewObject(env,
				 cls_ntpT,
				 mid,
				 (jint)publ_prop->HBNornalRate.seconds,
				 (jlong)publ_prop->HBNornalRate.fraction);
    if (obj_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_ntpT = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
    #endif
    // set 'PublProp' NtpTime's field
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "HBNornalRate",
			     "Lorg/ocera/orte/types/NtpTime;");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetObjectField(env,
			   obj_pp,
			   fid,
			   obj_ntpT);
    /////////////////////////////////////////////////
    // fieldID - HBCQLRate
    // cls_ntpT and obj_ntpT already readed!!
    // new object
    obj_ntpT = (*env)->NewObject(env,
				 cls_ntpT,
				 mid,
				 (jint)publ_prop->HBCQLRate.seconds,
				 (jlong)publ_prop->HBCQLRate.fraction);
    if (obj_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_ntpT = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
    #endif
    // set 'PublProp' NtpTime's field
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "HBCQLRate",
			     "Lorg/ocera/orte/types/NtpTime;");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetObjectField(env,
			   obj_pp,
			   fid,
			   obj_ntpT);
    /////////////////////////////////////////////////
    // fieldID - HBCQLRate
    // cls_ntpT and obj_ntpT already readed!!
    // new object
    obj_ntpT = (*env)->NewObject(env,
				 cls_ntpT,
				 mid,
				 (jint)publ_prop->maxBlockTime.seconds,
				 (jlong)publ_prop->maxBlockTime.fraction);
    if (obj_ntpT == 0) {
      #ifdef TEST_STAGE
      printf(":!c: obj_ntpT = NULL \n");
      #endif
      break;
    }
    #ifdef TEST_STAGE
    printf(":c: instance of 'org.ocera.orte.types.NtpTime' created..\n");
    #endif
    // set 'PublProp' NtpTime's field
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "maxBlockTime",
			     "Lorg/ocera/orte/types/NtpTime;");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetObjectField(env,
			   obj_pp,
			   fid,
			   obj_ntpT);
    /////////////////////////////////////////////////
    // fieldID - reliabilityOffered
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "reliabilityOffered",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_pp,
			 fid,
			 (jlong)publ_prop->reliabilityOffered);
    /////////////////////////////////////////////////
    // fieldID - sendQueueSize
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "sendQueueSize",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_pp,
			 fid,
			 (jlong)publ_prop->sendQueueSize);
    /////////////////////////////////////////////////
    // fieldID - strength
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "strength",
			     "I");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetIntField(env,
			obj_pp,
			fid,
			(jint)publ_prop->strength);
    /////////////////////////////////////////////////
    // fieldID - criticalQueueLevel
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "criticalQueueLevel",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_pp,
			 fid,
			 (jlong)publ_prop->criticalQueueLevel);
    /////////////////////////////////////////////////
    // fieldID - HBMaxRetries
    fid = (*env)->GetFieldID(env,
			     cls_pp,
			     "HBMaxRetries",
			     "J");
    if (fid == 0) {
      #ifdef TEST_STAGE
      printf(":!c: fid = NULL \n");
      #endif
      break;
    }
    (*env)->SetLongField(env,
			 obj_pp,
			 fid,
			 (jlong)publ_prop->HBMaxRetries);
    // set flag
    flag_ok = 1;
  } while (0);

  if (flag_ok == 0) {
    return NULL;
  }

  return obj_pp;

}
Esempio n. 4
0
File: eval2.c Progetto: NV/nile
static oop _newOops(int type, size_t size)	{ oop obj= GC_malloc(size);		setType(obj, type);  return obj; }
Esempio n. 5
0
//
// Establishes the type of the resultant operation, as well as
// makes the operator the correct one for the operands.
//
// Returns false if operator can't work on operands.
//
bool TIntermBinary::promote(TInfoSink& infoSink)
{
    // This function only handles scalars, vectors, and matrices.
    if (left->isArray() || right->isArray()) {
        infoSink.info.message(EPrefixInternalError, getLine(), "Invalid operation for arrays");
        return false;
    }

    // GLSL ES 2.0 does not support implicit type casting.
    // So the basic type should always match.
    if (left->getBasicType() != right->getBasicType())
        return false;

    //
    // Base assumption:  just make the type the same as the left
    // operand.  Then only deviations from this need be coded.
    //
    setType(left->getType());

    // The result gets promoted to the highest precision.
    TPrecision higherPrecision = GetHigherPrecision(left->getPrecision(), right->getPrecision());
    getTypePointer()->setPrecision(higherPrecision);

    // Binary operations results in temporary variables unless both
    // operands are const.
    if (left->getQualifier() != EvqConst || right->getQualifier() != EvqConst) {
        getTypePointer()->setQualifier(EvqTemporary);
    }

    int size = std::max(left->getNominalSize(), right->getNominalSize());

    //
    // All scalars. Code after this test assumes this case is removed!
    //
    if (size == 1) {
        switch (op) {
            //
            // Promote to conditional
            //
            case EOpEqual:
            case EOpNotEqual:
            case EOpLessThan:
            case EOpGreaterThan:
            case EOpLessThanEqual:
            case EOpGreaterThanEqual:
                setType(TType(EbtBool, EbpUndefined));
                break;

            //
            // And and Or operate on conditionals
            //
            case EOpLogicalAnd:
            case EOpLogicalOr:
                // Both operands must be of type bool.
                if (left->getBasicType() != EbtBool || right->getBasicType() != EbtBool)
                    return false;
                setType(TType(EbtBool, EbpUndefined));
                break;

            default:
                break;
        }
        return true;
    }

    // If we reach here, at least one of the operands is vector or matrix.
    // The other operand could be a scalar, vector, or matrix.
    // Are the sizes compatible?
    //
    if (left->getNominalSize() != right->getNominalSize()) {
        // If the nominal size of operands do not match:
        // One of them must be scalar.
        if (left->getNominalSize() != 1 && right->getNominalSize() != 1)
            return false;
        // Operator cannot be of type pure assignment.
        if (op == EOpAssign || op == EOpInitialize)
            return false;
    }

    //
    // Can these two operands be combined?
    //
    TBasicType basicType = left->getBasicType();
    switch (op) {
        case EOpMul:
            if (!left->isMatrix() && right->isMatrix()) {
                if (left->isVector())
                    op = EOpVectorTimesMatrix;
                else {
                    op = EOpMatrixTimesScalar;
                    setType(TType(basicType, higherPrecision, EvqTemporary, size, true));
                }
            } else if (left->isMatrix() && !right->isMatrix()) {
                if (right->isVector()) {
                    op = EOpMatrixTimesVector;
                    setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
                } else {
                    op = EOpMatrixTimesScalar;
                }
            } else if (left->isMatrix() && right->isMatrix()) {
                op = EOpMatrixTimesMatrix;
            } else if (!left->isMatrix() && !right->isMatrix()) {
                if (left->isVector() && right->isVector()) {
                    // leave as component product
                } else if (left->isVector() || right->isVector()) {
                    op = EOpVectorTimesScalar;
                    setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
                }
            } else {
                infoSink.info.message(EPrefixInternalError, getLine(), "Missing elses");
                return false;
            }
            break;
        case EOpMulAssign:
            if (!left->isMatrix() && right->isMatrix()) {
                if (left->isVector())
                    op = EOpVectorTimesMatrixAssign;
                else {
                    return false;
                }
            } else if (left->isMatrix() && !right->isMatrix()) {
                if (right->isVector()) {
                    return false;
                } else {
                    op = EOpMatrixTimesScalarAssign;
                }
            } else if (left->isMatrix() && right->isMatrix()) {
                op = EOpMatrixTimesMatrixAssign;
            } else if (!left->isMatrix() && !right->isMatrix()) {
                if (left->isVector() && right->isVector()) {
                    // leave as component product
                } else if (left->isVector() || right->isVector()) {
                    if (! left->isVector())
                        return false;
                    op = EOpVectorTimesScalarAssign;
                    setType(TType(basicType, higherPrecision, EvqTemporary, size, false));
                }
            } else {
                infoSink.info.message(EPrefixInternalError, getLine(), "Missing elses");
                return false;
            }
            break;

        case EOpAssign:
        case EOpInitialize:
        case EOpAdd:
        case EOpSub:
        case EOpDiv:
        case EOpAddAssign:
        case EOpSubAssign:
        case EOpDivAssign:
            if ((left->isMatrix() && right->isVector()) ||
                (left->isVector() && right->isMatrix()))
                return false;
            setType(TType(basicType, higherPrecision, EvqTemporary, size, left->isMatrix() || right->isMatrix()));
            break;

        case EOpEqual:
        case EOpNotEqual:
        case EOpLessThan:
        case EOpGreaterThan:
        case EOpLessThanEqual:
        case EOpGreaterThanEqual:
            if ((left->isMatrix() && right->isVector()) ||
                (left->isVector() && right->isMatrix()))
                return false;
            setType(TType(EbtBool, EbpUndefined));
            break;

        default:
            return false;
    }
    
    return true;
}
ChessBoardPiece::ChessBoardPiece(CBW::WidgetType type, CBW::WidgetColor color, int file, int rank)
{
    setPostition(file, rank);
    setType(type);
    setColor(color);
}
Esempio n. 7
0
// Internal set type method
SubsystemType
SubsystemInfo::setType( SubsystemType _type, const char *_type_name )
{
	return setType( m_InfoTable->lookup(_type), _type_name );
}
Esempio n. 8
0
MidiChannelMessage::MidiChannelMessage(MidiMessageType type){
	setType(type);
};
Esempio n. 9
0
void Font::init()
{
    setType(GameObjectMetaType::Font);
    mFontAsset = 0;
}
Esempio n. 10
0
Weapon::Weapon(std::string str)
{
	setType(str);
	std::cout << "Weapon created" << std::endl;
	return ;
}
Esempio n. 11
0
MappedEvent::MappedEvent(InstrumentId id,
                         const Event &e,
                         const RealTime &eventTime,
                         const RealTime &duration):
        m_trackId((int)NO_TRACK),
        m_instrument(id),
        m_type(MidiNote),
        m_data1(0),
        m_data2(0),
        m_eventTime(eventTime),
        m_duration(duration),
        m_audioStartMarker(0, 0),
        m_dataBlockId(0),
        m_runtimeSegmentId( -1),
        m_autoFade(false),
        m_fadeInTime(RealTime::zeroTime),
        m_fadeOutTime(RealTime::zeroTime),
        m_recordedChannel(0),
        m_recordedDevice(0)

{
    try {

        // For each event type, we set the properties in a particular
        // order: first the type, then whichever of data1 and data2 fits
        // less well with its default value.  This way if one throws an
        // exception for no data, we still have a good event with the
        // defaults set.

        if (e.isa(Note::EventType)) {
            m_type = MidiNoteOneShot;
            long v = MidiMaxValue;
            e.get<Int>(BaseProperties::VELOCITY, v);
            m_data2 = v;
            m_data1 = e.get<Int>(BaseProperties::PITCH);
        } else if (e.isa(PitchBend::EventType)) {
            m_type = MidiPitchBend;
            PitchBend pb(e);
            m_data1 = pb.getMSB();
            m_data2 = pb.getLSB();
        } else if (e.isa(Controller::EventType)) {
            m_type = MidiController;
            Controller c(e);
            m_data1 = c.getNumber();
            m_data2 = c.getValue();
        } else if (e.isa(ProgramChange::EventType)) {
            m_type = MidiProgramChange;
            ProgramChange pc(e);
            m_data1 = pc.getProgram();
        } else if (e.isa(KeyPressure::EventType)) {
            m_type = MidiKeyPressure;
            KeyPressure kp(e);
            m_data1 = kp.getPitch();
            m_data2 = kp.getPressure();
        } else if (e.isa(ChannelPressure::EventType)) {
            m_type = MidiChannelPressure;
            ChannelPressure cp(e);
            m_data1 = cp.getPressure();
        } else if (e.isa(SystemExclusive::EventType)) {
            m_type = MidiSystemMessage;
            m_data1 = MIDI_SYSTEM_EXCLUSIVE;
            SystemExclusive s(e);
            std::string dataBlock = s.getRawData();
            DataBlockRepository::getInstance()->registerDataBlockForEvent(dataBlock, this);
        } else if (e.isa(Text::EventType)) {
            const Rosegarden::Text text(e);

            // Somewhat hacky: We know that annotations and LilyPond directives
            // aren't to be output, so we make their MappedEvents invalid.
            // InternalSegmentMapper will then discard those.
            if (text.getTextType() == Text::Annotation || text.getTextType() == Text::LilyPondDirective) {
                setType(InvalidMappedEvent);
            } else {
                setType(MappedEvent::Text);

                MidiByte midiTextType =
                    (text.getTextType() == Text::Lyric) ?
                    MIDI_LYRIC :
                    MIDI_TEXT_EVENT;
                setData1(midiTextType);
                                
                std::string metaMessage = text.getText();
                addDataString(metaMessage);
            }            
            
        } else {
            m_type = InvalidMappedEvent;
        }
    } catch (MIDIValueOutOfRange r) {

#ifdef DEBUG_MAPPEDEVENT
        std::cerr << "MIDI value out of range in MappedEvent ctor"
        << std::endl;
#else

        ;
#endif

    } catch (Event::NoData d) {

#ifdef DEBUG_MAPPEDEVENT
        std::cerr << "Caught Event::NoData in MappedEvent ctor, message is:"
        << std::endl << d.getMessage() << std::endl;
#else

        ;
#endif

    } catch (Event::BadType b) {

#ifdef DEBUG_MAPPEDEVENT
        std::cerr << "Caught Event::BadType in MappedEvent ctor, message is:"
        << std::endl << b.getMessage() << std::endl;
#else

        ;
#endif

    } catch (SystemExclusive::BadEncoding e) {

#ifdef DEBUG_MAPPEDEVENT
        std::cerr << "Caught bad SysEx encoding in MappedEvent ctor"
        << std::endl;
#else

        ;
#endif

    }
}
Esempio n. 12
0
Customer::Customer()
{
    setType(Location::CUSTOMER);
}
Esempio n. 13
0
QgsRasterFormatSaveOptionsWidget::QgsRasterFormatSaveOptionsWidget( QWidget* parent, const QString& format,
    QgsRasterFormatSaveOptionsWidget::Type type, const QString& provider )
    : QWidget( parent )
    , mFormat( format )
    , mProvider( provider )
    , mRasterLayer( nullptr )
    , mRasterFileName( QString() )
    , mPyramids( false )
    , mPyramidsFormat( QgsRaster::PyramidsGTiff )

{
  setupUi( this );

  setType( type );

  if ( mBuiltinProfiles.isEmpty() )
  {
    // key=profileKey values=format,profileName,options
    mBuiltinProfiles[ QStringLiteral( "z_adefault" )] = ( QStringList() << QLatin1String( "" ) << tr( "Default" ) << QLatin1String( "" ) );

    // these GTiff profiles are based on Tim's benchmarks at
    // http://linfiniti.com/2011/05/gdal-efficiency-of-various-compression-algorithms/
    // big: no compression | medium: reasonable size/speed tradeoff | small: smallest size
    mBuiltinProfiles[ QStringLiteral( "z_gtiff_1big" )] =
      ( QStringList() << QStringLiteral( "GTiff" ) << tr( "No compression" )
        << QStringLiteral( "COMPRESS=NONE BIGTIFF=IF_NEEDED" ) );
    mBuiltinProfiles[ QStringLiteral( "z_gtiff_2medium" )] =
      ( QStringList() << QStringLiteral( "GTiff" ) << tr( "Low compression" )
        << QStringLiteral( "COMPRESS=PACKBITS" ) );
    mBuiltinProfiles[ QStringLiteral( "z_gtiff_3small" )] =
      ( QStringList() << QStringLiteral( "GTiff" ) << tr( "High compression" )
        << QStringLiteral( "COMPRESS=DEFLATE PREDICTOR=2 ZLEVEL=9" ) );
    mBuiltinProfiles[ QStringLiteral( "z_gtiff_4jpeg" )] =
      ( QStringList() << QStringLiteral( "GTiff" ) << tr( "JPEG compression" )
        << QStringLiteral( "COMPRESS=JPEG JPEG_QUALITY=75" ) );

    // overview compression schemes for GTiff format, see
    // http://www.gdal.org/gdaladdo.html and http://www.gdal.org/frmt_gtiff.html
    // TODO - should we offer GDAL_TIFF_OVR_BLOCKSIZE option here or in QgsRasterPyramidsOptionsWidget ?
    mBuiltinProfiles[ QStringLiteral( "z__pyramids_gtiff_1big" )] =
      ( QStringList() << QStringLiteral( "_pyramids" ) << tr( "No compression" )
        << QStringLiteral( "COMPRESS_OVERVIEW=NONE BIGTIFF_OVERVIEW=IF_NEEDED" ) );
    mBuiltinProfiles[ QStringLiteral( "z__pyramids_gtiff_2medium" )] =
      ( QStringList() << QStringLiteral( "_pyramids" ) << tr( "Low compression" )
        << QStringLiteral( "COMPRESS_OVERVIEW=PACKBITS" ) );
    mBuiltinProfiles[ QStringLiteral( "z__pyramids_gtiff_3small" )] =
      ( QStringList() << QStringLiteral( "_pyramids" ) << tr( "High compression" )
        << QStringLiteral( "COMPRESS_OVERVIEW=DEFLATE PREDICTOR_OVERVIEW=2 ZLEVEL=9" ) ); // how to set zlevel?
    mBuiltinProfiles[ QStringLiteral( "z__pyramids_gtiff_4jpeg" )] =
      ( QStringList() << QStringLiteral( "_pyramids" ) << tr( "JPEG compression" )
        << PYRAMID_JPEG_YCBCR_COMPRESSION );
  }

  connect( mProfileComboBox, SIGNAL( currentIndexChanged( const QString & ) ),
           this, SLOT( updateOptions() ) );
  connect( mOptionsTable, SIGNAL( cellChanged( int, int ) ), this, SLOT( optionsTableChanged() ) );
  connect( mOptionsHelpButton, SIGNAL( clicked() ), this, SLOT( helpOptions() ) );
  connect( mOptionsValidateButton, SIGNAL( clicked() ), this, SLOT( validateOptions() ) );

  // create eventFilter to map right click to swapOptionsUI()
  // mOptionsLabel->installEventFilter( this );
  mOptionsLineEdit->installEventFilter( this );
  mOptionsStackedWidget->installEventFilter( this );

  updateControls();
  updateProfiles();

  QgsDebugMsg( "done" );
}
Esempio n. 14
0
bool CSensorUSBMotionNodeAccel::detect()
{
   setType();
   setPort();

   if (qcn_main::g_iStop) return false;

   // always check dll existence & try to load!
      std::string sstrDLL;

   // setup DLL path, if returns false then DLL doesn't exist at the path where it should
	if (!qcn_util::setDLLPath(sstrDLL, m_cstrDLL)) {
		closePort();
		return false;
	}

#ifdef __USE_DLOPEN__
   if (qcn_main::g_iStop) return false;

   m_WinDLLHandle = dlopen(sstrDLL.c_str(), RTLD_LAZY | RTLD_GLOBAL); // default
   if (!m_WinDLLHandle) {
       fprintf(stderr, "CSensorUSBMotionNodeAccel: dynamic library %s dlopen error %s\n", sstrDLL.c_str(), dlerror());
       return false;
   }

   if (qcn_main::g_iStop) return false;

   m_SymHandle = (PtrMotionNodeAccelFactory) dlsym(m_WinDLLHandle, "MotionNodeAccel_Factory");
   if (!m_SymHandle) {
       fprintf(stderr, "CSensorUSBMotionNodeAccel: Could not get dlsym MotionNode Accel dylib file %s - error %s\n", sstrDLL.c_str(), dlerror());
       return false;
   }

   m_node = (*m_SymHandle)(MOTIONNODE_ACCEL_API_VERSION);
#else // for Windows or not using dlopen just use the direct motionnode factory
   if ( !  ( m_WinDLLHandle = ::LoadLibrary(sstrDLL.c_str()) )  ) {
	   fprintf(stderr, "CSensorUSBMotionNodeAccel: Cannot load DLL %s\n", sstrDLL.c_str());
	   return false;
   }
   m_node = MotionNodeAccel::Factory();
#endif

   if (!m_node) {
      fprintf(stderr, "CSensorUSBMotionNodeAccel: Could not make MotionNode Factory\n");
      return false; // not found
   }

   if (qcn_main::g_iStop) return false;

   // Detect the number of available devices.
   unsigned int count = 0;
   m_node->get_num_device(count);
   if (!count) {
	  // fprintf(stderr, "CSensorUSBMotionNodeAccel: no MN detected via DLL %s\n", sstrDLL.c_str());
       closePort();
       return false;
   }

   if (qcn_main::g_iStop) return false;

   // Set the G range. Default is 2.
   if (!m_node->set_gselect(2.0)) {
       fprintf(stderr, "CSensorUSBMotionNodeAccel: Could not set range on MotionNode Accel\n");
       closePort();
       return false;
   }

   // set the sample rate to 100Hz to get at least 1 & possibly 2 samples at 50Hz
   /* from Luke Tokheim:
       Use the "set_delay" method before you connect, just like choosing the G 
    range. The delay ranges from 0 to 1. The available sample rates are from 
    50 to 100 Hz by 10 Hz increments. Compute the delay value with the 
    following formula:

    delay = 1 - (target_rate - minimum_rate) * 0.0125;

    So, to sample at 100 Hz set the delay to:

    1 - (100 - 50) * 0.0125 = 0.375

    To sample at 50 Hz, set the delay to:

    1 - (50 - 50) * 0.0125 = 1
   */
   if (!m_node->set_delay(0.0f)) {
       fprintf(stderr, "CSensorUSBMotionNodeAccel: Could not set delay time on MotionNode Accel\n");
       closePort();
       return false;
   }
   
   if (qcn_main::g_iStop) return false;

   if (!m_node->connect()) { // connect to the sensor
       fprintf(stderr, "CSensorUSBMotionNodeAccel: Could not connect to MotionNode Accel\n");
       closePort();
       return false;
   }

   if (qcn_main::g_iStop) return false;

   if (!m_node->start()) {
       fprintf(stderr, "CSensorUSBMotionNodeAccel: Could not start MotionNode Accel\n");
       closePort();
       return false;
   }

   // OK, at this point we should be connected, so from here on out can just read_xyz until closePort()
   // set as a single sample per point
   setSingleSampleDT(true);  // mn samples itself

   // NB: closePort resets the type & port, so have to set again 
   setType(SENSOR_USB_MOTIONNODEACCEL);
   setPort(getTypeEnum());

   return true;
}
Esempio n. 15
0
NumToken::NumToken(ANTLRTokenType tokenTypeNew) {
   init();
   setType(tokenTypeNew);
   setLine(0);
}
Esempio n. 16
0
RectMulticastStrategy::RectMulticastStrategy(CkArrayID aid)
    : Strategy(), CharmStrategy() {

    ainfo.setDestinationArray(aid);
    setType(ARRAY_STRATEGY);
}
Esempio n. 17
0
//
// Establishes the type of the resultant operation, as well as
// makes the operator the correct one for the operands.
//
// For lots of operations it should already be established that the operand
// combination is valid, but returns false if operator can't work on operands.
//
bool TIntermBinary::promote(TInfoSink &infoSink)
{
    ASSERT(mLeft->isArray() == mRight->isArray());

    //
    // Base assumption:  just make the type the same as the left
    // operand.  Then only deviations from this need be coded.
    //
    setType(mLeft->getType());

    // The result gets promoted to the highest precision.
    TPrecision higherPrecision = GetHigherPrecision(
        mLeft->getPrecision(), mRight->getPrecision());
    getTypePointer()->setPrecision(higherPrecision);

    // Binary operations results in temporary variables unless both
    // operands are const.
    if (mLeft->getQualifier() != EvqConst || mRight->getQualifier() != EvqConst)
    {
        getTypePointer()->setQualifier(EvqTemporary);
    }

    const int nominalSize =
        std::max(mLeft->getNominalSize(), mRight->getNominalSize());

    //
    // All scalars or structs. Code after this test assumes this case is removed!
    //
    if (nominalSize == 1)
    {
        switch (mOp)
        {
          //
          // Promote to conditional
          //
          case EOpEqual:
          case EOpNotEqual:
          case EOpLessThan:
          case EOpGreaterThan:
          case EOpLessThanEqual:
          case EOpGreaterThanEqual:
            setType(TType(EbtBool, EbpUndefined));
            break;

          //
          // And and Or operate on conditionals
          //
          case EOpLogicalAnd:
          case EOpLogicalXor:
          case EOpLogicalOr:
            ASSERT(mLeft->getBasicType() == EbtBool && mRight->getBasicType() == EbtBool);
            setType(TType(EbtBool, EbpUndefined));
            break;

          default:
            break;
        }
        return true;
    }

    // If we reach here, at least one of the operands is vector or matrix.
    // The other operand could be a scalar, vector, or matrix.
    // Can these two operands be combined?
    //
    TBasicType basicType = mLeft->getBasicType();
    switch (mOp)
    {
      case EOpMul:
        if (!mLeft->isMatrix() && mRight->isMatrix())
        {
            if (mLeft->isVector())
            {
                mOp = EOpVectorTimesMatrix;
                setType(TType(basicType, higherPrecision, EvqTemporary,
                              mRight->getCols(), 1));
            }
            else
            {
                mOp = EOpMatrixTimesScalar;
                setType(TType(basicType, higherPrecision, EvqTemporary,
                              mRight->getCols(), mRight->getRows()));
            }
        }
        else if (mLeft->isMatrix() && !mRight->isMatrix())
        {
            if (mRight->isVector())
            {
                mOp = EOpMatrixTimesVector;
                setType(TType(basicType, higherPrecision, EvqTemporary,
                              mLeft->getRows(), 1));
            }
            else
            {
                mOp = EOpMatrixTimesScalar;
            }
        }
        else if (mLeft->isMatrix() && mRight->isMatrix())
        {
            mOp = EOpMatrixTimesMatrix;
            setType(TType(basicType, higherPrecision, EvqTemporary,
                          mRight->getCols(), mLeft->getRows()));
        }
        else if (!mLeft->isMatrix() && !mRight->isMatrix())
        {
            if (mLeft->isVector() && mRight->isVector())
            {
                // leave as component product
            }
            else if (mLeft->isVector() || mRight->isVector())
            {
                mOp = EOpVectorTimesScalar;
                setType(TType(basicType, higherPrecision, EvqTemporary,
                              nominalSize, 1));
            }
        }
        else
        {
            infoSink.info.message(EPrefixInternalError, getLine(),
                                  "Missing elses");
            return false;
        }

        if (!ValidateMultiplication(mOp, mLeft->getType(), mRight->getType()))
        {
            return false;
        }
        break;

      case EOpMulAssign:
        if (!mLeft->isMatrix() && mRight->isMatrix())
        {
            if (mLeft->isVector())
            {
                mOp = EOpVectorTimesMatrixAssign;
            }
            else
            {
                return false;
            }
        }
        else if (mLeft->isMatrix() && !mRight->isMatrix())
        {
            if (mRight->isVector())
            {
                return false;
            }
            else
            {
                mOp = EOpMatrixTimesScalarAssign;
            }
        }
        else if (mLeft->isMatrix() && mRight->isMatrix())
        {
            mOp = EOpMatrixTimesMatrixAssign;
            setType(TType(basicType, higherPrecision, EvqTemporary,
                          mRight->getCols(), mLeft->getRows()));
        }
        else if (!mLeft->isMatrix() && !mRight->isMatrix())
        {
            if (mLeft->isVector() && mRight->isVector())
            {
                // leave as component product
            }
            else if (mLeft->isVector() || mRight->isVector())
            {
                if (!mLeft->isVector())
                    return false;
                mOp = EOpVectorTimesScalarAssign;
                setType(TType(basicType, higherPrecision, EvqTemporary,
                              mLeft->getNominalSize(), 1));
            }
        }
        else
        {
            infoSink.info.message(EPrefixInternalError, getLine(),
                                  "Missing elses");
            return false;
        }

        if (!ValidateMultiplication(mOp, mLeft->getType(), mRight->getType()))
        {
            return false;
        }
        break;

      case EOpAssign:
      case EOpInitialize:
        // No more additional checks are needed.
        ASSERT((mLeft->getNominalSize() == mRight->getNominalSize()) &&
            (mLeft->getSecondarySize() == mRight->getSecondarySize()));
        break;
      case EOpAdd:
      case EOpSub:
      case EOpDiv:
      case EOpIMod:
      case EOpBitShiftLeft:
      case EOpBitShiftRight:
      case EOpBitwiseAnd:
      case EOpBitwiseXor:
      case EOpBitwiseOr:
      case EOpAddAssign:
      case EOpSubAssign:
      case EOpDivAssign:
      case EOpIModAssign:
      case EOpBitShiftLeftAssign:
      case EOpBitShiftRightAssign:
      case EOpBitwiseAndAssign:
      case EOpBitwiseXorAssign:
      case EOpBitwiseOrAssign:
        if ((mLeft->isMatrix() && mRight->isVector()) ||
            (mLeft->isVector() && mRight->isMatrix()))
        {
            return false;
        }

        // Are the sizes compatible?
        if (mLeft->getNominalSize() != mRight->getNominalSize() ||
            mLeft->getSecondarySize() != mRight->getSecondarySize())
        {
            // If the nominal sizes of operands do not match:
            // One of them must be a scalar.
            if (!mLeft->isScalar() && !mRight->isScalar())
                return false;

            // In the case of compound assignment other than multiply-assign,
            // the right side needs to be a scalar. Otherwise a vector/matrix
            // would be assigned to a scalar. A scalar can't be shifted by a
            // vector either.
            if (!mRight->isScalar() &&
                (isAssignment() ||
                mOp == EOpBitShiftLeft ||
                mOp == EOpBitShiftRight))
                return false;
        }

        {
            const int secondarySize = std::max(
                mLeft->getSecondarySize(), mRight->getSecondarySize());
            setType(TType(basicType, higherPrecision, EvqTemporary,
                          nominalSize, secondarySize));
            if (mLeft->isArray())
            {
                ASSERT(mLeft->getArraySize() == mRight->getArraySize());
                mType.setArraySize(mLeft->getArraySize());
            }
        }
        break;

      case EOpEqual:
      case EOpNotEqual:
      case EOpLessThan:
      case EOpGreaterThan:
      case EOpLessThanEqual:
      case EOpGreaterThanEqual:
        ASSERT((mLeft->getNominalSize() == mRight->getNominalSize()) &&
            (mLeft->getSecondarySize() == mRight->getSecondarySize()));
        setType(TType(EbtBool, EbpUndefined));
        break;

      default:
        return false;
    }
    return true;
}
Esempio n. 18
0
/**
 * Sets message type to @a type.
 *
 * @overload
 * @sa Type
 */
void Message::setType(Type type)
{
    setType( typeToString(type) );
}
Esempio n. 19
0
// Public set type method
SubsystemType
SubsystemInfo::setType( SubsystemType _type )
{
	return setType( _type, NULL );
}
Esempio n. 20
0
PC::PC() {
	setType(0);
}
Esempio n. 21
0
File: eval2.c Progetto: NV/nile
static oop _newBits(int type, size_t size)	{ oop obj= GC_malloc_atomic(size);	setType(obj, type);  return obj; }
Esempio n. 22
0
Mouse::Mouse()
{
    // Hide cursor
    SDL_ShowCursor(0);
    setType(BIG_ARROW);
}
CntDetailModelItem::CntDetailModelItem( QContactDetail aDetail ) : 
HbDataFormModelItem(),
mDetail( aDetail )
    {
    setType( CustomItemBase );
    }
Esempio n. 24
0
Company::Company(const char* username, const char* password) : Customer(username, password) {
    setType(2);
}
Esempio n. 25
0
//Default constructor
Fruit::Fruit() : Food()
{
	setType(FRUIT);
}
Esempio n. 26
0
void LDZGameLayer::initLevel(int level){
    
    Size vs = Director::getInstance()->getVisibleSize();
    Vec2 vo = Director::getInstance()->getVisibleOrigin();
    
    _mode = MODE_BEGAIN;
    
    TMXTiledMap *map = TMXTiledMap::create("back.tmx");
    _map = map;
    _mapSize = Size(map->getMapSize().width * map->getTileSize().width , map->getMapSize().height * map->getTileSize().height);
    map->setPosition(Vec2(0, 0));
    this->addChild(map);
    
    //main char
    _mainC = Sprite::createWithSpriteFrameName("1.png");
    _mainC->setPosition(_mapSize.width/2, _mainC->getContentSize().height/2 + 10);
    this->addChild(_mainC,1);
    
    //progress
    auto progress = ProgressTimer::create(Sprite::createWithSpriteFrameName("tempb.png"));
    float progx = _mapSize.width/2 - _mainC->getContentSize().width/2 - progress->getContentSize().width/2 - 5;
    float progy = _mainC->getContentSize().height/2 + 10;
    progress->setPosition( progx, progy);
    progress->setType(cocos2d::ProgressTimer::Type::BAR);
    progress->setBarChangeRate(Vec2(0, 1));
    progress->setMidpoint(Vec2(0, 0));
    auto progback = Sprite::createWithSpriteFrameName("temp.png");
    progback->setPosition(progx, progy);
    this->addChild(progback);
    this->addChild(progress,1);
    progress->setVisible(false);
    progback->setVisible(false);
    _powerProg = progress;
    _powerProgBack = progback;
    
    //limit
    float height = 50 + arc4random()%100;
    float uy = _mapSize.height/3 + _mapSize.height/3*2*CCRANDOM_0_1() - 5;
    float dy = uy - height;
    _upLimit = Sprite::createWithSpriteFrameName("limit.png");
    _upLimit->setPosition(_mapSize.width/2, uy);
    this->addChild(_upLimit);
    _downLimit = Sprite::createWithSpriteFrameName("limit.png");
    _downLimit->setPosition(_mapSize.width/2, dy);
    this->addChild(_downLimit);
    
    //guide
    auto gt = ui::Text::create(LHLocalizedCString("guidetext"), Common_Font, 25);
    gt->setColor(Color3B::RED);
    gt->setPosition(Vec2(_mainC->getPosition().x , _mainC->getBoundingBox().getMaxY() + gt->getContentSize().height/2));
    this->addChild(gt);
    auto bl = Blink::create(1, 1);
    auto rp = RepeatForever::create(bl);
    gt->runAction(rp);
    
    auto da = Sprite::create("da.png");
    da->setScaleY(height/da->getContentSize().height);
    da->setPosition(Vec2(_mainC->getPosition().x,_downLimit->getPositionY()+height/2));
    this->addChild(da);
    
    auto lis = EventListenerTouchOneByOne::create();
    lis->onTouchBegan = [this,gt,progress,progback,da](Touch* tmpTouch, Event*){
        if (_mode == MODE_VIEW) {
            Vec2 loca = tmpTouch->getLocation();
            loca = this->convertToNodeSpace(loca);
            if (_mainC->getBoundingBox().containsPoint(loca)) {
                CallFunc *call = CallFunc::create([this](){
                    _mode = MODE_POWER;
                    this->scheduleUpdate();
                    CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("wiso.wav");
                });
                
                float focusMargin = 20;
                this->focusOn(_mainC->getPosition(), _mainC->getContentSize().height + focusMargin, true , call);
                _mode = MODE_BEGAIN;
                
                gt->removeFromParent();
                da->removeFromParent();
                
                progress->setVisible(true);
                progback->setVisible(true);
                progress->setPercentage(0);
            }
        }else if (_mode == MODE_POWER_END){
            _mode = MODE_POWER;
        }
        
        return true;
    };
    lis->onTouchMoved = [this](Touch* tmpTouch, Event*){
        Vec2 cu = tmpTouch->getLocation();
        Vec2 last = tmpTouch->getPreviousLocation();
        if (_mode == MODE_VIEW) {
            float toy = _focusCenter.y + (last.y - cu.y);
            if (toy+_focusLen/2 > _upLimit->getPositionY() + 20) {
                toy = _upLimit->getPositionY()+20 - _focusLen/2;
            }
            this->focusOn(Vec2(_focusCenter.x , toy),_focusLen, false);
        }else if (_mode == MODE_POWER){
            float dy = fabsf(cu.y - last.y);
            _powerProg->setPercentage(_powerProg->getPercentage()+dy/(_powerProg->getPercentage()+1)/MOVE_FACTOR);
        }
    };
    lis->onTouchEnded = [this](Touch*, Event*){
        if (_mode == MODE_POWER) {
            _mode = MODE_POWER_END;
            _powerCount = 0.1f;
        }
    };
    this->getEventDispatcher()->addEventListenerWithSceneGraphPriority(lis, this);
    
    focusOn(Vec2(_mapSize.width/2,(uy - height/2)), vs.width, false);
    auto dl2 = DelayTime::create(1);
    CallFunc *call = CallFunc::create([this](){
        auto tmpcall = CallFunc::create([this](){
            _mode = MODE_VIEW;
        });
        this->focusOn(_mainC->getPosition(), _focusLen, true , tmpcall);
    });
    auto sq = Sequence::create(dl2,call, NULL);
    this->runAction(sq);
}
Esempio n. 27
0
XHtmlElements::Img::Img() :
	XHtmlElement()
{
	setType( "IMG" );
}
Esempio n. 28
0
ConstantExpression::ConstantExpression(Constant constant) :
        constant { constant }
{
    auto type = constant.getType();
    setType(*type);
}
Esempio n. 29
0
/*!
    Constructs an easing curve of the given \a type.
 */
QEasingCurve::QEasingCurve(Type type)
    : d_ptr(new QEasingCurvePrivate)
{
    setType(type);
}
Esempio n. 30
0
void WatchItem::parseHelper(const GdbMi &input)
{
    setChildrenUnneeded();

    GdbMi mi = input["type"];
    if (mi.isValid())
        setType(mi.data());

    editvalue = input["editvalue"].data();
    editformat = DebuggerDisplay(input["editformat"].toInt());
    editencoding = DebuggerEncoding(input["editencoding"].data());

    mi = input["valueelided"];
    if (mi.isValid())
        elided = mi.toInt();

    mi = input["bitpos"];
    if (mi.isValid())
        bitpos = mi.toInt();

    mi = input["bitsize"];
    if (mi.isValid())
        bitsize = mi.toInt();

    mi = input["origaddr"];
    if (mi.isValid())
        origaddr = mi.toAddress();

    mi = input["address"];
    if (mi.isValid()) {
        address = mi.toAddress();
        if (exp.isEmpty()) {
            if (iname.startsWith("local.") && iname.count('.') == 1)
                // Solve one common case of adding 'class' in
                // *(class X*)0xdeadbeef for gdb.
                exp = name.toLatin1();
            else
                exp = "*(" + gdbQuoteTypes(type) + "*)" + hexAddress();
        }
    }

    mi = input["value"];
    QByteArray enc = input["valueencoded"].data();
    if (mi.isValid() || !enc.isEmpty()) {
        setValue(decodeData(mi.data(), enc));
    } else {
        setValueNeeded();
    }

    mi = input["size"];
    if (mi.isValid())
        size = mi.toInt();

    mi = input["exp"];
    if (mi.isValid())
        exp = mi.data();

    mi = input["valueenabled"];
    if (mi.data() == "true")
        valueEnabled = true;
    else if (mi.data() == "false")
        valueEnabled = false;

    mi = input["valueeditable"];
    if (mi.data() == "true")
        valueEditable = true;
    else if (mi.data() == "false")
        valueEditable = false;

    mi = input["numchild"]; // GDB/MI
    if (mi.isValid())
        setHasChildren(mi.toInt() > 0);
    mi = input["haschild"]; // native-mixed
    if (mi.isValid())
        setHasChildren(mi.toInt() > 0);

    mi = input["arraydata"];
    if (mi.isValid()) {
        DebuggerEncoding encoding(input["arrayencoding"].data());
        QByteArray childType = input["childtype"].data();
        decodeArrayData(this, mi.data(), encoding, childType);
    } else {
        const GdbMi children = input["children"];
        if (children.isValid()) {
            bool ok = false;
            // Try not to repeat data too often.
            const GdbMi childType = input["childtype"];
            const GdbMi childNumChild = input["childnumchild"];

            qulonglong addressBase = input["addrbase"].data().toULongLong(&ok, 0);
            qulonglong addressStep = input["addrstep"].data().toULongLong(&ok, 0);

            for (int i = 0, n = int(children.children().size()); i != n; ++i) {
                const GdbMi &subinput = children.children().at(i);
                WatchItem *child = new WatchItem;
                if (childType.isValid())
                    child->setType(childType.data());
                if (childNumChild.isValid())
                    child->setHasChildren(childNumChild.toInt() > 0);
                GdbMi name = subinput["name"];
                QByteArray nn;
                if (name.isValid()) {
                    nn = name.data();
                    child->name = QString::fromLatin1(nn);
                } else {
                    nn.setNum(i);
                    child->name = QString::fromLatin1("[%1]").arg(i);
                }
                GdbMi iname = subinput["iname"];
                if (iname.isValid())
                    child->iname = iname.data();
                else
                    child->iname = this->iname + '.' + nn;
                if (addressStep) {
                    child->address = addressBase + i * addressStep;
                    child->exp = "*(" + gdbQuoteTypes(child->type) + "*)" + child->hexAddress();
                }
                QByteArray key = subinput["key"].data();
                if (!key.isEmpty())
                    child->name = decodeData(key, subinput["keyencoded"].data());
                child->parseHelper(subinput);
                appendChild(child);
            }
        }
    }
}