//*****************************************************************************
// CLASS GeneralPage :: verifyAndSave() - save database info
//*****************************************************************************
IBase :: Boolean GeneralPage :: verifyAndSave( IString& theString,
                                               IString& theEntry,
                                               const IString theName )
{

    /*  verify data for correctness */

    if ((theName.length() == 0) && (employeeId.text().length() == 0 ))
        return true;

    // save person information
    if ((theName.length() == 0 ) && (theName.isAlphanumeric()))
        Key = employeeId.text();
    else
       Key = theName;

    // prime the page from data area
    setEmployeeData();

    //-------------------------------------------------------------------------
    // Save the query
    // The key is either what was passed in or the employee number
    //-------------------------------------------------------------------------
    if (theName.length()>0)
       employeeData.save(theName);
    else
       if ( (!isAquery) &&
            (Key.length()> 0 ))
             employeeData.save(Key);

     return true;
}
Пример #2
0
bool IString::isLike(IString s){
	IString _localpattern = "*?";
	IString::iterator _lcstrIterator;
	IString::iterator _lcptrIterator;
	int _strIndex = 0;
	
	_lcstrIterator = this->begin();
	_lcptrIterator = s.begin();
	
	while ( _lcptrIterator != s.end() && _lcstrIterator != this->end() ) {
		if ( *_lcptrIterator == '*'  ) {
			if ( *_lcstrIterator == *(_lcptrIterator+1) ) {
				_lcptrIterator++;
				_lcptrIterator++;
				_lcstrIterator++;
			} else _lcstrIterator++;
		}
		
		if ( *_lcptrIterator == '?'  ) {
			_lcptrIterator++;
			_lcstrIterator++;
		}
 
 		if ( *_lcptrIterator != '*' && *_lcptrIterator != '?' ) {
			if ( *_lcptrIterator != *_lcstrIterator )return false;
			_lcptrIterator++;
			_lcstrIterator++;
		}
	}
	return true;
}
Пример #3
0
void IShaderManager::SendLightsInfo()
{
    return;
    IString str;
    //printf("light count %d\n",ILight::m_aLights.Count());
    for (unsigned int i=0; i<m_pShaderList.Count(); i++)
    {
        if (m_pShaderList[i] && m_pShaderList[i]->IsCompiled())
        {
            //m_pShaderList[i]->UseShader();
            int ok = m_pShaderList[i]->SetParameterInt("m_nLightsCount",ILight::m_aLights.Count());
            //printf("Send light count %d\n",ok);
            if (ok)
                for (unsigned int j=0; j<ILight::m_aLights.Count(); j++)
                {
                    //Send color
                    str.Printf("m_v3LightsColor[%d]",j);
                    ok=m_pShaderList[i]->SetParameter3Float(str,ILight::m_aLights[j]->m_cColor);
                    //Send position
                    str.Printf("m_v3LightsPos[%d]",j);
                    ok=m_pShaderList[i]->SetParameter3Float(str,ILight::m_aLights[j]->m_vPosition);
                    //Send radius
                    str.Printf("m_fLightsRadius[%d]",j);
                    ok=m_pShaderList[i]->SetParameterFloat(str,ILight::m_aLights[j]->m_fRadius);
                }
        }
    }
}
Пример #4
0
void CAndorSDK3Camera::PerformReleaseVersionCheck()
{
   //Release 2 / 2.1 checks
   try
   {
      IString * firmwareVersion = cameraDevice->GetString(L"FirmwareVersion");
      if (firmwareVersion && firmwareVersion->IsImplemented())
      {
         wstring ws = firmwareVersion->Get();
         if (ws == g_RELEASE_2_0_FIRMWARE_VERSION)
         {
            LogMessage("Warning: Release 2.0 Camera firmware detected! Please upgrade your camera to Release 3");
         }
         else if (ws == g_RELEASE_2_1_FIRMWARE_VERSION)
         {
            LogMessage("Warning: Release 2.1 Camera firmware detected! Please upgrade your camera to Release 3");
         }
      }
      cameraDevice->Release(firmwareVersion);
   }
   catch (NotImplementedException & e)
   {
      LogMessage(e.what());
   }
}
/******************************************************************************
* Class AccountPage :: verifyAndSave - Save page information to the database  *
******************************************************************************/
bool AccountPage::verifyAndSave( IString& theString,
                                           IString& theEntry,
                                           const IString saveName )
{
/*-----------------------------------------------------------------------------
| If there is no data or is a query, return.                                  |
-----------------------------------------------------------------------------*/
   if ( ( ! saveName.length() )
        && ( ! Key.length() )
        || isAquery )
      return true;

/*-----------------------------------------------------------------------------
| If able to retrieve the container information,                              |
|  save the information to the database based on the key or query name.       |
-----------------------------------------------------------------------------*/
   if ( setAcctData() )
   {
      if ( ( saveName.length() > 0 ) && ( saveName.isAlphanumeric() ) )
         acctData.save( saveName );
       else
         if ( ( Key.length() > 0 ) && ( Key.isAlphanumeric() ) )
            acctData.save( Key );
   }

   return true;
};
// -------------------------------------------------------------------------
// QueryInfo Class :: inRange() - match check having a range
// -------------------------------------------------------------------------
IBase :: Boolean QueryInfo :: inRange(const IString &c1
                                     ,const IString &c2
                                     ,const IString &range)
{

   if (c2.length() == 0)
      return false;

    IString matchItem, compareItem;

    matchItem   = chopOff(c1);
    compareItem = chopOff(c2);

   if ( (c1.isDigits()) && (c2.isDigits()) ) {
      // compare 2 numbers
      long d1=c1.asInt();
      long d2=c2.asInt();
      return compareIt(d1, d2, range);
   }
   else {
      ADate *date1 = new ADate(c1);
      ADate *date2 = new ADate(c2);
      return compareIt(date1, date2, range);
   } /* endif */

};
Пример #7
0
/*
 *  v e r t i c a l
 *
 *  show select results in vertical direction
 */
