当前位置: 首页>>代码示例>>C++>>正文


C++ Switch函数代码示例

本文整理汇总了C++中Switch函数的典型用法代码示例。如果您正苦于以下问题:C++ Switch函数的具体用法?C++ Switch怎么用?C++ Switch使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Switch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: coeffsDict_

Foam::automatic::automatic
(
    const dictionary& cellSizeCalcTypeDict,
    const triSurfaceMesh& surface,
    const scalar& defaultCellSize
)
:
    cellSizeCalculationType
    (
        typeName,
        cellSizeCalcTypeDict,
        surface,
        defaultCellSize
    ),
    coeffsDict_(cellSizeCalcTypeDict.subDict(typeName + "Coeffs")),
    surfaceName_(surface.searchableSurface::name()),
    readCurvature_(Switch(coeffsDict_.lookup("curvature"))),
    curvatureFile_(coeffsDict_.lookup("curvatureFile")),
    readFeatureProximity_(Switch(coeffsDict_.lookup("featureProximity"))),
    featureProximityFile_(coeffsDict_.lookup("featureProximityFile")),
    readInternalCloseness_(Switch(coeffsDict_.lookup("internalCloseness"))),
    internalClosenessFile_(coeffsDict_.lookup("internalClosenessFile")),
    curvatureCellSizeCoeff_
    (
        readScalar(coeffsDict_.lookup("curvatureCellSizeCoeff"))
    ),
    maximumCellSize_
    (
        readScalar(coeffsDict_.lookup("maximumCellSizeCoeff"))*defaultCellSize
    )
{}
开发者ID:BarisCumhur,项目名称:OpenFOAM-2.3.x,代码行数:31,代码来源:automatic.C

示例2: Partition

int Partition(int a[], int low, int high) {
	int pk = a[low];
	while (low < high) {
		while (low<high && (a[high]>pk))high--;
		Switch(&a[low], &a[high]);
		while (low < high && (a[low] < pk))low++;
		Switch(&a[low], &a[high]);
	}
	return low;
}
开发者ID:shenleilei,项目名称:DataStruct,代码行数:10,代码来源:树和二叉搜索树.c

示例3: SetState

//------------------------------------------------------------------------------------------------
bool Person::PickUp(GunObject* gunobject)
{
	if (gunobject->mGun->mType == PRIMARY) {
		if (mGuns[PRIMARY] == NULL) {
			mGuns[PRIMARY] = gunobject;
			gunobject->mOnGround = false;
			/*if (mState == RELOADING) {
				SetState(NORMAL);
				if (mSoundId != -1) {
					mSoundSystem->StopSample(mSoundId);
					mSoundId = -1;
				}
			}
			mGunIndex = PRIMARY;*/
			Switch(PRIMARY);
			gSfxManager->PlaySample(gPickUpSound, mX, mY);
			return true;
		}
	}
	else if (gunobject->mGun->mType == SECONDARY) {
		if (mGuns[SECONDARY] == NULL) {
			mGuns[SECONDARY] = gunobject;
			gunobject->mOnGround = false;
			if (mGuns[PRIMARY] == NULL) {
				//mGunIndex = SECONDARY;
				Switch(SECONDARY);
			}
			gSfxManager->PlaySample(gPickUpSound, mX, mY);
			return true;
		}
	}
	else if (gunobject->mGun->mType == KNIFE) {
		if (mGuns[KNIFE] == NULL) {
			mGuns[KNIFE] = gunobject;
			gunobject->mOnGround = false;
			return true;
		}
	}
	else if (gunobject->mGun->mType == GRENADE) {
		if (mGuns[GRENADE] == NULL) {
			mGuns[GRENADE] = gunobject;
			gunobject->mOnGround = false;
			if (mGuns[PRIMARY] == NULL && mGuns[SECONDARY] == NULL) {
				//mGunIndex = GRENADE;
				Switch(GRENADE);
			}
			gSfxManager->PlaySample(gPickUpSound, mX, mY);
			return true;
		}
	}
	return false;
}
开发者ID:Leajian,项目名称:cspsp,代码行数:53,代码来源:Person.cpp

