Exemple #1
0
void CTestDLLsDlg::OnDestroy() 
{
	CDialog::OnDestroy();
	if (m_IServo) DeleteInstance(m_IServo);
	if (m_ISerialPort) DeleteInstance(m_ISerialPort);
	m_ISerialPort = NULL;

}
Exemple #2
0
void Console::Toggle() {
  if (IsOpen()) {
    DeleteInstance();
  } else {
    GetInstance();
  }
}
void _testDuplicate(CIMClient &client)
{
    CIMObjectPath filterPath;
    CIMObjectPath handlerPath;
    CIMObjectPath subscriptionPath;

    try
    {
        handlerPath = CreateHandler1Instance(client,
            PEGASUS_NAMESPACENAME_INTEROP);
        filterPath = CreateFilterInstance(client,
            QUERY1, "WQL", "Filter1",
            PEGASUS_NAMESPACENAME_INTEROP);
        subscriptionPath = CreateSbscriptionInstance(client, handlerPath,
            filterPath, PEGASUS_NAMESPACENAME_INTEROP);

        _createDuplicate(client, String::EMPTY, CIMNamespaceName(),
            filterPath, String::EMPTY, CIMNamespaceName(), handlerPath);

        _createDuplicate(client, String::EMPTY,
            PEGASUS_NAMESPACENAME_INTEROP, filterPath,
            String::EMPTY,PEGASUS_NAMESPACENAME_INTEROP, handlerPath);

        _createDuplicate(client, "127.0.0.1",
            PEGASUS_NAMESPACENAME_INTEROP, filterPath,
            String::EMPTY, CIMNamespaceName(), handlerPath);

        _createDuplicate(client, "127.0.0.1",PEGASUS_NAMESPACENAME_INTEROP,
            filterPath, "127.0.0.1", PEGASUS_NAMESPACENAME_INTEROP,
            handlerPath);

        _createDuplicate(client, String::EMPTY, CIMNamespaceName(),
            filterPath, "127.0.0.1", PEGASUS_NAMESPACENAME_INTEROP,
            handlerPath);
        _checkSubscriptionCount(client);
        DeleteInstance(client, subscriptionPath, PEGASUS_NAMESPACENAME_INTEROP);
        DeleteInstance(client, filterPath, PEGASUS_NAMESPACENAME_INTEROP);
        DeleteInstance(client, handlerPath, PEGASUS_NAMESPACENAME_INTEROP);
    }
    catch (const CIMException &e)
    {
        PEGASUS_STD(cerr) << "Exception: " << e.getMessage()
                          << PEGASUS_STD (endl);
        PEGASUS_TEST_ASSERT(0);
    }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Function Name: ShutDown
// Purpose: Shuts down the state
// Original Author: Ethan Pendergraft
// Creation Date: 5/12/2012
// Last Modification By:
// Last Modification Date:
/////////////////////////////////////////////////////////////////////////////////////////////////////
void COptionsState::Shutdown ()
{
	TextureManager::GetInstance()->UnloadTexture( m_lpOptionsVideo );
	TextureManager::GetInstance()->UnloadTexture( m_lpOptionsAudio );
	TextureManager::GetInstance()->UnloadTexture( m_lpOptionsExit );
	TextureManager::GetInstance()->UnloadTexture( m_nReticle );
	DeleteInstance();
}
Exemple #5
0
void WorldCreator::InstanceHardReset(MapMgr *mMapMgr)
{
	uint32 mapid = mMapMgr->GetMapId();
	uint32 instanceid = mMapMgr->GetInstanceID();
	//delete public instance WoWInstance to avoid "rats".
	DeleteInstance(mMapMgr->GetInstanceID(), mapid);
	//delete instance save data
	sInstanceSavingManager.RemoveSavedInstance(mapid, instanceid, true);
}
//
// Tests subscription creation by sending the similar concurrent subscription
// creation requests .
//
void _testConcurrent(CIMClient &client)
{
    CIMObjectPath filterPath;
    CIMObjectPath handlerPath;
    CIMObjectPath subscriptionPath;
    try
    {
        HandlerPath = CreateHandler1Instance(client,
            PEGASUS_NAMESPACENAME_INTEROP);
        FilterPath = CreateFilterInstance(client,
            QUERY1, "WQL", "Filter1",
            PEGASUS_NAMESPACENAME_INTEROP);

        Thread thread1(createSubscriptionFunc, (void *)0, false);
        Thread thread2(createSubscriptionFunc, (void *)0, false);
        Thread thread3(createSubscriptionFunc, (void *)0, false);
        Thread thread4(createSubscriptionFunc, (void *)0, false);

        thread1.run();
        thread2.run();
        thread3.run();
        thread4.run();

        thread1.join();
        thread2.join();
        thread3.join();
        thread4.join();

        _checkSubscriptionCount(client);

        PEGASUS_TEST_ASSERT(exceptionCount.get() == 3);

        DeleteInstance(client, SubscriptionPath, PEGASUS_NAMESPACENAME_INTEROP);
        DeleteInstance(client, FilterPath, PEGASUS_NAMESPACENAME_INTEROP);
        DeleteInstance(client, HandlerPath, PEGASUS_NAMESPACENAME_INTEROP);
   }
   catch(const CIMException &e)
   {
      PEGASUS_STD(cerr) << "Exception: " << e.getMessage()
                        << PEGASUS_STD (endl);
      PEGASUS_TEST_ASSERT(0);
   }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Function Name: Shutdown
// Purpose: Shuts down the state.
// Original Author: Rueben Massey
// Creation Date: 5/30/2012
// Last Modification By:
// Last Modification Date:
/////////////////////////////////////////////////////////////////////////////////////////////////////
void CVideoOptionsState::Shutdown()
{
	TextureManager* pTM = TextureManager::GetInstance();

	// Unload all the textures
	pTM->UnloadTexture( m_lpOptionsVideoGamma );
	pTM->UnloadTexture( m_lpOptionsVideoExit );
	pTM->UnloadTexture( m_lpOptionsVideoFS_On );
	pTM->UnloadTexture( m_lpOptionsVideoFS_Off );
	pTM->UnloadTexture( m_lpOptionsCheck);
	pTM->UnloadTexture( m_lpOptionsSlider );
	pTM->UnloadTexture( m_nReticle );
	pTM->UnloadTexture( m_lpFullScreenBlockOut );
	DeleteInstance();
}
void GooRoomClient::TerminateClient()
{
    DeleteInstance();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Function Name: ShutDown
// Purpose: Shuts down the state
// Original Author: Ethan Pendergraft
// Creation Date: 5/12/2012
// Last Modification By:
// Last Modification Date:
/////////////////////////////////////////////////////////////////////////////////////////////////////
void CEndGameState::Shutdown ()
{
	DeleteInstance();
}
Exemple #10
0
void GameClient::TerminateClient()
{
    DeleteInstance();
}
int _test(CIMClient& client, String& qlang, String& query1, String& query2)
{
    CIMObjectPath Handler1Ref, Handler2Ref;
    CIMObjectPath Filter1Ref, Filter2Ref;
    CIMObjectPath Subscription1Ref, Subscription2Ref;

    try
    {
        Handler1Ref =
            CreateHandler1Instance(client, PEGASUS_NAMESPACENAME_INTEROP);
        Handler2Ref = CreateHandler1Instance(client, NAMESPACE2);
    }
    catch (Exception& e)
    {
        PEGASUS_STD (cerr) << "Exception: " << e.getMessage()
                           << PEGASUS_STD (endl);
        PEGASUS_STD (cerr) << "create handler instance failed"
                           << PEGASUS_STD (endl);
        return -1;
    }

    PEGASUS_STD (cout) << "+++++ handler instances created"
                       << PEGASUS_STD (endl);
    try
    {
      String name1 = "TestFilter01";
      String name2 = "TestFilter02";
      Filter1Ref = CreateFilterInstance (client, query1, qlang, name1,
          PEGASUS_NAMESPACENAME_INTEROP);
      Filter2Ref = CreateFilterInstance (client, query2, qlang, name2,
          NAMESPACE1);
    }
    catch (Exception& e)
    {
        PEGASUS_STD (cerr) << "Exception: " << e.getMessage()
                           << PEGASUS_STD (endl);
        PEGASUS_STD (cerr) << "create filter instances failed"
                           << PEGASUS_STD (endl);
        return -1;
    }

    PEGASUS_STD (cout) << "+++++ filter instances created for "
                       << qlang
                       << PEGASUS_STD (endl);
    try
    {
        Subscription1Ref =
          CreateSbscriptionInstance (client, Handler1Ref, Filter1Ref,
              PEGASUS_NAMESPACENAME_INTEROP);
        Subscription2Ref =
          CreateSbscriptionInstance (client, Handler1Ref, Filter2Ref,
              NAMESPACE3);
    }
    catch (Exception& e)
    {
        PEGASUS_STD (cerr) << "Exception: " << e.getMessage()
                           << PEGASUS_STD (endl);
        PEGASUS_STD (cerr) << "create subscription instance failed"
                           << PEGASUS_STD (endl);
        return -1;
    }

    PEGASUS_STD (cout) << "+++++ subscription instances created"
                       << PEGASUS_STD (endl);

    // get display consumer
    String indicationFile2, oldIndicationFile;

    indicationFile2 = INDICATION_DIR;
    indicationFile2.append("/indicationLog");

    if (FileSystem::exists(indicationFile2))
    {
        oldIndicationFile = INDICATION_DIR;
        oldIndicationFile.append("/oldIndicationFile");
        if (FileSystem::exists(oldIndicationFile))
        {
          FileSystem::removeFile(oldIndicationFile);
        }
        if (!FileSystem::renameFile(indicationFile2, oldIndicationFile))
        {
          FileSystem::removeFile(indicationFile2);
        }
    }

    try
    {
      //
      // generate three indications
      //
      for(Uint8 i = 0; i < 3; i++)
      {
        generateIndication(client);
      }
    }
    catch (Exception& e)
    {
      PEGASUS_STD (cerr) << "Exception: " << e.getMessage()
                         << PEGASUS_STD (endl);
      PEGASUS_STD (cerr) << "generate indication failed"
                         << PEGASUS_STD (endl);
      return -1;
    }

    PEGASUS_STD (cout) << "+++++ indications generated"
                       << PEGASUS_STD (endl);

    System::sleep(5);

    try
    {
      DeleteInstance (client, Subscription1Ref,
                      PEGASUS_NAMESPACENAME_INTEROP);
      DeleteInstance (client, Subscription2Ref, NAMESPACE3);
      DeleteInstance (client, Filter1Ref,
                      PEGASUS_NAMESPACENAME_INTEROP);
      DeleteInstance (client, Filter2Ref, NAMESPACE1);
      DeleteInstance (client, Handler1Ref,
                      PEGASUS_NAMESPACENAME_INTEROP);
      DeleteInstance (client, Handler2Ref, NAMESPACE2);
    }
    catch (Exception& e)
    {
      PEGASUS_STD (cerr) << "Exception: " << e.getMessage()
                         << PEGASUS_STD (endl);
      PEGASUS_STD (cerr) << "delete instance failed"
                         << PEGASUS_STD (endl);
      return -1;
    }

    PEGASUS_STD (cout) << "+++++ instances deleted"
                       << PEGASUS_STD (endl);

    //
    // compare indications with the master output
    //
    String indicationFile, masterFile, indication_failed;

    indicationFile = INDICATION_DIR;
    indicationFile.append("/indicationLog");

    // Get environment variable:
    masterFile = getenv("PEGASUS_ROOT");
    masterFile.append(
        "/src/Pegasus/IndicationService/tests/IndicationProcess/masterOutput");

    if (FileSystem::exists(indicationFile) && FileSystem::exists(masterFile))
    {
      if (FileSystem::compareFiles(indicationFile, masterFile))
      {
        PEGASUS_STD (cout) << "+++++ passed all tests." << PEGASUS_STD (endl);
        // remove indicationFile
        FileSystem::removeFile(indicationFile);
        return 0;
      }
      else
      {
        PEGASUS_STD (cerr) << "----- tests failed" << PEGASUS_STD (endl);
        // rename indicationFile to be indicationLog_FAILED
        // and remove indicationFile
        indication_failed = INDICATION_DIR;
        indication_failed.append("/indicationLog_FAILED");
        FileSystem::renameFile(indicationFile, indication_failed);
        FileSystem::removeFile(indicationFile);
        return 1;
      }
    }
    else
    {
      PEGASUS_STD (cerr) << "----- tests failed" << PEGASUS_STD (endl);
      // rename indicationFile to be indicationFile_FAILED
      // and remove indicationFile
      if (FileSystem::exists(indicationFile))
      {
        indication_failed = INDICATION_DIR;
        indication_failed.append("/indicationLog_FAILED");
        FileSystem::renameFile(indicationFile, indication_failed);
        FileSystem::removeFile(indicationFile);
      }
      return 1;
    }
}
  //
  // Toggle
  // 
  // Toggle a footprint for an existing object
  //
  void Type::Toggle(MapObj *obj, Bool toggle)
  {
    ASSERT(obj);

    // Does this object already have a footprint instance
    if (obj->GetFootInstance())
    {
      // Start a modification session
      TerrainData::SessionStart();

      // Delete any existing instance
      DeleteInstance(obj);

      // End the session
      TerrainData::SessionEnd();
    }

    // Are we placing the footprint
    if (toggle)
    {
      // Create a placement helper
      Placement place(this);

      // Copy the world matrix of the object
      Matrix m = obj->WorldMatrix();

      // Adjust the position
      place.AdjustLocation(m);
         
      // Is this object allowed to zip at this location
      Placement::Result r = place.Check(m);

      if (FootPrint::Placement::Acceptable(r))
      {
        // Move the object
        obj->SetSimCurrent(m);

        // Start a modification session
        TerrainData::SessionStart();

        // Zip the terrain instantly
        place.ThumpTerrain(obj->Position().y, 0.0F);

        // Do instance managment
        CreateInstance(obj, place);

        // End the session
        TerrainData::SessionEnd();
      }
      else
      {
        LOG_DIAG(("Result not acceptable for placement (%d/%d)", toggle, r));

        // Write informational message to console

        // "Mission::LoadError"
        CONSOLE(0xA1D5DDD2, ("Object %s (id:%d) was unable to zip", obj->TypeName(), obj->Id()))

        const char *reason = NULL;
        switch (r)
        {
          case Placement::PR_OFFMAP:   reason = "Object off map"; break;
          case Placement::PR_CLAIM:    reason = "Cell is currently claimed"; break;
          case Placement::PR_FOOTON:   reason = "Another footprint on footprint area"; break;
          case Placement::PR_FOOTOFF:  reason = "Another footprint on fringe area"; break;
        }

        if (reason)
        {
          // "Mission::LoadError"
          CONSOLE(0xA1D5DDD2, ("  Reason: %s", reason));
        }
      }
    }
  }
void CAssetsProducer::OnLoadingThreadEnd()
{
	m_SpriteLine.Release();
	m_AnimateLine.Release();
	DeleteInstance();
}