static void vertical(KSqlCursor *csr, int cols)
{
    int pcnt = 0;
    while (csr->fetch()) {
        log("");
        if (pausechk(pcnt)) break;
        for (int col = 0; col < cols; col++) {
            ostrstream* out = new ostrstream();
            *out << setiosflags(ios::left) << setw(20) << setfill('.')
                 << csr->selectColumnName(col)
                 << setiosflags(0) << setw(0) << setfill(' ') << ": ";
            int width = dispWidth(csr,col);
            int scale = csr->selectColumnScale(col);
            if (scale>=0) {
                out->setf(ios::fixed);
                out->precision(scale);
            } //
            if (numeric(csr,col)) {
                double val;
                *csr >> val;
                *out << val;
            } else {
                IString val;
                *csr >> val;
                *out << val.subString(1,width).strip() << setiosflags(0);
            } /* endif */
            char* ss = out->str();
            ss[out->pcount()] = 0;
            log(ss);
            delete ss;
            delete out;
            if (pausechk(pcnt)) return;
        } // for
    } // while
// -------------------------------------------------------------------------
// QueryInfo Class :: chopOff() - ignore decimal points
// -------------------------------------------------------------------------
IString QueryInfo :: chopOff( const IString& c2) {
   unsigned i = c2.indexOf(".");
   if (i > 0)
      return (c2.subString(1, i-1));
   return c2;

};
// -------------------------------------------------------------------------
// QueryInfo Class :: compareItData() - compare integers for a match
// -------------------------------------------------------------------------
IBase :: Boolean QueryInfo :: compareIt( const long  d1
                                        ,const long  d2
                                        ,const IString& range)
{
   Boolean retCode = false;
   // now compare the date or integer
   if (d1 == d2 )
       if (range.indexOfAnyOf("="))
          retCode=true;
       else
          retCode=false;
   else
     if (d2 > d1 )
       if (range.indexOfAnyOf(">"))
          retCode=true;
       else
          retCode=false;
     else
        if (d2 < d1 )
          if (range.indexOfAnyOf("<"))
             retCode=true;
          else
             retCode=false;

    return retCode;
};
Пример #10
0
void setMovieWindowHandle(IWindowHandle movieWindowHandle)
{
  if (movieWindowHandle)
  {
    IString unqualifiedFileName = movieFrame->quickFlick->fileName();
    unsigned long lastDelimiterIndex = unqualifiedFileName.lastIndexOf('\\');
    unqualifiedFileName = unqualifiedFileName.subString(lastDelimiterIndex + 1, unqualifiedFileName.length() - lastDelimiterIndex);
    movieFrame->title.setObjectText("QuickFlick");
    movieFrame->title.setViewText(unqualifiedFileName);
    movieFrame->addToWindowList();

    movieFrame->movieWindow = IWindow::windowWithHandle(movieWindowHandle);
    IDMHandler::enableDropOn(movieFrame->movieWindow);
    movieFrame->movieWindow->setItemProvider(movieFrame);
  }

  if (movieFrame->quickFlick->logoWindowHandle())
  {
    movieFrame->logo = IWindow::windowWithHandle(movieFrame->quickFlick->logoWindowHandle());
    IDMHandler::enableDropOn(movieFrame->logo);
    movieFrame->logo->setItemProvider(movieFrame);
  }

  if (movieWindowHandle && QuickFlick::nonEmbeddedDisplay() == QF_NONEMBED_TOFIT)
    movieFrame->reset();
  else
    movieFrame->showWindow();
}
Пример #11
0
void LumosGame::ItemToButton( const GameItem* item, gamui::Button* button )
{
	CStr<64> text;

	// Set the text to the proper name, if we have it.
	// Then an icon for what it is, and a check
	// mark if the object is in use.
	int value = item->GetValue();
	const char* name = item->ProperName() ? item->ProperName() : item->Name();
	if ( value ) {
		text.Format( "%s\n%d", name, value );
	}
	else {
		text.Format( "%s\n ", name );
	}
	button->SetText( text.c_str() );

	IString decoName = item->keyValues.GetIString( "uiIcon" );
	RenderAtom atom  = LumosGame::CalcUIIconAtom( decoName.c_str(), true );
	atom.renderState = (const void*) UIRenderer::RENDERSTATE_UI_DECO_DISABLED;
	RenderAtom atomD = LumosGame::CalcUIIconAtom( decoName.c_str(), false );
	atomD.renderState = (const void*) UIRenderer::RENDERSTATE_UI_DECO_DISABLED;

	button->SetDeco( atom, atomD );
}
Пример #12
0
IString IString::words(int _firstWord, int _numWords ) {
	IString returnString;
	
	for ( int index = _firstWord; index < _numWords; index++ ) {
		returnString.append(this->word(index));
	}
	return returnString;
}
Пример #13
0
Verzeichnis::Verzeichnis (IString const &n)
{
        Path = n;
        IString name = n;
        HPOINTER p = WinLoadFileIcon (n, FALSE);
        if ( p )
                setIcon (IPointerHandle (p));
        else
                setIcon (ISystemPointerHandle (ISystemPointerHandle::folder));
        setIconText (name.remove (1, Path.lastIndexOf ('\\')));
}
Пример #14
0
int CoreScript::DoTick(U32 delta)
{
	int nScoreTicks = scoreTicker.Delta(delta);
	int nAITicks = aiTicker.Delta(delta);

	Citizens(0);	// if someone was deleted, the spawn tick will reset.
	int nSpawnTicks = spawnTick.Delta(delta);

	// Clean rock off the core.
	Vector2I pos2i = ToWorld2I(parentChit->Position());
	const WorldGrid& wg = Context()->worldMap->GetWorldGrid(pos2i);
	if (wg.RockHeight()) {
		Context()->worldMap->SetRock(pos2i.x, pos2i.y, 0, false, 0);
	}

	if (InUse()) {
		DoTickInUse(delta, nSpawnTicks);
		UpdateScore(nScoreTicks);
	}
	else {
		DoTickNeutral(delta, nSpawnTicks);
	}
	workQueue->DoTick();

	if (nAITicks) {
		UpdateAI();
	}

	for (int i = 0; i < MAX_SQUADS; ++i) {
		if (squads[i].Empty()) {
			waypoints[i].Clear();
		}
	}

	if (strategicTicker.Delta(delta)) {
		if (this->InUse() && Context()->chitBag->GetHomeCore() != this) {
			DoStrategicTick();
		}
	}

	RenderComponent* rc = parentChit->GetRenderComponent();
	if (rc) {
		int team = parentChit->Team();
		CStr<40> str = "";
		if (this->InUse() && Team::IsDenizen(team)) {
			IString teamName = Team::Instance()->TeamName(team);
			str.Format("%s", teamName.safe_str());
		}
		rc->SetDecoText(str.safe_str());
	}

	return Min(spawnTick.Next(), aiTicker.Next(), scoreTicker.Next());
}
Пример #15
0
Chit* LumosChitBag::NewDenizen( const grinliz::Vector2I& pos, int team )
{
	const ChitContext* context = Context();
	IString itemName;

	switch (Team::Group(team)) {
		case TEAM_HOUSE:	itemName = (random.Bit()) ? ISC::humanFemale : ISC::humanMale;	break;
		case TEAM_GOB:		itemName = ISC::gobman;											break;
		case TEAM_KAMAKIRI:	itemName = ISC::kamakiri;										break;
		default: GLASSERT(0); break;
	}

	Chit* chit = NewChit();
	const GameItem& root = ItemDefDB::Instance()->Get(itemName.safe_str());

	chit->Add( new RenderComponent(root.ResourceName()));
	chit->Add( new PathMoveComponent());

	const char* altName = 0;
	if (Team::Group(team) == TEAM_HOUSE) {
		altName = "human";
	}
	AddItem(root.Name(), chit, context->engine, team, 0, 0, altName);

	ReserveBank::Instance()->WithdrawDenizen(chit->GetWallet());
	chit->GetItem()->GetTraitsMutable()->Roll( random.Rand() );
	chit->GetItem()->GetPersonalityMutable()->Roll( random.Rand(), &chit->GetItem()->Traits() );
	chit->GetItem()->FullHeal();

	IString nameGen = chit->GetItem()->keyValues.GetIString( "nameGen" );
	if ( !nameGen.empty() ) {
		LumosChitBag* chitBag = chit->Context()->chitBag;
		if ( chitBag ) {
			chit->GetItem()->SetProperName(chitBag->NameGen(nameGen.c_str(), chit->ID()));
		}
	}

	AIComponent* ai = new AIComponent();
	chit->Add( ai );

	chit->Add( new HealthComponent());
	chit->SetPosition( (float)pos.x+0.5f, 0, (float)pos.y+0.5f );

	chit->GetItem()->SetSignificant(GetNewsHistory(), ToWorld2F(pos), NewsEvent::DENIZEN_CREATED, NewsEvent::DENIZEN_KILLED, 0);

	if (XenoAudio::Instance()) {
		Vector3F pos3 = ToWorld3F(pos);
		XenoAudio::Instance()->PlayVariation(ISC::rezWAV, random.Rand(), &pos3);
	}

	return chit;
}
/******************************************************************************
* class FontSelectHandler::enter - Handle combo box selections
******************************************************************************/
bool FontSelectHandler::enter( IControlEvent& event)
{
  IString fontChoice =  ((IComboBox*)event.controlWindow())->text();
  if(fontChoice.length())
  {
/*----------------------------------------------------------------------------|
| Set the new font                                                            |
-----------------------------------------------------------------------------*/
     editorFrame.editorFont().setName(fontChoice);
     editorFrame.editorWindow().setFont(editorFrame.editorFont());
  }
  return true;
}
/******************************************************************************
* Class AccountPage :: addAcct - Add the account information to the container *
******************************************************************************/
bool AccountPage::addAcct( IString& user, IString& node )
{
   bool
      rc = true;

/*-----------------------------------------------------------------------------
| Create a container text cursor based on the user ID.                        |
-----------------------------------------------------------------------------*/
   IContainerControl::TextCursor
      txtCur( *pCnr, IString( user ), true, false, true );

/*-----------------------------------------------------------------------------
| Start at the beginning of the cursor.                                       |
| If the cursor contains a duplicate, set the return code to false.           |
-----------------------------------------------------------------------------*/
   for ( txtCur.setToFirst();
         txtCur.isValid();
         txtCur.setToNext() )
   {
      if ( ( (AcctCnrObj*) txtCur.current() )->getNode() == node )
      {
         rc = false;
         break;
      }
   }

/*-----------------------------------------------------------------------------
| If the object doesn't exist,                                                |
|  Add the object to the database.                                            |
|  Create an account container object.                                        |
|  Add the object to the container.                                           |
|  Refresh the container.                                                     |
-----------------------------------------------------------------------------*/
   if ( rc )
   {
      if ( isAquery )
      {
         if ( ! user.length() )
            user = "******";
         if ( ! node.length() )
            node = "*";
      }

      acctData.putItem( user, node, LAcctData::add );
      pAcctCnrObj = new AcctCnrObj( user, node );
      pCnr->addObject( pAcctCnrObj );
      pCnr->refresh();
   }

   return rc;
}
Пример #18
0
bool MOBKeyFilter::Accept(Chit* chit)
{
	GameItem* item = chit->GetItem();
	if (item) {
		IString mob = item->keyValues.GetIString(ISC::mob);
		if (!mob.empty()) {
			if (value.empty())
				return RelationshipFilter::Accept(chit);
			else if (value == mob)
				return RelationshipFilter::Accept(chit);
		}
	}
	return false;
}
Пример #19
0
/*
 *  d e s c r i b e
 *
 *  describe columns of a table
 */
static void describe()
{
    if (!connected) {
        log("not connected!");
        return;
    } // if
    IString table = input.word(2);
    if (table=="") {
        log("missing table name!");
        return;
    } // if
    static KSqlCursor *csr;
    mainLink->getCursor(&csr);
    csr->parse("SELECT * FROM "+table+" WHERE ROWNUM<1");
    csr->execute();
    int cols = csr->selectColumnCount();
    int pcnt = 0;
    for (int col = 0; col < cols; col++) {
        ostrstream* out = new ostrstream();
        *out << setiosflags(ios::left) << setw(20) << setfill('.')
             << csr->selectColumnName(col)
             << setiosflags(0) << setw(0)  << setfill(' ')
             << ": " << csr->selectColumnDescription(col);
        char* ss = out->str();
        ss[out->pcount()] = 0;
        log(ss);
        delete ss;
        delete out;
        if (pausechk(pcnt)) break;
    } // for
} // describe
Пример #20
0
/**
* CAndorSDK3Camera constructor.
* Setup default all variables and create device properties required to exist
* before intialization. In this case, no such properties were required. All
* properties will be created in the Initialize() method.
*
* As a general guideline Micro-Manager devices do not access hardware in the
* the constructor. We should do as little as possible in the constructor and
* perform most of the initialization in the Initialize() method.
*/
CAndorSDK3Camera::CAndorSDK3Camera()
: CCameraBase<CAndorSDK3Camera> (),
  deviceManager(NULL),
  cameraDevice(NULL),
  bufferControl(NULL),
  startAcquisitionCommand(NULL),
  sendSoftwareTrigger(NULL),
  initialized_(false),
  b_cameraPresent_(false),
  number_of_devices_(0),
  deviceInUseIndex_(0),
  sequenceStartTime_(0),
  fpgaTSclockFrequency_(0),
  timeStamp_(0),
  defaultExposureTime_(0.0f),
  pDemoResourceLock_(0),
  image_buffers_(NULL),
  numImgBuffersAllocated_(0),
  currentSeqExposure_(0),
  keep_trying_(false),
  stopOnOverflow_(false)
{
   // call the base class method to set-up default error codes/messages
   InitializeDefaultErrorMessages();
   //Add in some others not currently in base impl, will show in CoreLog/Msgbox on error
   SetErrorText(DEVICE_BUFFER_OVERFLOW, " Circular Buffer Overflow code from MMCore");
   SetErrorText(DEVICE_OUT_OF_MEMORY, " Allocation Failure - out of memory");
   SetErrorText(DEVICE_SNAP_IMAGE_FAILED, " Snap Image Failure");
   
#ifdef TESTRESOURCELOCKING
   pDemoResourceLock_ = new MMThreadLock();
#endif
   thd_ = new MySequenceThread(this);

   // Create an atcore++ device manager
   deviceManager = new TDeviceManager;

   // Open a system device
   IDevice * systemDevice = deviceManager->OpenSystemDevice();
   IInteger * deviceCount = systemDevice->GetInteger(L"DeviceCount");
   SetNumberOfDevicesPresent(static_cast<int>(deviceCount->Get()));
   systemDevice->Release(deviceCount);
   IString * swVersion = systemDevice->GetString(L"SoftwareVersion");
   currentSoftwareVersion_ = swVersion->Get();
   systemDevice->Release(swVersion);
   deviceManager->CloseDevice(systemDevice);
}
// -------------------------------------------------------------------------
// QueryGenl Class :: aMatch() - checks for a match
// -------------------------------------------------------------------------
IBase :: Boolean  QueryGenl :: aMatch(const LEmployeeData* ed,
                                      const IString& key,
                                      const IString& value)
{
  if (key == "employeeNum" )
    if (ed->employeeNumber().length() > 0)
       return ed->employeeNumber().isLike(value);

  if (key == "lastName" )
    if (ed->lastName().length() > 0)
       return ed->lastName().isLike(value);

  if (key == "firstName" )
    if (ed->firstName().length() > 0)
       return ed->firstName().isLike(value);

  if (key == "middleInitial" )
    if (ed->middleInitial().length() > 0)
       return ed->middleInitial().isLike(value);

  if (key == "internalPhone" )
    if (ed->internalPhone().length() > 0)
       return ed->internalPhone().isLike(value);

  if (key == "externalPhone" )
    if (ed->externalPhone().length() > 0)
       return ed->externalPhone().isLike(value);

  if (key == "room" )
    if (ed->room().length() > 0)
       return ed->room().isLike(value);

  if (key == "building" )
    if (ed->building().length() > 0)
       return ed->building().isLike(value);

  if (key == "deptName" )
    if (ed->department().length() > 0)
       return ed->department().isLike(value);

  if (key == "divName" )
    if (ed->division().length() > 0)
       return ed->division().isLike(value);

  if (key == "managerName" )
    if (ed->managerName().length() > 0)
       return ed->managerName().isLike(value);

  if (key == "managerNum" )
    if (ed->managerNumber().length() > 0)
       return ed->managerNumber().isLike(value);

  if (key == "employeeType" )
     return value.isLike(IString(ed->employeeType()) );

  return false;
};
Пример #22
0
Chit* LumosChitBag::NewLawnOrnament(const Vector2I& pos, const char* name, int team)
{
	const ChitContext* context = Context();
	Chit* chit = NewChit();

	GameItem* rootItem = ItemDefDB::Instance()->Get(name).Clone();

	// Hack...how to do this better??
	if (rootItem->IResourceName() == "ruins1.0") {
		CStr<32> str;
		str.Format("ruins1.%d", random.Rand(2));
		rootItem->SetResource(str.c_str());
	}

	int size = 1;
	rootItem->keyValues.Get(ISC::size, &size);

	MapSpatialComponent* msc = new MapSpatialComponent();
	msc->SetBuilding(size, false, 0);
	msc->SetBlocks((rootItem->flags & GameItem::PATH_NON_BLOCKING) ? false : true);
	chit->Add(msc);
	MapSpatialComponent::SetMapPosition(chit, pos.x, pos.y);


	chit->Add(new RenderComponent(rootItem->ResourceName()));
	chit->Add(new HealthComponent());
	AddItem(rootItem, chit, context->engine, team, 0);

	IString proc = rootItem->keyValues.GetIString("procedural");
	if (!proc.empty()) {
		ProcRenderInfo info;
		AssignProcedural(chit->GetItem(), &info);
		chit->GetRenderComponent()->SetProcedural(0, info);
	}
	
	context->engine->particleSystem->EmitPD(ISC::constructiondone, ToWorld3F(pos), V3F_UP, 0);

	if (XenoAudio::Instance()) {
		Vector3F pos3 = ToWorld3F(pos);
		XenoAudio::Instance()->PlayVariation(ISC::rezWAV, random.Rand(), &pos3);
	}

	return chit;
}
Пример #23
0
  void Preference::Load(const QString &file) {
    // Read the input PVL preference file
    Isis::Pvl pvl;

    if(Isis::FileName(file).fileExists()) {
      pvl.read(file);
    }

    // Override parameters each time load is called
    for(int i = 0; i < pvl.groups(); i++) {
      Isis::PvlGroup &inGroup = pvl.group(i);
      if(this->hasGroup(inGroup.name())) {
        Isis::PvlGroup &outGroup = this->findGroup(inGroup.name());
        for(int k = 0; k < inGroup.keywords(); k++) {
          Isis::PvlKeyword &inKey = inGroup[k];
          while(outGroup.hasKeyword(inKey.name())) {
            outGroup.deleteKeyword(inKey.name());
          }
          outGroup += inKey;
        }
      }
      else {
        this->addGroup(inGroup);
      }
    }

    // Configure Isis to use the user performance preferences where
    //   appropriate.
    if (hasGroup("Performance")) {
      PvlGroup &performance = findGroup("Performance");
      if (performance.hasKeyword("GlobalThreads")) {
        IString threadsPreference = performance["GlobalThreads"][0];

        if (threadsPreference.DownCase() != "optimized") {
          // We need a no-iException conversion here
          int threads = threadsPreference.ToQt().toInt();

          if (threads > 0) {
            QThreadPool::globalInstance()->setMaxThreadCount(threads);
          }
        }
      }
    }
  }
// -------------------------------------------------------------------------
// QueryMgrs Class :: aMatch() - checks for a match
// -------------------------------------------------------------------------
IBase :: Boolean  QueryMgrs :: aMatch(const LEmployeeData* ed,
                                      const IString& key,
                                      const IString& value)
{

  if (key == "employeeType" )
     return value.isLike(IString(ed->employeeType()) );

  return false;
};
Пример #25
0
  /**
   * This method opens a cube. If the cube is already opened, this method will
   * return the cube from memory. The CubeManager class retains ownership of this
   * cube pointer, so do not close the cube, destroy the pointer, or otherwise
   * modify the cube object or pointer such that another object using them would
   * fail. This method does not guarantee you are the only one with this pointer,
   * nor is it recommended to keep this pointer out of a local (method) scope.
   *
   * @param cubeFileName The filename of the cube you wish to open
   *
   * @return Cube* A pointer to the cube object that CubeManager retains ownership
   *         to and may delete at any time
   */
  Cube *CubeManager::OpenCube(const QString &cubeFileName) {
    CubeAttributeInput attIn(cubeFileName);
    IString attri = attIn.toString();
    IString expName = FileName(cubeFileName).expanded();

    // If there are attributes, we need a plus sign on the name
    if(attri.size() > 0) {
      expName += "+";
    }

    IString fullName = expName + attri;
    QString fileName(fullName.ToQt());
    QMap<QString, Cube *>::iterator searchResult = p_cubes.find(fileName);

    if(searchResult == p_cubes.end()) {
      p_cubes.insert(fileName, new Cube());
      searchResult = p_cubes.find(fileName);
      // Bands are the only thing input attributes can affect
      (*searchResult)->setVirtualBands(attIn.bands());

      try {
        (*searchResult)->open(fileName);
      }
      catch(IException &e) {
        CleanCubes(fileName);
        throw;
      }
    }

    // Keep track of the newly opened cube in our queue
    p_opened.removeAll(fileName);
    p_opened.enqueue(fileName);

    // cleanup if necessary
    if(p_minimumCubes != 0) {
      while(p_opened.size() > (int)(p_minimumCubes)) {
        QString needsCleaned = p_opened.dequeue();
        CleanCubes(needsCleaned);
      }
    }

    return (*searchResult);
  }
bool SimpleIterationDataBlock::plotEntry(ostream& log, const ProtocolProperties& pP) const
 {
    bool value = true;
     
    const LongInt lengthStepString  = stepString()  .length();
    const LongInt lengthErrorString = errorString() .length();
   
    const LongInt lengthOfNumber = (pP.format().precision() + 6);
   
    LongInt disStepString;
    LongInt disStepNumber;
    LongInt disErrorString;
    LongInt disErrorNumber; 
   
    centeringEntrys(4,              lengthStepString,  disStepString,  disStepNumber);
    centeringEntrys(lengthOfNumber, lengthErrorString, disErrorString, disErrorNumber);
     
    const LongInt disStep  = MAX(4,              lengthStepString);
    const LongInt disError = MAX(lengthOfNumber, lengthErrorString);  	
   
    log << setw(disStep                                          - disStepString)  << stepString  ();
    log << setw(disStepString + disError + pP.format().tabSize() - disErrorString) << errorString ();
    log << endl; 
   
    const LongInt size = numberOfEntrys();

    for(LongInt i=0; i<size; i++)
     {
        const SimpleIterationData data = (*this).getEntryAt(i);
       
        const LongInt  st = data.step();
        const LongReal er = data.error();
        
	       IString zerosStep;
	       zerosStep.setZeros(st,4);
       
        log << setw(disStep                                          - disStepNumber)  << zerosStep;
        log << setw(disStepNumber + disError + pP.format().tabSize() - disErrorNumber) << er;
        log << endl;
     }
   return value;
 }   
Пример #27
0
Boolean QFMotionPlayer::command(ICommandEvent &event)
{
  IString saveAsFileName;
  FOURCC ioProc;

  switch (event.commandId())
  {
    case PLAY_BUTTON_ID:
      handlePlayCommand();
      return true;

    case MI_MOTION_SAVEAS:
      saveAsFileName = qf.showSaveAsDialog(window_p);
      if (saveAsFileName.length())
      {
        if (movieWindow)
          movieWindow->disable();
        if (qf.controller())
          qf.controller()->disableControls();
        if (isPositionTracking)
        {
          isPositionTracking = false;
          moviePlayer->stopPositionTracking();
          moviePlayer->deletePendingEvents(IMMDevice::positionChangeEvent);
        }

        moviePlayer->stop();

        ((IMMDigitalVideo*)moviePlayer)->saveAs(saveAsFileName, IMMDevice::wait);

        autoStartPerformed = false;
        atEnd = true;
        if (qf.controller())
          qf.controller()->setArmPercent(.0);
        prepareThread = new IThread(new IThreadMemberFn<QFMotionPlayer>(*this, QFMotionPlayer::prepare));
      }
      return true;

    default:
      return false;
  }
}
Пример #28
0
void CoreScript::DoTickNeutral( int delta, int nSpawnTicks )
{
	int lesser, greater, denizen;
	const Census& census = Context()->chitBag->census;
	census.NumByType(&lesser, &greater, &denizen);

	IString defaultSpawn = Context()->worldMap->GetSectorData(sector).defaultSpawn;
	int typical = 0;
	int numOf = census.NumOf(defaultSpawn, &typical);

	bool lesserPossible = (lesser < TYPICAL_LESSER) && (!typical || numOf < typical * 2);

	Vector2I pos2i = ToWorld2I(parentChit->Position());
	Vector2I sector = ToSector(pos2i);

	if (nSpawnTicks && lesserPossible) {
#if SPAWN_MOBS > 0
		int spawnEnabled = Context()->chitBag->GetSim()->SpawnEnabled() & Sim::SPAWN_LESSER;

		if (Context()->chitBag->GetSim() && spawnEnabled && !defaultSpawn.empty()) {

			Vector3F pf = { (float)pos2i.x + 0.5f, 0, (float)pos2i.y + 0.5f };
			int nSpawn = (defaultSpawn == ISC::trilobyte) ? 4 : 1;

			int team = Team::GetTeam(defaultSpawn);
			GLASSERT(team != TEAM_NEUTRAL);
			for (int i = 0; i < nSpawn; ++i) {
				Context()->chitBag->NewMonsterChit(pf, defaultSpawn.safe_str(), team);
				pf.x += 0.05f;
			}
		}
#endif
	}
	// Clear the work queue - chit is gone that controls this.
	if (!workQueue || workQueue->HasJob()) {
		delete workQueue;
		workQueue = new WorkQueue();
		workQueue->InitSector(parentChit, ToSector(parentChit->Position()));
	}
}
Пример #29
0
  Environment::Environment() {
    // Set the Qt plugin directory
    QStringList pluginPaths;

    IString root = getEnvironmentValue("ISISROOT", "");

    if (root != "") {
      IString thirdPartyPluginPath = root + "/3rdParty/plugins";
      pluginPaths << thirdPartyPluginPath.ToQt();
      QCoreApplication::setLibraryPaths(pluginPaths);
    }

#ifndef __APPLE__
    // We need to force the correct QDBus library to be loaded... to do that, just
    //   use a symbol in it's library. This only applies to linux and fixes #1228.

    // Long explanation:
    //   When we run GUI apps, the system (and Qt) work together to figure out
    //   which runtime libraries are necessary on-the-fly. When QApplication is
    //   instantiated, it goes into QtGui's style code. The styles ignore our plugin
    //   path setting (above) on all OS's. So Qt GUI grabs a style from the OS's styles,
    //   which is a shared library in the kde area. These styles require a version (any version)
    //   of QtDBus loaded. If QtDBus is not yet loaded, then the style library will grab it.
    //   However, on Ubuntu 12.04, the style library grabs the system (OS) QDBus library. QDBus
    //   detects that you've already loaded Isis' QtCore, so the library versions mismatch, and
    //   it crashes. The problem becomes more interesting because sometimes it picks up the system
    //   QDBus, and sometimes it picks up Isis' QDBus, and I have no good reason why we pick up
    //   one versus another; currently, installed apps pick up the system and locally built apps
    //   pick up Isis' (even when the executables are made to be identical). The end result is no
    //   installed GUI applications will run and our automated tests fail to catch it. This solution
    //   bypasses the entire issue by forcing QDBus to be loaded long before any styles are loaded,
    //   so the style plugins do not need to go and get their own QDBus library.
    //
    //   The root cause is that Ubuntu's run time loader is failing to respect
    //   our executable's rpaths when loading a style library. However, when we link against the
    //   QBus library directly, we get the right one.
    QDBusArgument();
#endif
  }
ListBoxItem :: ListBoxItem ( IDMSourceOperation *srcOp,
                             IListBox           *srcLB,
                             unsigned            index )
  : IDMItem( srcOp,
             IDM::text,
             IDMItem:: moveable | IDMItem::copyable,
             none )
  {
  // Item contents is the list box item text.
  this -> setContents( srcLB->itemText( index ) );
  // Item object is the item index.
  this -> setObject( (void*)index );
  // Try to use rfText...
  IString
    name = this -> generateSourceName(),
    rfs   = rfForThisProcess();
  if ( name.length() )
    { // Text fits, use rfText.
    this -> setSourceName( name );
    rfs += IString( "," ) + IDM::rfText;
    }
  else
    { // Text doesn't fit, use rfSharedMem instead.
    rfs += IString( "," ) + IDM::rfSharedMem;
    this -> setRequiresPreparation();
    }
  // Set up RMFs; we support dropping on shredder, too.
  this -> setRMFs( rmfsFrom( IDM::rmLibrary, rfs ) );
  this -> addRMF( IDM::rmDiscard, IDM::rfUnknown );

  // Use text icon when dragged.
  ISystemPointerHandle
    icon( ISystemPointerHandle::text );
  IDMImage
    image( icon );
  this -> setImage( image );
  }