示例4: simnet

void simnet()
{
  Signal a, b, c, d, F;                   // Switch and output objects 

  Switch ( SD("1a"), a, 'a' );            // Switch a controlled by 'a' key
  Switch ( SD("2a"), b, 'b' );            // Switch b controlled by 'b' key
  Switch ( SD("3a"), c, 'c' );            // Switch c controlled by 'c' key
  Switch ( SD("4a"), d, 'd' );            // Switch d controlled by 'd' key
 
  circuit( SD("1c-4c"), a, b, c, d, F );

  Probe ( (SD("2e"), "F"), F );           // Probe
}
开发者ID:helpmoeny,项目名称:CSE320,代码行数:13,代码来源:lab02.modules.c

示例5: liggghtsCommandModel

// Construct from components
writeLiggghts::writeLiggghts
(
    const dictionary& dict,
    cfdemCloud& sm,
    int i
)
:
    liggghtsCommandModel(dict,sm,i),
    propsDict_(dict),
    command_("write_restart"),
    path_(word("..")/word("DEM")),
    writeName_("liggghts.restartCFDEM"),
    writeLast_(true),
    overwrite_(true)
{
    if (dict.found(typeName + "Props"))    
    {
        propsDict_=dictionary(dict.subDict(typeName + "Props"));

        // check if verbose
        if (propsDict_.found("verbose")) verbose_=true;

        if(propsDict_.found("writeLast"))
        {
            writeLast_=Switch(propsDict_.lookup("writeLast"));
        }

        if (!writeLast_ && propsDict_.found("overwrite"))
        {
            overwrite_=Switch(propsDict_.lookup("overwrite"));
        }
    }
    if(writeLast_)
        runLast_=true;
    else
    {
        //Warning << "Using invalid options of writeLiggghts, please use 'writeLast' option." << endl;
        runEveryWriteStep_=true;
    }    


    command_ += " " + path_ + "/" + writeName_;
    if(overwrite_)
        strCommand_=string(command_);
    else
        command_ += "_";

    Info << "writeLiggghts: A restart file writeName_"<< command_ <<" is written." << endl;

    checkTimeSettings(dict_);
}
开发者ID:jtvanlew,项目名称:CFDEMcoupling-PUBLIC,代码行数:52,代码来源:writeLiggghts.C

示例6: mesh_

// Construct from components
polyStateController::polyStateController
(
    Time& t,
    polyMoleculeCloud& molCloud,
    const dictionary& dict
)
:
    mesh_(refCast<const fvMesh>(molCloud.mesh())),
    molCloud_(molCloud),
//     controllerDict_(dict.subDict("controllerProperties")),
	time_(t), 
    regionName_(dict.lookup("zoneName")),
    regionId_(-1),
    control_(true),
    controlInterForces_(false),
    writeInTimeDir_(true),
    writeInCase_(true)
{
    const cellZoneMesh& cellZones = mesh_.cellZones();
    regionId_ = cellZones.findZoneID(regionName_);

    if(regionId_ == -1)
    {
        FatalErrorIn("polyStateController::polyStateController()")
            << "Cannot find region: " << regionName_ << nl << "in: "
            << time_.time().system()/"controllersDict"
            << exit(FatalError);
    }
    
    if(dict.found("control"))
    {    
        control_ = Switch(dict.lookup("control"));
    }
//     readStateFromFile_ = Switch(dict.lookup("readStateFromFile"));
}
开发者ID:BijanZarif,项目名称:OpenFOAM-2.4.0-MNF,代码行数:36,代码来源:polyStateController.C

示例7: main

int main (void)
{
	uint8_t no = 0;
//	wait(10);
	setMU2PutFunc(uart0Put);
	setMU2GetFunc(uart0Get);
	initUART(
		UART0,
		StopBitIs1Bit|NonParity,
		ReceiverEnable|TransmiterEnable|ReceiveCompleteInteruptEnable,
		UARTBAUD(19200)
	);
	initLED();
	initSwitch();
	
	initRCRx();
	
	no = Switch() & 0x03;
	
	mu2Command("EI",EI[no]);
	mu2Command("DI",DI[no]);
	mu2Command("GI",GI[no]);
	mu2Command("CH",CH[no]);

	sei();
	userMain();
	
	return 0;
}
开发者ID:NaganoNCTRoboPro,项目名称:2012,代码行数:29,代码来源:main.c

示例8: isPressed

bool CTabBarClass::OnKeyboard(UINT messg, WPARAM wParam, LPARAM lParam)
{
	//if (!IsShown()) return FALSE; -- всегда. Табы теперь есть в памяти
	BOOL lbAltPressed = isPressed(VK_MENU);

	if (messg == WM_KEYDOWN && wParam == VK_TAB)
	{
		if (!isPressed(VK_SHIFT))
			SwitchNext(lbAltPressed);
		else
			SwitchPrev(lbAltPressed);

		return true;
	}
	else if (mb_InKeySwitching && messg == WM_KEYDOWN && !lbAltPressed
	        && (wParam == VK_UP || wParam == VK_DOWN || wParam == VK_LEFT || wParam == VK_RIGHT))
	{
		bool bRecent = gpSet->isTabRecent;
		gpSet->isTabRecent = false;
		BOOL bForward = (wParam == VK_RIGHT || wParam == VK_DOWN);
		Switch(bForward);
		gpSet->isTabRecent = bRecent;

		return true;
	}

	return false;
}
开发者ID:negadj,项目名称:ConEmu,代码行数:28,代码来源:TabBar.cpp

示例9: switch

eOSState cMenuAnnounceList::ProcessKey(eKeys Key)
{
    eOSState state = cMenuSearchResultsForList::ProcessKey(Key);
    if (state == osUnknown)
    {
        switch (Key) {
        case kBlue:
        {
            cMenuSearchResultsItem *item = (cMenuSearchResultsItem *)Get(Current());
            if (item)
            {
                if (!HasSubMenu())
                    return AddSubMenu(new cMenuAnnounceDetails(item->event, item->search));
                else if (!showsDetails)
                    return Switch();
                else
                    return osContinue;
            }
        }
        break;
        default:
            break;
        }
    }
    return state;
}
开发者ID:flensrocker,项目名称:vdr-plugin-epgsearch,代码行数:26,代码来源:menu_announcelist.c

示例10: Switch

CString CCommandLineParameters::GetSwitchStr(const char *sz,
                                             const char *szDefault, /* = "" */
                                             const BOOL bCase /* = FALSE */
                                            )
{
    int idx = Switch(sz,bCase);
    if (idx > 0) {
        CString s = ParamStr(idx);
        int n = s.Find(':');
        if (n > -1) {
			CString ts = s.Mid(n + 1);
			ts.Replace("\"", "");
            return ts;
//            return s.Mid(n+1);
        } 
//		else {
//          if ((idx+1) < paramcount) {
//              if (!IsSwitch(parms[idx+1])) {
//                  return parms[idx+1];
//              }
//          }
//        }
        //return szDefault;
    }
    return szDefault;
}
开发者ID:GeospatialDaryl,项目名称:FUSION_LKT_from_SourceForgeSVN,代码行数:26,代码来源:argslib.cpp

示例11: useEquivalentSize_

Foam::LambertWall<CloudType>::LambertWall
(
    const dictionary& dict,
    CloudType& cloud,
    const scalar& surfaceTension,
    const scalar& contactAngle,
    const scalar& liqFrac,
    const scalar& viscosity,
    const scalar& minSep
)
:
    PendularWallModel<CloudType>
    (
        dict,
        cloud,
        typeName,
        surfaceTension,
        contactAngle,
        liqFrac,
        viscosity,
        minSep
    ),
    useEquivalentSize_(Switch(this->coeffDict().lookup("useEquivalentSize")))
{
    if (useEquivalentSize_)
    {
        volumeFactor_ = readScalar(this->coeffDict().lookup("volumeFactor"));
    }
}
开发者ID:Washino,项目名称:WashOpenFOAM-2.3.x,代码行数:29,代码来源:LambertWall.C

示例12: ClonePolicy

    virtual ResultExpr ClonePolicy() const {
        // Allow use for simple thread creation (pthread_create) only.

        // WARNING: s390 and cris pass the flags in the second arg -- see
        // CLONE_BACKWARDS2 in arch/Kconfig in the kernel source -- but we
        // don't support seccomp-bpf on those archs yet.
        Arg<int> flags(0);

        // The glibc source hasn't changed the thread creation clone flags
        // since 2004, so this *should* be safe to hard-code.  Bionic's
        // value has changed a few times, and has converged on the same one
        // as glibc; allow any of them.
        static const int flags_common = CLONE_VM | CLONE_FS | CLONE_FILES |
                                        CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM;
        static const int flags_modern = flags_common | CLONE_SETTLS |
                                        CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID;

        // Can't use CASES here because its decltype magic infers const
        // int instead of regular int and bizarre voluminous errors issue
        // forth from the depths of the standard library implementation.
        return Switch(flags)
#ifdef ANDROID
               .Case(flags_common | CLONE_DETACHED, Allow()) // <= JB 4.2
               .Case(flags_common, Allow()) // JB 4.3 or KK 4.4
#endif
               .Case(flags_modern, Allow()) // Android L or glibc
               .Default(InvalidSyscall());
    }
开发者ID:Jar-win,项目名称:Waterfox,代码行数:28,代码来源:SandboxFilter.cpp

示例13: Switch

// updated current script
bool Scripts::Update(Controller& ctrl, float elapsedTime)
{
	// if script is done, switch script
	if (! _scripts[_current]->Update(ctrl, elapsedTime))
		return Switch();
	return true;
}
开发者ID:soupi,项目名称:RPG-System,代码行数:8,代码来源:Scripts.cpp

示例14: switch

eOSState cMenuSearchResultsForBlacklist::ProcessKey(eKeys Key)
{
   eOSState state = cMenuSearchResults::ProcessKey(Key);

   if (state == osUnknown) {
      switch (Key) {
         case k1...k9:
            state = HasSubMenu()?osContinue:Commands(Key);
            break;
         case kRecord:
         case kRed:
            state = OnRed();
            break;
         case kBlue:
            if (HasSubMenu())
               state = Switch();
            else
               state = osContinue;
            break;
         default:
            break;
      }
   }
   return state;
}
开发者ID:jowi24,项目名称:vdr-epgsearch,代码行数:25,代码来源:menu_searchresults.c

示例15: dictionary

initialPointsMethod::initialPointsMethod
(
    const word& type,
    const dictionary& initialPointsDict,
    const Time& runTime,
    Random& rndGen,
    const conformationSurfaces& geometryToConformTo,
    const cellShapeControl& cellShapeControls,
    const autoPtr<backgroundMeshDecomposition>& decomposition
)
:
    dictionary(initialPointsDict),
    runTime_(runTime),
    rndGen_(rndGen),
    geometryToConformTo_(geometryToConformTo),
    cellShapeControls_(cellShapeControls),
    decomposition_(decomposition),
    detailsDict_(subDict(type + "Coeffs")),
    minimumSurfaceDistanceCoeffSqr_
    (
        sqr
        (
            readScalar
            (
                initialPointsDict.lookup("minimumSurfaceDistanceCoeff")
            )
        )
    ),
    fixInitialPoints_(Switch(initialPointsDict.lookup("fixInitialPoints")))
{}
开发者ID:BarisCumhur,项目名称:OpenFOAM-dev,代码行数:30,代码来源:initialPointsMethod.C


注:本文中的Switch函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。